GNU bug report logs -
#18228
24.4.50; electrict-indent-mode bad indentation in python-mode
Previous Next
Reported by: Jorgen Schaefer <forcer <at> forcix.cx>
Date: Sat, 9 Aug 2014 10:02:02 UTC
Severity: minor
Found in version 24.3.93
Fixed in version 24.4.50
Done: fgallina <at> gnu.org (Fabián Ezequiel Gallina)
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
Andreas Röhler <andreas.roehler <at> easy-emacs.de> writes:
> On 12.08.2014 04:40, Stefan Monnier wrote:
>>>>> But what should electric-indent do than?
>>>> No re-indent upon : when it's not 100% sure of the result.
>>> Which sums up to switch it off.
>>
>> Not to switch off electric-indent, no (it's enabled globally).
>
> Python modes should switch it off by default.
>
No, it shouldn't. The electric cases can be controlled in such way in
that the feature is still useful.
>>
>> And presumably the : was made to re-indent because in some/many cases
>> there is only 1 correct indentation (and the code is able to find it).
>> I don't know if the code is also able to detect when it's correct and
>> when it's not,
>
> In Python indent is meaning - at least sometimes.
> A reliable electric-indent must know what the programmer wants to write, predict his decision.
>
That's what I'm aiming to and the code is pretty much there, believe it
or not.
> There are some special cases, where its possible.
> In a lot of other cases not.
>
Name impossible ones and let's see.
> Alltogether, when digging in here, you run in a complex matter where
> artificial intelligence might deliver some progress indeed - which
> seems fairly out of scope giving the resources when
> maintaining/developing Emacs' python-modes.
>
> IMO it would be a waste of time investing here.
>
If because something it's "hard" we should drop any hopes of developing
further, let's go back to abacuses. And no, electric indent is not that
hard, really.
Andreas Röhler <andreas.roehler <at> easy-emacs.de> writes:
> If inside a nested block, there is no way for Emacs to determine whereto such
> "else" should belong.
> I.o.w, don't see a difference between these both cases.
Well, you'd be surprised at how smart the current implementation of
electric indent for python is. Even if there's no sure shot, Emacs
would let you cycle between the possible indentations. I invite you to
see `python-indent-dedenters-*' tests to understand what I'm talking
about.
Regards,
Fabián
This bug report was last modified 10 years and 261 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.