Subject: bug#19272: 25.0.50; electric-indent-mode: Appears to do the opposite

From: Alan Mackenzie <[email-masked]>
Date: 4 Dec 2014 22:11:39 -0000

In article <[email-masked]> you wrote:

> In both Emacs 24.4 -- as well as Emacs 25 built from head:

> In lisp buffers electric-indent-mode is on by default.

electric-indent-mode is now enabled everywhere, by default.

> But if it is on, then hitting C-j does not indent -- it ends up leaving
> point on the first column in the newly inserted line.

This is deliberate - the swapping of the actions of C-j and RET.  Most
people on the developers' mailing list agreed it was time to do this, for
the benefit of new users who expect auto indentation of the new line, but
who aren't used to typing C-j for it.

However, this change in key actions has been conflated with
electric-indent-mode.  En/dis-able that minor mode, and the action of your
keys is swapped.

> I do have 10 in the list electric-indent-chars.

10 is <LF>, aka C-j.  When you type a character which is in
electric-indent-chars, that causes electric indentation of the current
line (not the new one you may create).  I think that 10 causes
indentation of that line regardless of whether you type C-j or RET.

> Even stranger, turning off electric-indent-mode results in the behavior
> I want, ie C-j inserts a newline then inserts.

This is indeed strange, but is deliberate.  The two behaviours
(electric-indent-mode and the transpositions of the key actions) were
linked together "for simplicity".  If you want to have
electric-indent-mode enabled at the same time as having C-j and RET
behave traditionally, you're going to have to swap the key bindings or
start hacking the Emacs lisp code.

This situation is a big part of why I personally haven't upgraded to
Emacs 24.4.

> In GNU Emacs 25.0.50.1 (x86_64-unknown-linux-gnu, X toolkit, Xaw scroll bars)
> of 2014-12-02 on raman-glaptop
> Repository revision: cb2257edc4a4b74ce9b566edc2d15a54e1ce2f22
> System Description:     Ubuntu 14.04 LTS

-- 
Alan Mackenzie (Nuremberg, Germany).