diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2013-04-23 08:29:14 -0400 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2013-04-23 08:29:14 -0400 |
commit | 117f94cf109728a2e6f1d506041a741481eeedff (patch) | |
tree | c74fe2f2df96446d9ffc8329bd1060decdf44fd8 /lisp/jit-lock.el | |
parent | 1d829c64d28693a09ca6ec7ddc188c6ae7ba0df0 (diff) | |
download | emacs-117f94cf109728a2e6f1d506041a741481eeedff.tar.gz |
* lisp/jit-lock.el: Fix signals in jit-lock-force-redisplay.
Use lexical-binding.
(jit-lock-force-redisplay): Use markers, check buffer's continued
existence and beware narrowed buffers.
(jit-lock-fontify-now): Adjust call accordingly.
Diffstat (limited to 'lisp/jit-lock.el')
-rw-r--r-- | lisp/jit-lock.el | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/lisp/jit-lock.el b/lisp/jit-lock.el index d879735c344..9359a65a1b8 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. @@ -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. |