Description
Normally, if you have electric-indent-mode
disabled, then RET
(aka C-m
) does nothing more than insert a newline; if you want to insert a newline and automatically indent the next line, you'd type C-j
to invoke newline-and-indent
. However, gnuplot-mode clobbers the existing definition of RET
to behave the same as C-j
, which forces this behavior on users who have explicitly chosen not to use it:
(define-key map "\C-m" #'newline-and-indent)
The proper thing to do is to simply not do this at all; gnuplot-mode already sets the indent-line-function
variable, and that's really all that's needed for electric-indent-mode
to automatically indent whenever a newline is inserted. gnuplot-mode should be leaving all electricity-related functionality in the hands of that minor mode (this includes its remapping of the }
key to gnuplot-electric-insert
, which also shouldn't be done).