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 see you already have editing over sftp in your todo for 1.1.
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?
-Travis
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.
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.
Justin
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
Travis P wrote:
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).
This sounds like it would require a whole lot of coding to get this done properly. And it's only of use to you if it's done properly, otherwise you'll turn it off after two uses and never look at it again.
Also, this is something that would only work in languages where the indentation is defined by brackets or something. And then only for people with the same coding style.
Perhaps I'm a bit biased, because I mostly code in python where it simply is not possible to have syntax-aware indentation. (Because the indentation *is* syntax).
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.
There already is a feature for this: when you move over a parens/brace/etc, the matching one lights up briefly.
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.
As stated before: these are almost all user contributed. If you don't like the way it looks, get your hands dirty and edit the syntax file...
And before you ask: A syntax highlighting configuration editor/preferences window is already on the list of requested features ;-)
Jeroen.
On Oct 29, 2004, at 3:41 AM, Jeroen wrote:
Travis P wrote:
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).
This sounds like it would require a whole lot of coding to get this done properly. And it's only of use to you if it's done properly, otherwise you'll turn it off after two uses and never look at it again.
I'm afraid I don't know how much code it is. It would involve some code, yes. If might not be that much though. Looks to me like it might actually involve not much at all. Playing with XCode, it does not appear to be language customized for the most part. It just counts (){}[]-depth and then indents a level of tab-size x depth.
For example in XCode, it properly indents this "Java": public class test { hey there() { iffy ( smash !@ grab ) { do it } } }
There is no Java keyword "iffy". There no Java operator !@. But it all works anyway for this style. However, if one prefers
if ( ... ) { statements; }
rather than
if ( ... ) { statements; }
Then XCode does need to recognize the "if" syntax as taking a block of statements or else the { }'s themselves are incorrectly placed. But I'm not sure why. XCode appears to be following some exceptional rule to intentionally misplace them in that instance. For languages like C/C++/Java, it does need to know about commands for which it needs to indent the first statement if that first statement is on the following line and is not {}'ed, as if/for/while statements don't require the {}'es unless one is supplying a block of multiple statements.
There are a few exceptions that are language specific. HTML <pre> sections, LaTeX verbatim, Perl/Shell here-files all should not have any auto-indentation done on them. Also, the indentation-code would have to be careful of (){}[] in strings and regular expressions where they shouldn't affect the indentation.
Also, this is something that would only work in languages where the indentation is defined by brackets or something. And then only for people with the same coding style.
Perhaps I'm a bit biased, because I mostly code in python where it simply is not possible to have syntax-aware indentation. (Because the indentation *is* syntax).
It works well Perl, Tcl, Java, C, C++. I use it for all 5 of those languages extensively. I believe it also works for shell scripts (bash/ksh/csh), though I try to keep such scripts short enough that its not an issue for me.
I'm only very minimally familiar with Python. Sounds Python is more the exception, so if that is your primary language then yes, maybe you wouldn't find this useful. The five languages I mentioned are not rare birds though. :-)
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.
There already is a feature for this: when you move over a parens/brace/etc, the matching one lights up briefly.
I use that too. The highlighted-matching doesn't help the other exceptional case I mention (bodies that are mistakenly not bracketed) and doesn't work particularly well for large grouped things like whole functions and whole C++/Java classes/namespaces.
Based on your earlier comment about Python, maybe this does not apply to you.
-Travis
On Fri, 29 Oct 2004, Jeroen wrote:
This sounds like it would require a whole lot of coding to get this done properly. And it's only of use to you if it's done properly, otherwise you'll turn it off after two uses and never look at it again.
I'm not sure how much code it would take to implement quality code wrapping, a la Vim. However, I think the current wrapping situation could be made a lot better by the inclusion of un-indent cues (which I believe is on Allan's to do list).
Also, this is something that would only work in languages where the indentation is defined by brackets or something. And then only for people with the same coding style.
Well, I'd assume that it would be customizable, just as the syntax files are for folk with different tastes in colors.
Perhaps I'm a bit biased, because I mostly code in python where it simply is not possible to have syntax-aware indentation. (Because the indentation *is* syntax).
Hmmmm... it would seem that the Vim folk disagree with you there, as they have a Python indentation package in their standard distribution (though I'm not sure what it does, as I'm not a Python guy).
There already is a feature for this: when you move over a parens/brace/etc, the matching one lights up briefly.
Although this could be improved as well. Right now, the hilighting only occurs when you move forward over the closing member of the pair (unless I'm missing a menu option somewhere), instead of either direction over either opening or closing members. BTW: Consider this a feature request, if it's not already an option, and a plea for guidance otherwise.
William D. Neumann wdnx@unm.edu
FWO to the Nth degree!!! --- Dear Lord, please make me the kind of person my dog thinks I am.
Well, if it is done in terms of the current (rather simple) identation rules, I don't see it would require too much coding. I like that feature too, although it can also be highly annoying if you are not expecting it :-p.