+2005-12-22 Stefan Monnier <monnier@iro.umontreal.ca>
+
+ * font-lock.el (font-lock-default-fontify-buffer): Try and set-defaults
+ even if font-lock-mode is non-nil since it may be t without having
+ turned on font-lock-mode-internal.
+ (font-lock-choose-keywords): Minor optimization.
+ (font-lock-add-keywords, font-lock-remove-keywords)
+ (font-lock-set-defaults): Don't call make-local-variable on a variable
+ that we know to already be local.
+
2005-12-22 Katsumi Yamaoka <yamaoka@jpl.org>
* emacs-lisp/lisp.el (lisp-complete-symbol): Don't print progress
;;
;; (add-hook 'foo-mode-hook
;; (lambda ()
-;; (make-local-variable 'font-lock-defaults)
-;; (setq font-lock-defaults '(foo-font-lock-keywords t))))
+;; (set (make-local-variable 'font-lock-defaults)
+;; '(foo-font-lock-keywords t))))
;;; Adding Font Lock support for modes:
;;
;; and within `bar-mode' there could be:
;;
-;; (make-local-variable 'font-lock-defaults)
-;; (setq font-lock-defaults '(bar-font-lock-keywords nil t))
+;; (set (make-local-variable 'font-lock-defaults)
+;; '(bar-font-lock-keywords nil t))
\f
;; What is fontification for? You might say, "It's to make my code look nice."
;; I think it should be for adding information in the form of cues. These cues
(append keywords old)))))
;; If the keywords were compiled before, compile them again.
(if was-compiled
- (set (make-local-variable 'font-lock-keywords)
- (font-lock-compile-keywords font-lock-keywords t)))))))
+ (setq font-lock-keywords
+ (font-lock-compile-keywords font-lock-keywords t)))))))
(defun font-lock-update-removed-keyword-alist (mode keywords how)
"Update `font-lock-removed-keywords-alist' when adding new KEYWORDS to MODE."
;; If the keywords were compiled before, compile them again.
(if was-compiled
- (set (make-local-variable 'font-lock-keywords)
- (font-lock-compile-keywords font-lock-keywords t)))))))
+ (setq font-lock-keywords
+ (font-lock-compile-keywords font-lock-keywords t)))))))
\f
;;; Font Lock Support mode.
(when verbose
(format "Fontifying %s..." (buffer-name)))
;; Make sure we have the right `font-lock-keywords' etc.
- (unless font-lock-mode
- (font-lock-set-defaults))
+ (font-lock-set-defaults)
;; Make sure we fontify etc. in the whole buffer.
(save-restriction
(widen)
(cond ((not (and (listp keywords) (symbolp (car keywords))))
keywords)
((numberp level)
- (or (nth level keywords) (car (reverse keywords))))
+ (or (nth level keywords) (car (last keywords))))
((eq level t)
- (car (reverse keywords)))
+ (car (last keywords)))
(t
(car keywords))))
(font-lock-remove-keywords nil removed-keywords))
;; Now compile the keywords.
(unless (eq (car font-lock-keywords) t)
- (set (make-local-variable 'font-lock-keywords)
- (font-lock-compile-keywords font-lock-keywords t))))))
+ (setq font-lock-keywords
+ (font-lock-compile-keywords font-lock-keywords t))))))
\f
;;; Colour etc. support.