annotate lisp/packages/lazy-lock.el @ 0:376386a54a3c r19-14

Import from CVS: tag r19-14
author cvs
date Mon, 13 Aug 2007 08:45:50 +0200
parents
children ac2d302a0011
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 ;;; lazy-lock.el --- Lazy demand-driven fontification for fast Font Lock mode.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 ;; Copyright (C) 1994, 1995 Free Software Foundation, Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 ;; Author: Simon Marshall <simon@gnu.ai.mit.edu>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 ;; Keywords: faces files
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 ;; Version: 1.14
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 ;; LCD Archive Entry:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 ;; lazy-lock|Simon Marshall|simon@gnu.ai.mit.edu|
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 ;; Lazy Font Lock mode (with fast demand-driven fontification).|
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ;; 13-Oct-95|1.14|~/modes/lazy-lock.el.Z|
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 ;; The archive is archive.cis.ohio-state.edu in /pub/gnu/emacs/elisp-archive.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 ;;; This file is part of GNU Emacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 ;; GNU Emacs is free software; you can redistribute it and/or modify
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 ;; it under the terms of the GNU General Public License as published by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 ;; the Free Software Foundation; either version 2, or (at your option)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 ;; any later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 ;; GNU Emacs is distributed in the hope that it will be useful,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 ;; GNU General Public License for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 ;; You should have received a copy of the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 ;; along with GNU Emacs; see the file COPYING. If not, write to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 ;;; Synched up with: Not in FSF. (This seems very strange to me.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 ;;; Commentary:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 ;; Purpose:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 ;; To make visiting buffers in `font-lock-mode' faster by making fontification
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 ;; be demand-driven and stealthy.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 ;; Fontification only occurs when, and where, necessary.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 ;; See caveats and feedback below. See also the defer-lock and fast-lock
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 ;; packages. (But don't use lazy-lock.el and fast-lock.el at the same time!)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 ;; Installation:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 ;; Put this file somewhere where Emacs can find it (i.e., in one of the paths
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 ;; in your `load-path'), `byte-compile-file' it, and put in your ~/.emacs:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 ;; (autoload 'turn-on-lazy-lock "lazy-lock"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 ;; "Unconditionally turn on Lazy Lock mode.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 ;; (add-hook 'font-lock-mode-hook 'turn-on-lazy-lock)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 ;; Start up a new Emacs and use font-lock as usual (except that you can use the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 ;; so-called "gaudier" fontification regexps on big files without frustration).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 ;; In a buffer (which has `font-lock-mode' enabled) which is at least
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 ;; `lazy-lock-minimum-size' characters long, only the visible portion of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 ;; buffer will be fontified. Motion around the buffer will fontify those
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 ;; visible portions that were not previous fontified. If the variable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 ;; `lazy-lock-hide-invisible' is non-nil, redisplay will be delayed until after
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 ;; fontification. Otherwise, text that has not yet been fontified is displayed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 ;; in `lazy-lock-invisible-foreground'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 ;; If stealth fontification is enabled, fontification will occur in invisible
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 ;; parts of the buffer after `lazy-lock-stealth-time' seconds of idle time.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 ;; Advanced Use:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 ;; You can also do fancy things with `advice'. For example, to fontify when
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 ;; dragging the scroll-bar in Emacs, you could put in your ~/.emacs:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 ;; (autoload 'lazy-lock-post-command-fontify-windows "lazy-lock")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 ;; (defadvice scroll-bar-drag-1 (after fontify-window activate compile)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 ;; (let ((lazy-lock-walk-windows nil) (lazy-lock-hide-invisible nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 ;; (lazy-lock-post-command-fontify-windows)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 ;; Or to fontify when the Debugger pops up a source code window:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 ;; (autoload 'lazy-lock-fontify-walk-windows "lazy-lock")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 ;; (defadvice gud-display-line (after fontify-window activate compile)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 ;; (let ((lazy-lock-walk-windows t) (lazy-lock-hide-invisible t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 ;; (lazy-lock-fontify-walk-windows)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 ;; Scott Byer <byer@mv.us.adobe.com> suggested this to fontify the visible part
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 ;; of an insertion only:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 ;; (defvar lazy-lock-insert-commands
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 ;; '(yank yank-pop clipboard-yank hilit-yank hilit-yank-pop
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 ;; mail-yank-original mouse-yank-at-click mouse-yank-secondary
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 ;; yank-rectangle)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 ;; "A list of insertion commands.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 ;; (defadvice font-lock-after-change-function (around fontify-insertion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 ;; activate compile)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 ;; (if (or (not (memq this-command lazy-lock-insert-commands))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 ;; (and (pos-visible-in-window-p beg) (pos-visible-in-window-p end)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 ;; ad-do-it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 ;; (let ((this-command 'ignore))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 ;; (put-text-property beg end 'fontified nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 ;; (lazy-lock-fontify-window))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 ;; Let me know if you use any other `advice' and I'll put it here. Thanks.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 ;; These kinds of things with `advice' aren't done automatically because they
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 ;; cause large packages (advice.el plus bytecomp.el and friends) to be loaded.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 ;; Caveats:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 ;; Lazy Lock mode does not work efficiently with Outline mode. This is because
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 ;; when in Outline mode, although text may be hidden (not visible in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 ;; window), the text is visible to Emacs Lisp code (not surprisingly) and Lazy
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 ;; Lock fontifies it mercilessly. Hopefully this will be fixed one day.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 ;; Lazy Lock mode does not fontify windows as they appear:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 ;; 1. With `query-replace' or `ispell-*', as Lazy Lock only knows about point
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 ;; motion after the command exits.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 ;; 2. When displayed by gud.el (the Grand Unified Debugger), as they are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 ;; displayed via a process sentinel. See `Advanced Use' above.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 ;; 3. In XEmacs 19.12, when the last command was invoked via a mouse event,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 ;; because of a bug/feature in/of `sit-for'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 ;; 4. In other random situations that I don't know about (yet).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 ;; If you have `lazy-lock-hide-invisible' you may notice that redisplay occurs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 ;; before fontification regardlessly. This is due to other packages sitting on
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 ;; `post-command-hook' and provoking redisplay. If you use these packages, you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 ;; can't use `lazy-lock-hide-invisible'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 ;; If you have `lazy-lock-hide-invisible' and use scrollbar scrolling using
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 ;; Emacs 19, hidden text will not be fontified as it becomes visible. It is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 ;; expected that Emacs 19 will provide the necessary hooks in future, to solve
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 ;; this problem and the problem above.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 ;; Unless otherwise stated, "Emacs 19.X" means versions up to and including X.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 ;; In Emacs 19.25, one `window-start'/`window-end' bug means that if you open a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 ;; file in another frame (such as via `find-tag-other-frame'), the whole buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 ;; is fontified regardless. Upgrade!
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 ;; In Emacs 19.25, fontification by stealth is turned off because of a fatal
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 ;; bug in `previous-single-property-change'. Upgrade!
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 ;; In Emacs 19.28, if you see a message in the minibuffer of the form
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 ;; "Fontifying window... done. (Restarted in foo.c)"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 ;; it means the Garbage Collector has marked some (subsequently used) text
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 ;; properties. Lazy Lock attempts to recover the situation by restarting in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 ;; that buffer. Unfortunately, that buffer will be left in a writable and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 ;; modified state. Also, other windows may not be fontified when this happens.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 ;; To reduce the frequency of this bug occuring, increase in your ~/.emacs the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 ;; value of `gc-cons-threshold' to, say, 1Meg, e.g.:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 ;; (setq gc-cons-threshold (* 1024 1024))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 ;; The solution is to upgrade! (With thanks to Kevin Broadey for help here.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 ;; For XEmacs 19.11 and Lucid Emacs 19.10 users, lazy-lock sort-of works.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 ;; There are bugs in text property and point/window primatives. Upgrade!
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 ;; Feedback:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 ;; Feedback is welcome.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 ;; To submit a bug report (or make comments) please use the mechanism provided:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 ;; M-x lazy-lock-submit-bug-report RET
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 ;; History:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 ;; 0.01--1.00:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 ;; - Changed name from fore-lock to lazy-lock. Shame though.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 ;; - Dropped `advice'-wrapping completely. Ask me if you're interested in it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 ;; - Made `lazy-lock-mode' ignore `post-command-hook' and `buffer-file-name'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 ;; - Made `lazy-lock-fontify-window' check `lazy-lock-mode' and `this-command'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 ;; - Made `lazy-lock-fontify-window' redisplay via `sit-for'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 ;; - Added `lazy-lock-minimum-size' to control `lazy-lock-mode'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 ;; 1.00--1.01:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 ;; - Added `lazy-lock-fontify-buffer'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 ;; - Made `lazy-lock-fontify-window' ignore `lazy-lock-mode'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 ;; - Made `lazy-lock-fontify-window' suspicious of `window-' favourites again.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 ;; - Added `lazy-lock-delay-commands' (idea from William G. Dubuque).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 ;; - Added `lazy-lock-ignore-commands' for completeness.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 ;; - Added `lazy-lock-continuity-time' for normal input delay.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 ;; 1.01--1.02:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 ;; - Made `lazy-lock-fontify-window' cope with multiple unfontified regions.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 ;; - Made `lazy-lock-mode' remove `fontified' properties if turned off.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 ;; - Made `lazy-lock-fontify-window' fontify by lines.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 ;; - Added `lazy-lock-cache-position' buffer local to detect visibility change.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 ;; - Added `lazy-lock-post-command-hook' to do the waiting.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 ;; - Made `lazy-lock-fontify-window' just do the fontification.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 ;; - Made `lazy-lock-mode' append `lazy-lock-post-command-hook'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 ;; - Added `lazy-lock-walk-windows' to hack multi-window motion.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 ;; - Made `lazy-lock-post-command-hook' `walk-windows' if variable is non-nil.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 ;; - Removed `lazy-lock-ignore-commands' since insertion may change window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 ;; - Added `lazy-lock-fontify-stealthily' and `lazy-lock-stealth-time'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 ;; - Made `lazy-lock-post-command-hook' use them.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 ;; 1.02--1.03:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 ;; - Made `lazy-lock-fontify-stealthily' do `forward-line' not `previous-line'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 ;; - Made `lazy-lock-fontify-stealthily' `move-to-window-line' first.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 ;; - Made `lazy-lock-fontify-stealthily' use `text-property-any' for region.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 ;; - Made `lazy-lock-post-command-hook' loop on `lazy-lock-fontify-stealthily'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 ;; 1.03--1.04:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 ;; - Made `lazy-lock-mode' reset `lazy-lock-cache-position'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 ;; - Made `lazy-lock-post-command-hook' `widen' for `if' `text-property-any'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 ;; - Made `lazy-lock-fontify-stealthily' return `text-property-any'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 ;; - Added `lazy-lock-percent-fontified' for a/be-musement.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 ;; - Made `lazy-lock-post-command-hook' use it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 ;; - Made `lazy-lock-mode' use `make-local-hook' etc. if available.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 ;; - Made `lazy-lock-mode' use `before-revert-hook' and `after-revert-hook'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 ;; - Made `lazy-lock-post-command-hook' protect `deactivate-mark'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 ;; - Adds `lazy-lock-post-command-hook' globally to `post-command-hook'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 ;; 1.04--1.05:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 ;; - Made `lazy-lock-mode' test `make-local-hook' not `emacs-minor-version'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 ;; 1.05--1.06:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 ;; - Added `lazy-lock-ignore-commands' for commands that leave no event but do.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 ;; - Made `lazy-lock-post-command-hook' check `lazy-lock-ignore-commands'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 ;; 1.06--1.07:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 ;; - Removed `before-revert-hook' and `after-revert-hook' use.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 ;; 1.07--1.08:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 ;; - Added `lazy-lock-submit-bug-report'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 ;; - Made `lazy-lock-post-command-hook' check `executing-macro'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 ;; - Made it sort-of/almost work for XEmacs (help from Jonas Jarnestrom).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 ;; - XEmacs: Fix `text-property-not-all' (fix based on fast-lock.el 3.05 fix).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 ;; - XEmacs: Set `font-lock-no-comments' and alias `frame-parameters'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 ;; - Made `byte-compile-warnings' omit `unresolved' on compilation.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 ;; - Made `lazy-lock-post-command-hook' protect `buffer-undo-list'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 ;; - Moved `deactivate-mark' and `buffer-undo-list' protection to functions.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 ;; - Added `lazy-lock-invisible-foreground' (idea from Boris Goldowsky).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 ;; - XEmacs: Fix to use `text-property-not-all' t, not `text-property-any' nil.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 ;; - Made `lazy-lock-percent-fontified' return `round' to an integer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 ;; - XEmacs: Fix `text-property-any' (fix and work around for a bug elsewhere).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 ;; - XEmacs: Fix `lazy-lock-submit-bug-report' for reporter.el & vm-window.el.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 ;; - XEmacs: Made `lazy-lock-fontify-window' loop `while' `<' not `/='.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 ;; - Use `font-lock-after-change-function' to do the fontification.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 ;; 1.08--1.09:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 ;; - Made `lazy-lock-post-command-hook' protect with `condition-case'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 ;; - Made `lazy-lock-cache-start' to cache `window-start'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 ;; - Made `lazy-lock-fontify-window' check and cache `lazy-lock-cache-start'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 ;; - Renamed `lazy-lock-cache-position' to `lazy-lock-cache-end'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 ;; - XEmacs: Fix for `font-lock-after-change-function'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 ;; - Adds `lazy-lock-post-command-hook' globally to `window-setup-hook'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 ;; 1.09--1.10:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 ;; - Made `buffer-file-name' be `let' to prevent supersession (Kevin Broadey).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 ;; - Made `lazy-lock-submit-bug-report' `require' reporter (Ilya Zakharevich).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 ;; - Made `lazy-lock-mode' and `turn-on-lazy-lock' succeed `autoload' cookies.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 ;; - Added `lazy-lock-fontify-walk-windows' for walking window fontification.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 ;; - Added `lazy-lock-fontify-walk-stealthily' for walking stealth.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 ;; - Removed `move-to-window-line' from `lazy-lock-fontify-stealthily'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 ;; - Made `lazy-lock-percent-fontified' use `truncate' rather than `round'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 ;; - Added other `*-argument' to `lazy-lock-ignore-commands' (Kevin Broadey).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 ;; - Made `lazy-lock-fontify-stealthily' not assume buffer is part `fontified'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 ;; - Emacs: Fix for `font-lock-fontify-region'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 ;; - Made `lazy-lock-post-command-hook' check for minibuffer (Kevin Broadey).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 ;; - Added `lazy-lock-stealth-nice' for niceness during stealth fontification.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 ;; - Added `lazy-lock-stealth-lines' for chunks of stealth fontification.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 ;; 1.10--1.11: incorporated hack by Ben Wing from William Dubuque's fontifly.el
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 ;; - Made `lazy-lock-fontify-stealthily' see a non `fontified' preceding line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 ;; - XEmacs: Fix `text-property-any' and `text-property-not-all' (Ben Wing).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 ;; - XEmacs: Fix `lazy-lock-continuity-time' (Ben Wing).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 ;; - Added awful `lazy-lock-running-xemacs-p' (Ben Wing).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 ;; - Made loading set `emacs-minor-version' if it's not bound.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 ;; - Added `lazy-lock-hide-invisible' to control redisplay.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 ;; - Made `lazy-lock-post-command-hook' use it in `sit-for' (Ben Wing).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 ;; - Made `lazy-lock-fontify-window' move relative to `end-of-line' if non-nil.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 ;; - Added `lazy-lock-fontify-region' so packages can ensure fontification.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 ;; - Made `lazy-lock-fontify-walk-stealthily' do stealth widening.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 ;; - Made `lazy-lock-fontify-stealthily' always do adjacent preceding regions.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 ;; - Added `lazy-lock-after-fontify-buffer'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 ;; - XEmacs: Removed `font-lock-no-comments' incompatibility code.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 ;; - Removed `lazy-lock-delay-time' and `lazy-lock-delay-commands'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 ;; - Removed `lazy-lock-post-command' and split the functionality.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 ;; - Adds `lazy-lock-post-command-fontify-windows' on first.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 ;; - Adds `lazy-lock-post-command-fontify-stealthily' on last.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 ;; - Made `lazy-lock-mode' ensure both first and last on `post-command-hook'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 ;; - Made `lazy-lock-mode' ensure `font-lock-mode' is on.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 ;; - Wrap `lazy-lock-post-command-fontify-stealthily' for errors (David Karr).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 ;; - Added `calcDigit-key' to `lazy-lock-ignore-commands' (Bob Glickstein).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 ;; - Wrap `lazy-lock-running-xemacs-p' with `eval-and-compile' (Erik Naggum).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 ;; - XEmacs: Fix use of `previous-single-property-change' (Jim Thompson).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 ;; - XEmacs: Fix `next-single-property-change' fix for 19.11 (Jim Thompson).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 ;; - Added `lazy-lock-post-resize-fontify-windows' to fontify on resizing.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 ;; - Adds globally to `window-size-change-functions'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 ;; - Added `lazy-lock-post-setup-fontify-windows' to fontify after start up.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 ;; - Adds globally to `window-setup-hook'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 ;; - Made `lazy-lock-post-command-fontify-windows' check for `input-pending-p'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 ;; - Made `save-selected-window' to restore the `selected-window'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 ;; - Use `save-selected-window' rather than `save-window-excursion'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 ;; 1.11--1.12:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 ;; - Made `lazy-lock-post-command-fontify-windows' do `set-buffer' first.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 ;; - Made `lazy-lock-fontify-stealthily' respect narrowing before point.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 ;; - Added `lazy-lock-post-setup-ediff-control-frame' for Ediff control frame.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 ;; - Adds globally to `ediff-after-setup-control-frame-hooks'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 ;; - Wrap `save-selected-window' with `save-excursion' for `current-buffer'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 ;; 1.12--1.13:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 ;; - XEmacs: Add `lazy-lock-after-fontify-buffer' to the Font Lock hook.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 ;; - Made `buffer-file-truename' also wrapped for supersession (Rick Sladkey).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 ;; - Made `font-lock-beginning-of-syntax-function' wrapped for fontification.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 ;; - Added `lazy-lock-stealth-verbose' (after harassment from Ben Wing).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 ;; - XEmacs: Made `font-lock-verbose' wrapped for stealth fontification.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 ;; 1.13--1.14:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 ;; - Wrap `lazy-lock-colour-invisible' for `set-face-foreground' (Jari Aalto).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 (require 'font-lock)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 (eval-when-compile
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 ;; Only `require' so `ediff-multiframe-setup-p' is expanded at compile time.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 (condition-case nil (require 'ediff) (file-error))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 ;; Well, shouldn't Lazy Lock be as lazy as possible?
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 ;(setq byte-compile-dynamic t byte-compile-dynamic-docstrings t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 ;; Shut Emacs' byte-compiler up (cf. stop me getting mail from users).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 (setq byte-compile-warnings '(free-vars callargs redefine)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 (defun lazy-lock-submit-bug-report ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 "Submit via mail a bug report on lazy-lock.el."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 (require 'reporter)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 (let ((reporter-prompt-for-summary-p t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323 (reporter-submit-bug-report "simon@gnu.ai.mit.edu" "lazy-lock 1.14"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 '(lazy-lock-walk-windows lazy-lock-continuity-time
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 lazy-lock-stealth-time lazy-lock-stealth-nice
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 lazy-lock-stealth-lines lazy-lock-stealth-verbose
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 lazy-lock-hide-invisible lazy-lock-invisible-foreground
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328 lazy-lock-minimum-size lazy-lock-ignore-commands)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 nil nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 (concat "Hi Si.,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 I want to report a bug. I've read the `Bugs' section of `Info' on Emacs, so I
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 know how to make a clear and unambiguous report. To reproduce the bug:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 Start a fresh Emacs via `" invocation-name " -no-init-file -no-site-file'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 In the `*scratch*' buffer, evaluate:"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 ;; Let's define `emacs-major-version', `emacs-minor-version', and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 ;; `emacs-version>=' if no-one else has.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 (if (not (boundp 'emacs-major-version))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 (eval-and-compile
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 (defconst emacs-major-version
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 (progn (or (string-match "^[0-9]+" emacs-version)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 (error "emacs-version unparsable"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 (string-to-int (match-string 0 emacs-version)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 "Major version number of this version of Emacs, as an integer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 Warning, this variable did not exist in Emacs versions earlier than:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 FSF Emacs: 19.23
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 XEmacs: 19.10")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 (if (not (boundp 'emacs-minor-version))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 (eval-and-compile
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 (defconst emacs-minor-version
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 (progn (or (string-match "^[0-9]+\\.\\([0-9]+\\)" emacs-version)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 (error "emacs-version unparsable"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 (string-to-int (match-string 1 emacs-version)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 "Minor version number of this version of Emacs, as an integer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 Warning, this variable did not exist in Emacs versions earlier than:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 FSF Emacs: 19.23
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 XEmacs: 19.10")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 (if (not (fboundp 'emacs-version>=))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 (eval-and-compile
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 (defun emacs-version>= (major &optional minor)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 "Return true if the Emacs version is >= to the given MAJOR and MINOR numbers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 The MAJOR version number argument is required, but the MINOR version number
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 argument is optional. If the minor version number is not specified (or is the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 symbol `nil') then only the major version numbers are considered in the test."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 (if (null minor)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 (>= emacs-major-version major)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 (or (> emacs-major-version major)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 (and (= emacs-major-version major)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 (>= emacs-minor-version minor))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 ))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379 ;; Yuck, but we make so much use of this variable it's probably worth it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 (eval-and-compile
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 (defconst lazy-lock-running-xemacs-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 (not (null (save-match-data (string-match "Lucid" emacs-version))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384 (defvar lazy-lock-cache-start nil) ; for window fontifiction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385 (defvar lazy-lock-cache-end nil) ; for window fontifiction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 (defvar lazy-lock-cache-continue nil) ; for stealth fontifiction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 (defvar lazy-lock-mode nil) ; for modeline
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391 ;; User Variables:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 (defvar lazy-lock-minimum-size (* 25 1024)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394 "*If non-nil, the minimum size for buffers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395 Only buffers more than this can have demand-driven fontification.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396 If nil, means size is irrelevant.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 (defvar lazy-lock-walk-windows t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399 "*If non-nil, fontify windows other than the selected window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 If `all-frames', fontify windows even on other frames.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 A non-nil value slows down redisplay.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403 ;; XEmacs 19.11 and below exercise a bug in the Xt event loop.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404 (defvar lazy-lock-continuity-time
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405 (if (or (not lazy-lock-running-xemacs-p) (emacs-version>= 19 12))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407 (if (featurep 'lisp-float-type) 0.001 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408 "*Time in seconds to delay before normal window fontification.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409 Window fontification occurs if there is no input within this time.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411 ;; `previous-single-property-change' at `point-min' up to Emacs 19.25 is fatal.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412 ;; `text-property-any', `text-property-not-all' and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413 ;; `next-single-property-change' up to XEmacs 19.11 are too broke.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414 (defvar lazy-lock-stealth-time
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415 (if (emacs-version>= 19 (if lazy-lock-running-xemacs-p 12 26)) 30)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 "*Time in seconds to delay before beginning stealth fontification.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417 Stealth fontification occurs if there is no input within this time.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418 If nil, means no fontification by stealth.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 (defvar lazy-lock-stealth-lines
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421 (cond ((boundp 'font-lock-maximum-decoration)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422 (if font-lock-maximum-decoration 75 150))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423 ((boundp 'font-lock-use-maximal-decoration)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424 (if font-lock-use-maximal-decoration 50 100))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426 50))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427 "*If non-nil, the maximum size of a chunk of stealth fontification.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428 Each iteration of stealth fontification can fontify this number of lines.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429 To speed up input response during stealth fontification, at the cost of stealth
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430 taking longer to fontify, you could reduce the value of this variable.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431 If nil, means use `window-height' for the maximum chunk size.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433 (defvar lazy-lock-stealth-nice (if (featurep 'lisp-float-type) 0.125 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434 "*Time in seconds to pause during chunks of stealth fontification.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435 To reduce machine load during stealth fontification, at the cost of stealth
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436 taking longer to fontify, you could increase the value of this variable.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
438 (defvar lazy-lock-stealth-verbose font-lock-verbose
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
439 "*If non-nil, means stealth fontification should show status messages.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
440
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
441 (defvar lazy-lock-ignore-commands
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
442 (append
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
443 ;; Standard commands...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
444 '(universal-argument digit-argument negative-argument
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445 isearch-other-control-char isearch-other-meta-char)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
446 ;; And some resulting from non-standard packages...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
447 (if (fboundp 'calc) '(calcDigit-key)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
448 "A list of commands after which fontification should not occur.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449 To speed up typing response, at the cost of Lazy Lock not fontifying when
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450 insertion causes scrolling, you could add `self-insert-command' to this list.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
452 (defvar lazy-lock-hide-invisible lazy-lock-running-xemacs-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453 "*If non-nil, hide invisible text while it is fontified.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454 If non-nil, redisplay is delayed until after fontification occurs. If nil,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455 text is shown (in `lazy-lock-invisible-foreground') while it is fontified.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456 A non-nil value slows down redisplay and can slow down cursor motion.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
458 (defvar lazy-lock-invisible-foreground "gray50"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
459 "The foreground colour to use to display invisible text.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
460 If nil, the default foreground is used. If t, the default background is used.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
461 If a string, it should be a colour to use (either its name or its RGB value).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
462 Invisible text is momentarily seen (if `lazy-lock-hide-invisible' is nil) when
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
463 scrolling into unfontified regions.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
464
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
465 ;; User Functions:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
466
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
467 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
468 (defun lazy-lock-mode (&optional arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
469 "Toggle Lazy Lock mode.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470 With arg, turn Lazy Lock mode on if and only if arg is positive and the buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
471 is at least `lazy-lock-minimum-size' characters long.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
472
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
473 When Lazy Lock mode is enabled, fontification is demand-driven and stealthy:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
474
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
475 - Fontification occurs in visible parts of buffers when necessary.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
476 Occurs if there is no input after pausing for `lazy-lock-continuity-time'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
477
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478 - Fontification occurs in invisible parts when Emacs has been idle.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479 Occurs if there is no input after pausing for `lazy-lock-stealth-time'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
480
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
481 If `lazy-lock-hide-invisible' is non-nil, text is not displayed until it is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
482 fontified, otherwise it is displayed in `lazy-lock-invisible-foreground'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
483
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484 See also variables `lazy-lock-walk-windows' and `lazy-lock-ignore-commands' for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485 window (scroll) fontification, and `lazy-lock-stealth-lines',
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486 `lazy-lock-stealth-nice' and `lazy-lock-stealth-verbose' for stealth
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487 fontification.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489 Use \\[lazy-lock-submit-bug-report] to send bug reports or feedback."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490 (interactive "P")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491 (set (make-local-variable 'lazy-lock-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492 (and (<= (or lazy-lock-minimum-size 0) (buffer-size))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493 (if arg (> (prefix-numeric-value arg) 0) (not lazy-lock-mode))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494 (if (and lazy-lock-mode (not font-lock-mode))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495 ;; Turned on `lazy-lock-mode' rather than using `font-lock-mode-hook'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497 (add-hook 'font-lock-mode-hook 'turn-on-lazy-lock)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
498 (font-lock-mode 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499 (lazy-lock-fixup-hooks)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
500 ;; Let's get down to business.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
501 (if (not lazy-lock-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
502 (let ((modified (buffer-modified-p)) (inhibit-read-only t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
503 (buffer-undo-list t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
504 deactivate-mark buffer-file-name buffer-file-truename)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
505 (remove-text-properties (point-min) (point-max) '(fontified nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
506 (or modified (set-buffer-modified-p nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
507 (if (and (not lazy-lock-hide-invisible) lazy-lock-invisible-foreground)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
508 (lazy-lock-colour-invisible))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
509 (set (make-local-variable 'lazy-lock-cache-start) 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
510 (set (make-local-variable 'lazy-lock-cache-end) 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
511 (set (make-local-variable 'font-lock-fontified) t))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
512
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
513 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
514 (defun turn-on-lazy-lock ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
515 "Unconditionally turn on Lazy Lock mode."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
516 (lazy-lock-mode 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
517
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
518 (if (not (emacs-version>= 19 (if lazy-lock-running-xemacs-p 12 29)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
519 ;; We don't need this in Emacs 19.29 or XEmacs 19.12.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
520 (defun lazy-lock-fontify-buffer ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
521 "Fontify the current buffer where necessary."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
522 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
523 (lazy-lock-fontify-region (point-min) (point-max))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
524
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
525 ;; API Functions:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
526
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
527 (defun lazy-lock-fixup-hooks ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
528 ;; Make sure our hooks are correct.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
529 (remove-hook 'pre-idle-hook 'lazy-lock-pre-idle-fontify-windows)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
530 (remove-hook 'post-command-hook 'lazy-lock-post-command-fontify-stealthily)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
531 ;; Make sure our hooks are at the end. Font-lock in XEmacs installs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
532 ;; its own pre-idle-hook to implement deferral (#### something that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
533 ;; should really be merged with this file; or more likely, lazy-lock
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
534 ;; in its entirety should be merged into font-lock).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
535 (add-hook 'pre-idle-hook 'lazy-lock-pre-idle-fontify-windows t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
536 (add-hook 'post-command-hook 'lazy-lock-post-command-fontify-stealthily t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
537 ;; Fascistically remove font-lock's after-change-function and install
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
538 ;; our own. We know better than font-lock what to do. Otherwise,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
539 ;; revert-buffer, insert-file, etc. cause full refontification of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
540 ;; entire changed area.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
541 (if lazy-lock-mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
542 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
543 (remove-hook 'after-change-functions 'font-lock-after-change-function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
544 t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
545 (make-local-hook 'after-change-functions)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
546 (add-hook 'after-change-functions 'lazy-lock-after-change-function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
547 nil t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
548 (remove-hook 'after-change-functions 'lazy-lock-after-change-function t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
549 (if font-lock-mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
550 (add-hook 'after-change-functions 'font-lock-after-change-function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
551 nil t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
552 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
553
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
554 ;; use put-nonduplicable-text-property to avoid unfriendly behavior
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
555 ;; when doing undo, etc. We really don't want syntax-highlighting text
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
556 ;; properties copied into strings or tracked by undo.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
557 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
558 ;; #### If start-open and end-open really behaved like they are supposed to,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
559 ;; we wouldn't really need this. I kind of fixed them up, but there's still
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
560 ;; a bug -- inserting text into the middle of a region of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
561 ;; (start-open t end-open t) text should cause it not to inherit, but it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
562 ;; does.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
563
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
564 (if lazy-lock-running-xemacs-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
565 (defalias 'lazy-lock-put-text-property 'put-nonduplicable-text-property)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
566 (defalias 'lazy-lock-put-text-property 'put-text-property))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
567
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
568 (defun lazy-lock-fontify-region (start end &optional buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
569 "Fontify between START and END in BUFFER where necessary."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
570 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
571 (and buffer (set-buffer buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
572 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
573 (narrow-to-region start end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
574 (let ((lazy-lock-stealth-lines (count-lines start end)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
575 (while (text-property-not-all start end 'fontified t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
576 (lazy-lock-fontify-stealthily))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
577
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
578 (defun lazy-lock-after-fontify-buffer ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
579 ;; Mark the buffer as `fontified'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
580 (let ((modified (buffer-modified-p)) (inhibit-read-only t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
581 (buffer-undo-list t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
582 deactivate-mark buffer-file-name buffer-file-truename)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
583 (lazy-lock-put-text-property (point-min) (point-max) 'fontified t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
584 (or modified (set-buffer-modified-p nil))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
585
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
586 ;; Just a cleaner-looking way of coping with Emacs' and XEmacs' `sit-for'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
587 (defmacro lazy-lock-sit-for (seconds &optional nodisp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
588 (if lazy-lock-running-xemacs-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
589 (` (sit-for (, seconds) (, nodisp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
590 (` (sit-for (, seconds) 0 (, nodisp)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
591
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
592 ;; Using `save-window-excursion' provokes `window-size-change-functions'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
593 ;; I prefer `save-walking-excursion', of course, because I have a warped mind.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
594 (if (fboundp 'save-selected-window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
595 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
596 (eval-and-compile
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
597 (defmacro save-selected-window (&rest body)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
598 "Execute the BODY forms, restoring the selected window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
599 Does not restore the value of point in the selected window, or anything else."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
600 (` (let ((original-window (selected-window)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
601 (unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
602 (progn (,@ body))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
603 (select-window original-window))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
604 (put 'save-selected-window 'lisp-indent-function 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
605
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
606 ;; Functions for hooks:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
607
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
608 ;; lazy-lock optimization:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
609 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
610 ;; pre-idle-hook is called an awful lot -- pretty much every time the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
611 ;; mouse moves or a timeout expires, for example. On Linux (sometimes),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
612 ;; IRIX 5.x, and Solaris 2.something, it happens every 1/4 of a second
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
613 ;; due to the 1/4-second timers installed to compensate for various
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
614 ;; operating system deficiencies in the handling of SIGIO and SIGCHLD.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
615 ;; (Those timers cause a cycle of the event loop. They don't necessarily
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
616 ;; have to, but rewriting to avoid this is fairly tricky and requires
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
617 ;; having significant amounts of code called from signal handlers, which
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
618 ;; (despite that fact that FSF Emacs reads its X input during a signal
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
619 ;; handler ?!), is almost always a bad idea -- it's extremely easy to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
620 ;; introduce race conditions, which are very hard to track down.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
621 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
622 ;; So to improve things, I added `frame-modified-tick'. This is an
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
623 ;; internal counter that gets ticked any time that any internal
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
624 ;; redisplay variable gets ticked. If `frame-modified-tick' is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
625 ;; the same as the last time we checked, it means that redisplay will
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
626 ;; do absolutely nothing when encountering this frame, and thus we
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
627 ;; can skip out immediately. This happens when the 1/4-second timer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
628 ;; fires while we're idle, or if we just move the mouse. (Moving
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
629 ;; around in a buffer changes `frame-modified-tick' because the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
630 ;; internal redisplay variable "point_changed" gets ticked. We could
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
631 ;; easily improve things further by adding more tick counters, mirroring
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
632 ;; more closely the internal redisplay counters -- e.g. if we had
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
633 ;; another counter that didn't get ticked when point moved, we could
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
634 ;; tell if anything was going to happen by seeing if point is within
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
635 ;; window-start and window-end, since we know that redisplay will
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
636 ;; only do a window-scroll if it's not. (If window-start or window-end
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
637 ;; or window-buffer or anything else changed, windows_changed or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
638 ;; some other variable will get ticked.))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
639 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
640 ;; Also, it's wise to try and avoid things that cons. Avoiding
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
641 ;; `save-window-excursion', as we do, is definitely a major win
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
642 ;; because that's a heavy-duty function as regards consing and such.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
643
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
644 (defvar lazy-lock-pre-idle-frame-modified-tick nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
645 (defvar lazy-lock-pre-idle-selected-frame nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
646
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
647 (defun lazy-lock-pre-idle-fontify-windows ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
648 ;; Do groovy things always unless we're in one of the ignored commands.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
649 ;; The old version did the following five checks:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
650 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
651 ;; (a) not in a macro,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
652 ;; (b) no input pending,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
653 ;; (c) got a real command (i.e. not an ignored command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
654 ;; (d) not in the minibuffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
655 ;; (e) no input after waiting for `lazy-lock-continuity-time'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
656 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
657 ;; (a), (b), and (e) are automatically taken care of by `pre-idle-hook'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
658 ;; I removed (d) because there doesn't seem to be any reason for it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
659 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
660 ;; Also, we do not have to `set-buffer' and in fact it would be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
661 ;; incorrect to do so, since we may be being called from
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
662 ;; `accept-process-output' or whatever.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
663 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
664 (if (memq this-command lazy-lock-ignore-commands)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
665 (setq lazy-lock-cache-continue nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
666 (setq lazy-lock-cache-continue t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
667 ;; #### we don't yet handle frame-modified-tick on multiple frames.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
668 ;; handling this shouldn't be hard but I just haven't done it yet.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
669 (if (or (eq 'all-frames lazy-lock-walk-windows)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
670 (not (eq lazy-lock-pre-idle-selected-frame (selected-frame)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
671 (not (eq lazy-lock-pre-idle-frame-modified-tick
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
672 (frame-modified-tick (selected-frame)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
673 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
674 ;; Do the visible parts of the buffer(s), i.e., the window(s).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
675 (if (or (not lazy-lock-walk-windows)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
676 (and (eq lazy-lock-walk-windows t) (one-window-p t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
677 (if lazy-lock-mode (condition-case nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
678 (lazy-lock-fontify-window)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
679 (lazy-lock-fontify-walk-windows))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
680 (setq lazy-lock-pre-idle-selected-frame (selected-frame))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
681 (setq lazy-lock-pre-idle-frame-modified-tick
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
682 (frame-modified-tick (selected-frame)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
683
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
684 (defun lazy-lock-after-change-function (beg end old-len)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
685 (and lazy-lock-mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
686 (if (= beg end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
687 (font-lock-after-change-function beg end old-len)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
688 (lazy-lock-put-text-property beg end 'fontified nil))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
689
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
690 ;; DO NOT put this as a pre-idle hook! The sit-for messes up
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
691 ;; mouse dragging.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
692 (defun lazy-lock-post-command-fontify-stealthily ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
693 ;; Do groovy things if (a-d) above, (e) not moving the mouse, and (f) no
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
694 ;; input after after waiting for `lazy-lock-stealth-time'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
695 (if (and lazy-lock-cache-continue lazy-lock-stealth-time)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
696 (condition-case data
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
697 (if (lazy-lock-sit-for lazy-lock-stealth-time)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
698 ;; Do the invisible parts of buffers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
699 (lazy-lock-fontify-walk-stealthily))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
700 (error (message "Fontifying stealthily... %s" data)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
701
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
702 ;; In XEmacs 19.14 with pre-idle-hook we do not have to call this.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
703 (defun lazy-lock-post-resize-fontify-windows (frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
704 ;; Fontify all windows in FRAME.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
705 (let ((lazy-lock-walk-windows t) executing-kbd-macro this-command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
706 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
707 (save-selected-window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
708 (select-frame frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
709 (lazy-lock-pre-idle-fontify-windows)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
710
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
711 (defun lazy-lock-post-setup-emacs-fontify-windows ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
712 ;; Fontify all windows in all frames.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
713 (let ((lazy-lock-walk-windows 'all-frames) executing-kbd-macro this-command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
714 (lazy-lock-pre-idle-fontify-windows)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
715
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
716 (defun lazy-lock-post-setup-ediff-control-frame ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
717 ;; Fontify all windows in all frames when using the Ediff control frame.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
718 (make-local-variable 'lazy-lock-walk-windows)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
719 (setq lazy-lock-walk-windows (if (ediff-multiframe-setup-p) 'all-frames t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
720 (lazy-lock-fixup-hooks))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
721
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
722 ;; Functions for fontification:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
723
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
724 (defun lazy-lock-fontify-window ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
725 ;; Fontify the visible part of the buffer where necessary.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
726 (let ((ws (if lazy-lock-hide-invisible
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
727 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
728 (end-of-line) (forward-line (- (window-height))) (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
729 (min (max (window-start) (point-min)) (point-max))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
730 (we (if lazy-lock-hide-invisible
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
731 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
732 (end-of-line) (forward-line (window-height)) (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
733 (min (max (1- (window-end)) (point-min)) (point-max)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
734 (if (or (/= ws lazy-lock-cache-start) (/= we lazy-lock-cache-end))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
735 ;; Find where we haven't `fontified' before.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
736 (let* ((start (or (text-property-not-all ws we 'fontified t) ws))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
737 (end (or (text-property-any start we 'fontified t) we))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
738 (modified (buffer-modified-p)) (inhibit-read-only t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
739 ;; We do the following to prevent: undo list addition; region
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
740 ;; highlight disappearance; supersession/locking checks.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
741 (buffer-undo-list t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
742 deactivate-mark buffer-file-name buffer-file-truename
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
743 ;; Ensure Emacs 19.30 syntactic fontification is always correct.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
744 font-lock-beginning-of-syntax-function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
745 ;; Prevent XEmacs 19.13 during fontification from messages.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
746 font-lock-verbose)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
747 (while (< start end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
748 ;; Fontify and flag the region as `fontified'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
749 ;; XEmacs: need to bind `font-lock-always-fontify-immediately'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
750 ;; or we'll mess up in the presence of deferred font-locking.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
751 (let ((font-lock-always-fontify-immediately t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
752 (font-lock-after-change-function start end 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
753 (lazy-lock-put-text-property start end 'fontified t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
754 ;; Find the next region.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
755 (setq start (or (text-property-not-all ws we 'fontified t) ws)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
756 end (or (text-property-any start we 'fontified t) we)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
757 (setq lazy-lock-cache-start ws lazy-lock-cache-end we)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
758 (or modified (set-buffer-modified-p nil))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
759
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
760 (defun lazy-lock-fontify-walk-windows ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
761 ;; Fontify windows in all required by walking through them.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
762 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
763 (save-selected-window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
764 (condition-case nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
765 (walk-windows
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
766 (function (lambda (window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
767 (select-window window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
768 (if lazy-lock-mode (lazy-lock-fontify-window))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
769 'no-minibuf (eq lazy-lock-walk-windows 'all-frames))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
770 (wrong-type-argument
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
771 ;; Looks like the Emacs 19.28 Garbage Collection bug has hit town.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
772 ;; Completely remove all text properties and restart.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
773 (set-text-properties (point-min) (point-max) nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
774 (turn-on-lazy-lock)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
775 (lazy-lock-fontify-window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
776 (message "Fontifying window... done. (Restarted in %s)"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
777 (buffer-name)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
778
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
779 (defun lazy-lock-fontify-stealthily ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
780 ;; Fontify an invisible part of the buffer where necessary.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
781 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
782 ;; Move to the end in case the character to the left is not `fontified'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
783 (end-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
784 ;; Find where the next and previous regions not `fontified' begin and end.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
785 (let ((next (text-property-not-all (point) (point-max) 'fontified t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
786 (prev (let ((p (previous-single-property-change (point) 'fontified)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
787 (and p (> p (point-min)) p)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
788 (modified (buffer-modified-p)) (inhibit-read-only t) start end
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
789 ;; We do the following to prevent: undo list addition; region
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
790 ;; highlight disappearance; supersession/locking checks.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
791 (buffer-undo-list t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
792 deactivate-mark buffer-file-name buffer-file-truename
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
793 ;; Ensure Emacs 19.30 syntactic fontification is always correct.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
794 font-lock-beginning-of-syntax-function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
795 ;; Prevent XEmacs 19.13 during fontification from spewing messages.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
796 font-lock-verbose)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
797 (cond ((and (null next) (null prev))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
798 ;; Nothing has been `fontified' yet.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
799 (beginning-of-line 1) (setq start (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
800 (forward-line (or lazy-lock-stealth-lines (window-height)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
801 (setq end (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
802 ((or (null prev)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
803 (and next (> (- (point) prev) (- next (point)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
804 ;; The next region is the nearest not `fontified'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
805 (goto-char next) (beginning-of-line 1) (setq start (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
806 (forward-line (or lazy-lock-stealth-lines (window-height)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
807 ;; Maybe the region is already partially `fontified'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
808 (setq end (or (text-property-any next (point) 'fontified t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
809 (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
810 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
811 ;; The previous region is the nearest not `fontified'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
812 (goto-char prev) (forward-line 1) (setq end (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
813 (forward-line (- (or lazy-lock-stealth-lines (window-height))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
814 ;; Maybe the region is already partially `fontified'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
815 (setq start
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
816 (or (previous-single-property-change prev 'fontified nil (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
817 (point)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
818 ;; Fontify and flag the region as `fontified'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
819 ;; XEmacs: need to bind `font-lock-always-fontify-immediately'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
820 ;; or we'll mess up in the presence of deferred font-locking.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
821 (let ((font-lock-always-fontify-immediately t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
822 (font-lock-after-change-function start end 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
823 (lazy-lock-put-text-property start end 'fontified t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
824 (or modified (set-buffer-modified-p nil)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
825
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
826 (defun lazy-lock-fontify-walk-stealthily ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
827 ;; Fontify regions in all required buffers while there is no input.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
828 (let ((buffers (buffer-list)) (continue t) fontified message-log-max)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
829 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
830 (while (and buffers continue)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
831 (set-buffer (car buffers))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
832 (if (and lazy-lock-mode (lazy-lock-unfontified-p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
833 ;; Fontify regions in this buffer while there is no input.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
834 (let ((bufname (buffer-name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
835 (if (and lazy-lock-stealth-verbose (not fontified))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
836 (message "Fontifying stealthily..."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
837 ;; We `save-restriction' and `widen' around everything as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
838 ;; `lazy-lock-fontify-stealthily' doesn't and we `sit-for'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
839 (save-restriction (widen) (lazy-lock-fontify-stealthily))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
840 (while (and (lazy-lock-unfontified-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
841 (setq continue (lazy-lock-sit-for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
842 lazy-lock-stealth-nice)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
843 (if lazy-lock-stealth-verbose
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
844 (message "Fontifying stealthily... %2d%% of %s"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
845 (lazy-lock-percent-fontified) bufname))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
846 (save-restriction (widen) (lazy-lock-fontify-stealthily)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
847 ;; Note that fontification occurred.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
848 (setq fontified t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
849 (setq buffers (cdr buffers))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
850 (if (and lazy-lock-stealth-verbose fontified)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
851 (message "Fontifying stealthily... %s." (if continue "done" "quit")))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
852
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
853 (defun lazy-lock-unfontified-p ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
854 ;; Return non-nil if there is anywhere still to be `fontified'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
855 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
856 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
857 (text-property-not-all (point-min) (point-max) 'fontified t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
858
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
859 (defun lazy-lock-percent-fontified ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
860 ;; Return the percentage (of characters) of the buffer that are `fontified'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
861 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
862 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
863 (let ((size 0) (start (point-min)) (max (point-max)) end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
864 (while (setq start (text-property-any start max 'fontified t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
865 (setq end (or (text-property-not-all start max 'fontified t) max)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
866 size (+ size (- end start))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
867 start end))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
868 ;; Saying "99% done" is probably better than "100% done" when it isn't.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
869 (truncate (/ (* size 100.0) (buffer-size))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
870
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
871 (defun lazy-lock-colour-invisible ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
872 ;; Fontify the current buffer in `lazy-lock-invisible-face'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
873 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
874 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
875 (let ((face 'lazy-lock-invisible-face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
876 (fore (if (stringp lazy-lock-invisible-foreground)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
877 lazy-lock-invisible-foreground
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
878 (cdr (assq 'background-color (frame-parameters)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
879 (modified (buffer-modified-p)) (inhibit-read-only t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
880 (buffer-undo-list t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
881 deactivate-mark buffer-file-name buffer-file-truename)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
882 (make-face face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
883 (if (not (equal (face-foreground face) fore))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
884 (condition-case nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
885 (set-face-foreground face fore)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
886 (error (message "Unable to use foreground \"%s\"" fore))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
887 (lazy-lock-put-text-property (point-min) (point-max) 'face face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
888 (lazy-lock-put-text-property (point-min) (point-max) 'fontified nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
889 (or modified (set-buffer-modified-p nil)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
890
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
891 ;; Functions for Emacs:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
892
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
893 ;; This fix is for a number of bugs in the function in Emacs 19.28.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
894 (if (and (not lazy-lock-running-xemacs-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
895 (not (emacs-version>= 19 29)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
896 (defun font-lock-fontify-region (start end &optional loudly)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
897 "Put proper face on each string and comment between START and END."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
898 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
899 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
900 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
901 (goto-char start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
902 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
903 (if loudly (message "Fontifying %s... (syntactically...)" (buffer-name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
904 (let ((inhibit-read-only t) (buffer-undo-list t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
905 buffer-file-name buffer-file-truename
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
906 (modified (buffer-modified-p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
907 (old-syntax (syntax-table))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
908 (synstart (if comment-start-skip
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
909 (concat "\\s\"\\|" comment-start-skip)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
910 "\\s\""))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
911 (comstart (if comment-start-skip
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
912 (concat "\\s<\\|" comment-start-skip)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
913 "\\s<"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
914 (startline (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
915 state prev prevstate)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
916 (unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
917 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
918 (if font-lock-syntax-table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
919 (set-syntax-table font-lock-syntax-table))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
920 ;; Find the state at the line-beginning before START.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
921 (if (eq startline font-lock-cache-position)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
922 (setq state font-lock-cache-state)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
923 ;; Find outermost containing sexp.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
924 (beginning-of-defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
925 ;; Find the state at STARTLINE.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
926 (while (< (point) startline)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
927 (setq state (parse-partial-sexp (point) startline 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
928 (setq font-lock-cache-state state
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
929 font-lock-cache-position (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
930 ;; Now find the state precisely at START.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
931 (setq state (parse-partial-sexp (point) start nil nil state))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
932 ;; If the region starts inside a string, show the extent of it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
933 (if (nth 3 state)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
934 (let ((beg (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
935 (while (and (re-search-forward "\\s\"" end 'move)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
936 (nth 3 (parse-partial-sexp beg (point) nil nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
937 state))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
938 (lazy-lock-put-text-property
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
939 beg (point) 'face font-lock-string-face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
940 (setq state (parse-partial-sexp beg (point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
941 nil nil state))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
942 ;; Likewise for a comment.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
943 (if (or (nth 4 state) (nth 7 state))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
944 (let ((beg (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
945 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
946 (narrow-to-region (point-min) end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
947 (condition-case nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
948 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
949 (re-search-backward comstart (point-min) 'move)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
950 (forward-comment 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
951 ;; forward-comment skips all whitespace,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
952 ;; so go back to the real end of the comment.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
953 (skip-chars-backward " \t"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
954 (error (goto-char end))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
955 (lazy-lock-put-text-property beg (point) 'face
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
956 font-lock-comment-face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
957 (setq state (parse-partial-sexp beg (point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
958 nil nil state))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
959 ;; Find each interesting place between here and END.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
960 (while (and (< (point) end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
961 (setq prev (point) prevstate state)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
962 (re-search-forward synstart end t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
963 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
964 ;; Clear out the fonts of what we skip over.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
965 (remove-text-properties prev (point) '(face nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
966 ;; Verify the state at that place
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
967 ;; so we don't get fooled by \" or \;.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
968 (setq state (parse-partial-sexp prev (point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
969 nil nil state))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
970 (let ((here (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
971 (if (or (nth 4 state) (nth 7 state))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
972 ;; We found a real comment start.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
973 (let ((beg (match-beginning 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
974 (goto-char beg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
975 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
976 (narrow-to-region (point-min) end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
977 (condition-case nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
978 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
979 (forward-comment 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
980 ;; forward-comment skips all whitespace,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
981 ;; so go back to the real end of the comment.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
982 (skip-chars-backward " \t"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
983 (error (goto-char end))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
984 (lazy-lock-put-text-property
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
985 beg (point) 'face font-lock-comment-face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
986 (setq state (parse-partial-sexp here (point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
987 nil nil state)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
988 (if (nth 3 state)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
989 (let ((beg (match-beginning 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
990 (while (and (re-search-forward "\\s\"" end 'move)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
991 (nth 3 (parse-partial-sexp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
992 here (point) nil nil state))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
993 (lazy-lock-put-text-property
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
994 beg (point) 'face font-lock-string-face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
995 (setq state (parse-partial-sexp here (point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
996 nil nil state))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
997 ;; Make sure PREV is non-nil after the loop
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
998 ;; only if it was set on the very last iteration.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
999 (setq prev nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1000 (set-syntax-table old-syntax)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1001 (and prev
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1002 (remove-text-properties prev end '(face nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1003 (and (buffer-modified-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1004 (not modified)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1005 (set-buffer-modified-p nil))))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1006
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1007 ;; Functions for XEmacs:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1008
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1009 ;; These fix bugs in `text-property-any' and `text-property-not-all'. They may
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1010 ;; not work perfectly in 19.11 and below because `next-single-property-change'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1011 ;; is also broke and not easily fixable in Lisp.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1012 (if (and lazy-lock-running-xemacs-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1013 (not (emacs-version>= 19 12)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1014 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1015 ;; Loop through property changes until found. This fix includes a work
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1016 ;; around which prevents a bug in `window-start' causing a barf here.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1017 (defun text-property-any (start end prop value &optional buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1018 "Check text from START to END to see if PROP is ever `eq' to VALUE.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1019 If so, return the position of the first character whose PROP is `eq'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1020 to VALUE. Otherwise return nil."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1021 (let ((start (min start end)) (end (max start end)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1022 (while (and start (not (eq (get-text-property start prop buffer) value)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1023 (setq start (next-single-property-change start prop buffer end)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1024 start))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1025 ;; No need to loop here; if it's not at START it's at the next change.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1026 ;; However, `next-single-property-change' sometimes returns LIMIT, or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1027 ;; `point-max', if no change is found and sometimes returns nil.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1028 (defun text-property-not-all (start end prop value &optional buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1029 "Check text from START to END to see if PROP is ever not `eq' to VALUE.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1030 If so, return the position of the first character whose PROP is not
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1031 `eq' to VALUE. Otherwise, return nil."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1032 (if (not (eq value (get-text-property start prop buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1033 start
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1034 (let ((next (next-single-property-change start prop buffer end))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1035 (end (or end (save-excursion (and buffer (set-buffer buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1036 (point-max)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1037 (and next (< next end) next))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1038
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1039 ;; XEmacs 19.11 function `font-lock-any-extents-p' looks for `text-prop' rather
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1040 ;; than `face'. Since `font-lock-unfontify-region' only removes `face', and we
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1041 ;; have non-font-lock properties hanging about, `text-prop' never gets removed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1042 ;; Unfortunately `font-lock-any-extents-p' is inlined so we can't redefine it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1043 (if (and lazy-lock-running-xemacs-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1044 (not (emacs-version>= 19 12)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1045 (add-hook 'font-lock-mode-hook
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1046 (function (lambda ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1047 (remove-hook 'after-change-functions 'font-lock-after-change-function)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1048 (add-hook 'after-change-functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1049 (function (lambda (beg end old-len)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1050 (let ((a-c-beg beg) (a-c-end end))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1051 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1052 ;; First set `text-prop' to nil for `font-lock-any-extents-p'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1053 (goto-char end) (forward-line 1) (setq end (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1054 (goto-char beg) (beginning-of-line) (setq beg (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1055 (lazy-lock-put-text-property beg end 'text-prop nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1056 ;; Then do the real `font-lock-after-change-function'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1057 (font-lock-after-change-function a-c-beg a-c-end old-len)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1058 ;; Now set `fontified' to t to stop `lazy-lock-fontify-window'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1059 (lazy-lock-put-text-property beg end 'fontified t))))))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1060
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1061 (if (and lazy-lock-running-xemacs-p (emacs-version>= 19 12))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1062 ;; XEmacs 19.12 font-lock.el's `font-lock-fontify-buffer' runs a hook.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1063 (add-hook 'font-lock-after-fontify-buffer-hook
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1064 'lazy-lock-after-fontify-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1065
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1066 ;; Cope with the differences between Emacs and [LX]Emacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1067 (or (fboundp 'frame-parameters)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1068 (defalias 'frame-parameters 'screen-parameters))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1069
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1070 ;; Install ourselves:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1071
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1072 ;; We don't install ourselves on `font-lock-mode-hook' as other packages can be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1073 ;; used with font-lock.el, and lazy-lock.el should be dumpable without forcing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1074 ;; people to get lazy or making it difficult for people to use alternatives.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1075 ;; make sure we add after font-lock's own pre-idle-hook.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1076 (add-hook 'window-setup-hook 'lazy-lock-post-setup-emacs-fontify-windows)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1077 ;Not needed in XEmacs 19.14:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1078 ;(add-hook 'window-size-change-functions 'lazy-lock-post-resize-fontify-windows)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1079
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1080 ;; Package-specific.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1081 (add-hook 'ediff-after-setup-control-frame-hooks
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1082 'lazy-lock-post-setup-ediff-control-frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1083
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1084 ;; Might as well uninstall too. Package-local symbols would be nice...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1085 (and (fboundp 'unintern) (unintern 'lazy-lock-running-xemacs-p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1086 (and (fboundp 'unintern) (unintern 'lazy-lock-sit-for))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1087
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1088 ;; Maybe save on the modeline?
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1089 ;;(setcdr (assq 'font-lock-mode minor-mode-alist) '(" Lazy"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1090
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1091 ;(or (assq 'lazy-lock-mode minor-mode-alist)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1092 ; (setq minor-mode-alist (cons '(lazy-lock-mode " Lazy") minor-mode-alist)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1093
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1094 ;; XEmacs change: do it the right way. This works with modeline mousing.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1095 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1096 (add-minor-mode 'lazy-lock-mode " Lazy")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1097
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1098 ;; Provide ourselves:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1099
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1100 (provide 'lazy-lock)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1101
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1102 ;;; lazy-lock.el ends here