emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 4fabcbf: Fix debbugs#20240 part two (jit-lock error


From: Alan Mackenzie
Subject: [Emacs-diffs] master 4fabcbf: Fix debbugs#20240 part two (jit-lock error during `comment-dwim').
Date: Sat, 04 Apr 2015 10:33:28 +0000

branch: master
commit 4fabcbfbcd8447351ae59b01b329a0dabebea872
Author: Alan Mackenzie <address@hidden>
Commit: Alan Mackenzie <address@hidden>

    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.
---
 lisp/ChangeLog   |    7 +++++++
 lisp/jit-lock.el |   14 ++++++++------
 2 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 5757317..cab6aba 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
+2015-04-04  Alan Mackenzie  <address@hidden>
+
+       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  <address@hidden>
 
        * net/tramp-cache.el (tramp-flush-file-property)
diff --git a/lisp/jit-lock.el b/lisp/jit-lock.el
index 0faabeb..d5651c6 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]