aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorTassilo Horn2015-09-30 20:15:22 +0200
committerTassilo Horn2015-09-30 20:15:22 +0200
commit82df1878e6559188e688195f992fff10f35035e8 (patch)
tree9c5146d06a3d58aabe82d16da06aa24d682309f1 /lisp
parent8b1df960131a173779e88df605a21ebc0443634a (diff)
downloademacs-82df1878e6559188e688195f992fff10f35035e8.tar.gz
emacs-82df1878e6559188e688195f992fff10f35035e8.zip
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.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/progmodes/prog-mode.el9
1 files 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."
165 (if (and (not (equal prettify-symbols--current-symbol-bounds (list start end))) 165 (if (and (not (equal prettify-symbols--current-symbol-bounds (list start end)))
166 (funcall prettify-symbols-compose-predicate start end match)) 166 (funcall prettify-symbols-compose-predicate start end match))
167 ;; That's a symbol alright, so add the composition. 167 ;; That's a symbol alright, so add the composition.
168 (progn 168 (with-silent-modifications
169 (compose-region start end (cdr (assoc match alist))) 169 (compose-region start end (cdr (assoc match alist)))
170 (add-text-properties 170 (add-text-properties
171 start end 171 start end
@@ -193,7 +193,7 @@ Regexp match data 0 points to the chars."
193 (if-let ((c (get-text-property (point) 'composition)) 193 (if-let ((c (get-text-property (point) 'composition))
194 (s (get-text-property (point) 'prettify-symbols-start)) 194 (s (get-text-property (point) 'prettify-symbols-start))
195 (e (get-text-property (point) 'prettify-symbols-end))) 195 (e (get-text-property (point) 'prettify-symbols-end)))
196 (progn 196 (with-silent-modifications
197 (setq prettify-symbols--current-symbol-bounds (list s e)) 197 (setq prettify-symbols--current-symbol-bounds (list s e))
198 (remove-text-properties s e '(composition))) 198 (remove-text-properties s e '(composition)))
199 (when (and prettify-symbols--current-symbol-bounds 199 (when (and prettify-symbols--current-symbol-bounds
@@ -236,7 +236,10 @@ support it."
236 (when (setq prettify-symbols--keywords (prettify-symbols--make-keywords)) 236 (when (setq prettify-symbols--keywords (prettify-symbols--make-keywords))
237 (font-lock-add-keywords nil prettify-symbols--keywords) 237 (font-lock-add-keywords nil prettify-symbols--keywords)
238 (setq-local font-lock-extra-managed-props 238 (setq-local font-lock-extra-managed-props
239 (cons 'composition font-lock-extra-managed-props)) 239 (append font-lock-extra-managed-props
240 '(composition
241 prettify-symbols-start
242 prettify-symbols-end)))
240 (when prettify-symbols-unprettify-at-point 243 (when prettify-symbols-unprettify-at-point
241 (add-hook 'post-command-hook 244 (add-hook 'post-command-hook
242 #'prettify-symbols--post-command-hook nil t)) 245 #'prettify-symbols--post-command-hook nil t))