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