help-gnu-emacs
[Top][All Lists]
Advanced

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

Why flip RET and C-j with electric-indent-mode?


From: Bob Proulx
Subject: Why flip RET and C-j with electric-indent-mode?
Date: Fri, 28 Nov 2014 15:56:30 -0700
User-agent: Mutt/1.5.23 (2014-03-12)

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



reply via email to

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