aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorStefan Monnier2013-01-30 12:03:44 -0500
committerStefan Monnier2013-01-30 12:03:44 -0500
commit1d4e72256b0e35046a70f561a2da3169872feeb1 (patch)
tree6f0d47b3eea2cbb1607c97e8c8e4b72d6f06a610 /lisp
parent7c3fb76fc9b1ef672911c3385590fe620cae67e9 (diff)
downloademacs-1d4e72256b0e35046a70f561a2da3169872feeb1.tar.gz
emacs-1d4e72256b0e35046a70f561a2da3169872feeb1.zip
* 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. Fixes: debbugs:13542
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog21
-rw-r--r--lisp/jit-lock.el84
2 files changed, 54 insertions, 51 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 997b0067d74..868f6cf6fad 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
12013-01-30 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * jit-lock.el (jit-lock-stealth-chunk-start): Don't widen (bug#13542).
4 (jit-lock-mode, jit-lock-functions, jit-lock-context-unfontify-pos):
5 Use defvar-local.
6 (jit-lock-register): Use setq-local.
7
12013-01-30 Jay Belanger <jay.p.belanger@gmail.com> 82013-01-30 Jay Belanger <jay.p.belanger@gmail.com>
2 9
3 * calc-units.el (math-default-units-table): Remove initial value. 10 * calc-units.el (math-default-units-table): Remove initial value.
@@ -19,8 +26,8 @@
19 26
202013-01-30 Fabián Ezequiel Gallina <fgallina@cuca> 272013-01-30 Fabián Ezequiel Gallina <fgallina@cuca>
21 28
22 * progmodes/python.el (python-shell-parse-command): Find 29 * progmodes/python.el (python-shell-parse-command):
23 python-shell-interpreter with modified environment. 30 Find python-shell-interpreter with modified environment.
24 31
252013-01-30 Stefan Monnier <monnier@iro.umontreal.ca> 322013-01-30 Stefan Monnier <monnier@iro.umontreal.ca>
26 33
@@ -30,7 +37,7 @@
30 37
31 Amend to fontify /regexp/s in actions correctly. 38 Amend to fontify /regexp/s in actions correctly.
32 * cc-awk.el (c-awk-harmless-char-re, c-awk-harmless-string*-re): 39 * cc-awk.el (c-awk-harmless-char-re, c-awk-harmless-string*-re):
33 (c-awk-harmless-string*-here-re): braces, parens and semicolons 40 (c-awk-harmless-string*-here-re): Braces, parens and semicolons
34 are no longer included. 41 are no longer included.
35 (c-awk-harmless-line-char-re, c-awk-harmless-line-string*-re): 42 (c-awk-harmless-line-char-re, c-awk-harmless-line-string*-re):
36 What used to be these variables without "-line" in the name. 43 What used to be these variables without "-line" in the name.
@@ -47,13 +54,13 @@
47 54
482013-01-29 Michael Albinus <michael.albinus@gmx.de> 552013-01-29 Michael Albinus <michael.albinus@gmx.de>
49 56
50 * autorevert.el (auto-revert-use-notify): Use 57 * autorevert.el (auto-revert-use-notify):
51 `custom-initialize-default' for initialization. (Bug#13583) 58 Use `custom-initialize-default' for initialization. (Bug#13583)
52 59
53 * net/ange-ftp.el (ange-ftp-skip-msgs): Add another message. 60 * net/ange-ftp.el (ange-ftp-skip-msgs): Add another message.
54 61
55 * net/tramp-sh.el (tramp-sh-handle-start-file-process): Catch 62 * net/tramp-sh.el (tramp-sh-handle-start-file-process):
56 `suppress'. Otherwise, `tramp-run-real-handler' might be called 63 Catch `suppress'. Otherwise, `tramp-run-real-handler' might be called
57 in `tramp-file-name-handler'. 64 in `tramp-file-name-handler'.
58 (tramp-gw-tunnel-method, tramp-gw-socks-method): Declare for 65 (tramp-gw-tunnel-method, tramp-gw-socks-method): Declare for
59 compatibility. 66 compatibility.
diff --git a/lisp/jit-lock.el b/lisp/jit-lock.el
index 668f1ec963a..d879735c344 100644
--- a/lisp/jit-lock.el
+++ b/lisp/jit-lock.el
@@ -132,20 +132,16 @@ If nil, fontification is not deferred."
132 132
133;;; Variables that are not customizable. 133;;; Variables that are not customizable.
134 134
135(defvar jit-lock-mode nil 135(defvar-local jit-lock-mode nil
136 "Non-nil means Just-in-time Lock mode is active.") 136 "Non-nil means Just-in-time Lock mode is active.")
137(make-variable-buffer-local 'jit-lock-mode)
138 137
139(defvar jit-lock-functions nil 138(defvar-local jit-lock-functions nil
140 "Functions to do the actual fontification. 139 "Functions to do the actual fontification.
141They are called with two arguments: the START and END of the region to fontify.") 140They are called with two arguments: the START and END of the region to fontify.")
142(make-variable-buffer-local 'jit-lock-functions)
143 141
144(defvar jit-lock-context-unfontify-pos nil 142(defvar-local jit-lock-context-unfontify-pos nil
145 "Consider text after this position as contextually unfontified. 143 "Consider text after this position as contextually unfontified.
146If nil, contextual fontification is disabled.") 144If nil, contextual fontification is disabled.")
147(make-variable-buffer-local 'jit-lock-context-unfontify-pos)
148
149 145
150(defvar jit-lock-stealth-timer nil 146(defvar jit-lock-stealth-timer nil
151 "Timer for stealth fontification in Just-in-time Lock mode.") 147 "Timer for stealth fontification in Just-in-time Lock mode.")
@@ -305,7 +301,7 @@ that needs to be (re)fontified.
305If non-nil, CONTEXTUAL means that a contextual fontification would be useful." 301If non-nil, CONTEXTUAL means that a contextual fontification would be useful."
306 (add-hook 'jit-lock-functions fun nil t) 302 (add-hook 'jit-lock-functions fun nil t)
307 (when (and contextual jit-lock-contextually) 303 (when (and contextual jit-lock-contextually)
308 (set (make-local-variable 'jit-lock-contextually) t)) 304 (setq-local jit-lock-contextually t))
309 (jit-lock-mode t)) 305 (jit-lock-mode t))
310 306
311(defun jit-lock-unregister (fun) 307(defun jit-lock-unregister (fun)
@@ -439,41 +435,39 @@ Defaults to the whole buffer. END can be out of bounds."
439Value is nil if there is nothing more to fontify." 435Value is nil if there is nothing more to fontify."
440 (if (zerop (buffer-size)) 436 (if (zerop (buffer-size))
441 nil 437 nil
442 (save-restriction 438 (let* ((next (text-property-not-all around (point-max) 'fontified t))
443 (widen) 439 (prev (previous-single-property-change around 'fontified))
444 (let* ((next (text-property-not-all around (point-max) 'fontified t)) 440 (prop (get-text-property (max (point-min) (1- around))
445 (prev (previous-single-property-change around 'fontified)) 441 'fontified))
446 (prop (get-text-property (max (point-min) (1- around)) 442 (start (cond
447 'fontified)) 443 ((null prev)
448 (start (cond 444 ;; There is no property change between AROUND
449 ((null prev) 445 ;; and the start of the buffer. If PROP is
450 ;; There is no property change between AROUND 446 ;; non-nil, everything in front of AROUND is
451 ;; and the start of the buffer. If PROP is 447 ;; fontified, otherwise nothing is fontified.
452 ;; non-nil, everything in front of AROUND is 448 (if (eq prop t)
453 ;; fontified, otherwise nothing is fontified. 449 nil
454 (if (eq prop t) 450 (max (point-min)
455 nil 451 (- around (/ jit-lock-chunk-size 2)))))
456 (max (point-min) 452 ((eq prop t)
457 (- around (/ jit-lock-chunk-size 2))))) 453 ;; PREV is the start of a region of fontified
458 ((eq prop t) 454 ;; text containing AROUND. Start fontifying a
459 ;; PREV is the start of a region of fontified 455 ;; chunk size before the end of the unfontified
460 ;; text containing AROUND. Start fontifying a 456 ;; region in front of that.
461 ;; chunk size before the end of the unfontified 457 (max (or (previous-single-property-change prev 'fontified)
462 ;; region in front of that. 458 (point-min))
463 (max (or (previous-single-property-change prev 'fontified) 459 (- prev jit-lock-chunk-size)))
464 (point-min)) 460 (t
465 (- prev jit-lock-chunk-size))) 461 ;; PREV is the start of a region of unfontified
466 (t 462 ;; text containing AROUND. Start at PREV or
467 ;; PREV is the start of a region of unfontified 463 ;; chunk size in front of AROUND, whichever is
468 ;; text containing AROUND. Start at PREV or 464 ;; nearer.
469 ;; chunk size in front of AROUND, whichever is 465 (max prev (- around jit-lock-chunk-size)))))
470 ;; nearer. 466 (result (cond ((null start) next)
471 (max prev (- around jit-lock-chunk-size))))) 467 ((null next) start)
472 (result (cond ((null start) next) 468 ((< (- around start) (- next around)) start)
473 ((null next) start) 469 (t next))))
474 ((< (- around start) (- next around)) start) 470 result)))
475 (t next))))
476 result))))
477 471
478(defun jit-lock-stealth-fontify (&optional repeat) 472(defun jit-lock-stealth-fontify (&optional repeat)
479 "Fontify buffers stealthily. 473 "Fontify buffers stealthily.
@@ -564,7 +558,9 @@ non-nil in a repeated invocation of this function."
564 (when jit-lock-context-unfontify-pos 558 (when jit-lock-context-unfontify-pos
565 ;; (message "Jit-Context %s" (buffer-name)) 559 ;; (message "Jit-Context %s" (buffer-name))
566 (save-restriction 560 (save-restriction
567 (widen) 561 ;; Don't be blindsided by narrowing that starts in the middle
562 ;; of a jit-lock-defer-multiline.
563 (widen)
568 (when (and (>= jit-lock-context-unfontify-pos (point-min)) 564 (when (and (>= jit-lock-context-unfontify-pos (point-min))
569 (< jit-lock-context-unfontify-pos (point-max))) 565 (< jit-lock-context-unfontify-pos (point-max)))
570 ;; If we're in text that matches a complex multi-line 566 ;; If we're in text that matches a complex multi-line