summaryrefslogtreecommitdiff
path: root/lisp/font-core.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>2002-08-20 17:22:30 +0000
committerRichard M. Stallman <rms@gnu.org>2002-08-20 17:22:30 +0000
commit2dc20ca8004a628dbce63749e286d13bcfb2e703 (patch)
treeb8bee27a2c3f8975f1844148a55593bc9e300be7 /lisp/font-core.el
parent20cd3579bd4252ccb091ce0b73c3fa6c8806fbd7 (diff)
downloademacs-2dc20ca8004a628dbce63749e286d13bcfb2e703.tar.gz
(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.
Diffstat (limited to 'lisp/font-core.el')
-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 @@
;;; Code:
+(defvar font-lock-maximum-size)
+(defvar font-lock-verbose)
+
;; This variable is used by mode packages that support Font Lock mode by
;; defining their own keywords to use for `font-lock-keywords'. (The mode
;; 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
(funcall font-lock-function font-lock-mode)
;; Arrange to unfontify this buffer if we change major mode later.
(if font-lock-mode
- (add-hook 'change-major-mode-hook 'font-lock-unfontify-buffer nil t)
- (remove-hook 'change-major-mode-hook 'font-lock-unfontify-buffer t)))
+ (add-hook 'change-major-mode-hook 'font-lock-change-mode nil t)
+ (remove-hook 'change-major-mode-hook 'font-lock-change-mode t)))
+
+;; Get rid of fontification for the old major mode.
+;; We do this when changing major modes.
+(defun font-lock-change-mode ()
+ (let ((inhibit-read-only t))
+ (save-restriction
+ (widen)
+ (remove-list-of-text-properties
+ (point-min) (point-max) '(font-lock-face))))
+ (when font-lock-defaults
+ (font-lock-unfontify-buffer)))
(defun font-lock-default-function (font-lock-mode)
;; Turn on Font Lock mode.