summaryrefslogtreecommitdiff
path: root/lisp/font-core.el
diff options
context:
space:
mode:
authorColin Walters <walters@gnu.org>2002-06-09 00:19:23 +0000
committerColin Walters <walters@gnu.org>2002-06-09 00:19:23 +0000
commit660acebe9ce362749a96ca8c7450d50219a94062 (patch)
tree62db85661cc7dd2a5e7c57446b663558c3cde616 /lisp/font-core.el
parent4d1b2f822a9ea3b1866f7410b6c45a20dfddb36c (diff)
downloademacs-660acebe9ce362749a96ca8c7450d50219a94062.tar.gz
(font-lock-core-only): New variable.
(font-lock-set-defaults): Use it.
Diffstat (limited to 'lisp/font-core.el')
-rw-r--r--lisp/font-core.el18
1 files changed, 12 insertions, 6 deletions
diff --git a/lisp/font-core.el b/lisp/font-core.el
index fff4820e28a..08d2eb07d97 100644
--- a/lisp/font-core.el
+++ b/lisp/font-core.el
@@ -73,6 +73,9 @@ and those for buffer-specialised fontification functions,
`font-lock-inhibit-thing-lock' and `font-lock-maximum-size'.")
(make-variable-buffer-local 'font-lock-defaults)
+(defvar font-lock-core-only nil
+ "If non-nil, then don't load font-lock.el unless necessary.")
+
;; This variable is used where font-lock.el itself supplies the
;; keywords. Really, this shouldn't need to be in font-core.el, but
;; we can't avoid it. In the future, this stuff will hopefully be
@@ -264,12 +267,15 @@ Sets various variables using `font-lock-defaults' (or, if nil, using
(set (make-local-variable 'font-lock-set-defaults) t)
(make-local-variable 'font-lock-fontified)
(make-local-variable 'font-lock-multiline)
- ;; Detect if this is a simple mode, which doesn't use any
- ;; syntactic fontification functions.
- (when (or font-lock-defaults
- (assq major-mode font-lock-defaults-alist))
- (require 'font-lock)
- (font-lock-set-defaults-1))))
+ (let ((defaults (or font-lock-defaults
+ (assq major-mode font-lock-defaults-alist))))
+ (when (and defaults
+ ;; Detect if this is a simple mode, which doesn't use
+ ;; any syntactic fontification functions.
+ (not (cdr (assq 'font-lock-core-only
+ (nthcdr 5 defaults)))))
+ (require 'font-lock)
+ (font-lock-set-defaults-1)))))
;;; Global Font Lock mode.