diff options
| author | Simon Marshall | 1996-03-07 13:47:46 +0000 |
|---|---|---|
| committer | Simon Marshall | 1996-03-07 13:47:46 +0000 |
| commit | 2d9cdda805dbdeccb0410f7421d4d64518ee5922 (patch) | |
| tree | b8118ec0fdc5c1528ee9b74892b7acb3778339dc | |
| parent | 35aba73916dfc9a41e1fe8710efa0aca25da166d (diff) | |
| download | emacs-2d9cdda805dbdeccb0410f7421d4d64518ee5922.tar.gz emacs-2d9cdda805dbdeccb0410f7421d4d64518ee5922.zip | |
Treat font-lock-keywords of (t) the same as nil.
xvc
| -rw-r--r-- | lisp/font-lock.el | 91 |
1 files changed, 45 insertions, 46 deletions
diff --git a/lisp/font-lock.el b/lisp/font-lock.el index b5bce661d0c..33ba04dc41a 100644 --- a/lisp/font-lock.el +++ b/lisp/font-lock.el | |||
| @@ -97,7 +97,7 @@ | |||
| 97 | 97 | ||
| 98 | ;;;###autoload | 98 | ;;;###autoload |
| 99 | (defvar font-lock-maximum-decoration nil | 99 | (defvar font-lock-maximum-decoration nil |
| 100 | "*If non-nil, the maximum decoration level for fontifying. | 100 | "*Maximum decoration level for fontification. |
| 101 | If nil, use the default decoration (typically the minimum available). | 101 | If nil, use the default decoration (typically the minimum available). |
| 102 | If t, use the maximum decoration available. | 102 | If t, use the maximum decoration available. |
| 103 | If a number, use that level of decoration (or if not available the maximum). | 103 | If a number, use that level of decoration (or if not available the maximum). |
| @@ -109,7 +109,7 @@ available for buffers in `c-mode', and level 1 decoration otherwise.") | |||
| 109 | 109 | ||
| 110 | ;;;###autoload | 110 | ;;;###autoload |
| 111 | (defvar font-lock-maximum-size (* 250 1024) | 111 | (defvar font-lock-maximum-size (* 250 1024) |
| 112 | "*If non-nil, the maximum size for buffers for fontifying. | 112 | "*Maximum size of a buffer for buffer fontification. |
| 113 | Only buffers less than this can be fontified when Font Lock mode is turned on. | 113 | Only buffers less than this can be fontified when Font Lock mode is turned on. |
| 114 | If nil, means size is irrelevant. | 114 | If nil, means size is irrelevant. |
| 115 | If a list, each element should be a cons pair of the form (MAJOR-MODE . SIZE), | 115 | If a list, each element should be a cons pair of the form (MAJOR-MODE . SIZE), |
| @@ -516,12 +516,12 @@ Turn on only if the buffer mode supports it and the terminal can display it." | |||
| 516 | ;; `major-mode-hook' is simpler), but maybe someone can come up with another | 516 | ;; `major-mode-hook' is simpler), but maybe someone can come up with another |
| 517 | ;; solution? --sm. | 517 | ;; solution? --sm. |
| 518 | 518 | ||
| 519 | (defvar font-lock-cache-buffers nil) ; For remembering buffers. | 519 | (defvar font-lock-buffers nil) ; For remembering buffers. |
| 520 | (defvar change-major-mode-hook nil) ; Make sure it's not void. | 520 | (defvar change-major-mode-hook nil) ; Make sure it's not void. |
| 521 | 521 | ||
| 522 | ;;;###autoload | 522 | ;;;###autoload |
| 523 | (defvar font-lock-global-modes t | 523 | (defvar font-lock-global-modes t |
| 524 | "*List of modes for which Font Lock mode is automatically turned on. | 524 | "*Modes for which Font Lock mode is automatically turned on. |
| 525 | Global Font Lock mode is controlled by the `global-font-lock-mode' command. | 525 | Global Font Lock mode is controlled by the `global-font-lock-mode' command. |
| 526 | If nil, means no modes have Font Lock mode automatically turned on. | 526 | If nil, means no modes have Font Lock mode automatically turned on. |
| 527 | If t, all modes that support Font Lock mode have it automatically turned on. | 527 | If t, all modes that support Font Lock mode have it automatically turned on. |
| @@ -546,7 +546,7 @@ turned on in a buffer if its major mode is one of `font-lock-global-modes'." | |||
| 546 | (remove-hook 'change-major-mode-hook 'font-lock-change-major-mode) | 546 | (remove-hook 'change-major-mode-hook 'font-lock-change-major-mode) |
| 547 | (add-hook 'change-major-mode-hook 'font-lock-change-major-mode) | 547 | (add-hook 'change-major-mode-hook 'font-lock-change-major-mode) |
| 548 | (add-hook 'post-command-hook 'turn-on-font-lock-if-enabled) | 548 | (add-hook 'post-command-hook 'turn-on-font-lock-if-enabled) |
| 549 | (setq font-lock-cache-buffers (buffer-list))) | 549 | (setq font-lock-buffers (buffer-list))) |
| 550 | (if message | 550 | (if message |
| 551 | (message "Global Font Lock mode is now %s." (if off-p "OFF" "ON"))) | 551 | (message "Global Font Lock mode is now %s." (if off-p "OFF" "ON"))) |
| 552 | (not off-p))) | 552 | (not off-p))) |
| @@ -557,23 +557,23 @@ turned on in a buffer if its major mode is one of `font-lock-global-modes'." | |||
| 557 | ;; major mode is being changed. Run `turn-on-font-lock-if-enabled' after the | 557 | ;; major mode is being changed. Run `turn-on-font-lock-if-enabled' after the |
| 558 | ;; current command has finished. | 558 | ;; current command has finished. |
| 559 | (add-hook 'post-command-hook 'turn-on-font-lock-if-enabled) | 559 | (add-hook 'post-command-hook 'turn-on-font-lock-if-enabled) |
| 560 | (add-to-list 'font-lock-cache-buffers (current-buffer))) | 560 | (add-to-list 'font-lock-buffers (current-buffer))) |
| 561 | 561 | ||
| 562 | (defun turn-on-font-lock-if-enabled () | 562 | (defun turn-on-font-lock-if-enabled () |
| 563 | ;; Gross hack warning: Delicate readers should avert eyes now. | 563 | ;; Gross hack warning: Delicate readers should avert eyes now. |
| 564 | ;; Turn on Font Lock mode if it's one of `font-lock-global-modes'. | 564 | ;; Turn on Font Lock mode if it's one of `font-lock-global-modes'. |
| 565 | (remove-hook 'post-command-hook 'turn-on-font-lock-if-enabled) | 565 | (remove-hook 'post-command-hook 'turn-on-font-lock-if-enabled) |
| 566 | (while font-lock-cache-buffers | 566 | (while font-lock-buffers |
| 567 | (if (buffer-live-p (car font-lock-cache-buffers)) | 567 | (if (buffer-live-p (car font-lock-buffers)) |
| 568 | (save-excursion | 568 | (save-excursion |
| 569 | (set-buffer (car font-lock-cache-buffers)) | 569 | (set-buffer (car font-lock-buffers)) |
| 570 | (if (or (eq font-lock-global-modes t) | 570 | (if (or (eq font-lock-global-modes t) |
| 571 | (if (eq (car-safe font-lock-global-modes) 'not) | 571 | (if (eq (car-safe font-lock-global-modes) 'not) |
| 572 | (not (memq major-mode (cdr font-lock-global-modes))) | 572 | (not (memq major-mode (cdr font-lock-global-modes))) |
| 573 | (memq major-mode font-lock-global-modes))) | 573 | (memq major-mode font-lock-global-modes))) |
| 574 | (let (inhibit-quit) | 574 | (let (inhibit-quit) |
| 575 | (turn-on-font-lock))))) | 575 | (turn-on-font-lock))))) |
| 576 | (setq font-lock-cache-buffers (cdr font-lock-cache-buffers)))) | 576 | (setq font-lock-buffers (cdr font-lock-buffers)))) |
| 577 | 577 | ||
| 578 | ;; End of Global Font Lock mode. | 578 | ;; End of Global Font Lock mode. |
| 579 | 579 | ||
| @@ -1051,41 +1051,40 @@ Sets various variables using `font-lock-defaults' (or, if nil, using | |||
| 1051 | (font-lock-make-faces) | 1051 | (font-lock-make-faces) |
| 1052 | ;; Set fontification defaults. | 1052 | ;; Set fontification defaults. |
| 1053 | (make-local-variable 'font-lock-fontified) | 1053 | (make-local-variable 'font-lock-fontified) |
| 1054 | (if font-lock-keywords | 1054 | (if (member font-lock-keywords '(nil (t))) |
| 1055 | nil | 1055 | (let* ((defaults (or font-lock-defaults |
| 1056 | (let* ((defaults (or font-lock-defaults | 1056 | (cdr (assq major-mode font-lock-defaults-alist)))) |
| 1057 | (cdr (assq major-mode font-lock-defaults-alist)))) | 1057 | (keywords |
| 1058 | (keywords | 1058 | (font-lock-choose-keywords (nth 0 defaults) |
| 1059 | (font-lock-choose-keywords (nth 0 defaults) | 1059 | (font-lock-value-in-major-mode font-lock-maximum-decoration)))) |
| 1060 | (font-lock-value-in-major-mode font-lock-maximum-decoration)))) | 1060 | ;; Regexp fontification? |
| 1061 | ;; Regexp fontification? | 1061 | (setq font-lock-keywords (if (fboundp keywords) |
| 1062 | (setq font-lock-keywords (if (fboundp keywords) | 1062 | (funcall keywords) |
| 1063 | (funcall keywords) | 1063 | (eval keywords))) |
| 1064 | (eval keywords))) | 1064 | ;; Syntactic fontification? |
| 1065 | ;; Syntactic fontification? | 1065 | (if (nth 1 defaults) |
| 1066 | (if (nth 1 defaults) | 1066 | (set (make-local-variable 'font-lock-keywords-only) t)) |
| 1067 | (set (make-local-variable 'font-lock-keywords-only) t)) | 1067 | ;; Case fold during regexp fontification? |
| 1068 | ;; Case fold during regexp fontification? | 1068 | (if (nth 2 defaults) |
| 1069 | (if (nth 2 defaults) | 1069 | (set (make-local-variable 'font-lock-keywords-case-fold-search) t)) |
| 1070 | (set (make-local-variable 'font-lock-keywords-case-fold-search) t)) | 1070 | ;; Syntax table for regexp and syntactic fontification? |
| 1071 | ;; Syntax table for regexp and syntactic fontification? | 1071 | (if (nth 3 defaults) |
| 1072 | (if (nth 3 defaults) | 1072 | (let ((slist (nth 3 defaults))) |
| 1073 | (let ((slist (nth 3 defaults))) | 1073 | (set (make-local-variable 'font-lock-syntax-table) |
| 1074 | (set (make-local-variable 'font-lock-syntax-table) | 1074 | (copy-syntax-table (syntax-table))) |
| 1075 | (copy-syntax-table (syntax-table))) | 1075 | (while slist |
| 1076 | (while slist | 1076 | (modify-syntax-entry (car (car slist)) (cdr (car slist)) |
| 1077 | (modify-syntax-entry (car (car slist)) (cdr (car slist)) | 1077 | font-lock-syntax-table) |
| 1078 | font-lock-syntax-table) | 1078 | (setq slist (cdr slist))))) |
| 1079 | (setq slist (cdr slist))))) | 1079 | ;; Syntax function for syntactic fontification? |
| 1080 | ;; Syntax function for syntactic fontification? | 1080 | (if (nth 4 defaults) |
| 1081 | (if (nth 4 defaults) | 1081 | (set (make-local-variable 'font-lock-beginning-of-syntax-function) |
| 1082 | (set (make-local-variable 'font-lock-beginning-of-syntax-function) | 1082 | (nth 4 defaults))) |
| 1083 | (nth 4 defaults))) | 1083 | ;; Variable alist? |
| 1084 | ;; Variable alist? | 1084 | (let ((alist (nthcdr 5 defaults))) |
| 1085 | (let ((alist (nthcdr 5 defaults))) | 1085 | (while alist |
| 1086 | (while alist | 1086 | (set (make-local-variable (car (car alist))) (cdr (car alist))) |
| 1087 | (set (make-local-variable (car (car alist))) (cdr (car alist))) | 1087 | (setq alist (cdr alist))))))) |
| 1088 | (setq alist (cdr alist))))))) | ||
| 1089 | 1088 | ||
| 1090 | (defun font-lock-unset-defaults () | 1089 | (defun font-lock-unset-defaults () |
| 1091 | "Unset fontification defaults. See `font-lock-set-defaults'." | 1090 | "Unset fontification defaults. See `font-lock-set-defaults'." |