allowing braces around suites
Isaac To
iketo2 at netscape.net
Fri Aug 27 09:15:13 EDT 2004
>>>>> "Kjetil" == Kjetil Torgrim Homme <kjetilho at yksi.ifi.uio.no> writes:
Kjetil> how can Emacs tell? if I press TAB and thus ask Emacs to
Kjetil> re-indent the line, that's what it will do.
If the aim is simply to do a local change that is sufficient to deal
with the problem just in your computer, then the simplest answer might
be to use "pass": if your code contains
if t1 == t2:
t1 = t3
else:
t2 = t3
pass
t = t2
and you tab at the last line, Emacs won't try to indent the t=t2 line
further to after the pass line where it is impossible to execute.
If you want something that is done globally and everybody will use
it... not a chance.
Kjetil> arguably, the correct fix is to disable the "clever"
Kjetil> re-indentation code of Emacs since it's too easy to fool
Kjetil> it, but this makes coding more awkward in other cases.
The indent-region command of Emacs (M-C-\) is really disabled in
Python mode, I think it is done by nullifying the
indent-region-function. Anyway, reindent makes sense only when the
indentation does not constitute the meaning of a program and thus the
editor can freely change it. If indentation does mean something, it
doesn't make sense at all.
Kjetil> it also doesn't solve cut-n-paste errors.
Use C-c > and C-c < might work for you.
Regards,
Isaac.
More information about the Python-list
mailing list