Re:Elastic Tab Stops: A Better Way to Indent and Align Code
by ryanbooker on Wednesday October 15, 2008 @10:25PM
(#334056)
That sounds like it is simply indenting the whole line... not reformatting the actual block... i.e. respacing internally within the line. Which is what the elastic tabstops is doing.
It's not simply realigning each line. It's reformatting the entire block, realigning ALL tabstops within the lines, so that blocks of text are all positioned within a grid.
Re:Elastic Tab Stops: A Better Way to Indent and Align Code
by d0mine on Thursday October 16, 2008 @01:42AM
(#334174)
"simply indenting the whole line" </quote>
"the package cc-engine (including its cc-* helper packages) bundled with GNU Emacs 22 is approximately 27,000 lines of lisp code, and it's all dedicated to indentation." </quote> http://steve-yegge.blogspot.com/2008/03/js2-mode-new-javascr...
It seems realigning each line is not that simple.
Re:Elastic Tab Stops: A Better Way to Indent and Align Code
by DougBTX on Thursday October 16, 2008 @12:55PM
(#334633)
Elastic tab stops is actually orthogonal to this. Aligning elastic tab stops is easy (minor complications caused by blank lines), knowing how many tab stops to put in is where those 27 000 lines of lisp come in.
Re:Elastic Tab Stops: A Better Way to Indent and Align Code
by ryanbooker on Thursday October 16, 2008 @04:57AM
(#334262)
That's hardly the point now is it? You knew exactly what the expression I used means in this context.
If you want to reformat an entire block of code in this way, you can set a region (the emacs equivalent of "selection") and then press Ctrl-Meta-\, which stands for "indent-region". Then either the whole region will magically become properly indented, or emacs will yell at you because your XHTML syntax is broken (at least, that's what just happened when I tried this in XHTML mode. Every major mode can be slightly different.)
I know that emacs supports all the indentation tricks shown in this guy's example ... except that I don't know about the end-of-line comments. I never use end-of-line comments.