GNU bug report logs - #21884
25.0.50; Unexpected indentation from `open-line' due to new `electric-indent-mode' default.

Previous Next

Package: emacs;

Reported by: Karl Fogel <kfogel <at> red-bean.com>

Date: Thu, 12 Nov 2015 07:58:02 UTC

Severity: normal

Found in version 25.0.50

Done: Karl Fogel <kfogel <at> red-bean.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 21884 in the body.
You can then email your comments to 21884 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#21884; Package emacs. (Thu, 12 Nov 2015 07:58:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Karl Fogel <kfogel <at> red-bean.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 12 Nov 2015 07:58:03 GMT) Full text and rfc822 format available.

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

From: Karl Fogel <kfogel <at> red-bean.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 25.0.50; Unexpected indentation from `open-line' due to new
 `electric-indent-mode' default.
Date: Thu, 12 Nov 2015 01:57:34 -0600
Note that this bug report summarizes a discussion on the Emacs Devel mailing list -- please check there for updates:

  "Questioning the new behavior of `open-line'."
  https://lists.gnu.org/archive/html/emacs-devel/2015-11/threads.html#01100

The problem:

Since Artur Malabarba's commits of 2015-10-24 in simple.el, `open-line' has a new indentation behavior, because those commits made `open-line' sensitive to `electric-indent-mode', which in turn is now on by default.

For example, suppose you have the following text in a buffer, in just about any mode (i.e., not necessarily a programming language mode), and indented by two spaces as below:

  A lovely haiku
  An example for this bug
  For Emacs Devel

Now place point where the imaginary "X" is below and do C-o (`open-line'):

X A lovely haiku
  An example for this bug
  For Emacs Devel

Formerly, that would literally insert a newline, but not remove the the
two spaces of indendation that come *after* the new newline (the two
spaces right before "A lovely haiku").  So this would be the result:

[...this is the new line; imagine it's blank...]
  A lovely haiku
  An example for this bug
  For Emacs Devel

But after the recent commits, those two spaces get removed:

[...this is the new line; imagine it's blank...]
A lovely haiku
  An example for this bug
  For Emacs Devel

Thus one can no longer just put point in column 0 and type C-o to open a line 
right before a block of indented text while preserving the block's indentation.

Solutions:

One solution would be to revert `open-line' to being entirely insensitive to `electric-indent-mode'.  But Artur points out (in https://lists.gnu.org/archive/html/emacs-devel/2015-11/msg01100.html) that when point is in the middle of a line, one might want electric-indent behavior from `open-line'.  For instance, in the above example, put point at the first ‘h’ and do C-o.  If `open-line' just ignores electric-indent, then this would be the result:

  A lovely
haiku
  An example for this bug
  For Emacs Devel

Whereas with Artur's changes, the result would be this (which at least some people, including Artur, would desire):

  A lovely
  haiku
  An example for this bug
  For Emacs Devel

John Wiegley has proposed that `open-line' just be aware of when point is in column 0 and not do the electric-indent behavior then.  This preserves the common use case of C-a C-o, but also preserves Artur's "fix" (for those who agree it is a fix) for when C-o is invoked in the middle of a line.

Discussion is ongoing as of this writing.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21884; Package emacs. (Fri, 20 Nov 2015 12:45:01 GMT) Full text and rfc822 format available.

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

From: Karl Fogel <kfogel <at> red-bean.com>
To: 21884 <at> debbugs.gnu.org
Subject: Behavior reverted on emacs-25 branch.
Date: Fri, 20 Nov 2015 06:44:04 -0600
As per Artur's recent message, the indentation-sensitive behavior is
reverted on the 'emacs-25' branch while we continue to discuss.  See
http://git.savannah.gnu.org/cgit/emacs.git/commit/?h=emacs-25&id=c593538968a6d6c3d03da9ef6f489da6210e70e1
for details.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21884; Package emacs. (Sun, 22 Nov 2015 04:54:01 GMT) Full text and rfc822 format available.

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

From: Karl Fogel <kfogel <at> red-bean.com>
To: 21884 <at> debbugs.gnu.org
Subject: Cleanup commit on emacs-25 branch finishes reversion.
Date: Sat, 21 Nov 2015 22:53:00 -0600
A followup change was needed to complete the reversion:

    commit 8726de6663608b74e81ff88e530b4ddc6165700f
    Author: Karl Fogel <kfogel <at> red-bean.com>
    Date:   Sat Nov 21 22:50:05 2015 -0600




Reply sent to Karl Fogel <kfogel <at> red-bean.com>:
You have taken responsibility. (Sun, 22 Nov 2015 06:30:04 GMT) Full text and rfc822 format available.

Notification sent to Karl Fogel <kfogel <at> red-bean.com>:
bug acknowledged by developer. (Sun, 22 Nov 2015 06:30:06 GMT) Full text and rfc822 format available.

Message #16 received at 21884-done <at> debbugs.gnu.org (full text, mbox):

From: Karl Fogel <kfogel <at> red-bean.com>
To: 21884-done <at> debbugs.gnu.org
Subject: Closing this bug, since we'd discuss before reviving new behavior.
Date: Sun, 22 Nov 2015 00:29:01 -0600
Closing this bug as the electric-indent behavior is reverted in the 'emacs-25' branch now and the reversion will eventually be automatically ported to 'master'.  If the electric indentation behavior is revived, it would be through a discussion anyway.  We can re-open this ticket then if we want, but there might be no need: the continued mailing list discussion would probably be enough.





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 20 Dec 2015 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 9 years and 187 days ago.

Previous Next


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