aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2000-10-08 19:07:14 +0000
committerStefan Monnier2000-10-08 19:07:14 +0000
commitfd612dd94676a64abf6f85d4edfabaec02d71296 (patch)
tree1999dfde6545777f27bb81a0ed1bee7960b5f2ca
parenta62e3c6f35f76a6bb22dc28f23df2d609993eb37 (diff)
downloademacs-fd612dd94676a64abf6f85d4edfabaec02d71296.tar.gz
emacs-fd612dd94676a64abf6f85d4edfabaec02d71296.zip
(font-lock-defaults): Make buffer-local.
(font-lock-turn-on-thing-lock): Use jit-lock-refontify. (font-lock-choose-keywords): Ignore LEVEL unless KEYWORDS is a list of syms. (c-keywords, c++-keywords, objc-keywords, java-keywords): Don't wrap regexp-opt things in \(...\) unnecessarily.
-rw-r--r--lisp/font-lock.el16
1 files changed, 9 insertions, 7 deletions
diff --git a/lisp/font-lock.el b/lisp/font-lock.el
index 637b6d9a4ff..463c94e2127 100644
--- a/lisp/font-lock.el
+++ b/lisp/font-lock.el
@@ -444,6 +444,8 @@ and those for buffer-specialised fontification functions,
444`font-lock-fontify-buffer-function', `font-lock-unfontify-buffer-function', 444`font-lock-fontify-buffer-function', `font-lock-unfontify-buffer-function',
445`font-lock-fontify-region-function', `font-lock-unfontify-region-function', 445`font-lock-fontify-region-function', `font-lock-unfontify-region-function',
446`font-lock-inhibit-thing-lock' and `font-lock-maximum-size'.") 446`font-lock-inhibit-thing-lock' and `font-lock-maximum-size'.")
447;;;###autoload
448(make-variable-buffer-local 'font-lock-defaults)
447 449
448;; This variable is used where font-lock.el itself supplies the keywords. 450;; This variable is used where font-lock.el itself supplies the keywords.
449(defvar font-lock-defaults-alist 451(defvar font-lock-defaults-alist
@@ -1084,7 +1086,7 @@ The value of this variable is used when Font Lock mode is turned on."
1084 (remove-hook 'after-change-functions 1086 (remove-hook 'after-change-functions
1085 'font-lock-after-change-function t) 1087 'font-lock-after-change-function t)
1086 (set (make-local-variable 'font-lock-fontify-buffer-function) 1088 (set (make-local-variable 'font-lock-fontify-buffer-function)
1087 'jit-lock-fontify-buffer) 1089 'jit-lock-refontify)
1088 ;; Don't fontify eagerly (and don't abort is the buffer is large). 1090 ;; Don't fontify eagerly (and don't abort is the buffer is large).
1089 (set (make-local-variable 'font-lock-fontified) t) 1091 (set (make-local-variable 'font-lock-fontified) t)
1090 ;; Use jit-lock. 1092 ;; Use jit-lock.
@@ -1693,7 +1695,7 @@ Structure is ((MAJOR-MODE . VALUE) ...) where MAJOR-MODE may be t."
1693 "Return LEVELth element of KEYWORDS. 1695 "Return LEVELth element of KEYWORDS.
1694A LEVEL of nil is equal to a LEVEL of 0, a LEVEL of t is equal to 1696A LEVEL of nil is equal to a LEVEL of 0, a LEVEL of t is equal to
1695\(1- (length KEYWORDS))." 1697\(1- (length KEYWORDS))."
1696 (cond ((symbolp keywords) 1698 (cond ((not (and (listp keywords) (symbolp (car keywords))))
1697 keywords) 1699 keywords)
1698 ((numberp level) 1700 ((numberp level)
1699 (or (nth level keywords) (car (reverse keywords)))) 1701 (or (nth level keywords) (car (reverse keywords))))
@@ -2286,10 +2288,10 @@ See also `c-font-lock-extra-types'.")
2286 "typedef" "extern" "auto" "register" "static" 2288 "typedef" "extern" "auto" "register" "static"
2287 "volatile" "const" 2289 "volatile" "const"
2288 ;; Dan Nicolaescu <done@gnu.org> says this is new. 2290 ;; Dan Nicolaescu <done@gnu.org> says this is new.
2289 "restrict") t))) 2291 "restrict"))))
2290 (c-type-specs 2292 (c-type-specs
2291 (eval-when-compile 2293 (eval-when-compile
2292 (regexp-opt '("enum" "struct" "union") t))) 2294 (regexp-opt '("enum" "struct" "union"))))
2293 (c-type-specs-depth 2295 (c-type-specs-depth
2294 (regexp-opt-depth c-type-specs)) 2296 (regexp-opt-depth c-type-specs))
2295 (c-type-names 2297 (c-type-names
@@ -2506,7 +2508,7 @@ See also `c++-font-lock-extra-types'.")
2506 ;; as keywords not types. 2508 ;; as keywords not types.
2507 "typedef" "template" 2509 "typedef" "template"
2508 "extern" "auto" "register" "const" "volatile" "static" 2510 "extern" "auto" "register" "const" "volatile" "static"
2509 "inline" "friend" "virtual") t))) 2511 "inline" "friend" "virtual"))))
2510 (c++-operators 2512 (c++-operators
2511 (eval-when-compile 2513 (eval-when-compile
2512 (regexp-opt 2514 (regexp-opt
@@ -2716,7 +2718,7 @@ See also `objc-font-lock-extra-types'.")
2716 (regexp-opt '("break" "continue" "do" "else" "for" "if" "return" 2718 (regexp-opt '("break" "continue" "do" "else" "for" "if" "return"
2717 "switch" "while" "sizeof" "self" "super" 2719 "switch" "while" "sizeof" "self" "super"
2718 "typedef" "auto" "extern" "static" 2720 "typedef" "auto" "extern" "static"
2719 "volatile" "const") t))) 2721 "volatile" "const"))))
2720 (objc-type-specs 2722 (objc-type-specs
2721 (eval-when-compile 2723 (eval-when-compile
2722 (regexp-opt 2724 (regexp-opt
@@ -2877,7 +2879,7 @@ See also `java-font-lock-extra-types'.")
2877 ;; "cast" "byvalue" "future" "generic" "operator" "var" 2879 ;; "cast" "byvalue" "future" "generic" "operator" "var"
2878 ;; "inner" "outer" "rest" 2880 ;; "inner" "outer" "rest"
2879 "implements" "extends" "throws" "instanceof" "new" 2881 "implements" "extends" "throws" "instanceof" "new"
2880 "interface" "return" "switch" "throw" "try" "while") t))) 2882 "interface" "return" "switch" "throw" "try" "while"))))
2881 ;; 2883 ;;
2882 ;; Classes immediately followed by an object name. 2884 ;; Classes immediately followed by an object name.
2883 (java-type-names 2885 (java-type-names