Mercurial > emacs
comparison lisp/font-core.el @ 45708:148691ba23f9
(font-lock-core-only): New variable.
(font-lock-set-defaults): Use it.
author | Colin Walters <walters@gnu.org> |
---|---|
date | Sun, 09 Jun 2002 00:19:23 +0000 |
parents | 25d73d0e2b98 |
children | 57fbb3200dc6 |
comparison
equal
deleted
inserted
replaced
45707:1ad70e69b4ba | 45708:148691ba23f9 |
---|---|
70 and those for buffer-specialised fontification functions, | 70 and those for buffer-specialised fontification functions, |
71 `font-lock-fontify-buffer-function', `font-lock-unfontify-buffer-function', | 71 `font-lock-fontify-buffer-function', `font-lock-unfontify-buffer-function', |
72 `font-lock-fontify-region-function', `font-lock-unfontify-region-function', | 72 `font-lock-fontify-region-function', `font-lock-unfontify-region-function', |
73 `font-lock-inhibit-thing-lock' and `font-lock-maximum-size'.") | 73 `font-lock-inhibit-thing-lock' and `font-lock-maximum-size'.") |
74 (make-variable-buffer-local 'font-lock-defaults) | 74 (make-variable-buffer-local 'font-lock-defaults) |
75 | |
76 (defvar font-lock-core-only nil | |
77 "If non-nil, then don't load font-lock.el unless necessary.") | |
75 | 78 |
76 ;; This variable is used where font-lock.el itself supplies the | 79 ;; This variable is used where font-lock.el itself supplies the |
77 ;; keywords. Really, this shouldn't need to be in font-core.el, but | 80 ;; keywords. Really, this shouldn't need to be in font-core.el, but |
78 ;; we can't avoid it. In the future, this stuff will hopefully be | 81 ;; we can't avoid it. In the future, this stuff will hopefully be |
79 ;; moved to cc-mode itself. | 82 ;; moved to cc-mode itself. |
262 `font-lock-defaults-alist') and `font-lock-maximum-decoration'." | 265 `font-lock-defaults-alist') and `font-lock-maximum-decoration'." |
263 (unless font-lock-set-defaults | 266 (unless font-lock-set-defaults |
264 (set (make-local-variable 'font-lock-set-defaults) t) | 267 (set (make-local-variable 'font-lock-set-defaults) t) |
265 (make-local-variable 'font-lock-fontified) | 268 (make-local-variable 'font-lock-fontified) |
266 (make-local-variable 'font-lock-multiline) | 269 (make-local-variable 'font-lock-multiline) |
267 ;; Detect if this is a simple mode, which doesn't use any | 270 (let ((defaults (or font-lock-defaults |
268 ;; syntactic fontification functions. | 271 (assq major-mode font-lock-defaults-alist)))) |
269 (when (or font-lock-defaults | 272 (when (and defaults |
270 (assq major-mode font-lock-defaults-alist)) | 273 ;; Detect if this is a simple mode, which doesn't use |
271 (require 'font-lock) | 274 ;; any syntactic fontification functions. |
272 (font-lock-set-defaults-1)))) | 275 (not (cdr (assq 'font-lock-core-only |
276 (nthcdr 5 defaults))))) | |
277 (require 'font-lock) | |
278 (font-lock-set-defaults-1))))) | |
273 | 279 |
274 ;;; Global Font Lock mode. | 280 ;;; Global Font Lock mode. |
275 | 281 |
276 ;; A few people have hassled in the past for a way to make it easier to turn on | 282 ;; A few people have hassled in the past for a way to make it easier to turn on |
277 ;; Font Lock mode, without the user needing to know for which modes s/he has to | 283 ;; Font Lock mode, without the user needing to know for which modes s/he has to |