From cbaf6ee73f9129fdb8f1e45ba680ca029981d290 Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Sun, 12 May 2019 13:53:31 -0400 Subject: [PATCH] Bind RET to newline-and-indent (Bug#35254) * lisp/bindings.el: Bind RET to newline-and-indent, C-j to newline. * lisp/electric.el: Don't bind electric-newline-and-maybe-indent to C-j. (electric-indent-chars): Remove newline from default value. --- lisp/bindings.el | 3 ++- lisp/electric.el | 4 +--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lisp/bindings.el b/lisp/bindings.el index 744bcc36a8..43b4f8b8cf 100644 --- a/lisp/bindings.el +++ b/lisp/bindings.el @@ -892,7 +892,8 @@ (define-key global-map "\C-g" 'keyboard-quit) ;; suspend only the relevant terminal. (substitute-key-definition 'suspend-emacs 'suspend-frame global-map) -(define-key global-map "\C-m" 'newline) +(define-key global-map "\C-m" 'newline-and-indent) +(define-key global-map "\C-j" 'newline) (define-key global-map "\C-o" 'open-line) (define-key esc-map "\C-o" 'split-line) (define-key global-map "\C-q" 'quoted-insert) diff --git a/lisp/electric.el b/lisp/electric.el index 07da2f1d9e..e5c318e34f 100644 --- a/lisp/electric.el +++ b/lisp/electric.el @@ -207,7 +207,7 @@ (defun electric--sort-post-self-insertion-hook () ;; should usually set this variable by adding elements to the default ;; value, which only works well if the variable is preloaded. ;;;###autoload -(defvar electric-indent-chars '(?\n) +(defvar electric-indent-chars '() "Characters that should cause automatic reindentation.") (defvar electric-indent-functions nil @@ -306,8 +306,6 @@ (defun electric-indent-just-newline (arg) (newline arg 'interactive))) ;;;###autoload -(define-key global-map "\C-j" 'electric-newline-and-maybe-indent) -;;;###autoload (defun electric-newline-and-maybe-indent () "Insert a newline. If `electric-indent-mode' is enabled, that's that, but if it -- 2.11.0