all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* newline-and-indent vs. electric-indent-mode
@ 2021-01-22 13:53 Harald Jörg
  2021-01-22 14:49 ` Stefan Monnier
  0 siblings, 1 reply; 30+ messages in thread
From: Harald Jörg @ 2021-01-22 13:53 UTC (permalink / raw)
  To: Emacs Developer List

Hi all,

in a debugging session for some indenting bugs I noticed with some
surprise how often the mode-specific indenting function is called.
There seems to be a systematic overlap between the keybinding of RET and
electric-indent-mode.

Many (almost all?) modes bind RET to newline-and-indent, but '(?\n) is
also the default value of electric-indent-chars.  So, whenever a newline
is entered, there are three calls to the mode-specific indenting
function:

 - one call for the current line, caused by electric-indent-mode.  This
   makes some sense because the line's content might suggest a different
   indentation than what could be guessed when the line started out as a
   new empty line.  It is annoying, however, when the mode gets the
   indentation wrong (which occasionally happens).  It is also
   superfluous if the character which causes a change in indentation
   (for example "}") is either itself in electric-indent-chars (as in
   perl-mode) or handled by the mode's keymap (as in cperl-mode), both
   resulting in a call to the indenting function.

 - two calls for the following, empty line.  One is caused by '(?\n)
   being in electric-indent-chars, the other by the current command
   being newline-AND-INDENT.  This doesn't make any sense.

Should electric-indent-mode be switched off by modes which map RET to
newline-and-indent? Or should the modes refrain from mapping RET?
-- 
Cheers,
haj



^ permalink raw reply	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2021-01-26 15:58 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-22 13:53 newline-and-indent vs. electric-indent-mode Harald Jörg
2021-01-22 14:49 ` Stefan Monnier
2021-01-22 15:02   ` Dmitry Gutov
2021-01-22 15:09     ` Stefan Monnier
2021-01-22 22:43       ` Dmitry Gutov
2021-01-22 22:56         ` Stefan Monnier
2021-01-22 23:00           ` Dmitry Gutov
2021-01-22 23:16             ` Stefan Monnier
2021-01-23  0:45               ` Dmitry Gutov
2021-01-23  3:16                 ` Stefan Monnier
2021-01-24  2:54                   ` Dmitry Gutov
2021-01-24  5:29                     ` Stefan Monnier
2021-01-24 21:45                       ` Dmitry Gutov
2021-01-25  1:56                   ` Madhu
2021-01-25  2:29                     ` Dmitry Gutov
2021-01-25 10:45                       ` Madhu
2021-01-25 11:59                         ` Dmitry Gutov
2021-01-25 14:36                         ` Stefan Monnier
2021-01-25 14:42                           ` Dmitry Gutov
2021-01-25 15:15                             ` Stefan Monnier
2021-01-25 20:10                               ` Rudolf Schlatte
2021-01-26  2:04                               ` Dmitry Gutov
2021-01-26  2:43                                 ` Stefan Monnier
2021-01-26 15:58                               ` martin rudalics
2021-01-25  3:33                     ` Eli Zaretskii
2021-01-22 19:33   ` Harald Jörg
2021-01-22 22:05     ` Stefan Monnier
2021-01-23  2:19       ` Harald Jörg
2021-01-23  3:29         ` Stefan Monnier
2021-01-23 16:27           ` Harald Jörg

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.