Mercurial > emacs
annotate lisp/lazy-lock.el @ 18538:d4c11d4de7f4
(Finsert_file_contents): Doc-string fixed. Call
Ffind_operation_coding_system.
(Fwrite_region): Call Ffind_operation_coding_system.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Wed, 02 Jul 1997 12:53:58 +0000 |
parents | 9e96c09a1466 |
children | dec0f8a4fd02 |
rev | line source |
---|---|
15461 | 1 ;;; lazy-lock.el --- Lazy demand-driven fontification for fast Font Lock mode. |
2 | |
17498 | 3 ;; Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc. |
15461 | 4 |
5 ;; Author: Simon Marshall <simon@gnu.ai.mit.edu> | |
6 ;; Keywords: faces files | |
18464
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
7 ;; Version: 2.08.03 |
15461 | 8 |
9 ;;; This file is part of GNU Emacs. | |
10 | |
11 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
12 ;; it under the terms of the GNU General Public License as published by | |
13 ;; the Free Software Foundation; either version 2, or (at your option) | |
14 ;; any later version. | |
15 | |
16 ;; GNU Emacs is distributed in the hope that it will be useful, | |
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 ;; GNU General Public License for more details. | |
20 | |
21 ;; You should have received a copy of the GNU General Public License | |
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
24 ;; Boston, MA 02111-1307, USA. | |
25 | |
26 ;;; Commentary: | |
27 | |
17498 | 28 ;; Purpose: |
29 ;; | |
16580
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
30 ;; Lazy Lock mode is a Font Lock support mode. |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
31 ;; It makes visiting buffers in Font Lock mode faster by making fontification |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
32 ;; be demand-driven, deferred and stealthy, so that fontification only occurs |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
33 ;; when, and where, necessary. |
15461 | 34 ;; |
35 ;; See caveats and feedback below. | |
36 ;; See also the fast-lock package. (But don't use them at the same time!) | |
37 | |
38 ;; Installation: | |
39 ;; | |
40 ;; Put in your ~/.emacs: | |
41 ;; | |
15499
aa9675ed8ed4
Test for lazy-lock-mode before swapping hooks.
Simon Marshall <simon@gnu.org>
parents:
15461
diff
changeset
|
42 ;; (setq font-lock-support-mode 'lazy-lock-mode) |
15461 | 43 ;; |
44 ;; Start up a new Emacs and use font-lock as usual (except that you can use the | |
45 ;; so-called "gaudier" fontification regexps on big files without frustration). | |
46 ;; | |
47 ;; In a buffer (which has `font-lock-mode' enabled) which is at least | |
48 ;; `lazy-lock-minimum-size' characters long, buffer fontification will not | |
49 ;; occur and only the visible portion of the buffer will be fontified. Motion | |
50 ;; around the buffer will fontify those visible portions not previously | |
51 ;; fontified. If stealth fontification is enabled, buffer fontification will | |
52 ;; occur in invisible parts of the buffer after `lazy-lock-stealth-time' | |
53 ;; seconds of idle time. If on-the-fly fontification is deferred, on-the-fly | |
54 ;; fontification will occur after `lazy-lock-defer-time' seconds of idle time. | |
55 | |
56 ;; User-visible differences with version 1: | |
57 ;; | |
58 ;; - Version 2 can defer on-the-fly fontification. Therefore you need not, and | |
59 ;; should not, use defer-lock.el with this version of lazy-lock.el. | |
60 ;; | |
61 ;; A number of variables have changed meaning: | |
62 ;; | |
63 ;; - A value of nil for the variable `lazy-lock-minimum-size' means never turn | |
64 ;; on demand-driven fontification. In version 1 this meant always turn on | |
65 ;; demand-driven fontification. If you really want demand-driven fontification | |
66 ;; regardless of buffer size, set this variable to 0. | |
67 ;; | |
68 ;; - The variable `lazy-lock-stealth-lines' cannot have a nil value. In | |
69 ;; version 1 this meant use `window-height' as the maximum number of lines to | |
70 ;; fontify as a stealth chunk. This makes no sense; stealth fontification is | |
71 ;; of a buffer, not a window. | |
72 | |
73 ;; Implementation differences with version 1: | |
74 ;; | |
75 ;; - Version 1 of lazy-lock.el is a bit of a hack. Version 1 demand-driven | |
76 ;; fontification, the core feature of lazy-lock.el, is implemented by placing a | |
77 ;; function on `post-command-hook'. This function fontifies where necessary, | |
78 ;; i.e., where a window scroll has occurred. However, there are a number of | |
79 ;; problems with using `post-command-hook': | |
80 ;; | |
81 ;; (a) As the name suggests, `post-command-hook' is run after every command, | |
82 ;; i.e., frequently and regardless of whether scrolling has occurred. | |
83 ;; (b) Scrolling can occur during a command, when `post-command-hook' is not | |
84 ;; run, i.e., it is not necessarily run after scrolling has occurred. | |
85 ;; (c) When `post-command-hook' is run, there is nothing to suggest where | |
86 ;; scrolling might have occurred, i.e., which windows have scrolled. | |
87 ;; | |
88 ;; Thus lazy-lock.el's function is called almost as often as possible, usually | |
89 ;; when it need not be called, yet it is not always called when it is needed. | |
90 ;; Also, lazy-lock.el's function must check each window to see if a scroll has | |
91 ;; occurred there. Worse still, lazy-lock.el's function must fontify a region | |
92 ;; twice as large as necessary to make sure the window is completely fontified. | |
93 ;; Basically, `post-command-hook' is completely inappropriate for lazy-lock.el. | |
94 ;; | |
95 ;; Ideally, we want to attach lazy-lock.el's function to a hook that is run | |
96 ;; only when scrolling occurs, e.g., `window-start' has changed, and tells us | |
97 ;; as much information as we need, i.e., the window and its new buffer region. | |
98 ;; Richard Stallman implemented a `window-scroll-functions' for Emacs 19.30. | |
99 ;; Functions on it are run when `window-start' has changed, and are supplied | |
100 ;; with the window and the window's new `window-start' position. (It would be | |
101 ;; better if it also supplied the window's new `window-end' position, but that | |
102 ;; is calculated as part of the redisplay process, and the functions on | |
103 ;; `window-scroll-functions' are run before redisplay has finished.) Thus, the | |
104 ;; hook deals with the above problems (a), (b) and (c). | |
105 ;; | |
106 ;; If only life was that easy. Version 2 demand-driven fontification is mostly | |
107 ;; implemented by placing a function on `window-scroll-functions'. However, | |
108 ;; not all scrolling occurs when `window-start' has changed. A change in | |
109 ;; window size, e.g., via C-x 1, or a significant deletion, e.g., of a number | |
16580
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
110 ;; of lines, causes text previously invisible (i.e., after `window-end') to |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
111 ;; become visible without changing `window-start'. Arguably, these events are |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
112 ;; not scrolling events, but fontification must occur for lazy-lock.el to work. |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
113 ;; Hooks `window-size-change-functions' and `redisplay-end-trigger-functions' |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
114 ;; were added for these circumstances. |
15461 | 115 ;; |
17498 | 116 ;; (Ben Wing thinks these hooks are "horribly horribly kludgy", and implemented |
15461 | 117 ;; a `pre-idle-hook', a `mother-of-all-post-command-hooks', for XEmacs 19.14. |
118 ;; He then hacked up a version 1 lazy-lock.el to use `pre-idle-hook' rather | |
119 ;; than `post-command-hook'. Whereas functions on `post-command-hook' are | |
120 ;; called almost as often as possible, functions on `pre-idle-hook' really are | |
121 ;; called as often as possible, even when the mouse moves and, on some systems, | |
122 ;; while XEmacs is idle. Thus, the hook deals with the above problem (b), but | |
123 ;; unfortunately it makes (a) worse and does not address (c) at all. | |
124 ;; | |
125 ;; I freely admit that `redisplay-end-trigger-functions' and, to a much lesser | |
126 ;; extent, `window-size-change-functions' are not pretty. However, I feel that | |
127 ;; a `window-scroll-functions' feature is cleaner than a `pre-idle-hook', and | |
128 ;; the result is faster and smaller, less intrusive and more targeted, code. | |
129 ;; Since `pre-idle-hook' is pretty much like `post-command-hook', there is no | |
130 ;; point in making this version of lazy-lock.el work with it. Anyway, that's | |
131 ;; Lit 30 of my humble opinion. | |
132 ;; | |
17498 | 133 ;; Steve Baur reverted to a non-hacked version 1 lazy-lock.el for XEmacs 19.15 |
134 ;; and 20.0. Obviously, the above `post-command-hook' problems still apply.) | |
135 ;; | |
15461 | 136 ;; - Version 1 stealth fontification is also implemented by placing a function |
137 ;; on `post-command-hook'. This function waits for a given amount of time, | |
138 ;; and, if Emacs remains idle, fontifies where necessary. Again, there are a | |
139 ;; number of problems with using `post-command-hook': | |
140 ;; | |
141 ;; (a) Functions on `post-command-hook' are run sequentially, so this function | |
142 ;; can interfere with other functions on the hook, and vice versa. | |
143 ;; (b) This function waits for a given amount of time, so it can interfere with | |
144 ;; various features that are dealt with by Emacs after a command, e.g., | |
145 ;; region highlighting, asynchronous updating and keystroke echoing. | |
146 ;; (c) Fontification may be required during a command, when `post-command-hook' | |
147 ;; is not run. (Version 2 deferred fontification only.) | |
148 ;; | |
149 ;; Again, `post-command-hook' is completely inappropriate for lazy-lock.el. | |
150 ;; Richard Stallman and Morten Welinder implemented internal Timers and Idle | |
151 ;; Timers for Emacs 19.31. Functions can be run independently at given times | |
152 ;; or after given amounts of idle time. Thus, the feature deals with the above | |
153 ;; problems (a), (b) and (c). Version 2 deferral and stealth are implemented | |
154 ;; by functions on Idle Timers. (A function on XEmacs' `pre-idle-hook' is | |
16580
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
155 ;; similar to an Emacs Idle Timer function with a fixed zero second timeout.) |
15461 | 156 |
17498 | 157 ;; - Version 1 has the following problems (relative to version 2): |
158 ;; | |
159 ;; (a) It is slow when it does its job. | |
160 ;; (b) It does not always do its job when it should. | |
161 ;; (c) It slows all interaction (when it doesn't need to do its job). | |
162 ;; (d) It interferes with other package functions on `post-command-hook'. | |
163 ;; (e) It interferes with Emacs things within the read-eval loop. | |
164 ;; | |
165 ;; Ben's hacked-up lazy-lock.el 1.14 almost solved (b) but made (c) worse. | |
166 ;; | |
167 ;; - Version 2 has the following additional features (relative to version 1): | |
168 ;; | |
169 ;; (a) It can defer fontification (both on-the-fly and on-scrolling). | |
170 ;; (b) It can fontify contextually (syntactically true on-the-fly). | |
171 | |
15461 | 172 ;; Caveats: |
173 ;; | |
16580
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
174 ;; Lazy Lock mode does not work efficiently with Outline mode. |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
175 ;; This is because when in Outline mode, although text may be not visible to |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
176 ;; you in the window, the text is visible to Emacs Lisp code (not surprisingly) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
177 ;; and Lazy Lock fontifies it mercilessly. Maybe it will be fixed one day. |
15461 | 178 ;; |
179 ;; Because buffer text is not necessarily fontified, other packages that expect | |
180 ;; buffer text to be fontified in Font Lock mode either might not work as | |
181 ;; expected, or might not display buffer text as expected. An example of the | |
182 ;; latter is `occur', which copies lines of buffer text into another buffer. | |
183 ;; | |
184 ;; In Emacs 19.30, Lazy Lock mode does not ensure that an existing buffer is | |
185 ;; fontified if it is made visible via a minibuffer-less command that replaces | |
186 ;; an existing window's buffer (e.g., via the Buffers menu). Upgrade! | |
187 ;; | |
188 ;; In Emacs 19.30, Lazy Lock mode does not work well with Transient Mark mode | |
189 ;; or modes based on Comint mode (e.g., Shell mode), and also interferes with | |
190 ;; the echoing of keystrokes in the minibuffer. This is because of the way | |
191 ;; deferral and stealth have to be implemented for Emacs 19.30. Upgrade! | |
192 ;; | |
15499
aa9675ed8ed4
Test for lazy-lock-mode before swapping hooks.
Simon Marshall <simon@gnu.org>
parents:
15461
diff
changeset
|
193 ;; Currently XEmacs does not have the features to support this version of |
aa9675ed8ed4
Test for lazy-lock-mode before swapping hooks.
Simon Marshall <simon@gnu.org>
parents:
15461
diff
changeset
|
194 ;; lazy-lock.el. Maybe it will one day. |
15461 | 195 |
17587
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
196 ;; History: |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
197 ;; |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
198 ;; 1.15--2.00: |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
199 ;; - Rewrite for Emacs 19.30 and the features rms added to support lazy-lock.el |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
200 ;; so that it could work correctly and efficiently. |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
201 ;; - Many thanks to those who reported bugs, fixed bugs, made suggestions or |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
202 ;; otherwise contributed in the version 1 cycle; Jari Aalto, Kevin Broadey, |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
203 ;; Ulrik Dickow, Bill Dubuque, Bob Glickstein, Boris Goldowsky, |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
204 ;; Jonas Jarnestrom, David Karr, Michael Kifer, Erik Naggum, Rick Sladkey, |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
205 ;; Jim Thompson, Ben Wing, Ilya Zakharevich, and Richard Stallman. |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
206 ;; 2.00--2.01: |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
207 ;; - Made `lazy-lock-fontify-after-command' always `sit-for' and so redisplay |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
208 ;; - Use `buffer-name' not `buffer-live-p' (Bill Dubuque hint) |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
209 ;; - Made `lazy-lock-install' do `add-to-list' not `setq' of `current-buffer' |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
210 ;; - Made `lazy-lock-fontify-after-install' loop over buffer list |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
211 ;; - Made `lazy-lock-arrange-before-change' to arrange `window-end' triggering |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
212 ;; - Made `lazy-lock-let-buffer-state' wrap both `befter-change-functions' |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
213 ;; - Made `lazy-lock-fontify-region' do `condition-case' (Hyman Rosen report) |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
214 ;; 2.01--2.02: |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
215 ;; - Use `buffer-live-p' as `buffer-name' can barf (Richard Stanton report) |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
216 ;; - Made `lazy-lock-install' set `font-lock-fontified' (Kevin Davidson report) |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
217 ;; - Made `lazy-lock-install' add hooks only if needed |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
218 ;; - Made `lazy-lock-unstall' add `font-lock-after-change-function' if needed |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
219 ;; 2.02--2.03: |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
220 ;; - Made `lazy-lock-fontify-region' do `condition-case' for `quit' too |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
221 ;; - Made `lazy-lock-mode' respect the value of `font-lock-inhibit-thing-lock' |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
222 ;; - Added `lazy-lock-after-unfontify-buffer' |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
223 ;; - Removed `lazy-lock-fontify-after-install' hack |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
224 ;; - Made `lazy-lock-fontify-after-scroll' not `set-buffer' to `window-buffer' |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
225 ;; - Made `lazy-lock-fontify-after-trigger' not `set-buffer' to `window-buffer' |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
226 ;; - Made `lazy-lock-fontify-after-idle' be interruptible (Scott Burson hint) |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
227 ;; 2.03--2.04: |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
228 ;; - Rewrite for Emacs 19.31 idle timers |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
229 ;; - Renamed `buffer-windows' to `get-buffer-window-list' |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
230 ;; - Removed `buffer-live-p' |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
231 ;; - Made `lazy-lock-defer-after-change' always save `current-buffer' |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
232 ;; - Made `lazy-lock-fontify-after-defer' just process buffers |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
233 ;; - Made `lazy-lock-install-hooks' add hooks correctly (Kevin Broadey report) |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
234 ;; - Made `lazy-lock-install' cope if `lazy-lock-defer-time' is a list |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
235 ;; 2.04--2.05: |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
236 ;; - Rewrite for Common Lisp macros |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
237 ;; - Added `do-while' macro |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
238 ;; - Renamed `lazy-lock-let-buffer-state' macro to `save-buffer-state' |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
239 ;; - Returned `lazy-lock-fontify-after-install' hack (Darren Hall hint) |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
240 ;; - Added `lazy-lock-defer-on-scrolling' functionality (Scott Byer hint) |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
241 ;; - Made `lazy-lock-mode' wrap `font-lock-support-mode' |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
242 ;; 2.05--2.06: |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
243 ;; - Made `lazy-lock-fontify-after-defer' swap correctly (Scott Byer report) |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
244 ;; 2.06--2.07: |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
245 ;; - Added `lazy-lock-stealth-load' functionality (Rob Hooft hint) |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
246 ;; - Made `lazy-lock-unstall' call `lazy-lock-fontify-region' if needed |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
247 ;; - Made `lazy-lock-mode' call `lazy-lock-unstall' only if needed |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
248 ;; - Made `lazy-lock-defer-after-scroll' do `set-window-redisplay-end-trigger' |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
249 ;; - Added `lazy-lock-defer-contextually' functionality |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
250 ;; - Added `lazy-lock-defer-on-the-fly' from `lazy-lock-defer-time' |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
251 ;; - Renamed `lazy-lock-defer-driven' to `lazy-lock-defer-on-scrolling' |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
252 ;; - Removed `lazy-lock-submit-bug-report' and bade farewell |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
253 ;; 2.07--2.08: |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
254 ;; - Made `lazy-lock-fontify-conservatively' fontify around `window-point' |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
255 ;; - Made `save-buffer-state' wrap `inhibit-point-motion-hooks' |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
256 ;; - Added Custom support |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
257 ;; 2.08--2.09: |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
258 ;; - Removed `byte-*' variables from `eval-when-compile' (Erik Naggum hint) |
18464
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
259 ;; - Made various wrapping `inhibit-point-motion-hooks' (Vinicius Latorre hint) |
17587
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
260 |
16580
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
261 ;;; Code: |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
262 |
15461 | 263 (require 'font-lock) |
264 | |
265 ;; Make sure lazy-lock.el is supported. | |
266 (if (if (save-match-data (string-match "Lucid\\|XEmacs" (emacs-version))) | |
267 t | |
268 (and (= emacs-major-version 19) (< emacs-minor-version 30))) | |
269 (error "`lazy-lock' was written for Emacs 19.30 or later")) | |
270 | |
271 (eval-when-compile | |
272 ;; | |
273 ;; We don't do this at the top-level as idle timers are not necessarily used. | |
274 (require 'timer) | |
275 ;; We don't do this at the top-level as we only use non-autoloaded macros. | |
17587
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
276 (require 'cl) |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
277 ;; |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
278 ;; We use this to preserve or protect things when modifying text properties. |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
279 (defmacro save-buffer-state (varlist &rest body) |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
280 "Bind variables according to VARLIST and eval BODY restoring buffer state." |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
281 (` (let* ((,@ (append varlist |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
282 '((modified (buffer-modified-p)) (buffer-undo-list t) |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
283 (inhibit-read-only t) (inhibit-point-motion-hooks t) |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
284 before-change-functions after-change-functions |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
285 deactivate-mark buffer-file-name buffer-file-truename)))) |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
286 (,@ body) |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
287 (when (and (not modified) (buffer-modified-p)) |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
288 (set-buffer-modified-p nil))))) |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
289 (put 'save-buffer-state 'lisp-indent-function 1) |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
290 ;; |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
291 ;; We use this for clarity and speed. Naughty but nice. |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
292 (defmacro do-while (test &rest body) |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
293 "(do-while TEST BODY...): eval BODY... and repeat if TEST yields non-nil. |
15461 | 294 The order of execution is thus BODY, TEST, BODY, TEST and so on |
295 until TEST returns nil." | |
17587
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
296 (` (while (progn (,@ body) (, test))))) |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
297 (put 'do-while 'lisp-indent-function (get 'while 'lisp-indent-function)) |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
298 ;; |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
299 ;; We use this for clarity and speed. Borrowed from a future Emacs. |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
300 (or (fboundp 'with-current-buffer) |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
301 (defmacro with-current-buffer (buffer &rest body) |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
302 "Execute the forms in BODY with BUFFER as the current buffer. |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
303 The value returned is the value of the last form in BODY." |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
304 (` (save-excursion (set-buffer (, buffer)) (,@ body))))) |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
305 (put 'with-current-buffer 'lisp-indent-function 1) |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
306 ;; |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
307 ;; We use this for compatibility with a future Emacs. |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
308 (or (fboundp 'defcustom) |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
309 (defmacro defcustom (symbol value doc &rest args) |
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
310 (` (defvar (, symbol) (, value) (, doc)))))) |
16580
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
311 |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
312 ;(defun lazy-lock-submit-bug-report () |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
313 ; "Submit via mail a bug report on lazy-lock.el." |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
314 ; (interactive) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
315 ; (let ((reporter-prompt-for-summary-p t)) |
18464
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
316 ; (reporter-submit-bug-report "simon@gnu.ai.mit.edu" "lazy-lock 2.08.03" |
16580
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
317 ; '(lazy-lock-minimum-size lazy-lock-defer-on-the-fly |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
318 ; lazy-lock-defer-on-scrolling lazy-lock-defer-contextually |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
319 ; lazy-lock-defer-time lazy-lock-stealth-time |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
320 ; lazy-lock-stealth-load lazy-lock-stealth-nice lazy-lock-stealth-lines |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
321 ; lazy-lock-stealth-verbose) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
322 ; nil nil |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
323 ; (concat "Hi Si., |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
324 ; |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
325 ;I want to report a bug. I've read the `Bugs' section of `Info' on Emacs, so I |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
326 ;know how to make a clear and unambiguous report. To reproduce the bug: |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
327 ; |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
328 ;Start a fresh editor via `" invocation-name " -no-init-file -no-site-file'. |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
329 ;In the `*scratch*' buffer, evaluate:")))) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
330 |
17498 | 331 (defvar lazy-lock-mode nil) ; Whether we are turned on. |
332 (defvar lazy-lock-buffers nil) ; For deferral. | |
333 (defvar lazy-lock-timers (cons nil nil)) ; For deferral and stealth. | |
15461 | 334 |
335 ;; User Variables: | |
336 | |
17498 | 337 (defcustom lazy-lock-minimum-size (* 25 1024) |
15461 | 338 "*Minimum size of a buffer for demand-driven fontification. |
339 On-demand fontification occurs if the buffer size is greater than this value. | |
340 If nil, means demand-driven fontification is never performed. | |
341 If a list, each element should be a cons pair of the form (MAJOR-MODE . SIZE), | |
342 where MAJOR-MODE is a symbol or t (meaning the default). For example: | |
343 ((c-mode . 25600) (c++-mode . 25600) (rmail-mode . 1048576)) | |
344 means that the minimum size is 25K for buffers in C or C++ modes, one megabyte | |
345 for buffers in Rmail mode, and size is irrelevant otherwise. | |
346 | |
17498 | 347 The value of this variable is used when Lazy Lock mode is turned on." |
17507
fd87760f20cd
Cleaned up custom support.
Simon Marshall <simon@gnu.org>
parents:
17498
diff
changeset
|
348 :type '(choice (const :tag "none" nil) |
fd87760f20cd
Cleaned up custom support.
Simon Marshall <simon@gnu.org>
parents:
17498
diff
changeset
|
349 (integer :tag "size") |
fd87760f20cd
Cleaned up custom support.
Simon Marshall <simon@gnu.org>
parents:
17498
diff
changeset
|
350 (repeat :menu-tag "mode specific" :tag "mode specific" |
fd87760f20cd
Cleaned up custom support.
Simon Marshall <simon@gnu.org>
parents:
17498
diff
changeset
|
351 :value ((t . nil)) |
fd87760f20cd
Cleaned up custom support.
Simon Marshall <simon@gnu.org>
parents:
17498
diff
changeset
|
352 (cons :tag "Instance" |
fd87760f20cd
Cleaned up custom support.
Simon Marshall <simon@gnu.org>
parents:
17498
diff
changeset
|
353 (radio :tag "Mode" |
fd87760f20cd
Cleaned up custom support.
Simon Marshall <simon@gnu.org>
parents:
17498
diff
changeset
|
354 (const :tag "all" t) |
fd87760f20cd
Cleaned up custom support.
Simon Marshall <simon@gnu.org>
parents:
17498
diff
changeset
|
355 (symbol :tag "name")) |
fd87760f20cd
Cleaned up custom support.
Simon Marshall <simon@gnu.org>
parents:
17498
diff
changeset
|
356 (radio :tag "Size" |
fd87760f20cd
Cleaned up custom support.
Simon Marshall <simon@gnu.org>
parents:
17498
diff
changeset
|
357 (const :tag "none" nil) |
fd87760f20cd
Cleaned up custom support.
Simon Marshall <simon@gnu.org>
parents:
17498
diff
changeset
|
358 (integer :tag "size"))))) |
17498 | 359 :group 'lazy-lock) |
15461 | 360 |
17498 | 361 (defcustom lazy-lock-defer-on-the-fly t |
16580
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
362 "*If non-nil, means fontification after a change should be deferred. |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
363 If nil, means on-the-fly fontification is performed. This means when changes |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
364 occur in the buffer, those areas are immediately fontified. |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
365 If a list, it should be a list of `major-mode' symbol names for which deferred |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
366 fontification should occur. The sense of the list is negated if it begins with |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
367 `not'. For example: |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
368 (c-mode c++-mode) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
369 means that on-the-fly fontification is deferred for buffers in C and C++ modes |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
370 only, and deferral does not occur otherwise. |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
371 |
17498 | 372 The value of this variable is used when Lazy Lock mode is turned on." |
17507
fd87760f20cd
Cleaned up custom support.
Simon Marshall <simon@gnu.org>
parents:
17498
diff
changeset
|
373 :type '(choice (const :tag "never" nil) |
fd87760f20cd
Cleaned up custom support.
Simon Marshall <simon@gnu.org>
parents:
17498
diff
changeset
|
374 (const :tag "always" t) |
fd87760f20cd
Cleaned up custom support.
Simon Marshall <simon@gnu.org>
parents:
17498
diff
changeset
|
375 (set :menu-tag "mode specific" :tag "modes" |
fd87760f20cd
Cleaned up custom support.
Simon Marshall <simon@gnu.org>
parents:
17498
diff
changeset
|
376 :value (not) |
fd87760f20cd
Cleaned up custom support.
Simon Marshall <simon@gnu.org>
parents:
17498
diff
changeset
|
377 (const :tag "Except" not) |
fd87760f20cd
Cleaned up custom support.
Simon Marshall <simon@gnu.org>
parents:
17498
diff
changeset
|
378 (repeat :inline t (symbol :tag "mode")))) |
17498 | 379 :group 'lazy-lock) |
16580
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
380 |
17498 | 381 (defcustom lazy-lock-defer-on-scrolling nil |
16580
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
382 "*If non-nil, means fontification after a scroll should be deferred. |
15499
aa9675ed8ed4
Test for lazy-lock-mode before swapping hooks.
Simon Marshall <simon@gnu.org>
parents:
15461
diff
changeset
|
383 If nil, means demand-driven fontification is performed. This means when |
aa9675ed8ed4
Test for lazy-lock-mode before swapping hooks.
Simon Marshall <simon@gnu.org>
parents:
15461
diff
changeset
|
384 scrolling into unfontified areas of the buffer, those areas are immediately |
aa9675ed8ed4
Test for lazy-lock-mode before swapping hooks.
Simon Marshall <simon@gnu.org>
parents:
15461
diff
changeset
|
385 fontified. Thus scrolling never presents unfontified areas. However, since |
aa9675ed8ed4
Test for lazy-lock-mode before swapping hooks.
Simon Marshall <simon@gnu.org>
parents:
15461
diff
changeset
|
386 fontification occurs during scrolling, scrolling may be slow. |
15461 | 387 If t, means defer-driven fontification is performed. This means fontification |
388 of those areas is deferred. Thus scrolling may present momentarily unfontified | |
389 areas. However, since fontification does not occur during scrolling, scrolling | |
390 will be faster than demand-driven fontification. | |
15499
aa9675ed8ed4
Test for lazy-lock-mode before swapping hooks.
Simon Marshall <simon@gnu.org>
parents:
15461
diff
changeset
|
391 If any other value, e.g., `eventually', means demand-driven fontification is |
aa9675ed8ed4
Test for lazy-lock-mode before swapping hooks.
Simon Marshall <simon@gnu.org>
parents:
15461
diff
changeset
|
392 performed until the buffer is fontified, then buffer fontification becomes |
aa9675ed8ed4
Test for lazy-lock-mode before swapping hooks.
Simon Marshall <simon@gnu.org>
parents:
15461
diff
changeset
|
393 defer-driven. Thus scrolling never presents unfontified areas until the buffer |
aa9675ed8ed4
Test for lazy-lock-mode before swapping hooks.
Simon Marshall <simon@gnu.org>
parents:
15461
diff
changeset
|
394 is first fontified, after which subsequent scrolling may present future buffer |
aa9675ed8ed4
Test for lazy-lock-mode before swapping hooks.
Simon Marshall <simon@gnu.org>
parents:
15461
diff
changeset
|
395 insertions momentarily unfontified. However, since fontification does not |
aa9675ed8ed4
Test for lazy-lock-mode before swapping hooks.
Simon Marshall <simon@gnu.org>
parents:
15461
diff
changeset
|
396 occur during scrolling after the buffer is first fontified, scrolling will |
16580
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
397 become faster. (But, since contextual changes continually occur, such a value |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
398 makes little sense if `lazy-lock-defer-contextually' is non-nil.) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
399 |
17498 | 400 The value of this variable is used when Lazy Lock mode is turned on." |
17507
fd87760f20cd
Cleaned up custom support.
Simon Marshall <simon@gnu.org>
parents:
17498
diff
changeset
|
401 :type '(choice (const :tag "never" nil) |
fd87760f20cd
Cleaned up custom support.
Simon Marshall <simon@gnu.org>
parents:
17498
diff
changeset
|
402 (const :tag "always" t) |
17682
70a83005a2ca
Use sexp widget in case modified outside custom.
Simon Marshall <simon@gnu.org>
parents:
17587
diff
changeset
|
403 (sexp :tag "eventually" :format "%t\n" eventually)) |
17498 | 404 :group 'lazy-lock) |
16580
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
405 |
17498 | 406 (defcustom lazy-lock-defer-contextually 'syntax-driven |
16580
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
407 "*If non-nil, means deferred fontification should be syntactically true. |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
408 If nil, means deferred fontification occurs only on those lines modified. This |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
409 means where modification on a line causes syntactic change on subsequent lines, |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
410 those subsequent lines are not refontified to reflect their new context. |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
411 If t, means deferred fontification occurs on those lines modified and all |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
412 subsequent lines. This means those subsequent lines are refontified to reflect |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
413 their new syntactic context, either immediately or when scrolling into them. |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
414 If any other value, e.g., `syntax-driven', means deferred syntactically true |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
415 fontification occurs only if syntactic fontification is performed using the |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
416 buffer mode's syntax table, i.e., only if `font-lock-keywords-only' is nil. |
15461 | 417 |
17498 | 418 The value of this variable is used when Lazy Lock mode is turned on." |
17507
fd87760f20cd
Cleaned up custom support.
Simon Marshall <simon@gnu.org>
parents:
17498
diff
changeset
|
419 :type '(choice (const :tag "never" nil) |
fd87760f20cd
Cleaned up custom support.
Simon Marshall <simon@gnu.org>
parents:
17498
diff
changeset
|
420 (const :tag "always" t) |
17682
70a83005a2ca
Use sexp widget in case modified outside custom.
Simon Marshall <simon@gnu.org>
parents:
17587
diff
changeset
|
421 (sexp :tag "syntax-driven" :format "%t\n" syntax-driven)) |
17498 | 422 :group 'lazy-lock) |
15461 | 423 |
17498 | 424 (defcustom lazy-lock-defer-time |
18464
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
425 (if (featurep 'lisp-float-type) (/ (float 1) (float 4)) 1) |
15461 | 426 "*Time in seconds to delay before beginning deferred fontification. |
427 Deferred fontification occurs if there is no input within this time. | |
16580
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
428 If nil, means fontification is never deferred, regardless of the values of the |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
429 variables `lazy-lock-defer-on-the-fly', `lazy-lock-defer-on-scrolling' and |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
430 `lazy-lock-defer-contextually'. |
15461 | 431 |
17498 | 432 The value of this variable is used when Lazy Lock mode is turned on." |
17507
fd87760f20cd
Cleaned up custom support.
Simon Marshall <simon@gnu.org>
parents:
17498
diff
changeset
|
433 :type '(choice (const :tag "never" nil) |
fd87760f20cd
Cleaned up custom support.
Simon Marshall <simon@gnu.org>
parents:
17498
diff
changeset
|
434 (number :tag "seconds")) |
17498 | 435 :group 'lazy-lock) |
15461 | 436 |
17498 | 437 (defcustom lazy-lock-stealth-time 30 |
15461 | 438 "*Time in seconds to delay before beginning stealth fontification. |
439 Stealth fontification occurs if there is no input within this time. | |
440 If nil, means stealth fontification is never performed. | |
441 | |
17498 | 442 The value of this variable is used when Lazy Lock mode is turned on." |
17507
fd87760f20cd
Cleaned up custom support.
Simon Marshall <simon@gnu.org>
parents:
17498
diff
changeset
|
443 :type '(choice (const :tag "never" nil) |
fd87760f20cd
Cleaned up custom support.
Simon Marshall <simon@gnu.org>
parents:
17498
diff
changeset
|
444 (number :tag "seconds")) |
17498 | 445 :group 'lazy-lock) |
15461 | 446 |
17498 | 447 (defcustom lazy-lock-stealth-lines (if font-lock-maximum-decoration 100 250) |
15461 | 448 "*Maximum size of a chunk of stealth fontification. |
449 Each iteration of stealth fontification can fontify this number of lines. | |
450 To speed up input response during stealth fontification, at the cost of stealth | |
17498 | 451 taking longer to fontify, you could reduce the value of this variable." |
17507
fd87760f20cd
Cleaned up custom support.
Simon Marshall <simon@gnu.org>
parents:
17498
diff
changeset
|
452 :type '(integer :tag "lines") |
17498 | 453 :group 'lazy-lock) |
15461 | 454 |
17498 | 455 (defcustom lazy-lock-stealth-load |
17508
1c2392208ad9
Don't use cl forms in defcustom declarations.
Simon Marshall <simon@gnu.org>
parents:
17507
diff
changeset
|
456 (if (condition-case nil (load-average) (error)) 200) |
16580
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
457 "*Load in percentage above which stealth fontification is suspended. |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
458 Stealth fontification pauses when the system short-term load average (as |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
459 returned by the function `load-average' if supported) goes above this level, |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
460 thus reducing the demand that stealth fontification makes on the system. |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
461 If nil, means stealth fontification is never suspended. |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
462 To reduce machine load during stealth fontification, at the cost of stealth |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
463 taking longer to fontify, you could reduce the value of this variable. |
17498 | 464 See also `lazy-lock-stealth-nice'." |
17507
fd87760f20cd
Cleaned up custom support.
Simon Marshall <simon@gnu.org>
parents:
17498
diff
changeset
|
465 :type (if (condition-case nil (load-average) (error)) |
fd87760f20cd
Cleaned up custom support.
Simon Marshall <simon@gnu.org>
parents:
17498
diff
changeset
|
466 '(choice (const :tag "never" nil) |
fd87760f20cd
Cleaned up custom support.
Simon Marshall <simon@gnu.org>
parents:
17498
diff
changeset
|
467 (integer :tag "load")) |
17587
fd8de684f5c7
Version 2.08.01 from author; defgroup happens in font-lock.el; don't prevent from compiling on emacs 19.34 etc.
Simon Marshall <simon@gnu.org>
parents:
17562
diff
changeset
|
468 '(const :format "%t: unsupported\n" nil)) |
17498 | 469 :group 'lazy-lock) |
16580
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
470 |
17498 | 471 (defcustom lazy-lock-stealth-nice |
15461 | 472 (if (featurep 'lisp-float-type) (/ (float 1) (float 8)) 1) |
473 "*Time in seconds to pause between chunks of stealth fontification. | |
16580
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
474 Each iteration of stealth fontification is separated by this amount of time, |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
475 thus reducing the demand that stealth fontification makes on the system. |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
476 If nil, means stealth fontification is never paused. |
15461 | 477 To reduce machine load during stealth fontification, at the cost of stealth |
16580
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
478 taking longer to fontify, you could increase the value of this variable. |
17498 | 479 See also `lazy-lock-stealth-load'." |
17507
fd87760f20cd
Cleaned up custom support.
Simon Marshall <simon@gnu.org>
parents:
17498
diff
changeset
|
480 :type '(choice (const :tag "never" nil) |
fd87760f20cd
Cleaned up custom support.
Simon Marshall <simon@gnu.org>
parents:
17498
diff
changeset
|
481 (number :tag "seconds")) |
17498 | 482 :group 'lazy-lock) |
15461 | 483 |
17498 | 484 (defcustom lazy-lock-stealth-verbose |
17508
1c2392208ad9
Don't use cl forms in defcustom declarations.
Simon Marshall <simon@gnu.org>
parents:
17507
diff
changeset
|
485 (if (featurep 'lisp-float-type) |
1c2392208ad9
Don't use cl forms in defcustom declarations.
Simon Marshall <simon@gnu.org>
parents:
17507
diff
changeset
|
486 (and (not lazy-lock-defer-contextually) (not (null font-lock-verbose)))) |
17498 | 487 "*If non-nil, means stealth fontification should show status messages." |
488 :type 'boolean | |
489 :group 'lazy-lock) | |
15461 | 490 |
491 ;; User Functions: | |
492 | |
493 ;;;###autoload | |
494 (defun lazy-lock-mode (&optional arg) | |
495 "Toggle Lazy Lock mode. | |
496 With arg, turn Lazy Lock mode on if and only if arg is positive. Enable it | |
497 automatically in your `~/.emacs' by: | |
498 | |
499 (setq font-lock-support-mode 'lazy-lock-mode) | |
500 | |
501 When Lazy Lock mode is enabled, fontification can be lazy in a number of ways: | |
502 | |
16580
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
503 - Demand-driven buffer fontification if `lazy-lock-minimum-size' is non-nil. |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
504 This means initial fontification does not occur if the buffer is greater than |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
505 `lazy-lock-minimum-size' characters in length. Instead, fontification occurs |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
506 when necessary, such as when scrolling through the buffer would otherwise |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
507 reveal unfontified areas. This is useful if buffer fontification is too slow |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
508 for large buffers. |
15461 | 509 |
16580
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
510 - Deferred scroll fontification if `lazy-lock-defer-on-scrolling' is non-nil. |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
511 This means demand-driven fontification does not occur as you scroll. |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
512 Instead, fontification is deferred until after `lazy-lock-defer-time' seconds |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
513 of Emacs idle time, while Emacs remains idle. This is useful if |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
514 fontification is too slow to keep up with scrolling. |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
515 |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
516 - Deferred on-the-fly fontification if `lazy-lock-defer-on-the-fly' is non-nil. |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
517 This means on-the-fly fontification does not occur as you type. Instead, |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
518 fontification is deferred until after `lazy-lock-defer-time' seconds of Emacs |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
519 idle time, while Emacs remains idle. This is useful if fontification is too |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
520 slow to keep up with your typing. |
15461 | 521 |
16580
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
522 - Deferred context fontification if `lazy-lock-defer-contextually' is non-nil. |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
523 This means fontification updates the buffer corresponding to true syntactic |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
524 context, after `lazy-lock-defer-time' seconds of Emacs idle time, while Emacs |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
525 remains idle. Otherwise, fontification occurs on modified lines only, and |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
526 subsequent lines can remain fontified corresponding to previous syntactic |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
527 contexts. This is useful where strings or comments span lines. |
15461 | 528 |
16580
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
529 - Stealthy buffer fontification if `lazy-lock-stealth-time' is non-nil. |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
530 This means remaining unfontified areas of buffers are fontified if Emacs has |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
531 been idle for `lazy-lock-stealth-time' seconds, while Emacs remains idle. |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
532 This is useful if any buffer has any deferred fontification. |
15461 | 533 |
16580
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
534 Basic Font Lock mode on-the-fly fontification behaviour fontifies modified |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
535 lines only. Thus, if `lazy-lock-defer-contextually' is non-nil, Lazy Lock mode |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
536 on-the-fly fontification may fontify differently, albeit correctly. In any |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
537 event, to refontify some lines you can use \\[font-lock-fontify-block]. |
15461 | 538 |
16580
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
539 Stealth fontification only occurs while the system remains unloaded. |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
540 If the system load rises above `lazy-lock-stealth-load' percent, stealth |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
541 fontification is suspended. Stealth fontification intensity is controlled via |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
542 the variable `lazy-lock-stealth-nice' and `lazy-lock-stealth-lines', and |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
543 verbosity is controlled via the variable `lazy-lock-stealth-verbose'." |
15461 | 544 (interactive "P") |
16580
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
545 (let* ((was-on lazy-lock-mode) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
546 (now-on (unless (memq 'lazy-lock-mode font-lock-inhibit-thing-lock) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
547 (if arg (> (prefix-numeric-value arg) 0) (not was-on))))) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
548 (cond ((and now-on (not font-lock-mode)) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
549 ;; Turned on `lazy-lock-mode' rather than `font-lock-mode'. |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
550 (let ((font-lock-support-mode 'lazy-lock-mode)) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
551 (font-lock-mode t))) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
552 (now-on |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
553 ;; Turn ourselves on. |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
554 (set (make-local-variable 'lazy-lock-mode) t) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
555 (lazy-lock-install)) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
556 (was-on |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
557 ;; Turn ourselves off. |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
558 (set (make-local-variable 'lazy-lock-mode) nil) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
559 (lazy-lock-unstall))))) |
15461 | 560 |
561 ;;;###autoload | |
562 (defun turn-on-lazy-lock () | |
563 "Unconditionally turn on Lazy Lock mode." | |
564 (lazy-lock-mode t)) | |
565 | |
566 (defun lazy-lock-install () | |
16580
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
567 (let ((min-size (font-lock-value-in-major-mode lazy-lock-minimum-size)) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
568 (defer-change (and lazy-lock-defer-time lazy-lock-defer-on-the-fly)) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
569 (defer-scroll (and lazy-lock-defer-time lazy-lock-defer-on-scrolling)) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
570 (defer-context (and lazy-lock-defer-time lazy-lock-defer-contextually |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
571 (or (eq lazy-lock-defer-contextually t) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
572 (null font-lock-keywords-only))))) |
15461 | 573 ;; |
574 ;; Tell Font Lock whether Lazy Lock will do fontification. | |
575 (make-local-variable 'font-lock-fontified) | |
576 (setq font-lock-fontified (and min-size (>= (buffer-size) min-size))) | |
577 ;; | |
578 ;; Add the text properties and fontify. | |
579 (if (not font-lock-fontified) | |
580 (lazy-lock-after-fontify-buffer) | |
581 ;; Make sure we fontify in any existing windows showing the buffer. | |
582 (let ((windows (get-buffer-window-list (current-buffer) 'nomini t))) | |
583 (lazy-lock-after-unfontify-buffer) | |
584 (while windows | |
585 (lazy-lock-fontify-conservatively (car windows)) | |
586 (setq windows (cdr windows))))) | |
587 ;; | |
588 ;; Add the fontification hooks. | |
589 (lazy-lock-install-hooks | |
590 font-lock-fontified | |
16580
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
591 (cond ((eq (car-safe defer-change) 'not) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
592 (not (memq major-mode (cdr defer-change)))) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
593 ((listp defer-change) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
594 (memq major-mode defer-change)) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
595 (t |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
596 defer-change)) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
597 (eq defer-scroll t) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
598 defer-context) |
15461 | 599 ;; |
600 ;; Add the fontification timers. | |
601 (lazy-lock-install-timers | |
16580
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
602 (if (or defer-change defer-scroll defer-context) lazy-lock-defer-time) |
15461 | 603 lazy-lock-stealth-time))) |
604 | |
16580
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
605 (defun lazy-lock-install-hooks (fontifying |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
606 defer-change defer-scroll defer-context) |
15461 | 607 ;; |
16580
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
608 ;; Add hook if lazy-lock.el is fontifying on scrolling or is deferring. |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
609 (when (or fontifying defer-change defer-scroll defer-context) |
15461 | 610 (make-local-hook 'window-scroll-functions) |
16580
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
611 (add-hook 'window-scroll-functions (if defer-scroll |
15461 | 612 'lazy-lock-defer-after-scroll |
613 'lazy-lock-fontify-after-scroll) | |
614 nil t)) | |
615 ;; | |
16580
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
616 ;; Add hook if lazy-lock.el is fontifying and is not deferring changes. |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
617 (when (and fontifying (not defer-change) (not defer-context)) |
15461 | 618 (make-local-hook 'before-change-functions) |
619 (add-hook 'before-change-functions 'lazy-lock-arrange-before-change nil t)) | |
620 ;; | |
16580
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
621 ;; Replace Font Lock mode hook. |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
622 (remove-hook 'after-change-functions 'font-lock-after-change-function t) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
623 (add-hook 'after-change-functions |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
624 (cond ((and defer-change defer-context) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
625 'lazy-lock-defer-rest-after-change) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
626 (defer-change |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
627 'lazy-lock-defer-line-after-change) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
628 (defer-context |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
629 'lazy-lock-fontify-rest-after-change) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
630 (t |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
631 'lazy-lock-fontify-line-after-change)) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
632 nil t) |
15461 | 633 ;; |
16580
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
634 ;; Add package-specific hook. |
15461 | 635 (make-local-hook 'outline-view-change-hook) |
636 (add-hook 'outline-view-change-hook 'lazy-lock-fontify-after-outline nil t)) | |
637 | |
638 (defun lazy-lock-install-timers (dtime stime) | |
639 ;; Schedule or re-schedule the deferral and stealth timers. | |
640 ;; The layout of `lazy-lock-timers' is: | |
641 ;; ((DEFER-TIME . DEFER-TIMER) (STEALTH-TIME . STEALTH-TIMER) | |
642 ;; If an idle timeout has changed, cancel the existing idle timer (if there | |
643 ;; is one) and schedule a new one (if the new idle timeout is non-nil). | |
644 (unless (eq dtime (car (car lazy-lock-timers))) | |
645 (let ((defer (car lazy-lock-timers))) | |
646 (when (cdr defer) | |
647 (cancel-timer (cdr defer))) | |
648 (setcar lazy-lock-timers (cons dtime (and dtime | |
649 (run-with-idle-timer dtime t 'lazy-lock-fontify-after-defer)))))) | |
650 (unless (eq stime (car (cdr lazy-lock-timers))) | |
651 (let ((stealth (cdr lazy-lock-timers))) | |
652 (when (cdr stealth) | |
653 (cancel-timer (cdr stealth))) | |
654 (setcdr lazy-lock-timers (cons stime (and stime | |
655 (run-with-idle-timer stime t 'lazy-lock-fontify-after-idle))))))) | |
656 | |
657 (defun lazy-lock-unstall () | |
658 ;; | |
16580
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
659 ;; If Font Lock mode is still enabled, make sure that the buffer is |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
660 ;; fontified, and reinstall its hook. We must do this first. |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
661 (when font-lock-mode |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
662 (when (lazy-lock-unfontified-p) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
663 (let ((verbose (if (numberp font-lock-verbose) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
664 (> (buffer-size) font-lock-verbose) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
665 font-lock-verbose))) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
666 (if verbose (message "Fontifying %s..." (buffer-name))) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
667 ;; Make sure we fontify etc. in the whole buffer. |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
668 (save-restriction |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
669 (widen) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
670 (lazy-lock-fontify-region (point-min) (point-max))) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
671 (if verbose (message "Fontifying %s...%s" (buffer-name) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
672 (if (lazy-lock-unfontified-p) "quit" "done"))))) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
673 (add-hook 'after-change-functions 'font-lock-after-change-function nil t)) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
674 ;; |
15461 | 675 ;; Remove the text properties. |
676 (lazy-lock-after-unfontify-buffer) | |
677 ;; | |
678 ;; Remove the fontification hooks. | |
679 (remove-hook 'window-scroll-functions 'lazy-lock-fontify-after-scroll t) | |
680 (remove-hook 'window-scroll-functions 'lazy-lock-defer-after-scroll t) | |
681 (remove-hook 'before-change-functions 'lazy-lock-arrange-before-change t) | |
16580
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
682 (remove-hook 'after-change-functions 'lazy-lock-fontify-line-after-change t) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
683 (remove-hook 'after-change-functions 'lazy-lock-fontify-rest-after-change t) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
684 (remove-hook 'after-change-functions 'lazy-lock-defer-line-after-change t) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
685 (remove-hook 'after-change-functions 'lazy-lock-defer-rest-after-change t) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
686 (remove-hook 'outline-view-change-hook 'lazy-lock-fontify-after-outline t)) |
15461 | 687 |
688 ;; Hook functions. | |
689 | |
16580
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
690 ;; Lazy Lock mode intervenes when (1) a previously invisible buffer region |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
691 ;; becomes visible, i.e., for demand- or defer-driven on-the-scroll |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
692 ;; fontification, (2) a buffer modification occurs, i.e., for defer-driven |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
693 ;; on-the-fly fontification, (3) Emacs becomes idle, i.e., for fontification of |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
694 ;; deferred fontification and stealth fontification, and (4) other special |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
695 ;; occasions. |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
696 |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
697 ;; 1. There are three ways whereby this can happen. |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
698 ;; |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
699 ;; (a) Scrolling the window, either explicitly (e.g., `scroll-up') or |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
700 ;; implicitly (e.g., `search-forward'). Here, `window-start' changes. |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
701 ;; Fontification occurs by adding `lazy-lock-fontify-after-scroll' (for |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
702 ;; demand-driven fontification) or `lazy-lock-defer-after-scroll' (for |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
703 ;; defer-driven fontification) to the hook `window-scroll-functions'. |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
704 |
15461 | 705 (defun lazy-lock-fontify-after-scroll (window window-start) |
706 ;; Called from `window-scroll-functions'. | |
16580
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
707 ;; Fontify WINDOW from WINDOW-START following the scroll. We cannot use |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
708 ;; `window-end' so we work out what it would be via `vertical-motion'. |
18464
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
709 (let ((inhibit-point-motion-hooks t)) |
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
710 (save-excursion |
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
711 (goto-char window-start) |
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
712 (vertical-motion (window-height window) window) |
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
713 (lazy-lock-fontify-region window-start (point)))) |
15461 | 714 ;; A prior deletion that did not cause scrolling, followed by a scroll, would |
715 ;; result in an unnecessary trigger after this if we did not cancel it now. | |
716 (set-window-redisplay-end-trigger window nil)) | |
717 | |
16580
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
718 (defun lazy-lock-defer-after-scroll (window window-start) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
719 ;; Called from `window-scroll-functions'. |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
720 ;; Defer fontification following the scroll. Save the current buffer so that |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
721 ;; we subsequently fontify in all windows showing the buffer. |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
722 (unless (memq (current-buffer) lazy-lock-buffers) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
723 (push (current-buffer) lazy-lock-buffers)) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
724 ;; A prior deletion that did not cause scrolling, followed by a scroll, would |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
725 ;; result in an unnecessary trigger after this if we did not cancel it now. |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
726 (set-window-redisplay-end-trigger window nil)) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
727 |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
728 ;; (b) Resizing the window, either explicitly (e.g., `enlarge-window') or |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
729 ;; implicitly (e.g., `delete-other-windows'). Here, `window-end' changes. |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
730 ;; Fontification occurs by adding `lazy-lock-fontify-after-resize' to the |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
731 ;; hook `window-size-change-functions'. |
15461 | 732 |
733 (defun lazy-lock-fontify-after-resize (frame) | |
734 ;; Called from `window-size-change-functions'. | |
16580
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
735 ;; Fontify windows in FRAME following the resize. We cannot use |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
736 ;; `window-start' or `window-end' so we fontify conservatively. |
15461 | 737 (save-excursion |
738 (save-selected-window | |
739 (select-frame frame) | |
740 (walk-windows (function (lambda (window) | |
741 (set-buffer (window-buffer window)) | |
742 (when lazy-lock-mode | |
743 (lazy-lock-fontify-conservatively window)) | |
744 (set-window-redisplay-end-trigger window nil))) | |
745 'nomini frame)))) | |
746 | |
16580
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
747 ;; (c) Deletion in the buffer. Here, a `window-end' marker can become visible. |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
748 ;; Fontification occurs by adding `lazy-lock-arrange-before-change' to |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
749 ;; `before-change-functions' and `lazy-lock-fontify-after-trigger' to the |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
750 ;; hook `redisplay-end-trigger-functions'. Before every deletion, the |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
751 ;; marker `window-redisplay-end-trigger' position is set to the soon-to-be |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
752 ;; changed `window-end' position. If the marker becomes visible, |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
753 ;; `lazy-lock-fontify-after-trigger' gets called. Ouch. Note that we only |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
754 ;; have to deal with this eventuality if there is no on-the-fly deferral. |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
755 |
15461 | 756 (defun lazy-lock-arrange-before-change (beg end) |
757 ;; Called from `before-change-functions'. | |
758 ;; Arrange that if text becomes visible it will be fontified (if a deletion | |
759 ;; is pending, text might become visible at the bottom). | |
760 (unless (eq beg end) | |
761 (let ((windows (get-buffer-window-list (current-buffer) 'nomini t)) window) | |
762 (while windows | |
763 (setq window (car windows)) | |
764 (unless (markerp (window-redisplay-end-trigger window)) | |
765 (set-window-redisplay-end-trigger window (make-marker))) | |
766 (set-marker (window-redisplay-end-trigger window) (window-end window)) | |
767 (setq windows (cdr windows)))))) | |
768 | |
16580
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
769 (defun lazy-lock-fontify-after-trigger (window trigger-point) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
770 ;; Called from `redisplay-end-trigger-functions'. |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
771 ;; Fontify WINDOW from TRIGGER-POINT. We cannot use `window-end' so we work |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
772 ;; out what it would be via `vertical-motion'. |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
773 ;; We could probably just use `lazy-lock-fontify-after-scroll' without loss: |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
774 ;; (lazy-lock-fontify-after-scroll window (window-start window)) |
18464
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
775 (let ((inhibit-point-motion-hooks t)) |
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
776 (save-excursion |
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
777 (goto-char (window-start window)) |
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
778 (vertical-motion (window-height window) window) |
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
779 (lazy-lock-fontify-region trigger-point (point))))) |
15461 | 780 |
16580
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
781 ;; 2. Modified text must be marked as unfontified so it can be identified and |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
782 ;; fontified later when Emacs is idle. Deferral occurs by adding one of |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
783 ;; `lazy-lock-fontify-*-after-change' (for on-the-fly fontification) or |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
784 ;; `lazy-lock-defer-*-after-change' (for deferred fontification) to the |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
785 ;; hook `after-change-functions'. |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
786 |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
787 (defalias 'lazy-lock-fontify-line-after-change |
15461 | 788 ;; Called from `after-change-functions'. |
16580
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
789 ;; Fontify the current change. |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
790 'font-lock-after-change-function) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
791 |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
792 (defun lazy-lock-fontify-rest-after-change (beg end old-len) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
793 ;; Called from `after-change-functions'. |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
794 ;; Fontify the current change and defer fontification of the rest of the |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
795 ;; buffer. Save the current buffer so that we subsequently fontify in all |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
796 ;; windows showing the buffer. |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
797 (lazy-lock-fontify-line-after-change beg end old-len) |
15461 | 798 (save-buffer-state nil |
799 (unless (memq (current-buffer) lazy-lock-buffers) | |
800 (push (current-buffer) lazy-lock-buffers)) | |
16580
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
801 (remove-text-properties end (point-max) '(lazy-lock nil)))) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
802 |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
803 (defun lazy-lock-defer-line-after-change (beg end old-len) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
804 ;; Called from `after-change-functions'. |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
805 ;; Defer fontification of the current change. Save the current buffer so |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
806 ;; that we subsequently fontify in all windows showing the buffer. |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
807 (save-buffer-state nil |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
808 (unless (memq (current-buffer) lazy-lock-buffers) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
809 (push (current-buffer) lazy-lock-buffers)) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
810 (remove-text-properties (max (1- beg) (point-min)) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
811 (min (1+ end) (point-max)) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
812 '(lazy-lock nil)))) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
813 |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
814 (defun lazy-lock-defer-rest-after-change (beg end old-len) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
815 ;; Called from `after-change-functions'. |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
816 ;; Defer fontification of the rest of the buffer. Save the current buffer so |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
817 ;; that we subsequently fontify in all windows showing the buffer. |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
818 (save-buffer-state nil |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
819 (unless (memq (current-buffer) lazy-lock-buffers) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
820 (push (current-buffer) lazy-lock-buffers)) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
821 (remove-text-properties (max (1- beg) (point-min)) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
822 (point-max) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
823 '(lazy-lock nil)))) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
824 |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
825 ;; 3. Deferred fontification and stealth fontification are done from these two |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
826 ;; functions. They are set up as Idle Timers. |
15461 | 827 |
828 (defun lazy-lock-fontify-after-defer () | |
829 ;; Called from `timer-idle-list'. | |
830 ;; Fontify all windows where deferral has occurred for its buffer. | |
831 (while (and lazy-lock-buffers (not (input-pending-p))) | |
832 (let ((windows (get-buffer-window-list (car lazy-lock-buffers) 'nomini t))) | |
833 (while windows | |
834 (lazy-lock-fontify-window (car windows)) | |
835 (setq windows (cdr windows))) | |
836 (setq lazy-lock-buffers (cdr lazy-lock-buffers)))) | |
15499
aa9675ed8ed4
Test for lazy-lock-mode before swapping hooks.
Simon Marshall <simon@gnu.org>
parents:
15461
diff
changeset
|
837 ;; Add hook if fontification should now be defer-driven in this buffer. |
16580
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
838 (when (and lazy-lock-mode lazy-lock-defer-on-scrolling |
15499
aa9675ed8ed4
Test for lazy-lock-mode before swapping hooks.
Simon Marshall <simon@gnu.org>
parents:
15461
diff
changeset
|
839 (memq 'lazy-lock-fontify-after-scroll window-scroll-functions) |
aa9675ed8ed4
Test for lazy-lock-mode before swapping hooks.
Simon Marshall <simon@gnu.org>
parents:
15461
diff
changeset
|
840 (not (or (input-pending-p) (lazy-lock-unfontified-p)))) |
15461 | 841 (remove-hook 'window-scroll-functions 'lazy-lock-fontify-after-scroll t) |
842 (add-hook 'window-scroll-functions 'lazy-lock-defer-after-scroll nil t))) | |
843 | |
844 (defun lazy-lock-fontify-after-idle () | |
845 ;; Called from `timer-idle-list'. | |
846 ;; Fontify all buffers that need it, stealthily while idle. | |
847 (unless (or executing-kbd-macro (window-minibuffer-p (selected-window))) | |
848 ;; Loop over all buffers, fontify stealthily for each if necessary. | |
849 (let ((buffers (buffer-list)) (continue t) message message-log-max) | |
850 (save-excursion | |
851 (do-while (and buffers continue) | |
852 (set-buffer (car buffers)) | |
853 (if (not (and lazy-lock-mode (lazy-lock-unfontified-p))) | |
854 (setq continue (not (input-pending-p))) | |
855 ;; Fontify regions in this buffer while there is no input. | |
16580
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
856 (do-while (and (lazy-lock-unfontified-p) continue) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
857 (if (and lazy-lock-stealth-load |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
858 (> (car (load-average)) lazy-lock-stealth-load)) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
859 ;; Wait a while before continuing with the loop. |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
860 (progn |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
861 (when message |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
862 (message "Fontifying stealthily...suspended") |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
863 (setq message nil)) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
864 (setq continue (sit-for (or lazy-lock-stealth-time 30)))) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
865 ;; Fontify a chunk. |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
866 (when lazy-lock-stealth-verbose |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
867 (if message |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
868 (message "Fontifying stealthily... %2d%% of %s" |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
869 (lazy-lock-percent-fontified) (buffer-name)) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
870 (message "Fontifying stealthily...") |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
871 (setq message t))) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
872 (lazy-lock-fontify-chunk) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
873 (setq continue (sit-for (or lazy-lock-stealth-nice 0)))))) |
15461 | 874 (setq buffers (cdr buffers)))) |
875 (when message | |
15499
aa9675ed8ed4
Test for lazy-lock-mode before swapping hooks.
Simon Marshall <simon@gnu.org>
parents:
15461
diff
changeset
|
876 (message "Fontifying stealthily...%s" (if continue "done" "quit")))))) |
15461 | 877 |
16580
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
878 ;; 4. Special circumstances. |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
879 |
15461 | 880 (defun lazy-lock-fontify-after-outline () |
881 ;; Called from `outline-view-change-hook'. | |
882 ;; Fontify windows showing the current buffer, as its visibility has changed. | |
883 ;; This is a conspiracy hack between lazy-lock.el and noutline.el. | |
884 (let ((windows (get-buffer-window-list (current-buffer) 'nomini t))) | |
885 (while windows | |
886 (lazy-lock-fontify-conservatively (car windows)) | |
887 (setq windows (cdr windows))))) | |
888 | |
889 (defun lazy-lock-after-fontify-buffer () | |
890 ;; Called from `font-lock-after-fontify-buffer'. | |
891 ;; Mark the current buffer as fontified. | |
892 ;; This is a conspiracy hack between lazy-lock.el and font-lock.el. | |
893 (save-buffer-state nil | |
894 (add-text-properties (point-min) (point-max) '(lazy-lock t)))) | |
895 | |
896 (defun lazy-lock-after-unfontify-buffer () | |
897 ;; Called from `font-lock-after-unfontify-buffer'. | |
898 ;; Mark the current buffer as unfontified. | |
899 ;; This is a conspiracy hack between lazy-lock.el and font-lock.el. | |
900 (save-buffer-state nil | |
901 (remove-text-properties (point-min) (point-max) '(lazy-lock nil)))) | |
902 | |
903 ;; Fontification functions. | |
904 | |
905 ;; If packages want to ensure that some region of the buffer is fontified, they | |
906 ;; should use this function. For an example, see ps-print.el. | |
907 (defun lazy-lock-fontify-region (beg end) | |
908 ;; Fontify between BEG and END, where necessary, in the current buffer. | |
909 (when (setq beg (text-property-any beg end 'lazy-lock nil)) | |
910 (save-excursion | |
911 (save-match-data | |
912 (save-buffer-state | |
913 ;; Ensure syntactic fontification is always correct. | |
914 (font-lock-beginning-of-syntax-function next) | |
915 ;; Find successive unfontified regions between BEG and END. | |
916 (condition-case data | |
917 (do-while beg | |
918 (setq next (or (text-property-any beg end 'lazy-lock t) end)) | |
919 ;; Make sure the region end points are at beginning of line. | |
920 (goto-char beg) | |
921 (unless (bolp) | |
922 (beginning-of-line) | |
923 (setq beg (point))) | |
924 (goto-char next) | |
925 (unless (bolp) | |
926 (forward-line) | |
927 (setq next (point))) | |
928 ;; Fontify the region, then flag it as fontified. | |
929 (font-lock-fontify-region beg next) | |
930 (add-text-properties beg next '(lazy-lock t)) | |
931 (setq beg (text-property-any next end 'lazy-lock nil))) | |
932 ((error quit) (message "Fontifying region...%s" data)))))))) | |
933 | |
934 (defun lazy-lock-fontify-chunk () | |
935 ;; Fontify the nearest chunk, for stealth, in the current buffer. | |
18464
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
936 (let ((inhibit-point-motion-hooks t)) |
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
937 (save-excursion |
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
938 (save-restriction |
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
939 (widen) |
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
940 ;; Move to end of line in case the character at point is not fontified. |
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
941 (end-of-line) |
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
942 ;; Find where the previous (next) unfontified regions end (begin). |
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
943 (let ((prev (previous-single-property-change (point) 'lazy-lock)) |
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
944 (next (text-property-any (point) (point-max) 'lazy-lock nil))) |
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
945 ;; Fontify from the nearest unfontified position. |
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
946 (if (or (null prev) (and next (< (- next (point)) (- (point) prev)))) |
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
947 ;; The next, or neither, region is the nearest not fontified. |
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
948 (lazy-lock-fontify-region |
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
949 (progn (goto-char (or next (point-min))) |
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
950 (beginning-of-line) |
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
951 (point)) |
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
952 (progn (goto-char (or next (point-min))) |
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
953 (forward-line lazy-lock-stealth-lines) |
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
954 (point))) |
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
955 ;; The previous region is the nearest not fontified. |
15461 | 956 (lazy-lock-fontify-region |
18464
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
957 (progn (goto-char prev) |
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
958 (forward-line (- lazy-lock-stealth-lines)) |
15461 | 959 (point)) |
18464
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
960 (progn (goto-char prev) |
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
961 (forward-line) |
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
962 (point))))))))) |
15461 | 963 |
964 (defun lazy-lock-fontify-window (window) | |
965 ;; Fontify in WINDOW between `window-start' and `window-end'. | |
966 ;; We can only do this when we can use `window-start' and `window-end'. | |
16580
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
967 (with-current-buffer (window-buffer window) |
15461 | 968 (lazy-lock-fontify-region (window-start window) (window-end window)))) |
969 | |
970 (defun lazy-lock-fontify-conservatively (window) | |
971 ;; Fontify in WINDOW conservatively around point. | |
972 ;; Where we cannot use `window-start' and `window-end' we do `window-height' | |
973 ;; lines around point. That way we guarantee to have done enough. | |
16580
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
974 (with-current-buffer (window-buffer window) |
18464
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
975 (let ((inhibit-point-motion-hooks t)) |
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
976 (lazy-lock-fontify-region |
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
977 (save-excursion |
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
978 (goto-char (window-point window)) |
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
979 (vertical-motion (- (window-height window)) window) (point)) |
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
980 (save-excursion |
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
981 (goto-char (window-point window)) |
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
982 (vertical-motion (window-height window) window) (point)))))) |
15461 | 983 |
984 (defun lazy-lock-unfontified-p () | |
985 ;; Return non-nil if there is anywhere still to be fontified. | |
986 (save-restriction | |
987 (widen) | |
988 (text-property-any (point-min) (point-max) 'lazy-lock nil))) | |
989 | |
990 (defun lazy-lock-percent-fontified () | |
991 ;; Return the percentage (of characters) of the buffer that are fontified. | |
992 (save-restriction | |
993 (widen) | |
16580
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
994 (let ((beg (point-min)) (size 0) next) |
15461 | 995 ;; Find where the next fontified region begins. |
16580
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
996 (while (setq beg (text-property-any beg (point-max) 'lazy-lock t)) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
997 (setq next (or (text-property-any beg (point-max) 'lazy-lock nil) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
998 (point-max))) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
999 (incf size (- next beg)) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
1000 (setq beg next)) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
1001 ;; Float because using integer multiplication will frequently overflow. |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
1002 (truncate (* (/ (float size) (point-max)) 100))))) |
15461 | 1003 |
1004 ;; Version dependent workarounds and fixes. | |
1005 | |
1006 (when (if (save-match-data (string-match "Lucid\\|XEmacs" (emacs-version))) | |
1007 nil | |
1008 (and (= emacs-major-version 19) (= emacs-minor-version 30))) | |
1009 ;; | |
1010 ;; We use `post-command-idle-hook' for deferral and stealth. Oh Lordy. | |
1011 (defun lazy-lock-install-timers (foo bar) | |
1012 (add-hook 'post-command-idle-hook 'lazy-lock-fontify-post-command t) | |
1013 (add-hook 'post-command-idle-hook 'lazy-lock-fontify-post-idle t) | |
1014 (add-to-list 'lazy-lock-install (current-buffer)) | |
1015 (add-hook 'post-command-hook 'lazy-lock-fontify-after-install)) | |
1016 (defun lazy-lock-fontify-post-command () | |
1017 (and lazy-lock-buffers (not executing-kbd-macro) | |
1018 (progn | |
1019 (and deactivate-mark (deactivate-mark)) | |
1020 (sit-for | |
1021 (or (cdr-safe lazy-lock-defer-time) lazy-lock-defer-time 0))) | |
1022 (lazy-lock-fontify-after-defer))) | |
1023 (defun lazy-lock-fontify-post-idle () | |
1024 (and lazy-lock-stealth-time (not executing-kbd-macro) | |
1025 (not (window-minibuffer-p (selected-window))) | |
1026 (progn | |
1027 (and deactivate-mark (deactivate-mark)) | |
1028 (sit-for lazy-lock-stealth-time)) | |
1029 (lazy-lock-fontify-after-idle))) | |
1030 ;; | |
1031 ;; Simulate running of `window-scroll-functions' in `set-window-buffer'. | |
1032 (defvar lazy-lock-install nil) | |
1033 (defun lazy-lock-fontify-after-install () | |
1034 (remove-hook 'post-command-hook 'lazy-lock-fontify-after-install) | |
1035 (while lazy-lock-install | |
1036 (mapcar 'lazy-lock-fontify-conservatively | |
1037 (get-buffer-window-list (pop lazy-lock-install) 'nomini t))))) | |
16580
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
1038 |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
1039 (when (consp lazy-lock-defer-time) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
1040 ;; |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
1041 ;; In 2.06.04 and below, `lazy-lock-defer-time' could specify modes and time. |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
1042 (with-output-to-temp-buffer "*Help*" |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
1043 (princ "The value of the variable `lazy-lock-defer-time' was\n ") |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
1044 (princ lazy-lock-defer-time) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
1045 (princ "\n") |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
1046 (princ "This variable cannot now be a list of modes and time, ") |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
1047 (princ "so instead use the forms:\n") |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
1048 (princ " (setq lazy-lock-defer-time ") |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
1049 (princ (cdr lazy-lock-defer-time)) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
1050 (princ ")\n") |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
1051 (princ " (setq lazy-lock-defer-on-the-fly '") |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
1052 (princ (car lazy-lock-defer-time)) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
1053 (princ ")\n") |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
1054 (princ "in your ~/.emacs. ") |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
1055 (princ "The above forms have been evaluated for this editor session,\n") |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
1056 (princ "but you should change your ~/.emacs now.")) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
1057 (setq lazy-lock-defer-on-the-fly (car lazy-lock-defer-time) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
1058 lazy-lock-defer-time (cdr lazy-lock-defer-time))) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
1059 |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
1060 (when (boundp 'lazy-lock-defer-driven) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
1061 ;; |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
1062 ;; In 2.06.04 and below, `lazy-lock-defer-driven' was the variable name. |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
1063 (with-output-to-temp-buffer "*Help*" |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
1064 (princ "The value of the variable `lazy-lock-defer-driven' is set to ") |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
1065 (if (memq lazy-lock-defer-driven '(nil t)) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
1066 (princ lazy-lock-defer-driven) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
1067 (princ "`") |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
1068 (princ lazy-lock-defer-driven) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
1069 (princ "'")) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
1070 (princ ".\n") |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
1071 (princ "This variable is now called `lazy-lock-defer-on-scrolling',\n") |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
1072 (princ "so instead use the form:\n") |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
1073 (princ " (setq lazy-lock-defer-on-scrolling ") |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
1074 (unless (memq lazy-lock-defer-driven '(nil t)) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
1075 (princ "'")) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
1076 (princ lazy-lock-defer-driven) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
1077 (princ ")\n") |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
1078 (princ "in your ~/.emacs. ") |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
1079 (princ "The above form has been evaluated for this editor session,\n") |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
1080 (princ "but you should change your ~/.emacs now.")) |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
1081 (setq lazy-lock-defer-on-scrolling lazy-lock-defer-driven)) |
15461 | 1082 |
1083 ;; Possibly absent. | |
1084 | |
1085 (unless (boundp 'font-lock-inhibit-thing-lock) | |
1086 ;; Font Lock mode uses this to direct Lazy and Fast Lock modes to stay off. | |
1087 (defvar font-lock-inhibit-thing-lock nil | |
1088 "List of Font Lock mode related modes that should not be turned on.")) | |
1089 | |
1090 (unless (fboundp 'font-lock-value-in-major-mode) | |
1091 (defun font-lock-value-in-major-mode (alist) | |
1092 ;; Return value in ALIST for `major-mode'. | |
1093 (if (consp alist) | |
1094 (cdr (or (assq major-mode alist) (assq t alist))) | |
1095 alist))) | |
1096 | |
1097 (unless (fboundp 'get-buffer-window-list) | |
1098 ;; We use this to get all windows showing a buffer we have to fontify. | |
1099 (defun get-buffer-window-list (buffer &optional minibuf frame) | |
1100 "Return windows currently displaying BUFFER, or nil if none." | |
1101 (let ((buffer (if (bufferp buffer) buffer (get-buffer buffer))) windows) | |
1102 (walk-windows (function (lambda (window) | |
1103 (when (eq (window-buffer window) buffer) | |
1104 (push window windows)))) | |
1105 minibuf frame) | |
1106 windows))) | |
1107 | |
1108 ;; Install ourselves: | |
1109 | |
1110 (add-hook 'window-size-change-functions 'lazy-lock-fontify-after-resize) | |
1111 (add-hook 'redisplay-end-trigger-functions 'lazy-lock-fontify-after-trigger) | |
1112 | |
1113 (unless (assq 'lazy-lock-mode minor-mode-alist) | |
1114 (setq minor-mode-alist (append minor-mode-alist '((lazy-lock-mode nil))))) | |
1115 | |
1116 ;; Provide ourselves: | |
1117 | |
1118 (provide 'lazy-lock) | |
1119 | |
1120 ;;; lazy-lock.el ends here |