emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 82df187: Don't modify buffer by unprettification


From: Tassilo Horn
Subject: [Emacs-diffs] master 82df187: Don't modify buffer by unprettification
Date: Wed, 30 Sep 2015 18:17:51 +0000

branch: master
commit 82df1878e6559188e688195f992fff10f35035e8
Author: Tassilo Horn <address@hidden>
Commit: Tassilo Horn <address@hidden>

    Don't modify buffer by unprettification
    
    * lisp/progmodes/prog-mode.el (prettify-symbols--compose-symbol):
    (prettify-symbols--post-command-hook, prettify-symbols-mode): Don't
    modify buffer when setting/removing custom prettify-symbols-start/end
    text properties.  Add them to font-lock-extra-managed-props, too.
---
 lisp/progmodes/prog-mode.el |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/lisp/progmodes/prog-mode.el b/lisp/progmodes/prog-mode.el
index b408509..e092e24 100644
--- a/lisp/progmodes/prog-mode.el
+++ b/lisp/progmodes/prog-mode.el
@@ -165,7 +165,7 @@ Regexp match data 0 points to the chars."
     (if (and (not (equal prettify-symbols--current-symbol-bounds (list start 
end)))
              (funcall prettify-symbols-compose-predicate start end match))
         ;; That's a symbol alright, so add the composition.
-        (progn
+        (with-silent-modifications
           (compose-region start end (cdr (assoc match alist)))
           (add-text-properties
            start end
@@ -193,7 +193,7 @@ Regexp match data 0 points to the chars."
   (if-let ((c (get-text-property (point) 'composition))
            (s (get-text-property (point) 'prettify-symbols-start))
            (e (get-text-property (point) 'prettify-symbols-end)))
-      (progn
+      (with-silent-modifications
         (setq prettify-symbols--current-symbol-bounds (list s e))
         (remove-text-properties s e '(composition)))
     (when (and prettify-symbols--current-symbol-bounds
@@ -236,7 +236,10 @@ support it."
       (when (setq prettify-symbols--keywords (prettify-symbols--make-keywords))
         (font-lock-add-keywords nil prettify-symbols--keywords)
         (setq-local font-lock-extra-managed-props
-                    (cons 'composition font-lock-extra-managed-props))
+                    (append font-lock-extra-managed-props
+                            '(composition
+                              prettify-symbols-start
+                              prettify-symbols-end)))
         (when prettify-symbols-unprettify-at-point
           (add-hook 'post-command-hook
                     #'prettify-symbols--post-command-hook nil t))



reply via email to

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