X-Git-Url: http://git.hcoop.net/bpt/emacs.git/blobdiff_plain/bba90ab24e80476efcad6b6a770fd5fda522a621..2200a8c91de23f9749d1b3c961c4f8bb3145ddfa:/lisp/jit-lock.el diff --git a/lisp/jit-lock.el b/lisp/jit-lock.el index d879735c34..d0e88309da 100644 --- a/lisp/jit-lock.el +++ b/lisp/jit-lock.el @@ -1,4 +1,4 @@ -;;; jit-lock.el --- just-in-time fontification +;;; jit-lock.el --- just-in-time fontification -*- lexical-binding: t -*- ;; Copyright (C) 1998, 2000-2013 Free Software Foundation, Inc. @@ -258,7 +258,7 @@ the variable `jit-lock-stealth-nice'." When this minor mode is enabled, jit-lock runs as little code as possible during redisplay and moves the rest to a timer, where things like `debug-on-error' and Edebug can be used." - :global t + :global t :group 'jit-lock (when jit-lock-defer-timer (cancel-timer jit-lock-defer-timer) (setq jit-lock-defer-timer nil)) @@ -412,21 +412,24 @@ 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 'jit-lock-force-redisplay - (current-buffer) start orig-start)) + (run-with-timer 0 nil #'jit-lock-force-redisplay + (copy-marker start) (copy-marker orig-start))) ;; Find the start of the next chunk, if any. (setq start (text-property-any next end 'fontified nil)))))))) -(defun jit-lock-force-redisplay (buf start end) +(defun jit-lock-force-redisplay (start end) "Force the display engine to re-render buffer BUF from START to END." - (with-current-buffer buf - (with-buffer-prepared-for-jit-lock - ;; Don't cause refontification (it's already been done), but just do - ;; some random buffer change, so as to force redisplay. - (put-text-property start end 'fontified t)))) - - + (when (marker-buffer start) + (with-current-buffer (marker-buffer start) + (with-buffer-prepared-for-jit-lock + (when (> end (point-max)) + (setq end (point-max) start (min start end))) + (when (< start (point-min)) + (setq start (point-min) end (max start end))) + ;; Don't cause refontification (it's already been done), but just do + ;; some random buffer change, so as to force redisplay. + (put-text-property start end 'fontified t))))) ;;; Stealth fontification. @@ -479,7 +482,7 @@ non-nil in a repeated invocation of this function." (cancel-timer jit-lock-stealth-repeat-timer)) (unless (or executing-kbd-macro memory-full - (window-minibuffer-p (selected-window)) + (window-minibuffer-p) ;; For first invocation set up `jit-lock-stealth-buffers'. ;; In repeated invocations it's already been set up. (null (if repeat