* bug#21884: 25.0.50; Unexpected indentation from `open-line' due to new `electric-indent-mode' default.
@ 2015-11-12 7:57 Karl Fogel
2015-11-20 12:44 ` bug#21884: Behavior reverted on emacs-25 branch Karl Fogel
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Karl Fogel @ 2015-11-12 7:57 UTC (permalink / raw)
To: 21884
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.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-11-22 6:29 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-12 7:57 bug#21884: 25.0.50; Unexpected indentation from `open-line' due to new `electric-indent-mode' default Karl Fogel
2015-11-20 12:44 ` bug#21884: Behavior reverted on emacs-25 branch Karl Fogel
2015-11-22 4:53 ` bug#21884: Cleanup commit on emacs-25 branch finishes reversion Karl Fogel
2015-11-22 6:29 ` bug#21884: Closing this bug, since we'd discuss before reviving new behavior Karl Fogel
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.