change C-j to newline,indent,one indention back?

Erik Max Francis max at alcyone.com
Fri Oct 18 22:51:25 CEST 2002


eugene kim wrote:

> i'm wondering if i can avoid hitting backspace key
> 
> for i in something :
>    for j in something:
>       statement1
>       statement2 # C-j here
>       |<-- cursor here & i would have to do 'backspace'
>    |<-- can C-j be changed to place cursor here?
> 
> return/C-j/C-m all do the same newline-indent..

Why would you want that?  At the end of the statement2 line, how is
python-mode supposed to know you want to autoindent to the _first_ for
loop, not the second?  There is no way for it to know.

Note that it _does_ detect cases where statement2 is a return or a
raise; in those cases it can rightly deduce that you're done with the
block and autointent to the lower level.  But it can't in general; only
you know that, and that's why you have to hit the backspace key.

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/  \ Consistency is the last refuge of the unimaginative.
\__/ Oscar Wilde
    Church / http://www.alcyone.com/pyos/church/
 A lambda calculus explorer in Python.



More information about the Python-list mailing list