emacs-diffs
[Top][All Lists]
Advanced

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

master 8d33413: Fix problem with filling with a computed fill prefix


From: Lars Ingebrigtsen
Subject: master 8d33413: Fix problem with filling with a computed fill prefix
Date: Wed, 24 Mar 2021 05:23:18 -0400 (EDT)

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

    Fix problem with filling with a computed fill prefix
    
    * lisp/textmodes/fill.el (fill-region-as-paragraph): Fix problem
    when filling text with a computed fill prefix (bug#47338).
---
 lisp/textmodes/fill.el | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/lisp/textmodes/fill.el b/lisp/textmodes/fill.el
index 81cd2f0..cb5027a 100644
--- a/lisp/textmodes/fill.el
+++ b/lisp/textmodes/fill.el
@@ -703,7 +703,8 @@ space does not end a sentence, so don't break a line there."
     (or justify (setq justify (current-justification)))
 
     ;; Don't let Adaptive Fill mode alter the fill prefix permanently.
-    (let ((fill-prefix fill-prefix))
+    (let ((actual-fill-prefix fill-prefix)
+          (fill-prefix fill-prefix))
       ;; Figure out how this paragraph is indented, if desired.
       (when (and adaptive-fill-mode
                 (or (null fill-prefix) (string= fill-prefix "")))
@@ -717,7 +718,7 @@ space does not end a sentence, so don't break a line there."
       (goto-char from)
       (beginning-of-line)
 
-      (if (not justify)          ; filling disabled: just check indentation
+      (if (not justify)     ; filling disabled: just check indentation
          (progn
            (goto-char from)
            (while (< (point) to)
@@ -747,12 +748,14 @@ space does not end a sentence, so don't break a line 
there."
               linebeg)
          (while (< (point) to)
             ;; On the first line, there may be text in the fill prefix
-            ;; zone.  In that case, don't consider that area when
-            ;; trying to find a place to put a line break (bug#45720).
+            ;; zone (when `fill-prefix' is specified externally, and
+            ;; not computed).  In that case, don't consider that area
+            ;; when trying to find a place to put a line break
+            ;; (bug#45720).
             (if (not first)
                (setq linebeg (point))
               (setq first nil
-                    linebeg (+ (point) (length fill-prefix))))
+                    linebeg (+ (point) (length actual-fill-prefix))))
            (move-to-column (current-fill-column))
            (if (when (< (point) to)
                  ;; Find the position where we'll break the line.



reply via email to

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