]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix debbugs#20240 part two (jit-lock error during `comment-dwim').
authorAlan Mackenzie <acm@muc.de>
Sat, 4 Apr 2015 10:26:31 +0000 (10:26 +0000)
committerAlan Mackenzie <acm@muc.de>
Sat, 4 Apr 2015 10:32:23 +0000 (10:32 +0000)
jit-lock.el (jit-lock-after-change): Widen the buffer before
putting 'fontified text properties.

lisp/ChangeLog
lisp/jit-lock.el

index 5757317f5e28e057b1d3b773152fa3823189a7ee..cab6abac6158d4f8af3571b884df642aa1ad9f45 100644 (file)
@@ -1,3 +1,10 @@
+2015-04-04  Alan Mackenzie  <acm@muc.de>
+
+       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.
+
 2015-04-03  Michael Albinus  <michael.albinus@gmx.de>
 
        * net/tramp-cache.el (tramp-flush-file-property)
index 0faabeb879ad44145fb75ef9c3ee3991663880a2..d5651c62811471498077ff6a2b60d51ec05ea54f 100644 (file)
@@ -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