From 8a11e430ec261c08cc928a7a5b05ee1027f50368 Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Thu, 27 Jun 2019 16:57:47 +0200 Subject: [PATCH] Use `default-indent-new-line' instead of `indent-new-comment-line' * lisp/simple.el (default-indent-new-line): Doc string fix. * lisp/textmodes/refill.el (refill-post-command-function): Make default-indent-new-line work as indent-new-comment-line. * lisp/textmodes/refill.el (refill-post-command-function): Bind `M-C-j' and `M-j' to default-indent-new-line instead of indent-new-comment-line to allow overriding via `comment-line-break-function' (bug#12413). --- lisp/bindings.el | 4 ++-- lisp/simple.el | 2 +- lisp/textmodes/refill.el | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lisp/bindings.el b/lisp/bindings.el index 744bcc36a85..5205d497ef5 100644 --- a/lisp/bindings.el +++ b/lisp/bindings.el @@ -1229,8 +1229,8 @@ if `inhibit-field-text-motion' is non-nil." (define-key ctl-x-map "\C-t" 'transpose-lines) (define-key esc-map ";" 'comment-dwim) -(define-key esc-map "j" 'indent-new-comment-line) -(define-key esc-map "\C-j" 'indent-new-comment-line) +(define-key esc-map "j" 'default-indent-new-line) +(define-key esc-map "\C-j" 'default-indent-new-line) (define-key ctl-x-map ";" 'comment-set-column) (define-key ctl-x-map [?\C-\;] 'comment-line) (define-key ctl-x-map "f" 'set-fill-column) diff --git a/lisp/simple.el b/lisp/simple.el index 87159366f61..5ef5d3dc2ea 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -7318,7 +7318,7 @@ indicating whether it should use soft newlines.") (defun default-indent-new-line (&optional soft) "Break line at point and indent. -If a comment syntax is defined, call `comment-indent-new-line'. +If a comment syntax is defined, call `comment-line-break-function'. The inserted newline is marked hard if variable `use-hard-newlines' is true, unless optional argument SOFT is non-nil." diff --git a/lisp/textmodes/refill.el b/lisp/textmodes/refill.el index 5c69fdc1b07..e597ba866c4 100644 --- a/lisp/textmodes/refill.el +++ b/lisp/textmodes/refill.el @@ -181,7 +181,7 @@ complex processing.") (setq refill-doit nil))) ((or 'quoted-insert 'fill-paragraph 'fill-region) nil) ((or 'newline 'newline-and-indent 'open-line 'indent-new-comment-line - 'reindent-then-newline-and-indent) + 'default-indent-new-line 'reindent-then-newline-and-indent) ;; Don't zap what was just inserted. (save-excursion (beginning-of-line) ; for newline-and-indent -- 2.39.2