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

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

[elpa] master 6bc26c1: * adaptive-wrap/adaptive-wrap.el: Fix interaction


From: Stefan Monnier
Subject: [elpa] master 6bc26c1: * adaptive-wrap/adaptive-wrap.el: Fix interaction with visual-fill
Date: Mon, 15 Oct 2018 11:57:56 -0400 (EDT)

branch: master
commit 6bc26c1d649607fb1d7aa514dfde576c4eeeaa98
Author: Stefan Monnier <address@hidden>
Commit: Stefan Monnier <address@hidden>

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

diff --git a/packages/adaptive-wrap/adaptive-wrap.el 
b/packages/adaptive-wrap/adaptive-wrap.el
index 5e073f1..6237924 100644
--- a/packages/adaptive-wrap/adaptive-wrap.el
+++ b/packages/adaptive-wrap/adaptive-wrap.el
@@ -4,7 +4,7 @@
 
 ;; Author: Stephen Berman <address@hidden>
 ;;         Stefan Monnier <address@hidden>
-;; 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]