]> git.eshelyaron.com Git - emacs.git/commitdiff
Un- and re-prettification are not exclusive
authorTassilo Horn <tsdh@gnu.org>
Thu, 1 Oct 2015 06:07:40 +0000 (08:07 +0200)
committerTassilo Horn <tsdh@gnu.org>
Thu, 1 Oct 2015 06:07:40 +0000 (08:07 +0200)
* 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

index 90c496f7a3a0cd10996129807171243455316e55..6696356a2dc853d95eb39e98b5fe945b9bc00655 100644 (file)
@@ -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