emacs-diffs
[Top][All Lists]
Advanced

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

master c6267c0: Fix flow filling for flowing multiple flowed lines


From: Lars Ingebrigtsen
Subject: master c6267c0: Fix flow filling for flowing multiple flowed lines
Date: Fri, 14 Aug 2020 10:15:20 -0400 (EDT)

branch: master
commit c6267c0fe61531501cb6ab56bdebb500bdf73c29
Author: Ferdinand Pieper <git@pie.tf>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Fix flow filling for flowing multiple flowed lines
    
    * lisp/mail/flow-fill.el (fill-flowed): Loop until all flowed lines
    are collected.
    * test/lisp/mail/flow-fill-tests.el
    (fill-flow-tests-fill-flowed-decode): Also test for multiple
    flowed lines (bug#42855).
---
 lisp/mail/flow-fill.el            | 36 +++++++++++++++++++++---------------
 test/lisp/mail/flow-fill-tests.el |  3 ++-
 2 files changed, 23 insertions(+), 16 deletions(-)

diff --git a/lisp/mail/flow-fill.el b/lisp/mail/flow-fill.el
index af3b493..f4b5503 100644
--- a/lisp/mail/flow-fill.el
+++ b/lisp/mail/flow-fill.el
@@ -131,31 +131,37 @@ lines."
             (goto-char (match-end 0))
             (unless (looking-at " ")
               (insert " "))
-            (end-of-line)
-            (when (and (not (eobp))
-                       (save-excursion
-                         (forward-line 1)
-                         (looking-at (format "\\(%s ?\\)[^>]" prefix))))
-              ;; Delete the newline and the quote at the start of the
-              ;; next line.
-              (delete-region (point) (match-end 1))
-              (ignore-errors
+            (while (and (eq (char-before (line-end-position)) ?\s)
+                        (not (eobp))
+                        (save-excursion
+                          (forward-line 1)
+                          (looking-at (format "\\(%s ?\\)[^>]" prefix))))
+              (end-of-line)
+              (when (and (not (eobp))
+                         (save-excursion
+                           (forward-line 1)
+                           (looking-at (format "\\(%s ?\\)[^>]" prefix))))
+                ;; Delete the newline and the quote at the start of the
+                ;; next line.
+                (delete-region (point) (match-end 1))))
+                (ignore-errors
                  (let ((fill-prefix (concat prefix " "))
                        adaptive-fill-mode)
                    (fill-region (line-beginning-position)
                                  (line-end-position)
-                                'left 'nosqueeze))))))
-         (t
+                                'left 'nosqueeze)))))
+          (t
           ;; Delete the newline.
           (when (eq (following-char) ?\s)
             (delete-char 1))
           ;; Hack: Don't do the flowing on the signature line.
           (when (and (not (looking-at "-- $"))
                      (eq (char-before (line-end-position)) ?\s))
-            (end-of-line)
-            (when delete-space
-              (delete-char -1))
-            (delete-char 1)
+            (while (eq (char-before (line-end-position)) ?\s)
+              (end-of-line)
+              (when delete-space
+                (delete-char -1))
+              (delete-char 1))
             (ignore-errors
                (let ((fill-prefix ""))
                  (fill-region (line-beginning-position)
diff --git a/test/lisp/mail/flow-fill-tests.el 
b/test/lisp/mail/flow-fill-tests.el
index 4d435ae..c2e4178 100644
--- a/test/lisp/mail/flow-fill-tests.el
+++ b/test/lisp/mail/flow-fill-tests.el
@@ -35,7 +35,8 @@
           ">>> unmuzzled ratsbane!\n"
           ">>>> Henceforth, the coding style is to be strictly \n"
           ">>>> enforced, including the use of only upper case.\n"
-          ">>>>> I've noticed a lack of adherence to the coding \n"
+          ">>>>> I've noticed a lack of adherence to \n"
+          ">>>>> the coding \n"
           ">>>>> styles, of late.\n"
           ">>>>>> Any complaints?\n"))
         (output



reply via email to

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