Incorrect re-indentation

Bug #1006643 reported by Barry Warsaw
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-mode.el
Opinion
Medium
Andreas Roehler

Bug Description

Start with this code:

def foo():
    if a == 1:
        x = 7
    if b == 2

with point right after the '2'. Now hit : and watch the line get re-indented to line up under the 'x'. This should not happen since I just explicitly dedented it when I started the line.

Changed in python-mode:
importance: Undecided → Medium
assignee: nobody → Andreas Roehler (a-roehler)
milestone: none → 6.0.9
Revision history for this message
Andreas Roehler (a-roehler) wrote : Re: [Bug 1006643] [NEW] Incorrect re-indentation

Am 31.05.2012 00:48, schrieb Barry Warsaw:
> Public bug reported:
>
> Start with this code:
>
> def foo():
> if a == 1:
> x = 7
> if b == 2
>
> with point right after the '2'. Now hit : and watch the line get re-
> indented to line up under the 'x'. This should not happen since I just
> explicitly dedented it when I started the line.

Hi Barry,

the rationale of smart-indentation is: "go to the outmost reasonable indent"

C-u :

should DTRT

Cheers

Revision history for this message
Barry Warsaw (barry) wrote :

On May 31, 2012, at 05:51 AM, Andreas Roehler wrote:

>Am 31.05.2012 00:48, schrieb Barry Warsaw:
>> Public bug reported:
>>
>> Start with this code:
>>
>> def foo():
>> if a == 1:
>> x = 7
>> if b == 2
>>
>> with point right after the '2'. Now hit : and watch the line get re-
>> indented to line up under the 'x'. This should not happen since I just
>> explicitly dedented it when I started the line.
>
>Hi Barry,
>
>the rationale of smart-indentation is: "go to the outmost reasonable
>indent"
>
>C-u :
>
>should DTRT

It does, but I still don't think that's correct, since it's much more
difficult to type. I'm not sure exactly what the rule should be, but this is
the one current thing that drives me crazy. :)

Revision history for this message
Andreas Roehler (a-roehler) wrote :

Am 31.05.2012 17:14, schrieb Barry Warsaw:
> On May 31, 2012, at 05:51 AM, Andreas Roehler wrote:
>
>> Am 31.05.2012 00:48, schrieb Barry Warsaw:
>>> Public bug reported:
>>>
>>> Start with this code:
>>>
>>> def foo():
>>> if a == 1:
>>> x = 7
>>> if b == 2
>>>
>>> with point right after the '2'. Now hit : and watch the line get re-
>>> indented to line up under the 'x'. This should not happen since I just
>>> explicitly dedented it when I started the line.
>>
>> Hi Barry,
>>
>> the rationale of smart-indentation is: "go to the outmost reasonable
>> indent"
>>
>> C-u :
>>
>> should DTRT
>
> It does, but I still don't think that's correct, since it's much more
> difficult to type. I'm not sure exactly what the rule should be, but this is
> the one current thing that drives me crazy. :)
>

so M-x py-smart-indentation-off

or M-x customize-variable RET py-smart-indentation

might save you :)

BTW maybe should set `py-smart-indentation' default to nil?

The curious thing around: AFAIS beginners expect this feature.

Cheers

Changed in python-mode:
status: New → Opinion
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.