emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/adaptive-wrap dd32f62 12/15: * adaptive-wrap/adaptive-w


From: Stefan Monnier
Subject: [elpa] externals/adaptive-wrap dd32f62 12/15: * adaptive-wrap/adaptive-wrap.el: Fix interaction with visual-fill
Date: Sun, 29 Nov 2020 19:09:10 -0500 (EST)

branch: externals/adaptive-wrap
commit dd32f624820dee73b4186336b22376169a730ed6
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>

    * adaptive-wrap/adaptive-wrap.el: Fix interaction with visual-fill
    
    (adaptive-wrap-prefix-function): Remove problematic 'display' properties
    as well.
---
 adaptive-wrap.el | 36 ++++++++++++++++++++++--------------
 1 file changed, 22 insertions(+), 14 deletions(-)

diff --git a/adaptive-wrap.el b/adaptive-wrap.el
index 5e073f1..6237924 100644
--- a/adaptive-wrap.el
+++ b/adaptive-wrap.el
@@ -4,7 +4,7 @@
 
 ;; Author: Stephen Berman <stephen.berman@gmx.net>
 ;;         Stefan Monnier <monnier@iro.umontreal.ca>
-;; Version: 0.5.2
+;; Version: 0.6
 
 ;; This program is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
@@ -94,19 +94,27 @@ extra indent = 2
   (setq beg (point))
   (while (< (point) end)
     (let ((lbp (point)))
-      (put-text-property (point)
-                         (progn (search-forward "\n" end 'move) (point))
-                         'wrap-prefix
-                        (let ((pfx (adaptive-wrap-fill-context-prefix
-                                    lbp (point))))
-                          ;; Remove any `wrap-prefix' property that
-                          ;; might have been added earlier.
-                          ;; Otherwise, we end up with a string
-                          ;; containing a `wrap-prefix' string
-                          ;; containing a `wrap-prefix' string ...
-                          (remove-text-properties
-                           0 (length pfx) '(wrap-prefix) pfx)
-                          pfx))))
+      (put-text-property
+       (point) (progn (search-forward "\n" end 'move) (point))
+       'wrap-prefix
+       (let ((pfx (adaptive-wrap-fill-context-prefix
+                  lbp (point))))
+        ;; Remove any `wrap-prefix' property that
+        ;; might have been added earlier.
+        ;; Otherwise, we end up with a string
+        ;; containing a `wrap-prefix' string
+        ;; containing a `wrap-prefix' string ...
+        (remove-text-properties
+         0 (length pfx) '(wrap-prefix) pfx)
+         (let ((dp (get-text-property 0 'display pfx)))
+           (when (and dp (eq dp (get-text-property (1- lbp) 'display)))
+             ;; There's a `display' property which covers not just the
+             ;; prefix but also the previous newline.  So it's not just making
+             ;; the prefix more pretty and could interfere or even defeat our
+             ;; efforts (e.g. it comes from `visual-fill-mode').
+             (remove-text-properties
+             0 (length pfx) '(display) pfx)))
+        pfx))))
   `(jit-lock-bounds ,beg . ,end))
 
 ;;;###autoload



reply via email to

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