I think I can help with explanation of why emacs behaves as it does,
and maybe you'd agree that it makes sense.
Now I understand it.
But it's hard to change habit.
Do you think the emacs way is better?
<tab> in emacs/ruby means (ruby-indent-command), which parses vicinity
of cursor and figures out correct identation. that is, it is not "add a
tab" but "format this line".
so to get desired result, you could just use 'end<tab>'
or call (indent-region) - Ctl-Alt-\ - to indent the whole thing in one
go later.
This way you dont need to care about formatting at all, it's done
correctly automatically.
I think I can help with explanation of why emacs behaves as it does,
and maybe you'd agree that it makes sense.
Now I understand it.
But it's hard to change habit.
Do you think the emacs way is better?
I got used to using C-j instead of RETs and TABs. Give it a bash.
<tab> in emacs/ruby means (ruby-indent-command), which parses vicinity
of cursor and figures out correct identation. that is, it is not "add a
tab" but "format this line".
so to get desired result, you could just use 'end<tab>'
or call (indent-region) - Ctl-Alt-\ - to indent the whole thing in one
go later.
This way you dont need to care about formatting at all, it's done
correctly automatically.
well, I think emacs way of autoformatting instead of 'fixed identation
levels' is better, as it is _automates_ things. (and does not get in
the way in the process /well, most of the time/ )
you can bind 'ruby-reindent-then-newline-and-indent to enter (as was
already proposed) and forget about formatting forever.
I got used to using C-j instead of RETs and TABs. Give it a bash.
Eugh, my pinky finger hurts enough from coding on a German keyboard from reaching to AltGr all the time, reaching for Ctrl for each newline would definately give me CTS You can always hack ruby-mode.el and map RUBY-REINDENT-NEWLINE-AND-INDENT (word order subject to change) to RET - I managed even as an utter elisp newbie. Works like a charm.
I got used to using C-j instead of RETs and TABs. Give it a bash.
Eugh, my pinky finger hurts enough from coding on a German keyboard from
reaching to AltGr all the time, reaching for Ctrl for each newline would
definately give me CTS You can always hack ruby-mode.el and map
RUBY-REINDENT-NEWLINE-AND-INDENT (word order subject to change) to RET -
I managed even as an utter elisp newbie. Works like a charm.
Heh. I'm surprised you'd put up with emacs at all if the control-key
proliferosity bothered you that much. I C-[fbpnaejod...] so often it
feels quite natural.
But you don't need to hack ruby-mode.el; just hook it in: