help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: python-mode's broken indentation behavior


From: Ian Zimmerman
Subject: Re: python-mode's broken indentation behavior
Date: Sun, 28 Jun 2015 18:23:24 -0700
User-agent: Mutt/1.5.21 (2010-09-15)

On 2015-06-28 21:47 +0200, Florian Weimer wrote:

> def foo(x):
>     if x:
>         return 2
>     else:
>         raise Foo
>     for i in range(0, 10)_
> 
> So far, so good.  Now press ‘:’:
> 
> def foo(x):
>     if x:
>         return 2
>     else:
>         raise Foo
>         for i in range(0, 10):_
> 
> Going from:
> 
> def foo(x):
>     if x:
>         x()
>     else:
>         y()
>     for i in range(0, 10)_
> 
> to:
> 
> def foo(x):
>     if x:
>         x()
>     else:
>         y()
>         for i in range(0, 10):_
> 
> is equally unhelpful.

While I completely agree that this behavior is broken in both cases (and
I feel smug using emacs23, which doesn't do this), I thought it's worth
pointing out that these cases are quite different.  In the second case,
it is correct for the code to not unindent automatically, but it should
not restore the indent after you manually fix it.

Maybe you can just turn off the electric colon somehow?  If nothing
else, you should be able to do

(add-hook 'python-mode-hook
  (lambda ()
    (local-unset-key ":")))

-- 
Please *no* private copies of mailing list or newsgroup messages.
Rule 420: All persons more than eight miles high to leave the court.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]