From: Stefan Monnier Date: Thu, 3 Aug 2006 03:35:45 +0000 (+0000) Subject: (jit-lock-fontify-now): Preserve the buffer's X-Git-Tag: emacs-pretest-22.0.90~1131 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=6b2fcbb546b8b69b2eef40c5042439d3f822bec7;p=emacs.git (jit-lock-fontify-now): Preserve the buffer's modification status when forcing the second redisplay. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index dc624acb0be..a92c989b9b5 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2006-08-02 Stefan Monnier + + * jit-lock.el (jit-lock-fontify-now): Preserve the buffer's + modification status when forcing the second redisplay. + 2006-08-03 Kim F. Storm * edmacro.el (edmacro-fix-menu-commands): Ignore switch-frame. diff --git a/lisp/jit-lock.el b/lisp/jit-lock.el index 7077d7880eb..4d7afe8c33f 100644 --- a/lisp/jit-lock.el +++ b/lisp/jit-lock.el @@ -31,6 +31,8 @@ (eval-when-compile + (require 'cl) + (defmacro with-buffer-unmodified (&rest body) "Eval BODY, preserving the current buffer's modified state." (declare (debug t)) @@ -384,10 +386,14 @@ Defaults to the whole buffer. END can be out of bounds." ;; eagerly extend the refontified region with ;; jit-lock-after-change-extend-region-functions. (when (< start orig-start) - (run-with-timer - 0 nil `(lambda () - (put-text-property ',start ',orig-start - 'fontified t ',(current-buffer))))) + (lexical-let ((start start) + (orig-start orig-start) + (buf (current-buffer))) + (run-with-timer + 0 nil (lambda () + (with-buffer-prepared-for-jit-lock + (put-text-property start orig-start + 'fontified t buf)))))) ;; Find the start of the next chunk, if any. (setq start (text-property-any next end 'fontified nil))))))))