aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTassilo Horn2015-10-01 08:07:40 +0200
committerTassilo Horn2015-10-01 08:07:40 +0200
commit9e4a6ad1c77c62e4a7d5b708567e5a1e23b9cdfd (patch)
tree427e68242cf3161430a3fa951d75f15311ef2fb6
parent35ad158f3d4b2481dcf5cca201697b42b1ba563e (diff)
downloademacs-9e4a6ad1c77c62e4a7d5b708567e5a1e23b9cdfd.tar.gz
emacs-9e4a6ad1c77c62e4a7d5b708567e5a1e23b9cdfd.zip
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.
-rw-r--r--lisp/progmodes/prog-mode.el32
1 files changed, 17 insertions, 15 deletions
diff --git a/lisp/progmodes/prog-mode.el b/lisp/progmodes/prog-mode.el
index 90c496f7a3a..6696356a2dc 100644
--- a/lisp/progmodes/prog-mode.el
+++ b/lisp/progmodes/prog-mode.el
@@ -209,21 +209,23 @@ on the symbol."
209 (when (and (eq prettify-symbols-unprettify-at-point 'right-edge) 209 (when (and (eq prettify-symbols-unprettify-at-point 'right-edge)
210 (not (bobp))) 210 (not (bobp)))
211 (get-text-property (1- (point)) prop)))))) 211 (get-text-property (1- (point)) prop))))))
212 (if-let ((c (get-prop-as-list 'composition)) 212 ;; Re-apply prettification to the previous symbol.
213 (s (get-prop-as-list 'prettify-symbols-start)) 213 (when (and prettify-symbols--current-symbol-bounds
214 (e (get-prop-as-list 'prettify-symbols-end)) 214 (or (< (point) (car prettify-symbols--current-symbol-bounds))
215 (s (apply #'min s)) 215 (> (point) (cadr prettify-symbols--current-symbol-bounds))
216 (e (apply #'max e))) 216 (and (not (eq prettify-symbols-unprettify-at-point 'right-edge))
217 (with-silent-modifications 217 (= (point) (cadr prettify-symbols--current-symbol-bounds)))))
218 (setq prettify-symbols--current-symbol-bounds (list s e)) 218 (apply #'font-lock-flush prettify-symbols--current-symbol-bounds)
219 (remove-text-properties s e '(composition))) 219 (setq prettify-symbols--current-symbol-bounds nil))
220 (when (and prettify-symbols--current-symbol-bounds 220 ;; Unprettify the current symbol.
221 (or (< (point) (car prettify-symbols--current-symbol-bounds)) 221 (when-let ((c (get-prop-as-list 'composition))
222 (> (point) (cadr prettify-symbols--current-symbol-bounds)) 222 (s (get-prop-as-list 'prettify-symbols-start))
223 (and (not (eq prettify-symbols-unprettify-at-point 'right-edge)) 223 (e (get-prop-as-list 'prettify-symbols-end))
224 (= (point) (cadr prettify-symbols--current-symbol-bounds))))) 224 (s (apply #'min s))
225 (apply #'font-lock-flush prettify-symbols--current-symbol-bounds) 225 (e (apply #'max e)))
226 (setq prettify-symbols--current-symbol-bounds nil))))) 226 (with-silent-modifications
227 (setq prettify-symbols--current-symbol-bounds (list s e))
228 (remove-text-properties s e '(composition))))))
227 229
228;;;###autoload 230;;;###autoload
229(define-minor-mode prettify-symbols-mode 231(define-minor-mode prettify-symbols-mode