* Why flip RET and C-j with electric-indent-mode?
@ 2014-11-28 22:56 Bob Proulx
2014-11-28 23:52 ` Drew Adams
` (3 more replies)
0 siblings, 4 replies; 14+ messages in thread
From: Bob Proulx @ 2014-11-28 22:56 UTC (permalink / raw)
To: help-gnu-emacs
So why did emacs flip RET and C-j with electric-indent-mode? It has
always been that typing RET in fundamental mode would insert a
newline. C-j would insert a newline and indent. This is now broken
in emacs24.4 and later. Now those two actions are reversed!
Aaarrrgghh!
Here is the news entry.
* Editing Changes in Emacs 24.4
** Indentation
*** `electric-indent-mode' is now enabled by default.
Typing RET reindents the current line and indents the new line.
`C-j' inserts a newline but does not indent. In some programming modes,
additional characters are electric (eg `{').
*** New buffer-local `electric-indent-local-mode'.
The change is to set electric-indent-mode all of the time. Even in
fundamental-mode? That is a terrible thing to do to users. Rug.
Standing on rug? Yank rug!
Bob
The previous online help for RET:
RET (translated from <return>) runs the command newline, which is an
interactive compiled Lisp function in `simple.el'.
It is bound to RET.
(newline &optional ARG)
Insert a newline, and move to left margin of the new line if it's
blank.
If `use-hard-newlines' is non-nil, the newline is marked with the
text-property `hard'.
With ARG, insert that many newlines.
Call `auto-fill-function' if the current column number is greater
than the value of `fill-column' and ARG is nil.
In the latest emacs24 RET now does:
RET runs the command newline, which is an interactive compiled Lisp
function in `simple.el'.
It is bound to RET.
(newline &optional ARG INTERACTIVE)
Insert a newline, and move to left margin of the new line if it's blank.
If option `use-hard-newlines' is non-nil, the newline is marked with the
text-property `hard'.
With ARG, insert that many newlines.
If `electric-indent-mode' is enabled, this indents the final new line
that it adds, and reindents the preceding line. To just insert
a newline, use M-x electric-indent-just-newline.
Calls `auto-fill-function' if the current column number is greater
than the value of `fill-column' and ARG is nil.
A non-nil INTERACTIVE argument means to run the `post-self-insert-hook'.
^ permalink raw reply [flat|nested] 14+ messages in thread
* RE: Why flip RET and C-j with electric-indent-mode?
2014-11-28 22:56 Why flip RET and C-j with electric-indent-mode? Bob Proulx
@ 2014-11-28 23:52 ` Drew Adams
2014-11-29 7:50 ` Eli Zaretskii
` (2 subsequent siblings)
3 siblings, 0 replies; 14+ messages in thread
From: Drew Adams @ 2014-11-28 23:52 UTC (permalink / raw)
To: Bob Proulx, help-gnu-emacs
> Now those two actions are reversed! Aaarrrgghh!
> The change is to set electric-indent-mode all of the time.
> Even in fundamental-mode? That is a terrible thing to do
> to users. Rug. Standing on rug? Yank rug!
Aaarrrgghh! indeed.
We old farts can either put things back the way they
were, locally, or adjust to the newfangled way of things.
Of course, if you use multiple Emacs versions you had
better put things back the way they were, or you will
be between two chairs...
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Why flip RET and C-j with electric-indent-mode?
2014-11-28 22:56 Why flip RET and C-j with electric-indent-mode? Bob Proulx
2014-11-28 23:52 ` Drew Adams
@ 2014-11-29 7:50 ` Eli Zaretskii
2014-11-29 23:20 ` Bob Proulx
[not found] ` <mailman.14976.1417303216.1147.help-gnu-emacs@gnu.org>
2014-11-29 12:31 ` Rasmus
2014-11-30 9:59 ` Andreas Röhler
3 siblings, 2 replies; 14+ messages in thread
From: Eli Zaretskii @ 2014-11-29 7:50 UTC (permalink / raw)
To: help-gnu-emacs
> Date: Fri, 28 Nov 2014 15:56:30 -0700
> From: Bob Proulx <bob@proulx.com>
>
> So why did emacs flip RET and C-j with electric-indent-mode?
Because users nowadays expect that.
> Here is the news entry.
>
> * Editing Changes in Emacs 24.4
>
> ** Indentation
>
> *** `electric-indent-mode' is now enabled by default.
> Typing RET reindents the current line and indents the new line.
> `C-j' inserts a newline but does not indent. In some programming modes,
> additional characters are electric (eg `{').
>
> *** New buffer-local `electric-indent-local-mode'.
>
> The change is to set electric-indent-mode all of the time. Even in
> fundamental-mode? That is a terrible thing to do to users. Rug.
> Standing on rug? Yank rug!
"C-h f newline RET" will have a suggestion that you will like, I
think.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Why flip RET and C-j with electric-indent-mode?
[not found] <mailman.14910.1417215406.1147.help-gnu-emacs@gnu.org>
@ 2014-11-29 9:34 ` jfbu
2014-11-30 4:48 ` Stefan Monnier
0 siblings, 1 reply; 14+ messages in thread
From: jfbu @ 2014-11-29 9:34 UTC (permalink / raw)
To: help-gnu-emacs
28/11/2014 23:56, Bob Proulx wrote :
> So why did emacs flip RET and C-j with electric-indent-mode? It has
> always been that typing RET in fundamental mode would insert a
> newline. C-j would insert a newline and indent. This is now broken
> in emacs24.4 and later. Now those two actions are reversed!
> Aaarrrgghh!
Thanks so much Bob! ever since I upgraded my Emacs (a build for Mac OS X)
I was terribly annoyed by strange indentation behavior whenever
typing RET for example when editing commented parts in my custom file,
and I settled on doing C-qC-j -- didn't know about C-j by the way.
All this mystery vanishes after turning off electric-indent-mode!
I am not competent to say if the change was well grounded or not,
but it is very nice to know what I observed in disarray is explained
by electric-mode setting.
thanks again,
Jean-Francois
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Why flip RET and C-j with electric-indent-mode?
2014-11-28 22:56 Why flip RET and C-j with electric-indent-mode? Bob Proulx
2014-11-28 23:52 ` Drew Adams
2014-11-29 7:50 ` Eli Zaretskii
@ 2014-11-29 12:31 ` Rasmus
2014-11-30 9:59 ` Andreas Röhler
3 siblings, 0 replies; 14+ messages in thread
From: Rasmus @ 2014-11-29 12:31 UTC (permalink / raw)
To: help-gnu-emacs
Bob Proulx <bob@proulx.com> writes:
> So why did emacs flip RET and C-j with electric-indent-mode? It has
> always been that typing RET in fundamental mode would insert a
> newline. C-j would insert a newline and indent. This is now broken
> in emacs24.4 and later. Now those two actions are reversed!
> Aaarrrgghh!
I really like this change. . . Reminds me that commentary of python.el
should be updated.
—Rasmus
--
This space is left intentionally blank
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Why flip RET and C-j with electric-indent-mode?
2014-11-29 7:50 ` Eli Zaretskii
@ 2014-11-29 23:20 ` Bob Proulx
2014-11-30 1:49 ` Drew Adams
[not found] ` <mailman.14976.1417303216.1147.help-gnu-emacs@gnu.org>
1 sibling, 1 reply; 14+ messages in thread
From: Bob Proulx @ 2014-11-29 23:20 UTC (permalink / raw)
To: help-gnu-emacs
Eli Zaretskii wrote:
> Bob Proulx wrote:
> > So why did emacs flip RET and C-j with electric-indent-mode?
>
> Because users nowadays expect that.
These days I think users expect mode specific behavior. In c-mode or
whatever then that type of electric behavior is rather expected. But
in the basic fundamental-mode that type of automatic indention really
gets in the way and is not expected. The fundamental-mode should be
simple and basic without all of the happy fluff.
> "C-h f newline RET" will have a suggestion that you will like, I
> think.
I think you might be hinting at:
To just insert a newline, use M-x electric-indent-just-newline.
But no. That isn't a suggestion I like. Obviously I already know
that setting this will set things back the way I prefer:
(setq electric-indent-mode nil) ; new in 24, default is t, breaks RET/C-j
I am simply registering my aggravation with this being the new default
for fundamental-mode.
Bob
^ permalink raw reply [flat|nested] 14+ messages in thread
* RE: Why flip RET and C-j with electric-indent-mode?
2014-11-29 23:20 ` Bob Proulx
@ 2014-11-30 1:49 ` Drew Adams
0 siblings, 0 replies; 14+ messages in thread
From: Drew Adams @ 2014-11-30 1:49 UTC (permalink / raw)
To: Bob Proulx, help-gnu-emacs
> setting this will set things back the way I prefer:
> (setq electric-indent-mode nil); new in 24, breaks RET/C-j
Yup. Did that as soon as I saw this happening.
At least Emacs doesn't jump to join *every* trend. I think
we've safely escaped the Hello Kitty wave of a while back,
but you never know. (http://www.emacswiki.org/PinkBliss)
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Why flip RET and C-j with electric-indent-mode?
2014-11-29 9:34 ` jfbu
@ 2014-11-30 4:48 ` Stefan Monnier
0 siblings, 0 replies; 14+ messages in thread
From: Stefan Monnier @ 2014-11-30 4:48 UTC (permalink / raw)
To: help-gnu-emacs
> Thanks so much Bob! ever since I upgraded my Emacs (a build for Mac OS X)
> I was terribly annoyed by strange indentation behavior whenever
> typing RET for example when editing commented parts in my custom file,
> and I settled on doing C-qC-j -- didn't know about C-j by the way.
BTW, beside the case where you simply dislike the new behavior (very
valid, and hopefully well supported by adding (electric-indent-mode -1)
to your .emacs), there can also be cases where the new behavior is
simply wrong.
These should be reported as bugs.
Stefan
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Why flip RET and C-j with electric-indent-mode?
2014-11-28 22:56 Why flip RET and C-j with electric-indent-mode? Bob Proulx
` (2 preceding siblings ...)
2014-11-29 12:31 ` Rasmus
@ 2014-11-30 9:59 ` Andreas Röhler
3 siblings, 0 replies; 14+ messages in thread
From: Andreas Röhler @ 2014-11-30 9:59 UTC (permalink / raw)
To: Bob Proulx; +Cc: help-gnu-emacs@gnu.org List
On 28.11.2014 23:56, Bob Proulx wrote:
> So why did emacs flip RET and C-j with electric-indent-mode? It has
> always been that typing RET in fundamental mode would insert a
> newline. C-j would insert a newline and indent. This is now broken
> in emacs24.4 and later. Now those two actions are reversed!
> Aaarrrgghh!
>
+1
In shell-modes --which are a major asset of Emacs-- RET still sends a newline.
Feels fairly inconsistent.
In favour of reverting this change,
Andreas
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Why flip RET and C-j with electric-indent-mode?
@ 2014-12-11 16:56 Stephen
0 siblings, 0 replies; 14+ messages in thread
From: Stephen @ 2014-12-11 16:56 UTC (permalink / raw)
To: help-gnu-emacs@gnu.org; +Cc: bob@proulx.com
> But no. That isn't a suggestion I like. Obviously I already know
> that setting this will set things back the way I prefer:
>
> (setq electric-indent-mode nil) ; new in 24, default is t, breaks RET/C-j
well, no
that disables the electric stuff in its entirety - in c-mode, where i spend a lot of time, you lose the other magic keys (comma, semicolon, parens etc etc)
this is the best workaround i've found:
(global-set-key (kbd "RET") 'electric-newline-and-maybe-indent)
also,
> Because users nowadays expect that.
strikes me as a little arrogant. if by "users" you mean "people who have never used emacs before" then yes. but if you mean "people who have been using emacs for 24 years" then no, i NOT "expect that", get off my lawn!
i don't object to change per se, but i am ticked off there was no obvious documented "old behaviour" flag, and that i had to waste my time coming up with an acceptable workaround for this frivolous change.
s.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Why flip RET and C-j with electric-indent-mode?
[not found] ` <mailman.14976.1417303216.1147.help-gnu-emacs@gnu.org>
@ 2016-04-29 17:57 ` jfiocca0
2016-06-03 23:41 ` Bob Proulx
0 siblings, 1 reply; 14+ messages in thread
From: jfiocca0 @ 2016-04-29 17:57 UTC (permalink / raw)
To: help-gnu-emacs
>
> (setq electric-indent-mode nil) ; new in 24, default is t, breaks RET/C-j
>
For me, that does not completely revert the behavior back to the old way. It does not automatically indent curly braces like it used to. How can I get back to the old way + auto-indent C curly braces?
Thanks,
Jim
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Why flip RET and C-j with electric-indent-mode?
2016-04-29 17:57 ` jfiocca0
@ 2016-06-03 23:41 ` Bob Proulx
2016-06-06 17:23 ` Jim Fiocca
0 siblings, 1 reply; 14+ messages in thread
From: Bob Proulx @ 2016-06-03 23:41 UTC (permalink / raw)
To: jfiocca0; +Cc: help-gnu-emacs
jfiocca0@gmail.com wrote:
> > (setq electric-indent-mode nil) ; new in 24, default is t, breaks RET/C-j
>
> For me, that does not completely revert the behavior back to the old
> way. It does not automatically indent curly braces like it used to.
> How can I get back to the old way + auto-indent C curly braces?
I have noticed this too. But I haven't figured out the details yet.
Could you say what programming mode you are using? There are many
with curly braces. And could you describe more precisely which action
is different? Is using C-j instead of Enter acceptable?
Bob
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Why flip RET and C-j with electric-indent-mode?
2016-06-03 23:41 ` Bob Proulx
@ 2016-06-06 17:23 ` Jim Fiocca
2016-06-06 22:08 ` Bob Proulx
0 siblings, 1 reply; 14+ messages in thread
From: Jim Fiocca @ 2016-06-06 17:23 UTC (permalink / raw)
To: help-gnu-emacs
Bob,
I am using C and C++ programming modes. Previously whenever I typed an
open curly brace, it would automatically indent to the correct column.
Now, with electric-indent-mode nil, it just stays at column 1. This has
nothing to do with RET or ctrl-J.
Funny thing is, if I turn electric-indent-mode on and then off while in
a C-mode buffer, it works fine. I just can't automate it. Something
wrong with the timing of turning it off globally or turning it off in my
c-mode-hook in .emacs.
Thanks,
Jim
On 6/3/2016 7:41 PM, Bob Proulx wrote:
> jfiocca0@gmail.com wrote:
>>> (setq electric-indent-mode nil) ; new in 24, default is t, breaks RET/C-j
>> For me, that does not completely revert the behavior back to the old
>> way. It does not automatically indent curly braces like it used to.
>> How can I get back to the old way + auto-indent C curly braces?
> I have noticed this too. But I haven't figured out the details yet.
>
> Could you say what programming mode you are using? There are many
> with curly braces. And could you describe more precisely which action
> is different? Is using C-j instead of Enter acceptable?
>
> Bob
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Why flip RET and C-j with electric-indent-mode?
2016-06-06 17:23 ` Jim Fiocca
@ 2016-06-06 22:08 ` Bob Proulx
0 siblings, 0 replies; 14+ messages in thread
From: Bob Proulx @ 2016-06-06 22:08 UTC (permalink / raw)
To: Jim Fiocca; +Cc: help-gnu-emacs
Jim Fiocca wrote:
> I am using C and C++ programming modes. Previously whenever I typed an open
> curly brace, it would automatically indent to the correct column. Now, with
> electric-indent-mode nil, it just stays at column 1. This has nothing to do
> with RET or ctrl-J.
>
> Funny thing is, if I turn electric-indent-mode on and then off while in a
> C-mode buffer, it works fine. I just can't automate it. Something wrong
> with the timing of turning it off globally or turning it off in my
> c-mode-hook in .emacs.
I am hoping you will file a bug report on the problem. Here is the
bug reporting documentation.
http://www.gnu.org/software/emacs/manual/html_node/emacs/Bugs.html#Bugs
Bob
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2016-06-06 22:08 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-28 22:56 Why flip RET and C-j with electric-indent-mode? Bob Proulx
2014-11-28 23:52 ` Drew Adams
2014-11-29 7:50 ` Eli Zaretskii
2014-11-29 23:20 ` Bob Proulx
2014-11-30 1:49 ` Drew Adams
[not found] ` <mailman.14976.1417303216.1147.help-gnu-emacs@gnu.org>
2016-04-29 17:57 ` jfiocca0
2016-06-03 23:41 ` Bob Proulx
2016-06-06 17:23 ` Jim Fiocca
2016-06-06 22:08 ` Bob Proulx
2014-11-29 12:31 ` Rasmus
2014-11-30 9:59 ` Andreas Röhler
[not found] <mailman.14910.1417215406.1147.help-gnu-emacs@gnu.org>
2014-11-29 9:34 ` jfbu
2014-11-30 4:48 ` Stefan Monnier
-- strict thread matches above, loose matches on Subject: below --
2014-12-11 16:56 Stephen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).