emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 9e4a6ad: Un- and re-prettification are not exclusiv


From: Tassilo Horn
Subject: [Emacs-diffs] master 9e4a6ad: Un- and re-prettification are not exclusive
Date: Thu, 01 Oct 2015 06:09:57 +0000

branch: master
commit 9e4a6ad1c77c62e4a7d5b708567e5a1e23b9cdfd
Author: Tassilo Horn <address@hidden>
Commit: Tassilo Horn <address@hidden>

    Un- and re-prettification are not exclusive
    
    * lisp/progmodes/prog-mode.el (prettify-symbols--post-command-hook):
    Re-apply prettification to previous symbol also when unprettifying next
    one.
---
 lisp/progmodes/prog-mode.el |   32 +++++++++++++++++---------------
 1 files changed, 17 insertions(+), 15 deletions(-)

diff --git a/lisp/progmodes/prog-mode.el b/lisp/progmodes/prog-mode.el
index 90c496f..6696356 100644
--- a/lisp/progmodes/prog-mode.el
+++ b/lisp/progmodes/prog-mode.el
@@ -209,21 +209,23 @@ on the symbol."
                              (when (and (eq 
prettify-symbols-unprettify-at-point 'right-edge)
                                         (not (bobp)))
                                (get-text-property (1- (point)) prop))))))
-    (if-let ((c (get-prop-as-list 'composition))
-             (s (get-prop-as-list 'prettify-symbols-start))
-             (e (get-prop-as-list 'prettify-symbols-end))
-             (s (apply #'min s))
-             (e (apply #'max e)))
-        (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
-                 (or (< (point) (car prettify-symbols--current-symbol-bounds))
-                     (> (point) (cadr prettify-symbols--current-symbol-bounds))
-                     (and (not (eq prettify-symbols-unprettify-at-point 
'right-edge))
-                          (= (point) (cadr 
prettify-symbols--current-symbol-bounds)))))
-        (apply #'font-lock-flush prettify-symbols--current-symbol-bounds)
-        (setq prettify-symbols--current-symbol-bounds nil)))))
+    ;; Re-apply prettification to the previous symbol.
+    (when (and prettify-symbols--current-symbol-bounds
+              (or (< (point) (car prettify-symbols--current-symbol-bounds))
+                  (> (point) (cadr prettify-symbols--current-symbol-bounds))
+                  (and (not (eq prettify-symbols-unprettify-at-point 
'right-edge))
+                       (= (point) (cadr 
prettify-symbols--current-symbol-bounds)))))
+      (apply #'font-lock-flush prettify-symbols--current-symbol-bounds)
+      (setq prettify-symbols--current-symbol-bounds nil))
+    ;; Unprettify the current symbol.
+    (when-let ((c (get-prop-as-list 'composition))
+              (s (get-prop-as-list 'prettify-symbols-start))
+              (e (get-prop-as-list 'prettify-symbols-end))
+              (s (apply #'min s))
+              (e (apply #'max e)))
+      (with-silent-modifications
+       (setq prettify-symbols--current-symbol-bounds (list s e))
+       (remove-text-properties s e '(composition))))))
 
 ;;;###autoload
 (define-minor-mode prettify-symbols-mode



reply via email to

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