|
|
Darren New <dne### [at] sanrrcom> wrote:
> If existing lines are indented incorrectly, then your code is broken. The
> reason that "auto indenting" is not possible in Python is the same reason
> that "auto bracing" isn't possible in C.
Actually, I can't think why "auto-bracing" wouldn't be possible in C,
at least if you don't mind having braces even around single-statement blocks
(something which many programming guides actually recommend).
Every time you write a statement which is followed by a code block (even
if it's an empty one in rare cases), such as a for-loop, the editor could
automatically add the '{' and '}' characters and indent the code such that
you can just keep typing the contents of the loop. (The only think which
would slightly interrupt the flow would be that when you end writing the
code block you need to exit it by pressing the down cursor a couple of
times...)
Hmm, maybe I'll try to make emacs do exactly that. At least by binding
that functionality to some key...
A lesser variation of that would be that every time you write a '{' the
editor automatically adds (and indents) a '}'. The editor could actually
constantly keep matching braces auto-indented, even if one of the pair is
changed somehow (most editors, including emacs, can highlight matching
braces, so it shouldn't be a problem to auto-indent them as well).
--
- Warp
Post a reply to this message
|
|