From 82df1878e6559188e688195f992fff10f35035e8 Mon Sep 17 00:00:00 2001 From: Tassilo Horn Date: Wed, 30 Sep 2015 20:15:22 +0200 Subject: [PATCH] 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 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lisp/progmodes/prog-mode.el b/lisp/progmodes/prog-mode.el index b4085093c1b..e092e240627 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)) -- 2.11.4.GIT