]> git.eshelyaron.com Git - emacs.git/commitdiff
Flow fill texts after the last hard newline
authorPengji Zhang <me@pengjiz.com>
Wed, 28 Aug 2024 10:57:35 +0000 (18:57 +0800)
committerEshel Yaron <me@eshelyaron.com>
Mon, 14 Oct 2024 17:39:51 +0000 (19:39 +0200)
* lisp/mail/flow-fill.el (fill-flowed-encode): Use `(point-max)'
as `end' if there are no remaining hard newlines in buffer.
This ensures that the last paragraph will always be encoded,
even without a trailing hard newline.  (Bug#72870)

(cherry picked from commit fc214b668391abed313920cd44f3d913c8207e0e)

lisp/mail/flow-fill.el

index 919490ec5aac7253aaeaec32437c50f905a78b3c..d4ad7d459823988912620dfc9d49bc56f1817f63 100644 (file)
@@ -78,7 +78,9 @@ RFC 2646 suggests 66 characters for readability."
       (let ((start (point-min)) end)
        ;; Go through each paragraph, filling it and adding SPC
        ;; as the last character on each line.
-       (while (setq end (text-property-any start (point-max) 'hard 't))
+       (while (and (< start (point-max))
+                    (setq end (or (text-property-any start (point-max) 'hard 't)
+                                  (point-max))))
          (save-restriction
            (narrow-to-region start end)
            (let ((fill-column (eval fill-flowed-encode-column t)))