emacs-diffs
[Top][All Lists]
Advanced

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

master b41f31d: Make `M-j' work reliably if `comment-auto-fill-only-comm


From: Lars Ingebrigtsen
Subject: master b41f31d: Make `M-j' work reliably if `comment-auto-fill-only-comments' is set
Date: Wed, 4 Aug 2021 04:03:21 -0400 (EDT)

branch: master
commit b41f31d2b60269bd0e7addd1081f3738f91e76bc
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Make `M-j' work reliably if `comment-auto-fill-only-comments' is set
    
    * lisp/simple.el (default-indent-new-line): Force breaking the
    line when called interactively (bug#49849).  (Perhaps the
    interactive command should be rebound and call this function
    instead...)
---
 lisp/simple.el | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/lisp/simple.el b/lisp/simple.el
index 5ec7fd8..3ad8634 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -8143,15 +8143,19 @@ is defined.
 The function should take a single optional argument, which is a flag
 indicating whether it should use soft newlines.")
 
-(defun default-indent-new-line (&optional soft)
+(defun default-indent-new-line (&optional soft force)
   "Break line at point and indent.
 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."
-  (interactive)
+  (interactive (list nil t))
   (if comment-start
-      (funcall comment-line-break-function soft)
+      ;; Force breaking the line when called interactively.
+      (if force
+          (let ((comment-auto-fill-only-comments nil))
+            (funcall comment-line-break-function soft))
+        (funcall comment-line-break-function soft))
     ;; Insert the newline before removing empty space so that markers
     ;; get preserved better.
     (if soft (insert-and-inherit ?\n) (newline 1))



reply via email to

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