summaryrefslogtreecommitdiff
path: root/lisp/jit-lock.el
diff options
context:
space:
mode:
authorAlan Mackenzie <acm@muc.de>2015-04-04 10:26:31 +0000
committerAlan Mackenzie <acm@muc.de>2015-04-04 10:32:23 +0000
commit4fabcbfbcd8447351ae59b01b329a0dabebea872 (patch)
treefe825494bd6f5a9b1db57b864cd64d822784474f /lisp/jit-lock.el
parent4de97eafb36a155e520c27e2dee7e068e52f099b (diff)
downloademacs-4fabcbfbcd8447351ae59b01b329a0dabebea872.tar.gz
Fix debbugs#20240 part two (jit-lock error during `comment-dwim').
jit-lock.el (jit-lock-after-change): Widen the buffer before putting 'fontified text properties.
Diffstat (limited to 'lisp/jit-lock.el')
-rw-r--r--lisp/jit-lock.el14
1 files changed, 8 insertions, 6 deletions
diff --git a/lisp/jit-lock.el b/lisp/jit-lock.el
index 0faabeb879a..d5651c62811 100644
--- a/lisp/jit-lock.el
+++ b/lisp/jit-lock.el
@@ -650,12 +650,14 @@ will take place when text is fontified stealthily."
(let ((jit-lock-start start)
(jit-lock-end end))
(with-buffer-prepared-for-jit-lock
- (run-hook-with-args 'jit-lock-after-change-extend-region-functions
- start end old-len)
- ;; Make sure we change at least one char (in case of deletions).
- (setq jit-lock-end (min (max jit-lock-end (1+ start)) (point-max)))
- ;; Request refontification.
- (put-text-property jit-lock-start jit-lock-end 'fontified nil))
+ (save-restriction
+ (widen)
+ (run-hook-with-args 'jit-lock-after-change-extend-region-functions
+ start end old-len)
+ ;; Make sure we change at least one char (in case of deletions).
+ (setq jit-lock-end (min (max jit-lock-end (1+ start)) (point-max)))
+ ;; Request refontification.
+ (put-text-property jit-lock-start jit-lock-end 'fontified nil)))
;; Mark the change for deferred contextual refontification.
(when jit-lock-context-unfontify-pos
(setq jit-lock-context-unfontify-pos