GNU bug report logs - #15596
Let's improve the default workings of electric-indent-mode.

Previous Next

Package: emacs;

Reported by: Alan Mackenzie <acm <at> muc.de>

Date: Sat, 12 Oct 2013 14:57:02 UTC

Severity: wishlist

Full log


Message #14 received at 15596 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Alan Mackenzie <acm <at> muc.de>
Cc: 15596 <at> debbugs.gnu.org
Subject: Re: bug#15596: Let's improve the default workings of
 electric-indent-mode.
Date: Sun, 13 Oct 2013 22:16:18 -0400
> These are surely bad ideas.  `electric-indent-mode' is a global mode, so
> creating buffer local copies of it will lead to confusion.

It's not meant for purely interactive use (and indeed it requires Elisp
coding), and for programmatic uses there's no reason why it should lead
to confusion.

> What does M-x electric-indent-mode do when there's a buffer local
> value of e-i-m?  If it toggles the global binding, it will appear not
> to have worked in the current buffer.

Presumably the user who added the buffer-local binding knows what it does.

> If it toggles the local binding, it is no longer a global mode.

Indeed, that would be a bug.

> I think I was a bit unclear.  I meant have the _variable_ e-i-m set to t
> by default, but have the electricity disabled by default by the new
> buffer local variable `electric-indent-enabled-flag'.  But the new
> variable `electric-indent-inhibit' can do this anyhow.

I'm not sure I understand what we're talking about, then:
when you wrote "make `electric-indent-mode' t by default" I understood
it to mean that the default behavior of Emacs in most modes should be to
auto-indent.

> As I reported in emacs-devel, I had trouble in Text Mode with e-i-m.

Maybe we should make text-mode disable electric-indent-mode by default?

> Surely e-i-inhibit should be t by default.  Electric indentation is
> useful in (?most) programming modes, but probably not very much in text
> modes, or things like Outline Mode.

In practice, it's already the case for those modes, AFAIK (tho not by
setting e-i-inhibit, because that feature existed before e-i-inhibit).

> How about having e-i-inhibit t by default, but setting it to nil in
> `prog-mode'?

I could consider that.  But if we can do without it, that would be
preferable, since many programming modes don't derive from prog-mode
(yet), and several non-programming modes support indentation
(e.g. latex-mode, change-log-mode).


        Stefan





This bug report was last modified 11 years and 245 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.