aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2002-08-20 17:22:30 +0000
committerRichard M. Stallman2002-08-20 17:22:30 +0000
commit2dc20ca8004a628dbce63749e286d13bcfb2e703 (patch)
treeb8bee27a2c3f8975f1844148a55593bc9e300be7
parent20cd3579bd4252ccb091ce0b73c3fa6c8806fbd7 (diff)
downloademacs-2dc20ca8004a628dbce63749e286d13bcfb2e703.tar.gz
emacs-2dc20ca8004a628dbce63749e286d13bcfb2e703.zip
(font-lock-change-mode): New function.
(font-lock-mode): Use font-lock-change-mode instead of font-lock-unfontify-buffer. (font-lock-maximum-size, font-lock-verbose): Add defvars.
-rw-r--r--lisp/font-core.el18
1 files changed, 16 insertions, 2 deletions
diff --git a/lisp/font-core.el b/lisp/font-core.el
index 6b97afd3274..0894380eb76 100644
--- a/lisp/font-core.el
+++ b/lisp/font-core.el
@@ -25,6 +25,9 @@
25 25
26;;; Code: 26;;; Code:
27 27
28(defvar font-lock-maximum-size)
29(defvar font-lock-verbose)
30
28;; This variable is used by mode packages that support Font Lock mode by 31;; This variable is used by mode packages that support Font Lock mode by
29;; defining their own keywords to use for `font-lock-keywords'. (The mode 32;; defining their own keywords to use for `font-lock-keywords'. (The mode
30;; command should make it buffer-local and set it to provide the set up.) 33;; command should make it buffer-local and set it to provide the set up.)
@@ -209,8 +212,19 @@ your own function which is called when `font-lock-mode' is toggled via
209 (funcall font-lock-function font-lock-mode) 212 (funcall font-lock-function font-lock-mode)
210 ;; Arrange to unfontify this buffer if we change major mode later. 213 ;; Arrange to unfontify this buffer if we change major mode later.
211 (if font-lock-mode 214 (if font-lock-mode
212 (add-hook 'change-major-mode-hook 'font-lock-unfontify-buffer nil t) 215 (add-hook 'change-major-mode-hook 'font-lock-change-mode nil t)
213 (remove-hook 'change-major-mode-hook 'font-lock-unfontify-buffer t))) 216 (remove-hook 'change-major-mode-hook 'font-lock-change-mode t)))
217
218;; Get rid of fontification for the old major mode.
219;; We do this when changing major modes.
220(defun font-lock-change-mode ()
221 (let ((inhibit-read-only t))
222 (save-restriction
223 (widen)
224 (remove-list-of-text-properties
225 (point-min) (point-max) '(font-lock-face))))
226 (when font-lock-defaults
227 (font-lock-unfontify-buffer)))
214 228
215(defun font-lock-default-function (font-lock-mode) 229(defun font-lock-default-function (font-lock-mode)
216 ;; Turn on Font Lock mode. 230 ;; Turn on Font Lock mode.