# HG changeset patch # User Stefan Monnier # Date 1159284934 0 # Node ID 365ddb09e33998ec12e97648bd91a4b7a320ce8c # Parent b7b3deb46c6af821ac801205c03784d3f3b0a0c3 (jit-lock-fontify-now): Don't fontify the empty text. (jit-lock-fontify-again): Don't refontify text that's not displayed. diff -r b7b3deb46c6a -r 365ddb09e339 lisp/ChangeLog --- a/lisp/ChangeLog Tue Sep 26 08:49:05 2006 +0000 +++ b/lisp/ChangeLog Tue Sep 26 15:35:34 2006 +0000 @@ -1,3 +1,8 @@ +2006-09-26 Stefan Monnier + + * jit-lock.el (jit-lock-fontify-now): Don't fontify the empty text. + (jit-lock-fontify-again): Don't refontify text that's not displayed. + 2006-09-26 Kenichi Handa * startup.el (display-splash-screen): Allow a prefix argument. diff -r b7b3deb46c6a -r 365ddb09e339 lisp/jit-lock.el --- a/lisp/jit-lock.el Tue Sep 26 08:49:05 2006 +0000 +++ b/lisp/jit-lock.el Tue Sep 26 15:35:34 2006 +0000 @@ -349,7 +349,7 @@ ;; Fontify chunks beginning at START. The end of a ;; chunk is either `end', or the start of a region ;; before `end' that has already been fontified. - (while start + (while (and start (< start end)) ;; Determine the end of this chunk. (setq next (or (text-property-any start end 'fontified t) end)) @@ -405,9 +405,11 @@ (defun jit-lock-fontify-again (buf start end) "Fontify in buffer BUF from START to END." - (with-current-buffer buf - (with-buffer-prepared-for-jit-lock - (put-text-property start end 'fontified t)))) + ;; Don't bother refontifying text that's not even displayed. + (when (setq start (text-property-not-all start end 'fontified nil buf)) + (with-current-buffer buf + (with-buffer-prepared-for-jit-lock + (put-text-property start end 'fontified nil)))))