[TxMt] Tab Always Indent and indent-region

Travis P woodtrail at jetemail.net
Fri Oct 29 06:21:18 UTC 2004


On Oct 29, 2004, at 12:43 AM, Justin French wrote:

> On 29/10/2004, at 3:29 PM, Travis P wrote:
>
>>
>> Two marvelously useful features that I use heavily for programming 
>> all kinds of language in Emacs and XEmacs are:
>>  - Tab Always Indent: when this option is on, hitting the TAB key 
>> always just indents the current line
>>  - indent-region: re-indent the selection
>
> I'm not entirely sure what each of these feature are (can you get more 
> specific?), but I *think* that both issue might be solved with TM's 
> column selection tool.
>
> I can select the first char of every line in a block, hit "tab" and it 
> will indent all selected lines by one tab.

Yep, that's not it.  I make do with a similar mode in SubEthaEdit 
sometimes, but it's inconvenient and requires a human to do a lot of 
work that the computer can do quite well.

I'm talking about a syntax-aware indentation.  It will change the 
indentation only if the line is not already properly indented (properly 
is language syntax dependent naturally).  If the line is not properly 
indented, it will be indented as appropriate with whitespace.

With the "Tab Always Indent" option, pressing tab anywhere on a line 
causes that line to be syntax-aware re-indented (which might not do 
anything if the line is already indented correctly).

"indent-region" just performs the operation on a selection.  It is like 
going to the first line, pressing tab (assuming Tab Always Indent), 
next line, pressing tab, next line, pressing tab, for each line of the 
selection.

XCode has these features too (I'm looking at version 1.1):
   Tab Always Indent:  Indentation Preference panel: "Syntax-aware 
indents"  and "Tab indents: Always"
   indent-region:  ", make a selection and choose Format" menu -> 
"Re-indent"

This feature has the nifty side-effect that it really helps finding 
unbalanced parens/braces/etc or other mistakes (forgetting to put 
braces around multiple statement if/else/while/for-statement bodies in 
languages where such braces are optional if the desired body is a 
single statement: C/C++/Java) because all of a sudden the indentation 
will be off unexpectedly.

>> TextMate looks like a good start and might find a nice niche.  It's a 
>> bit rough around the edges at the moment.  And I find it hard to work 
>> without the two indent features I mention above.  Maybe I should add 
>> them to the Feature requests page?
>
> Rather than "a bit rough around the edges", how about you get 
> specific... Allan and the rest of us who help out can't possibly read 
> your mind :)  It's still in it's infancy, but Allan has worked really 
> hard to implement all sane feature requests.

I was looking at the mailing list archives are referring to stuff that 
other people have gotten specific about.  I think I got really specific 
just above about the syntax-aware indentation. :-)   I'll be specific 
about other things as I get a chance to exercise the program.

Some other things that do come to my immediate attention:

  Web preview:  I wish there were a "Home"/Snapback button to bring me 
back to the page being edited. "Reload" in SubEthaEdit actually reloads 
(snapback) the page being edited (unlike a browser).  If you check a 
link or two and hit "Reload", TextMate reloads the page you navigated 
to (like a browser would).  Hitting Return in the "Base URL:" text 
field does not reload the base page (as it would in a browser).  The 
"Base URL:" text field can be edited (like a URL field in a browser), 
though the edits have no effect (unlike a browser).  That's confusing 
behavior.

Some language coloring/styling is problematic.  In particular, when 
looking at HTML or some code, some things are italicized.  In my 
preferred font of non-anti-aliased Monoco 10, italicized text is 
largely unreadable.  I like the colors, but not the style changes.

-Travis




More information about the textmate mailing list