DÅ?a Piatok 10 FebruÃ¡r 2006 19:27 Diego Cano L. napÃsal:
I am aware that it should (I use Vim, by the way), but it doesn’t. I have
all imaginable variables in my .vimrc (indent on, smartindent, etc.), but
all I have is syntax colours, no autoindentation.
Weird, last time I used Vim, it worked fine in this respect. But that
back in Windows times, and both the Windows Vim and XEmacs seem to come
slightly more sensible defaults in some respects.
It’s not a big problem for the code I write now, since I am quite careful
with correct indentation and all; but for old messy code, it could help me
a lot to have a auto-reindenter, and even better, a code beautifier
limiting code to 80 columns, uniformising spaces after commas and all this.
Bite into the bitter pill and have an emacs in batch mode chomp over
code? Although it might not quite work, the emacs ruby-mode doesn’t
support auto-fill-mode (the code to limit code to a set page width)
or handle multi-line comments and such.
And a pure ruby source code beautifier for Ruby does sound interesting,
there are some pitfalls - especially in the page width limitation when
determining where to put a line break.
Wasn’t there a project to make a self-hosting Ruby? You might want to
look at how far they got and possibly rip… err… -borrow- their Ruby
parser, and then just write a pretty printer for their code model to
yourself a lot of work?