aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2005-12-22 16:09:32 +0000
committerStefan Monnier2005-12-22 16:09:32 +0000
commite0be77f6d88f3cd8226c2897e5019d3897a39d4f (patch)
tree648376e940c25602835b90eb7562a7f1817fb274
parent2e23b82e52e5fa52971b2b6e4a0e173c05476f52 (diff)
downloademacs-e0be77f6d88f3cd8226c2897e5019d3897a39d4f.tar.gz
emacs-e0be77f6d88f3cd8226c2897e5019d3897a39d4f.zip
(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.
-rw-r--r--lisp/ChangeLog10
-rw-r--r--lisp/font-lock.el27
2 files changed, 23 insertions, 14 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 130bfcdde69..1aeb8df4fcc 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,13 @@
12005-12-22 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * font-lock.el (font-lock-default-fontify-buffer): Try and set-defaults
4 even if font-lock-mode is non-nil since it may be t without having
5 turned on font-lock-mode-internal.
6 (font-lock-choose-keywords): Minor optimization.
7 (font-lock-add-keywords, font-lock-remove-keywords)
8 (font-lock-set-defaults): Don't call make-local-variable on a variable
9 that we know to already be local.
10
12005-12-22 Katsumi Yamaoka <yamaoka@jpl.org> 112005-12-22 Katsumi Yamaoka <yamaoka@jpl.org>
2 12
3 * emacs-lisp/lisp.el (lisp-complete-symbol): Don't print progress 13 * emacs-lisp/lisp.el (lisp-complete-symbol): Don't print progress
diff --git a/lisp/font-lock.el b/lisp/font-lock.el
index be97ce41e61..ca0848bd561 100644
--- a/lisp/font-lock.el
+++ b/lisp/font-lock.el
@@ -153,8 +153,8 @@
153;; 153;;
154;; (add-hook 'foo-mode-hook 154;; (add-hook 'foo-mode-hook
155;; (lambda () 155;; (lambda ()
156;; (make-local-variable 'font-lock-defaults) 156;; (set (make-local-variable 'font-lock-defaults)
157;; (setq font-lock-defaults '(foo-font-lock-keywords t)))) 157;; '(foo-font-lock-keywords t))))
158 158
159;;; Adding Font Lock support for modes: 159;;; Adding Font Lock support for modes:
160 160
@@ -174,8 +174,8 @@
174;; 174;;
175;; and within `bar-mode' there could be: 175;; and within `bar-mode' there could be:
176;; 176;;
177;; (make-local-variable 'font-lock-defaults) 177;; (set (make-local-variable 'font-lock-defaults)
178;; (setq font-lock-defaults '(bar-font-lock-keywords nil t)) 178;; '(bar-font-lock-keywords nil t))
179 179
180;; What is fontification for? You might say, "It's to make my code look nice." 180;; What is fontification for? You might say, "It's to make my code look nice."
181;; I think it should be for adding information in the form of cues. These cues 181;; I think it should be for adding information in the form of cues. These cues
@@ -723,8 +723,8 @@ see the variables `c-font-lock-extra-types', `c++-font-lock-extra-types',
723 (append keywords old))))) 723 (append keywords old)))))
724 ;; If the keywords were compiled before, compile them again. 724 ;; If the keywords were compiled before, compile them again.
725 (if was-compiled 725 (if was-compiled
726 (set (make-local-variable 'font-lock-keywords) 726 (setq font-lock-keywords
727 (font-lock-compile-keywords font-lock-keywords t))))))) 727 (font-lock-compile-keywords font-lock-keywords t)))))))
728 728
729(defun font-lock-update-removed-keyword-alist (mode keywords how) 729(defun font-lock-update-removed-keyword-alist (mode keywords how)
730 "Update `font-lock-removed-keywords-alist' when adding new KEYWORDS to MODE." 730 "Update `font-lock-removed-keywords-alist' when adding new KEYWORDS to MODE."
@@ -830,8 +830,8 @@ happens, so the major mode can be corrected."
830 830
831 ;; If the keywords were compiled before, compile them again. 831 ;; If the keywords were compiled before, compile them again.
832 (if was-compiled 832 (if was-compiled
833 (set (make-local-variable 'font-lock-keywords) 833 (setq font-lock-keywords
834 (font-lock-compile-keywords font-lock-keywords t))))))) 834 (font-lock-compile-keywords font-lock-keywords t)))))))
835 835
836;;; Font Lock Support mode. 836;;; Font Lock Support mode.
837 837
@@ -1001,8 +1001,7 @@ The value of this variable is used when Font Lock mode is turned on."
1001 (when verbose 1001 (when verbose
1002 (format "Fontifying %s..." (buffer-name))) 1002 (format "Fontifying %s..." (buffer-name)))
1003 ;; Make sure we have the right `font-lock-keywords' etc. 1003 ;; Make sure we have the right `font-lock-keywords' etc.
1004 (unless font-lock-mode 1004 (font-lock-set-defaults)
1005 (font-lock-set-defaults))
1006 ;; Make sure we fontify etc. in the whole buffer. 1005 ;; Make sure we fontify etc. in the whole buffer.
1007 (save-restriction 1006 (save-restriction
1008 (widen) 1007 (widen)
@@ -1574,9 +1573,9 @@ A LEVEL of nil is equal to a LEVEL of 0, a LEVEL of t is equal to
1574 (cond ((not (and (listp keywords) (symbolp (car keywords)))) 1573 (cond ((not (and (listp keywords) (symbolp (car keywords))))
1575 keywords) 1574 keywords)
1576 ((numberp level) 1575 ((numberp level)
1577 (or (nth level keywords) (car (reverse keywords)))) 1576 (or (nth level keywords) (car (last keywords))))
1578 ((eq level t) 1577 ((eq level t)
1579 (car (reverse keywords))) 1578 (car (last keywords)))
1580 (t 1579 (t
1581 (car keywords)))) 1580 (car keywords))))
1582 1581
@@ -1642,8 +1641,8 @@ Sets various variables using `font-lock-defaults' (or, if nil, using
1642 (font-lock-remove-keywords nil removed-keywords)) 1641 (font-lock-remove-keywords nil removed-keywords))
1643 ;; Now compile the keywords. 1642 ;; Now compile the keywords.
1644 (unless (eq (car font-lock-keywords) t) 1643 (unless (eq (car font-lock-keywords) t)
1645 (set (make-local-variable 'font-lock-keywords) 1644 (setq font-lock-keywords
1646 (font-lock-compile-keywords font-lock-keywords t)))))) 1645 (font-lock-compile-keywords font-lock-keywords t))))))
1647 1646
1648;;; Colour etc. support. 1647;;; Colour etc. support.
1649 1648