Mercurial > emacs
annotate lisp/lazy-lock.el @ 34773:664ee7cb8bf9
*** empty log message ***
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Thu, 21 Dec 2000 06:46:32 +0000 |
parents | 307f82858763 |
children | 05bbe56d446f |
rev | line source |
---|---|
15461 | 1 ;;; lazy-lock.el --- Lazy demand-driven fontification for fast Font Lock mode. |
2 | |
23753
c1bedc24e8af
* lazy-lock.el (lazy-lock-unstall):
Simon Marshall <simon@gnu.org>
parents:
22771
diff
changeset
|
3 ;; Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. |
15461 | 4 |
20191
0ccfc7a0662f
In deferral, check saved buffers to make sure they exist and have lazy-lock on.
Simon Marshall <simon@gnu.org>
parents:
18980
diff
changeset
|
5 ;; Author: Simon Marshall <simon@gnu.org> |
27415 | 6 ;; Maintainer: FSF |
15461 | 7 ;; Keywords: faces files |
23753
c1bedc24e8af
* lazy-lock.el (lazy-lock-unstall):
Simon Marshall <simon@gnu.org>
parents:
22771
diff
changeset
|
8 ;; Version: 2.11 |
15461 | 9 |
10 ;;; This file is part of GNU Emacs. | |
11 | |
12 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
13 ;; it under the terms of the GNU General Public License as published by | |
14 ;; the Free Software Foundation; either version 2, or (at your option) | |
15 ;; any later version. | |
16 | |
17 ;; GNU Emacs is distributed in the hope that it will be useful, | |
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 ;; GNU General Public License for more details. | |
21 | |
22 ;; You should have received a copy of the GNU General Public License | |
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
25 ;; Boston, MA 02111-1307, USA. | |
26 | |
27 ;;; Commentary: | |
28 | |
17498 | 29 ;; Purpose: |
30 ;; | |
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
|
31 ;; 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
|
32 ;; 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
|
33 ;; 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
|
34 ;; when, and where, necessary. |
15461 | 35 ;; |
36 ;; See caveats and feedback below. | |
37 ;; See also the fast-lock package. (But don't use them at the same time!) | |
38 | |
39 ;; Installation: | |
40 ;; | |
41 ;; Put in your ~/.emacs: | |
42 ;; | |
15499
aa9675ed8ed4
Test for lazy-lock-mode before swapping hooks.
Simon Marshall <simon@gnu.org>
parents:
15461
diff
changeset
|
43 ;; (setq font-lock-support-mode 'lazy-lock-mode) |
15461 | 44 ;; |
45 ;; Start up a new Emacs and use font-lock as usual (except that you can use the | |
46 ;; so-called "gaudier" fontification regexps on big files without frustration). | |
47 ;; | |
48 ;; In a buffer (which has `font-lock-mode' enabled) which is at least | |
49 ;; `lazy-lock-minimum-size' characters long, buffer fontification will not | |
50 ;; occur and only the visible portion of the buffer will be fontified. Motion | |
51 ;; around the buffer will fontify those visible portions not previously | |
52 ;; fontified. If stealth fontification is enabled, buffer fontification will | |
53 ;; occur in invisible parts of the buffer after `lazy-lock-stealth-time' | |
54 ;; seconds of idle time. If on-the-fly fontification is deferred, on-the-fly | |
55 ;; fontification will occur after `lazy-lock-defer-time' seconds of idle time. | |
56 | |
57 ;; User-visible differences with version 1: | |
58 ;; | |
59 ;; - Version 2 can defer on-the-fly fontification. Therefore you need not, and | |
60 ;; should not, use defer-lock.el with this version of lazy-lock.el. | |
61 ;; | |
62 ;; A number of variables have changed meaning: | |
63 ;; | |
64 ;; - A value of nil for the variable `lazy-lock-minimum-size' means never turn | |
65 ;; on demand-driven fontification. In version 1 this meant always turn on | |
66 ;; demand-driven fontification. If you really want demand-driven fontification | |
67 ;; regardless of buffer size, set this variable to 0. | |
68 ;; | |
69 ;; - The variable `lazy-lock-stealth-lines' cannot have a nil value. In | |
70 ;; version 1 this meant use `window-height' as the maximum number of lines to | |
71 ;; fontify as a stealth chunk. This makes no sense; stealth fontification is | |
72 ;; of a buffer, not a window. | |
73 | |
74 ;; Implementation differences with version 1: | |
75 ;; | |
76 ;; - Version 1 of lazy-lock.el is a bit of a hack. Version 1 demand-driven | |
77 ;; fontification, the core feature of lazy-lock.el, is implemented by placing a | |
78 ;; function on `post-command-hook'. This function fontifies where necessary, | |
79 ;; i.e., where a window scroll has occurred. However, there are a number of | |
80 ;; problems with using `post-command-hook': | |
81 ;; | |
82 ;; (a) As the name suggests, `post-command-hook' is run after every command, | |
83 ;; i.e., frequently and regardless of whether scrolling has occurred. | |
84 ;; (b) Scrolling can occur during a command, when `post-command-hook' is not | |
85 ;; run, i.e., it is not necessarily run after scrolling has occurred. | |
86 ;; (c) When `post-command-hook' is run, there is nothing to suggest where | |
87 ;; scrolling might have occurred, i.e., which windows have scrolled. | |
88 ;; | |
89 ;; Thus lazy-lock.el's function is called almost as often as possible, usually | |
90 ;; when it need not be called, yet it is not always called when it is needed. | |
91 ;; Also, lazy-lock.el's function must check each window to see if a scroll has | |
92 ;; occurred there. Worse still, lazy-lock.el's function must fontify a region | |
93 ;; twice as large as necessary to make sure the window is completely fontified. | |
94 ;; Basically, `post-command-hook' is completely inappropriate for lazy-lock.el. | |
95 ;; | |
96 ;; Ideally, we want to attach lazy-lock.el's function to a hook that is run | |
97 ;; only when scrolling occurs, e.g., `window-start' has changed, and tells us | |
98 ;; as much information as we need, i.e., the window and its new buffer region. | |
99 ;; Richard Stallman implemented a `window-scroll-functions' for Emacs 19.30. | |
100 ;; Functions on it are run when `window-start' has changed, and are supplied | |
101 ;; with the window and the window's new `window-start' position. (It would be | |
102 ;; better if it also supplied the window's new `window-end' position, but that | |
103 ;; is calculated as part of the redisplay process, and the functions on | |
104 ;; `window-scroll-functions' are run before redisplay has finished.) Thus, the | |
105 ;; hook deals with the above problems (a), (b) and (c). | |
106 ;; | |
107 ;; If only life was that easy. Version 2 demand-driven fontification is mostly | |
108 ;; implemented by placing a function on `window-scroll-functions'. However, | |
109 ;; not all scrolling occurs when `window-start' has changed. A change in | |
110 ;; 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
|
111 ;; 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
|
112 ;; 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
|
113 ;; 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
|
114 ;; 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
|
115 ;; were added for these circumstances. |
15461 | 116 ;; |
17498 | 117 ;; (Ben Wing thinks these hooks are "horribly horribly kludgy", and implemented |
15461 | 118 ;; a `pre-idle-hook', a `mother-of-all-post-command-hooks', for XEmacs 19.14. |
119 ;; He then hacked up a version 1 lazy-lock.el to use `pre-idle-hook' rather | |
120 ;; than `post-command-hook'. Whereas functions on `post-command-hook' are | |
121 ;; called almost as often as possible, functions on `pre-idle-hook' really are | |
122 ;; called as often as possible, even when the mouse moves and, on some systems, | |
123 ;; while XEmacs is idle. Thus, the hook deals with the above problem (b), but | |
124 ;; unfortunately it makes (a) worse and does not address (c) at all. | |
125 ;; | |
126 ;; I freely admit that `redisplay-end-trigger-functions' and, to a much lesser | |
127 ;; extent, `window-size-change-functions' are not pretty. However, I feel that | |
128 ;; a `window-scroll-functions' feature is cleaner than a `pre-idle-hook', and | |
129 ;; the result is faster and smaller, less intrusive and more targeted, code. | |
130 ;; Since `pre-idle-hook' is pretty much like `post-command-hook', there is no | |
131 ;; point in making this version of lazy-lock.el work with it. Anyway, that's | |
132 ;; Lit 30 of my humble opinion. | |
133 ;; | |
134 ;; - Version 1 stealth fontification is also implemented by placing a function | |
135 ;; on `post-command-hook'. This function waits for a given amount of time, | |
136 ;; and, if Emacs remains idle, fontifies where necessary. Again, there are a | |
137 ;; number of problems with using `post-command-hook': | |
138 ;; | |
139 ;; (a) Functions on `post-command-hook' are run sequentially, so this function | |
140 ;; can interfere with other functions on the hook, and vice versa. | |
141 ;; (b) This function waits for a given amount of time, so it can interfere with | |
142 ;; various features that are dealt with by Emacs after a command, e.g., | |
143 ;; region highlighting, asynchronous updating and keystroke echoing. | |
144 ;; (c) Fontification may be required during a command, when `post-command-hook' | |
145 ;; is not run. (Version 2 deferred fontification only.) | |
146 ;; | |
147 ;; Again, `post-command-hook' is completely inappropriate for lazy-lock.el. | |
148 ;; Richard Stallman and Morten Welinder implemented internal Timers and Idle | |
149 ;; Timers for Emacs 19.31. Functions can be run independently at given times | |
150 ;; or after given amounts of idle time. Thus, the feature deals with the above | |
151 ;; problems (a), (b) and (c). Version 2 deferral and stealth are implemented | |
152 ;; 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
|
153 ;; similar to an Emacs Idle Timer function with a fixed zero second timeout.) |
15461 | 154 |
17498 | 155 ;; - Version 1 has the following problems (relative to version 2): |
156 ;; | |
157 ;; (a) It is slow when it does its job. | |
158 ;; (b) It does not always do its job when it should. | |
159 ;; (c) It slows all interaction (when it doesn't need to do its job). | |
160 ;; (d) It interferes with other package functions on `post-command-hook'. | |
161 ;; (e) It interferes with Emacs things within the read-eval loop. | |
162 ;; | |
163 ;; Ben's hacked-up lazy-lock.el 1.14 almost solved (b) but made (c) worse. | |
164 ;; | |
165 ;; - Version 2 has the following additional features (relative to version 1): | |
166 ;; | |
167 ;; (a) It can defer fontification (both on-the-fly and on-scrolling). | |
168 ;; (b) It can fontify contextually (syntactically true on-the-fly). | |
169 | |
15461 | 170 ;; Caveats: |
171 ;; | |
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
|
172 ;; 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
|
173 ;; 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
|
174 ;; 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
|
175 ;; and Lazy Lock fontifies it mercilessly. Maybe it will be fixed one day. |
15461 | 176 ;; |
177 ;; Because buffer text is not necessarily fontified, other packages that expect | |
178 ;; buffer text to be fontified in Font Lock mode either might not work as | |
179 ;; expected, or might not display buffer text as expected. An example of the | |
180 ;; latter is `occur', which copies lines of buffer text into another buffer. | |
181 ;; | |
182 ;; In Emacs 19.30, Lazy Lock mode does not ensure that an existing buffer is | |
183 ;; fontified if it is made visible via a minibuffer-less command that replaces | |
184 ;; an existing window's buffer (e.g., via the Buffers menu). Upgrade! | |
185 ;; | |
186 ;; In Emacs 19.30, Lazy Lock mode does not work well with Transient Mark mode | |
187 ;; or modes based on Comint mode (e.g., Shell mode), and also interferes with | |
188 ;; the echoing of keystrokes in the minibuffer. This is because of the way | |
189 ;; deferral and stealth have to be implemented for Emacs 19.30. Upgrade! | |
190 ;; | |
15499
aa9675ed8ed4
Test for lazy-lock-mode before swapping hooks.
Simon Marshall <simon@gnu.org>
parents:
15461
diff
changeset
|
191 ;; 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
|
192 ;; lazy-lock.el. Maybe it will one day. |
15461 | 193 |
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
|
194 ;; 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
|
195 ;; |
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 ;; 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
|
197 ;; - 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
|
198 ;; 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
|
199 ;; - 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
|
200 ;; 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
|
201 ;; 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
|
202 ;; 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
|
203 ;; 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
|
204 ;; 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
|
205 ;; - 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
|
206 ;; - 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
|
207 ;; - 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
|
208 ;; - 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
|
209 ;; - 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
|
210 ;; - 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
|
211 ;; - 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
|
212 ;; 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
|
213 ;; - 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
|
214 ;; - 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
|
215 ;; - 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
|
216 ;; - 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
|
217 ;; 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
|
218 ;; - 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
|
219 ;; - 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
|
220 ;; - 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
|
221 ;; - 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
|
222 ;; - 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
|
223 ;; - 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
|
224 ;; - 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
|
225 ;; 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
|
226 ;; - 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
|
227 ;; - 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
|
228 ;; - 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
|
229 ;; - 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
|
230 ;; - 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
|
231 ;; - 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
|
232 ;; - 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
|
233 ;; 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
|
234 ;; - 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
|
235 ;; - 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
|
236 ;; - 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
|
237 ;; - 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
|
238 ;; - 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
|
239 ;; - 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
|
240 ;; 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
|
241 ;; - 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
|
242 ;; 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
|
243 ;; - 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
|
244 ;; - 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
|
245 ;; - 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
|
246 ;; - 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
|
247 ;; - 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
|
248 ;; - 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
|
249 ;; - 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
|
250 ;; - 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
|
251 ;; 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
|
252 ;; - 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
|
253 ;; - 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
|
254 ;; - 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
|
255 ;; 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
|
256 ;; - 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
|
257 ;; - Made various wrapping `inhibit-point-motion-hooks' (Vinicius Latorre hint) |
18980
dec0f8a4fd02
Wrap minibuffer-auto-raise where nec. to stop frame raising.
Simon Marshall <simon@gnu.org>
parents:
18464
diff
changeset
|
258 ;; - Made `lazy-lock-fontify-after-idle' wrap `minibuffer-auto-raise' |
20191
0ccfc7a0662f
In deferral, check saved buffers to make sure they exist and have lazy-lock on.
Simon Marshall <simon@gnu.org>
parents:
18980
diff
changeset
|
259 ;; - Made `lazy-lock-fontify-after-defer' paranoid about deferred buffers |
21285
a3d90bdad8f9
use new UPDATE window-end arg.
Simon Marshall <simon@gnu.org>
parents:
20357
diff
changeset
|
260 ;; 2.09--2.10: |
23753
c1bedc24e8af
* lazy-lock.el (lazy-lock-unstall):
Simon Marshall <simon@gnu.org>
parents:
22771
diff
changeset
|
261 ;; - Use `window-end' UPDATE arg for Emacs 20.4 and later. |
22771
bd6a5af23e19
(lazy-lock-fontify-after-visage): Renamed from lazy-lock-fontify-after-outline.
Simon Marshall <simon@gnu.org>
parents:
22589
diff
changeset
|
262 ;; - Made deferral `widen' before unfontifying (Dan Nicolaescu report) |
bd6a5af23e19
(lazy-lock-fontify-after-visage): Renamed from lazy-lock-fontify-after-outline.
Simon Marshall <simon@gnu.org>
parents:
22589
diff
changeset
|
263 ;; - Use `lazy-lock-fontify-after-visage' for hideshow.el (Dan Nicolaescu hint) |
bd6a5af23e19
(lazy-lock-fontify-after-visage): Renamed from lazy-lock-fontify-after-outline.
Simon Marshall <simon@gnu.org>
parents:
22589
diff
changeset
|
264 ;; - Use `other' widget where possible (Andreas Schwab fix) |
23753
c1bedc24e8af
* lazy-lock.el (lazy-lock-unstall):
Simon Marshall <simon@gnu.org>
parents:
22771
diff
changeset
|
265 ;; 2.10--2.11: |
c1bedc24e8af
* lazy-lock.el (lazy-lock-unstall):
Simon Marshall <simon@gnu.org>
parents:
22771
diff
changeset
|
266 ;; - Used `with-temp-message' where possible to make messages temporary. |
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
|
267 |
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
|
268 ;;; 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
|
269 |
15461 | 270 (require 'font-lock) |
271 | |
272 (eval-when-compile | |
273 ;; 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
|
274 (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
|
275 ;; |
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 ;; 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
|
277 (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
|
278 "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
|
279 (` (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
|
280 '((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
|
281 (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
|
282 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
|
283 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
|
284 (,@ 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
|
285 (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
|
286 (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
|
287 (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
|
288 ;; |
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 ;; 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
|
290 (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
|
291 "(do-while TEST BODY...): eval BODY... and repeat if TEST yields non-nil. |
15461 | 292 The order of execution is thus BODY, TEST, BODY, TEST and so on |
293 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
|
294 (` (while (progn (,@ body) (, test))))) |
33421 | 295 (put 'do-while 'lisp-indent-function (get 'while 'lisp-indent-function))) |
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
|
296 |
17498 | 297 (defvar lazy-lock-mode nil) ; Whether we are turned on. |
298 (defvar lazy-lock-buffers nil) ; For deferral. | |
299 (defvar lazy-lock-timers (cons nil nil)) ; For deferral and stealth. | |
15461 | 300 |
301 ;; User Variables: | |
302 | |
23753
c1bedc24e8af
* lazy-lock.el (lazy-lock-unstall):
Simon Marshall <simon@gnu.org>
parents:
22771
diff
changeset
|
303 (defcustom lazy-lock-minimum-size 25600 |
15461 | 304 "*Minimum size of a buffer for demand-driven fontification. |
305 On-demand fontification occurs if the buffer size is greater than this value. | |
306 If nil, means demand-driven fontification is never performed. | |
307 If a list, each element should be a cons pair of the form (MAJOR-MODE . SIZE), | |
308 where MAJOR-MODE is a symbol or t (meaning the default). For example: | |
309 ((c-mode . 25600) (c++-mode . 25600) (rmail-mode . 1048576)) | |
310 means that the minimum size is 25K for buffers in C or C++ modes, one megabyte | |
311 for buffers in Rmail mode, and size is irrelevant otherwise. | |
312 | |
17498 | 313 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
|
314 :type '(choice (const :tag "none" nil) |
fd87760f20cd
Cleaned up custom support.
Simon Marshall <simon@gnu.org>
parents:
17498
diff
changeset
|
315 (integer :tag "size") |
fd87760f20cd
Cleaned up custom support.
Simon Marshall <simon@gnu.org>
parents:
17498
diff
changeset
|
316 (repeat :menu-tag "mode specific" :tag "mode specific" |
fd87760f20cd
Cleaned up custom support.
Simon Marshall <simon@gnu.org>
parents:
17498
diff
changeset
|
317 :value ((t . nil)) |
fd87760f20cd
Cleaned up custom support.
Simon Marshall <simon@gnu.org>
parents:
17498
diff
changeset
|
318 (cons :tag "Instance" |
fd87760f20cd
Cleaned up custom support.
Simon Marshall <simon@gnu.org>
parents:
17498
diff
changeset
|
319 (radio :tag "Mode" |
fd87760f20cd
Cleaned up custom support.
Simon Marshall <simon@gnu.org>
parents:
17498
diff
changeset
|
320 (const :tag "all" t) |
fd87760f20cd
Cleaned up custom support.
Simon Marshall <simon@gnu.org>
parents:
17498
diff
changeset
|
321 (symbol :tag "name")) |
fd87760f20cd
Cleaned up custom support.
Simon Marshall <simon@gnu.org>
parents:
17498
diff
changeset
|
322 (radio :tag "Size" |
fd87760f20cd
Cleaned up custom support.
Simon Marshall <simon@gnu.org>
parents:
17498
diff
changeset
|
323 (const :tag "none" nil) |
fd87760f20cd
Cleaned up custom support.
Simon Marshall <simon@gnu.org>
parents:
17498
diff
changeset
|
324 (integer :tag "size"))))) |
17498 | 325 :group 'lazy-lock) |
15461 | 326 |
17498 | 327 (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
|
328 "*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
|
329 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
|
330 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
|
331 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
|
332 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
|
333 `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
|
334 (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
|
335 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
|
336 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
|
337 |
17498 | 338 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
|
339 :type '(choice (const :tag "never" nil) |
fd87760f20cd
Cleaned up custom support.
Simon Marshall <simon@gnu.org>
parents:
17498
diff
changeset
|
340 (const :tag "always" t) |
fd87760f20cd
Cleaned up custom support.
Simon Marshall <simon@gnu.org>
parents:
17498
diff
changeset
|
341 (set :menu-tag "mode specific" :tag "modes" |
fd87760f20cd
Cleaned up custom support.
Simon Marshall <simon@gnu.org>
parents:
17498
diff
changeset
|
342 :value (not) |
fd87760f20cd
Cleaned up custom support.
Simon Marshall <simon@gnu.org>
parents:
17498
diff
changeset
|
343 (const :tag "Except" not) |
fd87760f20cd
Cleaned up custom support.
Simon Marshall <simon@gnu.org>
parents:
17498
diff
changeset
|
344 (repeat :inline t (symbol :tag "mode")))) |
17498 | 345 :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
|
346 |
17498 | 347 (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
|
348 "*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
|
349 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
|
350 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
|
351 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
|
352 fontification occurs during scrolling, scrolling may be slow. |
15461 | 353 If t, means defer-driven fontification is performed. This means fontification |
354 of those areas is deferred. Thus scrolling may present momentarily unfontified | |
355 areas. However, since fontification does not occur during scrolling, scrolling | |
356 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
|
357 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
|
358 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
|
359 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
|
360 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
|
361 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
|
362 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
|
363 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
|
364 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
|
365 |
17498 | 366 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
|
367 :type '(choice (const :tag "never" nil) |
fd87760f20cd
Cleaned up custom support.
Simon Marshall <simon@gnu.org>
parents:
17498
diff
changeset
|
368 (const :tag "always" t) |
22589
08ff5fd1e950
(lazy-lock-defer-on-scrolling,
Andreas Schwab <schwab@suse.de>
parents:
21285
diff
changeset
|
369 (other :tag "eventually" eventually)) |
17498 | 370 :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
|
371 |
17498 | 372 (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
|
373 "*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
|
374 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
|
375 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
|
376 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
|
377 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
|
378 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
|
379 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
|
380 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
|
381 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
|
382 buffer mode's syntax table, i.e., only if `font-lock-keywords-only' is nil. |
15461 | 383 |
17498 | 384 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
|
385 :type '(choice (const :tag "never" nil) |
fd87760f20cd
Cleaned up custom support.
Simon Marshall <simon@gnu.org>
parents:
17498
diff
changeset
|
386 (const :tag "always" t) |
22589
08ff5fd1e950
(lazy-lock-defer-on-scrolling,
Andreas Schwab <schwab@suse.de>
parents:
21285
diff
changeset
|
387 (other :tag "syntax-driven" syntax-driven)) |
17498 | 388 :group 'lazy-lock) |
15461 | 389 |
17498 | 390 (defcustom lazy-lock-defer-time |
18464
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
391 (if (featurep 'lisp-float-type) (/ (float 1) (float 4)) 1) |
15461 | 392 "*Time in seconds to delay before beginning deferred fontification. |
393 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
|
394 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
|
395 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
|
396 `lazy-lock-defer-contextually'. |
15461 | 397 |
17498 | 398 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
|
399 :type '(choice (const :tag "never" nil) |
fd87760f20cd
Cleaned up custom support.
Simon Marshall <simon@gnu.org>
parents:
17498
diff
changeset
|
400 (number :tag "seconds")) |
17498 | 401 :group 'lazy-lock) |
15461 | 402 |
17498 | 403 (defcustom lazy-lock-stealth-time 30 |
15461 | 404 "*Time in seconds to delay before beginning stealth fontification. |
405 Stealth fontification occurs if there is no input within this time. | |
406 If nil, means stealth fontification is never performed. | |
407 | |
17498 | 408 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
|
409 :type '(choice (const :tag "never" nil) |
fd87760f20cd
Cleaned up custom support.
Simon Marshall <simon@gnu.org>
parents:
17498
diff
changeset
|
410 (number :tag "seconds")) |
17498 | 411 :group 'lazy-lock) |
15461 | 412 |
17498 | 413 (defcustom lazy-lock-stealth-lines (if font-lock-maximum-decoration 100 250) |
15461 | 414 "*Maximum size of a chunk of stealth fontification. |
415 Each iteration of stealth fontification can fontify this number of lines. | |
416 To speed up input response during stealth fontification, at the cost of stealth | |
17498 | 417 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
|
418 :type '(integer :tag "lines") |
17498 | 419 :group 'lazy-lock) |
15461 | 420 |
17498 | 421 (defcustom lazy-lock-stealth-load |
17508
1c2392208ad9
Don't use cl forms in defcustom declarations.
Simon Marshall <simon@gnu.org>
parents:
17507
diff
changeset
|
422 (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
|
423 "*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
|
424 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
|
425 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
|
426 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
|
427 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
|
428 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
|
429 taking longer to fontify, you could reduce the value of this variable. |
17498 | 430 See also `lazy-lock-stealth-nice'." |
17507
fd87760f20cd
Cleaned up custom support.
Simon Marshall <simon@gnu.org>
parents:
17498
diff
changeset
|
431 :type (if (condition-case nil (load-average) (error)) |
fd87760f20cd
Cleaned up custom support.
Simon Marshall <simon@gnu.org>
parents:
17498
diff
changeset
|
432 '(choice (const :tag "never" nil) |
fd87760f20cd
Cleaned up custom support.
Simon Marshall <simon@gnu.org>
parents:
17498
diff
changeset
|
433 (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
|
434 '(const :format "%t: unsupported\n" nil)) |
17498 | 435 :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
|
436 |
17498 | 437 (defcustom lazy-lock-stealth-nice |
15461 | 438 (if (featurep 'lisp-float-type) (/ (float 1) (float 8)) 1) |
439 "*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
|
440 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
|
441 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
|
442 If nil, means stealth fontification is never paused. |
15461 | 443 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
|
444 taking longer to fontify, you could increase the value of this variable. |
17498 | 445 See also `lazy-lock-stealth-load'." |
17507
fd87760f20cd
Cleaned up custom support.
Simon Marshall <simon@gnu.org>
parents:
17498
diff
changeset
|
446 :type '(choice (const :tag "never" nil) |
fd87760f20cd
Cleaned up custom support.
Simon Marshall <simon@gnu.org>
parents:
17498
diff
changeset
|
447 (number :tag "seconds")) |
17498 | 448 :group 'lazy-lock) |
15461 | 449 |
17498 | 450 (defcustom lazy-lock-stealth-verbose |
17508
1c2392208ad9
Don't use cl forms in defcustom declarations.
Simon Marshall <simon@gnu.org>
parents:
17507
diff
changeset
|
451 (if (featurep 'lisp-float-type) |
1c2392208ad9
Don't use cl forms in defcustom declarations.
Simon Marshall <simon@gnu.org>
parents:
17507
diff
changeset
|
452 (and (not lazy-lock-defer-contextually) (not (null font-lock-verbose)))) |
17498 | 453 "*If non-nil, means stealth fontification should show status messages." |
454 :type 'boolean | |
455 :group 'lazy-lock) | |
15461 | 456 |
457 ;; User Functions: | |
458 | |
459 ;;;###autoload | |
460 (defun lazy-lock-mode (&optional arg) | |
461 "Toggle Lazy Lock mode. | |
462 With arg, turn Lazy Lock mode on if and only if arg is positive. Enable it | |
463 automatically in your `~/.emacs' by: | |
464 | |
465 (setq font-lock-support-mode 'lazy-lock-mode) | |
466 | |
467 When Lazy Lock mode is enabled, fontification can be lazy in a number of ways: | |
468 | |
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
|
469 - 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
|
470 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
|
471 `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
|
472 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
|
473 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
|
474 for large buffers. |
15461 | 475 |
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
|
476 - 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
|
477 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
|
478 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
|
479 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
|
480 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
|
481 |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
482 - 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
|
483 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
|
484 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
|
485 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
|
486 slow to keep up with your typing. |
15461 | 487 |
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
|
488 - 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
|
489 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
|
490 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
|
491 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
|
492 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
|
493 contexts. This is useful where strings or comments span lines. |
15461 | 494 |
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
|
495 - 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
|
496 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
|
497 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
|
498 This is useful if any buffer has any deferred fontification. |
15461 | 499 |
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
|
500 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
|
501 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
|
502 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
|
503 event, to refontify some lines you can use \\[font-lock-fontify-block]. |
15461 | 504 |
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
|
505 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
|
506 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
|
507 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
|
508 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
|
509 verbosity is controlled via the variable `lazy-lock-stealth-verbose'." |
15461 | 510 (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
|
511 (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
|
512 (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
|
513 (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
|
514 (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
|
515 ;; 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
|
516 (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
|
517 (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
|
518 (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
|
519 ;; 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
|
520 (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
|
521 (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
|
522 (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
|
523 ;; 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
|
524 (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
|
525 (lazy-lock-unstall))))) |
15461 | 526 |
527 ;;;###autoload | |
528 (defun turn-on-lazy-lock () | |
529 "Unconditionally turn on Lazy Lock mode." | |
530 (lazy-lock-mode t)) | |
531 | |
532 (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
|
533 (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
|
534 (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
|
535 (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
|
536 (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
|
537 (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
|
538 (null font-lock-keywords-only))))) |
15461 | 539 ;; |
540 ;; Tell Font Lock whether Lazy Lock will do fontification. | |
541 (make-local-variable 'font-lock-fontified) | |
542 (setq font-lock-fontified (and min-size (>= (buffer-size) min-size))) | |
543 ;; | |
544 ;; Add the text properties and fontify. | |
545 (if (not font-lock-fontified) | |
546 (lazy-lock-after-fontify-buffer) | |
547 ;; Make sure we fontify in any existing windows showing the buffer. | |
548 (let ((windows (get-buffer-window-list (current-buffer) 'nomini t))) | |
549 (lazy-lock-after-unfontify-buffer) | |
550 (while windows | |
551 (lazy-lock-fontify-conservatively (car windows)) | |
552 (setq windows (cdr windows))))) | |
553 ;; | |
554 ;; Add the fontification hooks. | |
555 (lazy-lock-install-hooks | |
556 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
|
557 (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
|
558 (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
|
559 ((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
|
560 (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
|
561 (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
|
562 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
|
563 (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
|
564 defer-context) |
15461 | 565 ;; |
566 ;; Add the fontification timers. | |
567 (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
|
568 (if (or defer-change defer-scroll defer-context) lazy-lock-defer-time) |
15461 | 569 lazy-lock-stealth-time))) |
570 | |
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
|
571 (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
|
572 defer-change defer-scroll defer-context) |
15461 | 573 ;; |
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
|
574 ;; 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
|
575 (when (or fontifying defer-change defer-scroll defer-context) |
15461 | 576 (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
|
577 (add-hook 'window-scroll-functions (if defer-scroll |
15461 | 578 'lazy-lock-defer-after-scroll |
579 'lazy-lock-fontify-after-scroll) | |
580 nil t)) | |
581 ;; | |
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
|
582 ;; 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
|
583 (when (and fontifying (not defer-change) (not defer-context)) |
15461 | 584 (make-local-hook 'before-change-functions) |
585 (add-hook 'before-change-functions 'lazy-lock-arrange-before-change nil t)) | |
586 ;; | |
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
|
587 ;; 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
|
588 (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
|
589 (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
|
590 (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
|
591 '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
|
592 (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 '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
|
594 (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
|
595 '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
|
596 (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
|
597 '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
|
598 nil t) |
15461 | 599 ;; |
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
|
600 ;; Add package-specific hook. |
15461 | 601 (make-local-hook 'outline-view-change-hook) |
22771
bd6a5af23e19
(lazy-lock-fontify-after-visage): Renamed from lazy-lock-fontify-after-outline.
Simon Marshall <simon@gnu.org>
parents:
22589
diff
changeset
|
602 (add-hook 'outline-view-change-hook 'lazy-lock-fontify-after-visage nil t) |
bd6a5af23e19
(lazy-lock-fontify-after-visage): Renamed from lazy-lock-fontify-after-outline.
Simon Marshall <simon@gnu.org>
parents:
22589
diff
changeset
|
603 (make-local-hook 'hs-hide-hook) |
bd6a5af23e19
(lazy-lock-fontify-after-visage): Renamed from lazy-lock-fontify-after-outline.
Simon Marshall <simon@gnu.org>
parents:
22589
diff
changeset
|
604 (add-hook 'hs-hide-hook 'lazy-lock-fontify-after-visage nil t)) |
15461 | 605 |
606 (defun lazy-lock-install-timers (dtime stime) | |
607 ;; Schedule or re-schedule the deferral and stealth timers. | |
608 ;; The layout of `lazy-lock-timers' is: | |
609 ;; ((DEFER-TIME . DEFER-TIMER) (STEALTH-TIME . STEALTH-TIMER) | |
610 ;; If an idle timeout has changed, cancel the existing idle timer (if there | |
611 ;; is one) and schedule a new one (if the new idle timeout is non-nil). | |
612 (unless (eq dtime (car (car lazy-lock-timers))) | |
613 (let ((defer (car lazy-lock-timers))) | |
614 (when (cdr defer) | |
615 (cancel-timer (cdr defer))) | |
616 (setcar lazy-lock-timers (cons dtime (and dtime | |
617 (run-with-idle-timer dtime t 'lazy-lock-fontify-after-defer)))))) | |
618 (unless (eq stime (car (cdr lazy-lock-timers))) | |
619 (let ((stealth (cdr lazy-lock-timers))) | |
620 (when (cdr stealth) | |
621 (cancel-timer (cdr stealth))) | |
622 (setcdr lazy-lock-timers (cons stime (and stime | |
623 (run-with-idle-timer stime t 'lazy-lock-fontify-after-idle))))))) | |
624 | |
625 (defun lazy-lock-unstall () | |
626 ;; | |
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
|
627 ;; 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
|
628 ;; 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
|
629 (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
|
630 (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
|
631 (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
|
632 (> (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
|
633 font-lock-verbose))) |
23753
c1bedc24e8af
* lazy-lock.el (lazy-lock-unstall):
Simon Marshall <simon@gnu.org>
parents:
22771
diff
changeset
|
634 (with-temp-message |
24004
42a8238f0597
* lazy-lock.el (lazy-lock-unstall):
Simon Marshall <simon@gnu.org>
parents:
23753
diff
changeset
|
635 (when verbose |
42a8238f0597
* lazy-lock.el (lazy-lock-unstall):
Simon Marshall <simon@gnu.org>
parents:
23753
diff
changeset
|
636 (format "Fontifying %s..." (buffer-name))) |
23753
c1bedc24e8af
* lazy-lock.el (lazy-lock-unstall):
Simon Marshall <simon@gnu.org>
parents:
22771
diff
changeset
|
637 ;; Make sure we fontify etc. in the whole buffer. |
c1bedc24e8af
* lazy-lock.el (lazy-lock-unstall):
Simon Marshall <simon@gnu.org>
parents:
22771
diff
changeset
|
638 (save-restriction |
c1bedc24e8af
* lazy-lock.el (lazy-lock-unstall):
Simon Marshall <simon@gnu.org>
parents:
22771
diff
changeset
|
639 (widen) |
c1bedc24e8af
* lazy-lock.el (lazy-lock-unstall):
Simon Marshall <simon@gnu.org>
parents:
22771
diff
changeset
|
640 (lazy-lock-fontify-region (point-min) (point-max)))))) |
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
|
641 (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
|
642 ;; |
15461 | 643 ;; Remove the text properties. |
644 (lazy-lock-after-unfontify-buffer) | |
645 ;; | |
646 ;; Remove the fontification hooks. | |
647 (remove-hook 'window-scroll-functions 'lazy-lock-fontify-after-scroll t) | |
648 (remove-hook 'window-scroll-functions 'lazy-lock-defer-after-scroll t) | |
649 (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
|
650 (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
|
651 (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
|
652 (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
|
653 (remove-hook 'after-change-functions 'lazy-lock-defer-rest-after-change t) |
22771
bd6a5af23e19
(lazy-lock-fontify-after-visage): Renamed from lazy-lock-fontify-after-outline.
Simon Marshall <simon@gnu.org>
parents:
22589
diff
changeset
|
654 (remove-hook 'outline-view-change-hook 'lazy-lock-fontify-after-visage t) |
bd6a5af23e19
(lazy-lock-fontify-after-visage): Renamed from lazy-lock-fontify-after-outline.
Simon Marshall <simon@gnu.org>
parents:
22589
diff
changeset
|
655 (remove-hook 'hs-hide-hook 'lazy-lock-fontify-after-visage t)) |
15461 | 656 |
657 ;; Hook functions. | |
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 ;; 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
|
660 ;; 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
|
661 ;; 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
|
662 ;; 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
|
663 ;; 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
|
664 ;; 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
|
665 |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-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 ;; 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
|
667 ;; |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-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 ;; (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
|
669 ;; 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
|
670 ;; 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
|
671 ;; 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
|
672 ;; 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
|
673 |
15461 | 674 (defun lazy-lock-fontify-after-scroll (window window-start) |
675 ;; Called from `window-scroll-functions'. | |
21285
a3d90bdad8f9
use new UPDATE window-end arg.
Simon Marshall <simon@gnu.org>
parents:
20357
diff
changeset
|
676 ;; Fontify WINDOW from WINDOW-START following the scroll. |
18464
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
677 (let ((inhibit-point-motion-hooks t)) |
21285
a3d90bdad8f9
use new UPDATE window-end arg.
Simon Marshall <simon@gnu.org>
parents:
20357
diff
changeset
|
678 (lazy-lock-fontify-region window-start (window-end window t))) |
15461 | 679 ;; A prior deletion that did not cause scrolling, followed by a scroll, would |
680 ;; result in an unnecessary trigger after this if we did not cancel it now. | |
681 (set-window-redisplay-end-trigger window nil)) | |
682 | |
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
|
683 (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
|
684 ;; 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
|
685 ;; 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
|
686 ;; 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
|
687 (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
|
688 (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
|
689 ;; 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
|
690 ;; 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
|
691 (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
|
692 |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-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 ;; (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
|
694 ;; 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
|
695 ;; 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
|
696 ;; hook `window-size-change-functions'. |
15461 | 697 |
698 (defun lazy-lock-fontify-after-resize (frame) | |
699 ;; 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
|
700 ;; 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
|
701 ;; `window-start' or `window-end' so we fontify conservatively. |
15461 | 702 (save-excursion |
703 (save-selected-window | |
704 (select-frame frame) | |
705 (walk-windows (function (lambda (window) | |
706 (set-buffer (window-buffer window)) | |
707 (when lazy-lock-mode | |
708 (lazy-lock-fontify-conservatively window)) | |
709 (set-window-redisplay-end-trigger window nil))) | |
710 'nomini frame)))) | |
711 | |
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
|
712 ;; (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
|
713 ;; 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
|
714 ;; `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
|
715 ;; 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
|
716 ;; 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
|
717 ;; 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
|
718 ;; `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
|
719 ;; 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
|
720 |
15461 | 721 (defun lazy-lock-arrange-before-change (beg end) |
722 ;; Called from `before-change-functions'. | |
723 ;; Arrange that if text becomes visible it will be fontified (if a deletion | |
724 ;; is pending, text might become visible at the bottom). | |
725 (unless (eq beg end) | |
726 (let ((windows (get-buffer-window-list (current-buffer) 'nomini t)) window) | |
727 (while windows | |
728 (setq window (car windows)) | |
729 (unless (markerp (window-redisplay-end-trigger window)) | |
730 (set-window-redisplay-end-trigger window (make-marker))) | |
731 (set-marker (window-redisplay-end-trigger window) (window-end window)) | |
732 (setq windows (cdr windows)))))) | |
733 | |
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
|
734 (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
|
735 ;; Called from `redisplay-end-trigger-functions'. |
21285
a3d90bdad8f9
use new UPDATE window-end arg.
Simon Marshall <simon@gnu.org>
parents:
20357
diff
changeset
|
736 ;; Fontify WINDOW from TRIGGER-POINT following the redisplay. |
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
|
737 ;; We could probably just use `lazy-lock-fontify-after-scroll' without loss: |
21285
a3d90bdad8f9
use new UPDATE window-end arg.
Simon Marshall <simon@gnu.org>
parents:
20357
diff
changeset
|
738 ;; (inline (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
|
739 (let ((inhibit-point-motion-hooks t)) |
21285
a3d90bdad8f9
use new UPDATE window-end arg.
Simon Marshall <simon@gnu.org>
parents:
20357
diff
changeset
|
740 (lazy-lock-fontify-region trigger-point (window-end window t)))) |
15461 | 741 |
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
|
742 ;; 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
|
743 ;; 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
|
744 ;; `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
|
745 ;; `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
|
746 ;; 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
|
747 |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-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 (defalias 'lazy-lock-fontify-line-after-change |
15461 | 749 ;; 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
|
750 ;; 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
|
751 '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
|
752 |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-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 (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
|
754 ;; 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
|
755 ;; 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
|
756 ;; 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
|
757 ;; 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
|
758 (lazy-lock-fontify-line-after-change beg end old-len) |
15461 | 759 (save-buffer-state nil |
760 (unless (memq (current-buffer) lazy-lock-buffers) | |
761 (push (current-buffer) lazy-lock-buffers)) | |
22771
bd6a5af23e19
(lazy-lock-fontify-after-visage): Renamed from lazy-lock-fontify-after-outline.
Simon Marshall <simon@gnu.org>
parents:
22589
diff
changeset
|
762 (save-restriction |
bd6a5af23e19
(lazy-lock-fontify-after-visage): Renamed from lazy-lock-fontify-after-outline.
Simon Marshall <simon@gnu.org>
parents:
22589
diff
changeset
|
763 (widen) |
bd6a5af23e19
(lazy-lock-fontify-after-visage): Renamed from lazy-lock-fontify-after-outline.
Simon Marshall <simon@gnu.org>
parents:
22589
diff
changeset
|
764 (remove-text-properties end (point-max) '(lazy-lock 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
|
765 |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
766 (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
|
767 ;; 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
|
768 ;; 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
|
769 ;; 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
|
770 (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
|
771 (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
|
772 (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
|
773 (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
|
774 (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
|
775 '(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
|
776 |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
777 (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
|
778 ;; 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
|
779 ;; 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
|
780 ;; 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
|
781 (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
|
782 (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
|
783 (push (current-buffer) lazy-lock-buffers)) |
22771
bd6a5af23e19
(lazy-lock-fontify-after-visage): Renamed from lazy-lock-fontify-after-outline.
Simon Marshall <simon@gnu.org>
parents:
22589
diff
changeset
|
784 (save-restriction |
bd6a5af23e19
(lazy-lock-fontify-after-visage): Renamed from lazy-lock-fontify-after-outline.
Simon Marshall <simon@gnu.org>
parents:
22589
diff
changeset
|
785 (widen) |
bd6a5af23e19
(lazy-lock-fontify-after-visage): Renamed from lazy-lock-fontify-after-outline.
Simon Marshall <simon@gnu.org>
parents:
22589
diff
changeset
|
786 (remove-text-properties (max (1- beg) (point-min)) |
bd6a5af23e19
(lazy-lock-fontify-after-visage): Renamed from lazy-lock-fontify-after-outline.
Simon Marshall <simon@gnu.org>
parents:
22589
diff
changeset
|
787 (point-max) |
bd6a5af23e19
(lazy-lock-fontify-after-visage): Renamed from lazy-lock-fontify-after-outline.
Simon Marshall <simon@gnu.org>
parents:
22589
diff
changeset
|
788 '(lazy-lock 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
|
789 |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-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 ;; 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
|
791 ;; functions. They are set up as Idle Timers. |
15461 | 792 |
793 (defun lazy-lock-fontify-after-defer () | |
794 ;; Called from `timer-idle-list'. | |
795 ;; Fontify all windows where deferral has occurred for its buffer. | |
20191
0ccfc7a0662f
In deferral, check saved buffers to make sure they exist and have lazy-lock on.
Simon Marshall <simon@gnu.org>
parents:
18980
diff
changeset
|
796 (save-excursion |
0ccfc7a0662f
In deferral, check saved buffers to make sure they exist and have lazy-lock on.
Simon Marshall <simon@gnu.org>
parents:
18980
diff
changeset
|
797 (while (and lazy-lock-buffers (not (input-pending-p))) |
0ccfc7a0662f
In deferral, check saved buffers to make sure they exist and have lazy-lock on.
Simon Marshall <simon@gnu.org>
parents:
18980
diff
changeset
|
798 (let ((buffer (car lazy-lock-buffers)) windows) |
0ccfc7a0662f
In deferral, check saved buffers to make sure they exist and have lazy-lock on.
Simon Marshall <simon@gnu.org>
parents:
18980
diff
changeset
|
799 ;; Paranoia: check that the buffer is still live and Lazy Lock mode on. |
0ccfc7a0662f
In deferral, check saved buffers to make sure they exist and have lazy-lock on.
Simon Marshall <simon@gnu.org>
parents:
18980
diff
changeset
|
800 (when (buffer-live-p buffer) |
0ccfc7a0662f
In deferral, check saved buffers to make sure they exist and have lazy-lock on.
Simon Marshall <simon@gnu.org>
parents:
18980
diff
changeset
|
801 (set-buffer buffer) |
0ccfc7a0662f
In deferral, check saved buffers to make sure they exist and have lazy-lock on.
Simon Marshall <simon@gnu.org>
parents:
18980
diff
changeset
|
802 (when lazy-lock-mode |
0ccfc7a0662f
In deferral, check saved buffers to make sure they exist and have lazy-lock on.
Simon Marshall <simon@gnu.org>
parents:
18980
diff
changeset
|
803 (setq windows (get-buffer-window-list buffer 'nomini t)) |
0ccfc7a0662f
In deferral, check saved buffers to make sure they exist and have lazy-lock on.
Simon Marshall <simon@gnu.org>
parents:
18980
diff
changeset
|
804 (while windows |
0ccfc7a0662f
In deferral, check saved buffers to make sure they exist and have lazy-lock on.
Simon Marshall <simon@gnu.org>
parents:
18980
diff
changeset
|
805 (lazy-lock-fontify-window (car windows)) |
0ccfc7a0662f
In deferral, check saved buffers to make sure they exist and have lazy-lock on.
Simon Marshall <simon@gnu.org>
parents:
18980
diff
changeset
|
806 (setq windows (cdr windows))))) |
0ccfc7a0662f
In deferral, check saved buffers to make sure they exist and have lazy-lock on.
Simon Marshall <simon@gnu.org>
parents:
18980
diff
changeset
|
807 (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
|
808 ;; 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
|
809 (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
|
810 (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
|
811 (not (or (input-pending-p) (lazy-lock-unfontified-p)))) |
15461 | 812 (remove-hook 'window-scroll-functions 'lazy-lock-fontify-after-scroll t) |
813 (add-hook 'window-scroll-functions 'lazy-lock-defer-after-scroll nil t))) | |
814 | |
815 (defun lazy-lock-fontify-after-idle () | |
816 ;; Called from `timer-idle-list'. | |
817 ;; Fontify all buffers that need it, stealthily while idle. | |
818 (unless (or executing-kbd-macro (window-minibuffer-p (selected-window))) | |
819 ;; Loop over all buffers, fontify stealthily for each if necessary. | |
18980
dec0f8a4fd02
Wrap minibuffer-auto-raise where nec. to stop frame raising.
Simon Marshall <simon@gnu.org>
parents:
18464
diff
changeset
|
820 (let ((buffers (buffer-list)) (continue t) |
dec0f8a4fd02
Wrap minibuffer-auto-raise where nec. to stop frame raising.
Simon Marshall <simon@gnu.org>
parents:
18464
diff
changeset
|
821 message message-log-max minibuffer-auto-raise) |
15461 | 822 (save-excursion |
823 (do-while (and buffers continue) | |
824 (set-buffer (car buffers)) | |
825 (if (not (and lazy-lock-mode (lazy-lock-unfontified-p))) | |
826 (setq continue (not (input-pending-p))) | |
827 ;; Fontify regions in this buffer while there is no input. | |
23753
c1bedc24e8af
* lazy-lock.el (lazy-lock-unstall):
Simon Marshall <simon@gnu.org>
parents:
22771
diff
changeset
|
828 (with-temp-message |
24004
42a8238f0597
* lazy-lock.el (lazy-lock-unstall):
Simon Marshall <simon@gnu.org>
parents:
23753
diff
changeset
|
829 (when lazy-lock-stealth-verbose |
42a8238f0597
* lazy-lock.el (lazy-lock-unstall):
Simon Marshall <simon@gnu.org>
parents:
23753
diff
changeset
|
830 "Fontifying stealthily...") |
23753
c1bedc24e8af
* lazy-lock.el (lazy-lock-unstall):
Simon Marshall <simon@gnu.org>
parents:
22771
diff
changeset
|
831 (do-while (and (lazy-lock-unfontified-p) continue) |
c1bedc24e8af
* lazy-lock.el (lazy-lock-unstall):
Simon Marshall <simon@gnu.org>
parents:
22771
diff
changeset
|
832 (if (and lazy-lock-stealth-load |
c1bedc24e8af
* lazy-lock.el (lazy-lock-unstall):
Simon Marshall <simon@gnu.org>
parents:
22771
diff
changeset
|
833 (> (car (load-average)) lazy-lock-stealth-load)) |
c1bedc24e8af
* lazy-lock.el (lazy-lock-unstall):
Simon Marshall <simon@gnu.org>
parents:
22771
diff
changeset
|
834 ;; Wait a while before continuing with the loop. |
c1bedc24e8af
* lazy-lock.el (lazy-lock-unstall):
Simon Marshall <simon@gnu.org>
parents:
22771
diff
changeset
|
835 (progn |
c1bedc24e8af
* lazy-lock.el (lazy-lock-unstall):
Simon Marshall <simon@gnu.org>
parents:
22771
diff
changeset
|
836 (when message |
c1bedc24e8af
* lazy-lock.el (lazy-lock-unstall):
Simon Marshall <simon@gnu.org>
parents:
22771
diff
changeset
|
837 (message "Fontifying stealthily...suspended") |
c1bedc24e8af
* lazy-lock.el (lazy-lock-unstall):
Simon Marshall <simon@gnu.org>
parents:
22771
diff
changeset
|
838 (setq message nil)) |
c1bedc24e8af
* lazy-lock.el (lazy-lock-unstall):
Simon Marshall <simon@gnu.org>
parents:
22771
diff
changeset
|
839 (setq continue (sit-for (or lazy-lock-stealth-time 30)))) |
c1bedc24e8af
* lazy-lock.el (lazy-lock-unstall):
Simon Marshall <simon@gnu.org>
parents:
22771
diff
changeset
|
840 ;; Fontify a chunk. |
c1bedc24e8af
* lazy-lock.el (lazy-lock-unstall):
Simon Marshall <simon@gnu.org>
parents:
22771
diff
changeset
|
841 (when lazy-lock-stealth-verbose |
c1bedc24e8af
* lazy-lock.el (lazy-lock-unstall):
Simon Marshall <simon@gnu.org>
parents:
22771
diff
changeset
|
842 (if message |
c1bedc24e8af
* lazy-lock.el (lazy-lock-unstall):
Simon Marshall <simon@gnu.org>
parents:
22771
diff
changeset
|
843 (message "Fontifying stealthily... %2d%% of %s" |
c1bedc24e8af
* lazy-lock.el (lazy-lock-unstall):
Simon Marshall <simon@gnu.org>
parents:
22771
diff
changeset
|
844 (lazy-lock-percent-fontified) (buffer-name)) |
c1bedc24e8af
* lazy-lock.el (lazy-lock-unstall):
Simon Marshall <simon@gnu.org>
parents:
22771
diff
changeset
|
845 (message "Fontifying stealthily...") |
c1bedc24e8af
* lazy-lock.el (lazy-lock-unstall):
Simon Marshall <simon@gnu.org>
parents:
22771
diff
changeset
|
846 (setq message t))) |
c1bedc24e8af
* lazy-lock.el (lazy-lock-unstall):
Simon Marshall <simon@gnu.org>
parents:
22771
diff
changeset
|
847 (lazy-lock-fontify-chunk) |
c1bedc24e8af
* lazy-lock.el (lazy-lock-unstall):
Simon Marshall <simon@gnu.org>
parents:
22771
diff
changeset
|
848 (setq continue (sit-for (or lazy-lock-stealth-nice 0))))))) |
c1bedc24e8af
* lazy-lock.el (lazy-lock-unstall):
Simon Marshall <simon@gnu.org>
parents:
22771
diff
changeset
|
849 (setq buffers (cdr buffers))))))) |
15461 | 850 |
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
|
851 ;; 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
|
852 |
22771
bd6a5af23e19
(lazy-lock-fontify-after-visage): Renamed from lazy-lock-fontify-after-outline.
Simon Marshall <simon@gnu.org>
parents:
22589
diff
changeset
|
853 (defun lazy-lock-fontify-after-visage () |
bd6a5af23e19
(lazy-lock-fontify-after-visage): Renamed from lazy-lock-fontify-after-outline.
Simon Marshall <simon@gnu.org>
parents:
22589
diff
changeset
|
854 ;; Called from `outline-view-change-hook' and `hs-hide-hook'. |
15461 | 855 ;; Fontify windows showing the current buffer, as its visibility has changed. |
22771
bd6a5af23e19
(lazy-lock-fontify-after-visage): Renamed from lazy-lock-fontify-after-outline.
Simon Marshall <simon@gnu.org>
parents:
22589
diff
changeset
|
856 ;; This is a conspiracy hack between lazy-lock.el, outline.el and |
bd6a5af23e19
(lazy-lock-fontify-after-visage): Renamed from lazy-lock-fontify-after-outline.
Simon Marshall <simon@gnu.org>
parents:
22589
diff
changeset
|
857 ;; hideshow.el. |
15461 | 858 (let ((windows (get-buffer-window-list (current-buffer) 'nomini t))) |
859 (while windows | |
860 (lazy-lock-fontify-conservatively (car windows)) | |
861 (setq windows (cdr windows))))) | |
862 | |
863 (defun lazy-lock-after-fontify-buffer () | |
864 ;; Called from `font-lock-after-fontify-buffer'. | |
865 ;; Mark the current buffer as fontified. | |
866 ;; This is a conspiracy hack between lazy-lock.el and font-lock.el. | |
867 (save-buffer-state nil | |
868 (add-text-properties (point-min) (point-max) '(lazy-lock t)))) | |
869 | |
870 (defun lazy-lock-after-unfontify-buffer () | |
871 ;; Called from `font-lock-after-unfontify-buffer'. | |
872 ;; Mark the current buffer as unfontified. | |
873 ;; This is a conspiracy hack between lazy-lock.el and font-lock.el. | |
874 (save-buffer-state nil | |
875 (remove-text-properties (point-min) (point-max) '(lazy-lock nil)))) | |
876 | |
877 ;; Fontification functions. | |
878 | |
879 ;; If packages want to ensure that some region of the buffer is fontified, they | |
880 ;; should use this function. For an example, see ps-print.el. | |
881 (defun lazy-lock-fontify-region (beg end) | |
882 ;; Fontify between BEG and END, where necessary, in the current buffer. | |
883 (when (setq beg (text-property-any beg end 'lazy-lock nil)) | |
884 (save-excursion | |
885 (save-match-data | |
886 (save-buffer-state | |
887 ;; Ensure syntactic fontification is always correct. | |
888 (font-lock-beginning-of-syntax-function next) | |
889 ;; Find successive unfontified regions between BEG and END. | |
890 (condition-case data | |
891 (do-while beg | |
892 (setq next (or (text-property-any beg end 'lazy-lock t) end)) | |
893 ;; Make sure the region end points are at beginning of line. | |
894 (goto-char beg) | |
895 (unless (bolp) | |
896 (beginning-of-line) | |
897 (setq beg (point))) | |
898 (goto-char next) | |
899 (unless (bolp) | |
900 (forward-line) | |
901 (setq next (point))) | |
902 ;; Fontify the region, then flag it as fontified. | |
903 (font-lock-fontify-region beg next) | |
904 (add-text-properties beg next '(lazy-lock t)) | |
905 (setq beg (text-property-any next end 'lazy-lock nil))) | |
906 ((error quit) (message "Fontifying region...%s" data)))))))) | |
907 | |
908 (defun lazy-lock-fontify-chunk () | |
909 ;; 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
|
910 (let ((inhibit-point-motion-hooks t)) |
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
911 (save-excursion |
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
912 (save-restriction |
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
913 (widen) |
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
914 ;; 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
|
915 (end-of-line) |
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
916 ;; 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
|
917 (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
|
918 (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
|
919 ;; Fontify from the nearest unfontified position. |
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
920 (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
|
921 ;; 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
|
922 (lazy-lock-fontify-region |
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
923 (progn (goto-char (or next (point-min))) |
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
924 (beginning-of-line) |
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
925 (point)) |
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
926 (progn (goto-char (or next (point-min))) |
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
927 (forward-line lazy-lock-stealth-lines) |
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
928 (point))) |
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
929 ;; The previous region is the nearest not fontified. |
15461 | 930 (lazy-lock-fontify-region |
18464
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
931 (progn (goto-char prev) |
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
932 (forward-line (- lazy-lock-stealth-lines)) |
15461 | 933 (point)) |
18464
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
934 (progn (goto-char prev) |
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
935 (forward-line) |
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
936 (point))))))))) |
15461 | 937 |
938 (defun lazy-lock-fontify-window (window) | |
939 ;; Fontify in WINDOW between `window-start' and `window-end'. | |
940 ;; 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
|
941 (with-current-buffer (window-buffer window) |
15461 | 942 (lazy-lock-fontify-region (window-start window) (window-end window)))) |
943 | |
944 (defun lazy-lock-fontify-conservatively (window) | |
945 ;; Fontify in WINDOW conservatively around point. | |
946 ;; Where we cannot use `window-start' and `window-end' we do `window-height' | |
947 ;; 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
|
948 (with-current-buffer (window-buffer window) |
18464
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
949 (let ((inhibit-point-motion-hooks t)) |
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
950 (lazy-lock-fontify-region |
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
951 (save-excursion |
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
952 (goto-char (window-point window)) |
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
953 (vertical-motion (- (window-height window)) window) (point)) |
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
954 (save-excursion |
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
955 (goto-char (window-point window)) |
9e96c09a1466
wrap inhibit-point-motion-hooks where nec.
Simon Marshall <simon@gnu.org>
parents:
17682
diff
changeset
|
956 (vertical-motion (window-height window) window) (point)))))) |
15461 | 957 |
958 (defun lazy-lock-unfontified-p () | |
959 ;; Return non-nil if there is anywhere still to be fontified. | |
960 (save-restriction | |
961 (widen) | |
962 (text-property-any (point-min) (point-max) 'lazy-lock nil))) | |
963 | |
964 (defun lazy-lock-percent-fontified () | |
965 ;; Return the percentage (of characters) of the buffer that are fontified. | |
966 (save-restriction | |
967 (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
|
968 (let ((beg (point-min)) (size 0) next) |
15461 | 969 ;; 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
|
970 (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
|
971 (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
|
972 (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
|
973 (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
|
974 (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
|
975 ;; 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
|
976 (truncate (* (/ (float size) (point-max)) 100))))) |
15461 | 977 |
978 ;; Version dependent workarounds and fixes. | |
979 | |
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
|
980 (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
|
981 ;; |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
982 ;; 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
|
983 (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
|
984 (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
|
985 (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
|
986 (princ "\n") |
23753
c1bedc24e8af
* lazy-lock.el (lazy-lock-unstall):
Simon Marshall <simon@gnu.org>
parents:
22771
diff
changeset
|
987 (princ "This variable cannot now be a list of modes and time,\n") |
c1bedc24e8af
* lazy-lock.el (lazy-lock-unstall):
Simon Marshall <simon@gnu.org>
parents:
22771
diff
changeset
|
988 (princ "so instead use ") |
c1bedc24e8af
* lazy-lock.el (lazy-lock-unstall):
Simon Marshall <simon@gnu.org>
parents:
22771
diff
changeset
|
989 (princ (substitute-command-keys "\\[customize-option]")) |
c1bedc24e8af
* lazy-lock.el (lazy-lock-unstall):
Simon Marshall <simon@gnu.org>
parents:
22771
diff
changeset
|
990 (princ " to modify the variables, or put the forms:\n") |
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
|
991 (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
|
992 (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
|
993 (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
|
994 (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
|
995 (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
|
996 (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
|
997 (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
|
998 (princ "The above forms have been evaluated for this editor session,\n") |
23753
c1bedc24e8af
* lazy-lock.el (lazy-lock-unstall):
Simon Marshall <simon@gnu.org>
parents:
22771
diff
changeset
|
999 (princ "but you should use ") |
c1bedc24e8af
* lazy-lock.el (lazy-lock-unstall):
Simon Marshall <simon@gnu.org>
parents:
22771
diff
changeset
|
1000 (princ (substitute-command-keys "\\[customize-option]")) |
c1bedc24e8af
* lazy-lock.el (lazy-lock-unstall):
Simon Marshall <simon@gnu.org>
parents:
22771
diff
changeset
|
1001 (princ " or change your ~/.emacs now.")) |
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
|
1002 (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
|
1003 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
|
1004 |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
1005 (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
|
1006 ;; |
f4429e6fe33c
(a) split lazy-lock-defer-time into lazy-lock-defer-time and lazy-lock-defer-on-the-fly, (b) add lazy-lock-defer-on-scrolling, (c) use these to choose one of lazy-lock-defer-line-after-change, lazy-lock-defer-rest-after-change, lazy-lock-fontify-line-after-change, lazy-lock-fontify-rest-after-change to add to after-change-functions, (d) use with-current-buffer rather than save-excursion, (e) avoid integer overflow in lazy-lock-percent-fontified.
Simon Marshall <simon@gnu.org>
parents:
15499
diff
changeset
|
1007 ;; 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
|
1008 (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
|
1009 (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
|
1010 (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
|
1011 (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
|
1012 (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
|
1013 (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
|
1014 (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
|
1015 (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
|
1016 (princ "This variable is now called `lazy-lock-defer-on-scrolling',\n") |
23753
c1bedc24e8af
* lazy-lock.el (lazy-lock-unstall):
Simon Marshall <simon@gnu.org>
parents:
22771
diff
changeset
|
1017 (princ "so instead use ") |
c1bedc24e8af
* lazy-lock.el (lazy-lock-unstall):
Simon Marshall <simon@gnu.org>
parents:
22771
diff
changeset
|
1018 (princ (substitute-command-keys "\\[customize-option]")) |
c1bedc24e8af
* lazy-lock.el (lazy-lock-unstall):
Simon Marshall <simon@gnu.org>
parents:
22771
diff
changeset
|
1019 (princ " to modify the variable, or put the form:\n") |
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
|
1020 (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
|
1021 (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
|
1022 (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
|
1023 (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
|
1024 (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
|
1025 (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
|
1026 (princ "The above form has been evaluated for this editor session,\n") |
23753
c1bedc24e8af
* lazy-lock.el (lazy-lock-unstall):
Simon Marshall <simon@gnu.org>
parents:
22771
diff
changeset
|
1027 (princ "but you should use ") |
c1bedc24e8af
* lazy-lock.el (lazy-lock-unstall):
Simon Marshall <simon@gnu.org>
parents:
22771
diff
changeset
|
1028 (princ (substitute-command-keys "\\[customize-option]")) |
c1bedc24e8af
* lazy-lock.el (lazy-lock-unstall):
Simon Marshall <simon@gnu.org>
parents:
22771
diff
changeset
|
1029 (princ " or change your ~/.emacs now.")) |
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
|
1030 (setq lazy-lock-defer-on-scrolling lazy-lock-defer-driven)) |
15461 | 1031 |
1032 ;; Install ourselves: | |
1033 | |
1034 (add-hook 'window-size-change-functions 'lazy-lock-fontify-after-resize) | |
1035 (add-hook 'redisplay-end-trigger-functions 'lazy-lock-fontify-after-trigger) | |
1036 | |
1037 (unless (assq 'lazy-lock-mode minor-mode-alist) | |
1038 (setq minor-mode-alist (append minor-mode-alist '((lazy-lock-mode nil))))) | |
1039 | |
1040 ;; Provide ourselves: | |
1041 | |
1042 (provide 'lazy-lock) | |
1043 | |
1044 ;;; lazy-lock.el ends here |