summaryrefslogtreecommitdiff
path: root/lisp/jit-lock.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>2005-03-06 18:31:36 +0000
committerRichard M. Stallman <rms@gnu.org>2005-03-06 18:31:36 +0000
commit2e0a74c6e80eccebf5e4eb326bb490b3d4b9152c (patch)
tree008aa5a1fbbd2099539bc6b365031a83fa7b3c41 /lisp/jit-lock.el
parent72287c23ef993fc3248deba670da1bab4882f3f7 (diff)
downloademacs-2e0a74c6e80eccebf5e4eb326bb490b3d4b9152c.tar.gz
(jit-lock-stealth-fontify): When calling sit-for,
make sure the current buffer is the expected one.
Diffstat (limited to 'lisp/jit-lock.el')
-rw-r--r--lisp/jit-lock.el11
1 files changed, 9 insertions, 2 deletions
diff --git a/lisp/jit-lock.el b/lisp/jit-lock.el
index 43c8457c80b..fe64d871d96 100644
--- a/lisp/jit-lock.el
+++ b/lisp/jit-lock.el
@@ -415,6 +415,7 @@ This functions is called after Emacs has been idle for
(unless (or executing-kbd-macro
(window-minibuffer-p (selected-window)))
(let ((buffers (buffer-list))
+ (outer-buffer (current-buffer))
minibuffer-auto-raise
message-log-max)
(with-local-quit
@@ -449,7 +450,10 @@ This functions is called after Emacs has been idle for
(point (point-min)))
(while (and (setq start
(jit-lock-stealth-chunk-start point))
- (sit-for nice))
+ ;; In case sit-for runs any timers,
+ ;; give them the expected current buffer.
+ (with-current-buffer outer-buffer
+ (sit-for nice)))
;; fontify a block.
(jit-lock-fontify-now start (+ start jit-lock-chunk-size))
@@ -461,7 +465,10 @@ This functions is called after Emacs has been idle for
;; Wait a little if load is too high.
(when (and jit-lock-stealth-load
(> (car (load-average)) jit-lock-stealth-load))
- (sit-for (or jit-lock-stealth-time 30)))))))))))))
+ ;; In case sit-for runs any timers,
+ ;; give them the expected current buffer.
+ (with-current-buffer outer-buffer
+ (sit-for (or jit-lock-stealth-time 30))))))))))))))