73 |
`font-lock-inhibit-thing-lock' and `font-lock-maximum-size'.") |
`font-lock-inhibit-thing-lock' and `font-lock-maximum-size'.") |
74 |
(make-variable-buffer-local 'font-lock-defaults) |
(make-variable-buffer-local 'font-lock-defaults) |
75 |
|
|
|
(defvar font-lock-core-only nil |
|
|
"If non-nil, then don't load font-lock.el unless necessary.") |
|
|
|
|
76 |
;; This variable is used where font-lock.el itself supplies the |
;; 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 |
;; 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 |
;; we can't avoid it. In the future, this stuff will hopefully be |
222 |
(push (list 'face 'font-lock-face) char-property-alias-alist))) |
(push (list 'face 'font-lock-face) char-property-alias-alist))) |
223 |
;; Only do hard work if the mode has specified stuff in |
;; Only do hard work if the mode has specified stuff in |
224 |
;; `font-lock-defaults'. |
;; `font-lock-defaults'. |
225 |
(when (and font-lock-defaults |
(when font-lock-defaults |
|
(not font-lock-core-only)) |
|
226 |
(add-hook 'after-change-functions 'font-lock-after-change-function t t) |
(add-hook 'after-change-functions 'font-lock-after-change-function t t) |
227 |
(font-lock-turn-on-thing-lock) |
(font-lock-turn-on-thing-lock) |
228 |
;; Fontify the buffer if we have to. |
;; Fontify the buffer if we have to. |
244 |
(setcdr elt (remq 'font-lock-face (cdr elt))) |
(setcdr elt (remq 'font-lock-face (cdr elt))) |
245 |
(when (null (cdr elt)) |
(when (null (cdr elt)) |
246 |
(setq char-property-alias-alist (delq elt char-property-alias-alist))))) |
(setq char-property-alias-alist (delq elt char-property-alias-alist))))) |
247 |
(when (and font-lock-defaults |
(when font-lock-defaults |
|
(not font-lock-core-only)) |
|
248 |
(remove-hook 'after-change-functions 'font-lock-after-change-function t) |
(remove-hook 'after-change-functions 'font-lock-after-change-function t) |
249 |
(font-lock-unfontify-buffer) |
(font-lock-unfontify-buffer) |
250 |
(font-lock-turn-off-thing-lock)))) |
(font-lock-turn-off-thing-lock)))) |
266 |
(make-local-variable 'font-lock-multiline) |
(make-local-variable 'font-lock-multiline) |
267 |
(let ((defaults (or font-lock-defaults |
(let ((defaults (or font-lock-defaults |
268 |
(cdr (assq major-mode font-lock-defaults-alist))))) |
(cdr (assq major-mode font-lock-defaults-alist))))) |
269 |
;; Variable alist? |
(when defaults |
|
(dolist (x (nthcdr 5 defaults)) |
|
|
(set (make-local-variable (car x)) (cdr x))) |
|
|
(when (and defaults |
|
|
;; Detect if this is a simple mode, which doesn't use |
|
|
;; any syntactic fontification functions. |
|
|
(not font-lock-core-only)) |
|
270 |
(require 'font-lock) |
(require 'font-lock) |
271 |
(font-lock-set-defaults-1))))) |
(font-lock-set-defaults-1))))) |
272 |
|
|
342 |
:group 'font-lock) |
:group 'font-lock) |
343 |
|
|
344 |
(defun turn-on-font-lock-if-enabled () |
(defun turn-on-font-lock-if-enabled () |
345 |
(when (and (or font-lock-defaults |
(unless (and (eq (car-safe font-lock-global-modes) 'not) |
346 |
(assq major-mode font-lock-defaults-alist)) |
(memq major-mode (cdr font-lock-global-modes))) |
|
(or (eq font-lock-global-modes t) |
|
|
(if (eq (car-safe font-lock-global-modes) 'not) |
|
|
(not (memq major-mode (cdr font-lock-global-modes))) |
|
|
(memq major-mode font-lock-global-modes)))) |
|
347 |
(let (inhibit-quit) |
(let (inhibit-quit) |
348 |
(turn-on-font-lock)))) |
(turn-on-font-lock)))) |
349 |
|
|