# HG changeset patch # User Richard M. Stallman # Date 1110133896 0 # Node ID f31205c87d5e6a4c603bdd8631f869d1ec2449ef # Parent 7da5648c2f7d22b41a1f0010836765ac657e36e8 (jit-lock-stealth-fontify): When calling sit-for, make sure the current buffer is the expected one. diff -r 7da5648c2f7d -r f31205c87d5e lisp/jit-lock.el --- a/lisp/jit-lock.el Sun Mar 06 18:29:10 2005 +0000 +++ b/lisp/jit-lock.el Sun Mar 06 18:31:36 2005 +0000 @@ -415,6 +415,7 @@ (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 @@ (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 @@ ;; 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))))))))))))))