emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r112357: * lisp/jit-lock.el: Fix sign


From: Stefan Monnier
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r112357: * lisp/jit-lock.el: Fix signals in jit-lock-force-redisplay.
Date: Tue, 23 Apr 2013 08:29:14 -0400
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 112357
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Tue 2013-04-23 08:29:14 -0400
message:
  * 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.
modified:
  lisp/ChangeLog
  lisp/jit-lock.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-04-23 12:27:06 +0000
+++ b/lisp/ChangeLog    2013-04-23 12:29:14 +0000
@@ -1,3 +1,11 @@
+2013-04-23  Stefan Monnier  <address@hidden>
+
+       * 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.
+
 2013-04-22  Stefan Monnier  <address@hidden>
 
        * minibuffer.el (minibuffer-completion-contents): Fix obsolescence info

=== modified file 'lisp/jit-lock.el'
--- a/lisp/jit-lock.el  2013-01-30 17:03:44 +0000
+++ b/lisp/jit-lock.el  2013-04-23 12:29:14 +0000
@@ -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 @@
            ;; 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.
 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]