[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

From: Stefan Monnier
Subject: bug#15596: Let's improve the default workings of electric-indent-mode.
Date: Sun, 13 Oct 2013 22:16:18 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

> 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

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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]