all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: fgallina@gnu.org (Fabián Ezequiel Gallina)
To: 18228@debbugs.gnu.org
Subject: bug#18228: 24.4.50; electrict-indent-mode bad indentation in python-mode
Date: Mon, 01 Sep 2014 20:11:31 -0300	[thread overview]
Message-ID: <87oauz6in0.fsf@gnu.org> (raw)
In-Reply-To: <53E9BCCB.5020304@easy-emacs.de> ("Andreas Röhler"'s message of "Tue, 12 Aug 2014 09:05:47 +0200")

Andreas Röhler <andreas.roehler@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@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






  parent reply	other threads:[~2014-09-01 23:11 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-09 10:00 bug#18228: 24.4.50; electrict-indent-mode bad indentation in python-mode Jorgen Schaefer
2014-08-11  7:11 ` Andreas Röhler
2014-08-11 14:45   ` Stefan Monnier
2014-08-11 17:18     ` Andreas Röhler
2014-08-12  2:40       ` Stefan Monnier
2014-08-12  7:05         ` Andreas Röhler
2014-08-12 14:04           ` Stefan Monnier
2014-08-27 19:34             ` Matthew Woodcraft
2014-08-28  6:05               ` Andreas Röhler
2014-08-28 19:00                 ` Matthew Woodcraft
2014-09-01 23:11           ` Fabián Ezequiel Gallina [this message]
2014-09-01 22:53 ` Fabián Ezequiel Gallina

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87oauz6in0.fsf@gnu.org \
    --to=fgallina@gnu.org \
    --cc=18228@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.