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: Florian Weimer
Subject: Re: python-mode's broken indentation behavior
Date: Mon, 29 Jun 2015 21:33:32 +0200

* Ian Zimmerman:

> 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.

I wanted to show that incorrect re-indent happens in both cases, both
for the unreachable case and the reachable case.  I have no problem
with automatic deindenting after a statement which causes an abnormal
exit of the block.


reply via email to

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