diff options
| author | Stefan Monnier | 2013-04-23 08:29:14 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2013-04-23 08:29:14 -0400 |
| commit | 117f94cf109728a2e6f1d506041a741481eeedff (patch) | |
| tree | c74fe2f2df96446d9ffc8329bd1060decdf44fd8 | |
| parent | 1d829c64d28693a09ca6ec7ddc188c6ae7ba0df0 (diff) | |
| download | emacs-117f94cf109728a2e6f1d506041a741481eeedff.tar.gz emacs-117f94cf109728a2e6f1d506041a741481eeedff.zip | |
* 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.
| -rw-r--r-- | lisp/ChangeLog | 8 | ||||
| -rw-r--r-- | lisp/jit-lock.el | 25 |
2 files changed, 22 insertions, 11 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index f538764f909..4307577950f 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2013-04-23 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * jit-lock.el: Fix signals in jit-lock-force-redisplay. | ||
| 4 | Use lexical-binding. | ||
| 5 | (jit-lock-force-redisplay): Use markers, check buffer's continued | ||
| 6 | existence and beware narrowed buffers. | ||
| 7 | (jit-lock-fontify-now): Adjust call accordingly. | ||
| 8 | |||
| 1 | 2013-04-22 Stefan Monnier <monnier@iro.umontreal.ca> | 9 | 2013-04-22 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 10 | ||
| 3 | * minibuffer.el (minibuffer-completion-contents): Fix obsolescence info | 11 | * minibuffer.el (minibuffer-completion-contents): Fix obsolescence info |
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 @@ | |||
| 1 | ;;; jit-lock.el --- just-in-time fontification | 1 | ;;; jit-lock.el --- just-in-time fontification -*- lexical-binding: t -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1998, 2000-2013 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1998, 2000-2013 Free Software Foundation, Inc. |
| 4 | 4 | ||
| @@ -412,21 +412,24 @@ Defaults to the whole buffer. END can be out of bounds." | |||
| 412 | ;; eagerly extend the refontified region with | 412 | ;; eagerly extend the refontified region with |
| 413 | ;; jit-lock-after-change-extend-region-functions. | 413 | ;; jit-lock-after-change-extend-region-functions. |
| 414 | (when (< start orig-start) | 414 | (when (< start orig-start) |
| 415 | (run-with-timer 0 nil 'jit-lock-force-redisplay | 415 | (run-with-timer 0 nil #'jit-lock-force-redisplay |
| 416 | (current-buffer) start orig-start)) | 416 | (copy-marker start) (copy-marker orig-start))) |
| 417 | 417 | ||
| 418 | ;; Find the start of the next chunk, if any. | 418 | ;; Find the start of the next chunk, if any. |
| 419 | (setq start (text-property-any next end 'fontified nil)))))))) | 419 | (setq start (text-property-any next end 'fontified nil)))))))) |
| 420 | 420 | ||
| 421 | (defun jit-lock-force-redisplay (buf start end) | 421 | (defun jit-lock-force-redisplay (start end) |
| 422 | "Force the display engine to re-render buffer BUF from START to END." | 422 | "Force the display engine to re-render buffer BUF from START to END." |
| 423 | (with-current-buffer buf | 423 | (when (marker-buffer start) |
| 424 | (with-buffer-prepared-for-jit-lock | 424 | (with-current-buffer (marker-buffer start) |
| 425 | ;; Don't cause refontification (it's already been done), but just do | 425 | (with-buffer-prepared-for-jit-lock |
| 426 | ;; some random buffer change, so as to force redisplay. | 426 | (when (> end (point-max)) |
| 427 | (put-text-property start end 'fontified t)))) | 427 | (setq end (point-max) start (min start end))) |
| 428 | 428 | (when (< start (point-min)) | |
| 429 | 429 | (setq start (point-min) end (max start end))) | |
| 430 | ;; Don't cause refontification (it's already been done), but just do | ||
| 431 | ;; some random buffer change, so as to force redisplay. | ||
| 432 | (put-text-property start end 'fontified t))))) | ||
| 430 | 433 | ||
| 431 | ;;; Stealth fontification. | 434 | ;;; Stealth fontification. |
| 432 | 435 | ||