aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorColin Walters2002-06-09 00:41:11 +0000
committerColin Walters2002-06-09 00:41:11 +0000
commitc32aa1a58037864ada514a1286d7bb58a5ac0d8f (patch)
tree7e1faa02f9686d4461a5f9466240d7aded64f469
parente9476ca8e2d271bc2f27cc0f81899b5c464becba (diff)
downloademacs-c32aa1a58037864ada514a1286d7bb58a5ac0d8f.tar.gz
emacs-c32aa1a58037864ada514a1286d7bb58a5ac0d8f.zip
(font-lock-default-function): If `font-lock-core-only' is non-nil,
don't use big font-lock machinery.
-rw-r--r--lisp/font-core.el12
1 files changed, 8 insertions, 4 deletions
diff --git a/lisp/font-core.el b/lisp/font-core.el
index 08d2eb07d97..69e899f31e5 100644
--- a/lisp/font-core.el
+++ b/lisp/font-core.el
@@ -225,7 +225,8 @@ your own function which is called when `font-lock-mode' is toggled via
225 (push (list 'face 'font-lock-face) char-property-alias-alist))) 225 (push (list 'face 'font-lock-face) char-property-alias-alist)))
226 ;; Only do hard work if the mode has specified stuff in 226 ;; Only do hard work if the mode has specified stuff in
227 ;; `font-lock-defaults'. 227 ;; `font-lock-defaults'.
228 (when font-lock-defaults 228 (when (and font-lock-defaults
229 (not font-lock-core-only))
229 (add-hook 'after-change-functions 'font-lock-after-change-function t t) 230 (add-hook 'after-change-functions 'font-lock-after-change-function t t)
230 (font-lock-turn-on-thing-lock) 231 (font-lock-turn-on-thing-lock)
231 ;; Fontify the buffer if we have to. 232 ;; Fontify the buffer if we have to.
@@ -247,7 +248,8 @@ your own function which is called when `font-lock-mode' is toggled via
247 (setcdr elt (remq 'font-lock-face (cdr elt))) 248 (setcdr elt (remq 'font-lock-face (cdr elt)))
248 (when (null (cdr elt)) 249 (when (null (cdr elt))
249 (setq char-property-alias-alist (delq elt char-property-alias-alist))))) 250 (setq char-property-alias-alist (delq elt char-property-alias-alist)))))
250 (when font-lock-defaults 251 (when (and font-lock-defaults
252 (not font-lock-core-only))
251 (remove-hook 'after-change-functions 'font-lock-after-change-function t) 253 (remove-hook 'after-change-functions 'font-lock-after-change-function t)
252 (font-lock-unfontify-buffer) 254 (font-lock-unfontify-buffer)
253 (font-lock-turn-off-thing-lock)))) 255 (font-lock-turn-off-thing-lock))))
@@ -269,11 +271,13 @@ Sets various variables using `font-lock-defaults' (or, if nil, using
269 (make-local-variable 'font-lock-multiline) 271 (make-local-variable 'font-lock-multiline)
270 (let ((defaults (or font-lock-defaults 272 (let ((defaults (or font-lock-defaults
271 (assq major-mode font-lock-defaults-alist)))) 273 (assq major-mode font-lock-defaults-alist))))
274 ;; Variable alist?
275 (dolist (x (nthcdr 5 defaults))
276 (set (make-local-variable (car x)) (cdr x)))
272 (when (and defaults 277 (when (and defaults
273 ;; Detect if this is a simple mode, which doesn't use 278 ;; Detect if this is a simple mode, which doesn't use
274 ;; any syntactic fontification functions. 279 ;; any syntactic fontification functions.
275 (not (cdr (assq 'font-lock-core-only 280 (not font-lock-core-only))
276 (nthcdr 5 defaults)))))
277 (require 'font-lock) 281 (require 'font-lock)
278 (font-lock-set-defaults-1))))) 282 (font-lock-set-defaults-1)))))
279 283