emacs-diffs
[Top][All Lists]
Advanced

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

master 6788d7b: Make `M-q' in message-mode work better


From: Lars Ingebrigtsen
Subject: master 6788d7b: Make `M-q' in message-mode work better
Date: Wed, 29 Sep 2021 12:45:20 -0400 (EDT)

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

    Make `M-q' in message-mode work better
    
    * lisp/gnus/message.el (message-newline-and-reformat): Fix
    bug#43299 differently.
    (message-newline-and-reformat): Revert change for bug#43299.  This
    fixes bug#50842.
---
 lisp/gnus/message.el | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el
index 4a754b9..f51f5c0 100644
--- a/lisp/gnus/message.el
+++ b/lisp/gnus/message.el
@@ -3572,8 +3572,18 @@ Prefix arg means justify as well."
     (when (looking-at message-cite-prefix-regexp)
       (setq quoted (match-string 0))
       (goto-char (match-end 0))
-      (looking-at "[ \t]*")
-      (setq leading-space (match-string 0)))
+      (let ((after (point)))
+        ;; This is a line with no text after the cite prefix.  In that
+        ;; case, the trailing space is commonly not present, so look
+        ;; around for other lines that have some data.
+        (when (looking-at-p "\n")
+          (let ((regexp (concat "^" message-cite-prefix-regexp ".")))
+            (when (or (re-search-backward regexp nil t)
+                      (re-search-forward regexp nil t))
+              (goto-char (1- (match-end 0))))))
+        (looking-at "[ \t]*")
+        (setq leading-space (match-string 0))
+        (goto-char after)))
     (if (and quoted
             (not not-break)
             (not bolp)
@@ -3590,7 +3600,7 @@ Prefix arg means justify as well."
                      (equal quoted (match-string 0)))
            (goto-char (match-end 0))
            (looking-at "[ \t]*")
-           (when (< (length leading-space) (length (match-string 0)))
+           (when (> (length leading-space) (length (match-string 0)))
              (setq leading-space (match-string 0)))
            (forward-line 1))
          (setq end (point))



reply via email to

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