comparison lisp/font-core.el @ 45713:57fbb3200dc6

(font-lock-default-function): If `font-lock-core-only' is non-nil, don't use big font-lock machinery.
author Colin Walters <walters@gnu.org>
date Sun, 09 Jun 2002 00:41:11 +0000
parents 148691ba23f9
children 9f0d0f0a1a7e
comparison
equal deleted inserted replaced
45712:3d25fe242d2a 45713:57fbb3200dc6
223 (unless (memq 'font-lock-face (cdr elt)) 223 (unless (memq 'font-lock-face (cdr elt))
224 (setcdr elt (nconc (cdr elt) (list 'font-lock-face)))) 224 (setcdr elt (nconc (cdr elt) (list 'font-lock-face))))
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.
232 (let ((max-size (font-lock-value-in-major-mode font-lock-maximum-size))) 233 (let ((max-size (font-lock-value-in-major-mode font-lock-maximum-size)))
233 (cond (font-lock-fontified 234 (cond (font-lock-fontified
245 (let ((elt (assq 'face char-property-alias-alist))) 246 (let ((elt (assq 'face char-property-alias-alist)))
246 (when elt 247 (when elt
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))))
254 256
255 (defun turn-on-font-lock () 257 (defun turn-on-font-lock ()
267 (set (make-local-variable 'font-lock-set-defaults) t) 269 (set (make-local-variable 'font-lock-set-defaults) t)
268 (make-local-variable 'font-lock-fontified) 270 (make-local-variable 'font-lock-fontified)
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
280 ;;; Global Font Lock mode. 284 ;;; Global Font Lock mode.
281 285