emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r111628: * lisp/jit-lock.el (jit-lock


From: Stefan Monnier
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r111628: * lisp/jit-lock.el (jit-lock-stealth-chunk-start): Don't widen.
Date: Wed, 30 Jan 2013 12:03:44 -0500
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 111628
fixes bug: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=13542
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Wed 2013-01-30 12:03:44 -0500
message:
  * lisp/jit-lock.el (jit-lock-stealth-chunk-start): Don't widen.
  (jit-lock-mode, jit-lock-functions, jit-lock-context-unfontify-pos):
  Use defvar-local.
  (jit-lock-register): Use setq-local.
modified:
  lisp/ChangeLog
  lisp/jit-lock.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-01-30 14:14:27 +0000
+++ b/lisp/ChangeLog    2013-01-30 17:03:44 +0000
@@ -1,3 +1,10 @@
+2013-01-30  Stefan Monnier  <address@hidden>
+
+       * jit-lock.el (jit-lock-stealth-chunk-start): Don't widen (bug#13542).
+       (jit-lock-mode, jit-lock-functions, jit-lock-context-unfontify-pos):
+       Use defvar-local.
+       (jit-lock-register): Use setq-local.
+
 2013-01-30  Jay Belanger  <address@hidden>
 
        * calc-units.el (math-default-units-table): Remove initial value.
@@ -19,8 +26,8 @@
 
 2013-01-30  Fabián Ezequiel Gallina  <address@hidden>
 
-       * progmodes/python.el (python-shell-parse-command): Find
-       python-shell-interpreter with modified environment.
+       * progmodes/python.el (python-shell-parse-command):
+       Find python-shell-interpreter with modified environment.
 
 2013-01-30  Stefan Monnier  <address@hidden>
 
@@ -30,7 +37,7 @@
 
        Amend to fontify /regexp/s in actions correctly.
        * cc-awk.el (c-awk-harmless-char-re, c-awk-harmless-string*-re):
-       (c-awk-harmless-string*-here-re): braces, parens and semicolons
+       (c-awk-harmless-string*-here-re): Braces, parens and semicolons
        are no longer included.
        (c-awk-harmless-line-char-re, c-awk-harmless-line-string*-re):
        What used to be these variables without "-line" in the name.
@@ -47,13 +54,13 @@
 
 2013-01-29  Michael Albinus  <address@hidden>
 
-       * autorevert.el (auto-revert-use-notify): Use
-       `custom-initialize-default' for initialization.  (Bug#13583)
+       * autorevert.el (auto-revert-use-notify):
+       Use `custom-initialize-default' for initialization.  (Bug#13583)
 
        * net/ange-ftp.el (ange-ftp-skip-msgs): Add another message.
 
-       * net/tramp-sh.el (tramp-sh-handle-start-file-process): Catch
-       `suppress'.  Otherwise, `tramp-run-real-handler' might be called
+       * net/tramp-sh.el (tramp-sh-handle-start-file-process):
+       Catch `suppress'.  Otherwise, `tramp-run-real-handler' might be called
        in `tramp-file-name-handler'.
        (tramp-gw-tunnel-method, tramp-gw-socks-method): Declare for
        compatibility.

=== modified file 'lisp/jit-lock.el'
--- a/lisp/jit-lock.el  2013-01-13 01:23:48 +0000
+++ b/lisp/jit-lock.el  2013-01-30 17:03:44 +0000
@@ -132,20 +132,16 @@
 
 ;;; Variables that are not customizable.
 
-(defvar jit-lock-mode nil
+(defvar-local jit-lock-mode nil
   "Non-nil means Just-in-time Lock mode is active.")
-(make-variable-buffer-local 'jit-lock-mode)
 
-(defvar jit-lock-functions nil
+(defvar-local jit-lock-functions nil
   "Functions to do the actual fontification.
 They are called with two arguments: the START and END of the region to 
fontify.")
-(make-variable-buffer-local 'jit-lock-functions)
 
-(defvar jit-lock-context-unfontify-pos nil
+(defvar-local jit-lock-context-unfontify-pos nil
   "Consider text after this position as contextually unfontified.
 If nil, contextual fontification is disabled.")
-(make-variable-buffer-local 'jit-lock-context-unfontify-pos)
-
 
 (defvar jit-lock-stealth-timer nil
   "Timer for stealth fontification in Just-in-time Lock mode.")
@@ -305,7 +301,7 @@
 If non-nil, CONTEXTUAL means that a contextual fontification would be useful."
   (add-hook 'jit-lock-functions fun nil t)
   (when (and contextual jit-lock-contextually)
-    (set (make-local-variable 'jit-lock-contextually) t))
+    (setq-local jit-lock-contextually t))
   (jit-lock-mode t))
 
 (defun jit-lock-unregister (fun)
@@ -439,41 +435,39 @@
 Value is nil if there is nothing more to fontify."
   (if (zerop (buffer-size))
       nil
-    (save-restriction
-      (widen)
-      (let* ((next (text-property-not-all around (point-max) 'fontified t))
-            (prev (previous-single-property-change around 'fontified))
-            (prop (get-text-property (max (point-min) (1- around))
-                                     'fontified))
-            (start (cond
-                    ((null prev)
-                     ;; There is no property change between AROUND
-                     ;; and the start of the buffer.  If PROP is
-                     ;; non-nil, everything in front of AROUND is
-                     ;; fontified, otherwise nothing is fontified.
-                     (if (eq prop t)
-                         nil
-                       (max (point-min)
-                            (- around (/ jit-lock-chunk-size 2)))))
-                    ((eq prop t)
-                     ;; PREV is the start of a region of fontified
-                     ;; text containing AROUND.  Start fontifying a
-                     ;; chunk size before the end of the unfontified
-                     ;; region in front of that.
-                     (max (or (previous-single-property-change prev 'fontified)
-                              (point-min))
-                          (- prev jit-lock-chunk-size)))
-                    (t
-                     ;; PREV is the start of a region of unfontified
-                     ;; text containing AROUND.  Start at PREV or
-                     ;; chunk size in front of AROUND, whichever is
-                     ;; nearer.
-                     (max prev (- around jit-lock-chunk-size)))))
-            (result (cond ((null start) next)
-                          ((null next) start)
-                          ((< (- around start) (- next around)) start)
-                          (t next))))
-       result))))
+    (let* ((next (text-property-not-all around (point-max) 'fontified t))
+           (prev (previous-single-property-change around 'fontified))
+           (prop (get-text-property (max (point-min) (1- around))
+                                    'fontified))
+           (start (cond
+                   ((null prev)
+                    ;; There is no property change between AROUND
+                    ;; and the start of the buffer.  If PROP is
+                    ;; non-nil, everything in front of AROUND is
+                    ;; fontified, otherwise nothing is fontified.
+                    (if (eq prop t)
+                        nil
+                      (max (point-min)
+                           (- around (/ jit-lock-chunk-size 2)))))
+                   ((eq prop t)
+                    ;; PREV is the start of a region of fontified
+                    ;; text containing AROUND.  Start fontifying a
+                    ;; chunk size before the end of the unfontified
+                    ;; region in front of that.
+                    (max (or (previous-single-property-change prev 'fontified)
+                             (point-min))
+                         (- prev jit-lock-chunk-size)))
+                   (t
+                    ;; PREV is the start of a region of unfontified
+                    ;; text containing AROUND.  Start at PREV or
+                    ;; chunk size in front of AROUND, whichever is
+                    ;; nearer.
+                    (max prev (- around jit-lock-chunk-size)))))
+           (result (cond ((null start) next)
+                         ((null next) start)
+                         ((< (- around start) (- next around)) start)
+                         (t next))))
+      result)))
 
 (defun jit-lock-stealth-fontify (&optional repeat)
   "Fontify buffers stealthily.
@@ -564,7 +558,9 @@
        (when jit-lock-context-unfontify-pos
          ;; (message "Jit-Context %s" (buffer-name))
          (save-restriction
-           (widen)
+            ;; Don't be blindsided by narrowing that starts in the middle
+            ;; of a jit-lock-defer-multiline.
+           (widen) 
            (when (and (>= jit-lock-context-unfontify-pos (point-min))
                       (< jit-lock-context-unfontify-pos (point-max)))
              ;; If we're in text that matches a complex multi-line


reply via email to

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