Subject: bug#18228: 24.4.50; electrict-indent-mode bad indentation in python-mode

From: Andreas Röhler <[email-masked]>
Date: Tue, 12 Aug 2014 09:05:47 +0200

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.

Using electric features with Python effectively requires a certain level of experience with Emacs and Python alike.
Nonetheless - nice play.

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

There are some special cases, where its possible.
In a lot of other cases not.

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.

but if it is, then we don't need to disable the "reindent
> on :" in all cases.
>          Stefan