diff options
| author | Stefan Monnier | 2002-09-25 19:34:07 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2002-09-25 19:34:07 +0000 |
| commit | 7f0d55f29ebc98d6ee06040e75fc1e415d5b55ec (patch) | |
| tree | fefc9b7bb90887c0d83e1a81a5526673ddc7ac1f | |
| parent | 1a40d81d1a511d2c0bb6be6e2149f6a3e84aa06c (diff) | |
| download | emacs-7f0d55f29ebc98d6ee06040e75fc1e415d5b55ec.tar.gz emacs-7f0d55f29ebc98d6ee06040e75fc1e415d5b55ec.zip | |
(fast-lock-mode, lazy-lock-mode, jit-lock-mode): Don't bind them variables.
(font-lock-turn-off-thing-lock, font-lock-after-fontify-buffer)
(font-lock-after-unfontify-buffer): Check that the vars are bound.
(font-lock-dont-widen): New var.
(font-lock-default-fontify-region): Use it.
| -rw-r--r-- | lisp/font-lock.el | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/lisp/font-lock.el b/lisp/font-lock.el index ceb0cc1187c..a8ecf18c5ed 100644 --- a/lisp/font-lock.el +++ b/lisp/font-lock.el | |||
| @@ -788,9 +788,9 @@ The value of this variable is used when Font Lock mode is turned on." | |||
| 788 | :version "21.1" | 788 | :version "21.1" |
| 789 | :group 'font-lock) | 789 | :group 'font-lock) |
| 790 | 790 | ||
| 791 | (defvar fast-lock-mode nil) | 791 | (defvar fast-lock-mode) |
| 792 | (defvar lazy-lock-mode nil) | 792 | (defvar lazy-lock-mode) |
| 793 | (defvar jit-lock-mode nil) | 793 | (defvar jit-lock-mode) |
| 794 | 794 | ||
| 795 | (defun font-lock-turn-on-thing-lock () | 795 | (defun font-lock-turn-on-thing-lock () |
| 796 | (let ((thing-mode (font-lock-value-in-major-mode font-lock-support-mode))) | 796 | (let ((thing-mode (font-lock-value-in-major-mode font-lock-support-mode))) |
| @@ -811,26 +811,26 @@ The value of this variable is used when Font Lock mode is turned on." | |||
| 811 | (not font-lock-keywords-only)))))) | 811 | (not font-lock-keywords-only)))))) |
| 812 | 812 | ||
| 813 | (defun font-lock-turn-off-thing-lock () | 813 | (defun font-lock-turn-off-thing-lock () |
| 814 | (cond (fast-lock-mode | 814 | (cond ((and (boundp 'fast-lock-mode) fast-lock-mode) |
| 815 | (fast-lock-mode -1)) | 815 | (fast-lock-mode -1)) |
| 816 | (jit-lock-mode | 816 | ((and (boundp 'jit-lock-mode) jit-lock-mode) |
| 817 | (jit-lock-unregister 'font-lock-fontify-region) | 817 | (jit-lock-unregister 'font-lock-fontify-region) |
| 818 | ;; Reset local vars to the non-jit-lock case. | 818 | ;; Reset local vars to the non-jit-lock case. |
| 819 | (kill-local-variable 'font-lock-fontify-buffer-function)) | 819 | (kill-local-variable 'font-lock-fontify-buffer-function)) |
| 820 | (lazy-lock-mode | 820 | ((and (boundp 'lazy-lock-mode) lazy-lock-mode) |
| 821 | (lazy-lock-mode -1)))) | 821 | (lazy-lock-mode -1)))) |
| 822 | 822 | ||
| 823 | (defun font-lock-after-fontify-buffer () | 823 | (defun font-lock-after-fontify-buffer () |
| 824 | (cond (fast-lock-mode | 824 | (cond ((and (boundp 'fast-lock-mode) fast-lock-mode) |
| 825 | (fast-lock-after-fontify-buffer)) | 825 | (fast-lock-after-fontify-buffer)) |
| 826 | ;; Useless now that jit-lock intercepts font-lock-fontify-buffer. -sm | 826 | ;; Useless now that jit-lock intercepts font-lock-fontify-buffer. -sm |
| 827 | ;; (jit-lock-mode | 827 | ;; (jit-lock-mode |
| 828 | ;; (jit-lock-after-fontify-buffer)) | 828 | ;; (jit-lock-after-fontify-buffer)) |
| 829 | (lazy-lock-mode | 829 | ((and (boundp 'lazy-lock-mode) lazy-lock-mode) |
| 830 | (lazy-lock-after-fontify-buffer)))) | 830 | (lazy-lock-after-fontify-buffer)))) |
| 831 | 831 | ||
| 832 | (defun font-lock-after-unfontify-buffer () | 832 | (defun font-lock-after-unfontify-buffer () |
| 833 | (cond (fast-lock-mode | 833 | (cond ((and (boundp 'fast-lock-mode) fast-lock-mode) |
| 834 | (fast-lock-after-unfontify-buffer)) | 834 | (fast-lock-after-unfontify-buffer)) |
| 835 | ;; Useless as well. It's only called when: | 835 | ;; Useless as well. It's only called when: |
| 836 | ;; - turning off font-lock: it does not matter if we leave spurious | 836 | ;; - turning off font-lock: it does not matter if we leave spurious |
| @@ -840,7 +840,7 @@ The value of this variable is used when Font Lock mode is turned on." | |||
| 840 | ;; | 840 | ;; |
| 841 | ;; (jit-lock-mode | 841 | ;; (jit-lock-mode |
| 842 | ;; (jit-lock-after-unfontify-buffer)) | 842 | ;; (jit-lock-after-unfontify-buffer)) |
| 843 | (lazy-lock-mode | 843 | ((and (boundp 'lazy-lock-mode) lazy-lock-mode) |
| 844 | (lazy-lock-after-unfontify-buffer)))) | 844 | (lazy-lock-after-unfontify-buffer)))) |
| 845 | 845 | ||
| 846 | ;;; End of Font Lock Support mode. | 846 | ;;; End of Font Lock Support mode. |
| @@ -932,13 +932,18 @@ The value of this variable is used when Font Lock mode is turned on." | |||
| 932 | (font-lock-after-unfontify-buffer) | 932 | (font-lock-after-unfontify-buffer) |
| 933 | (setq font-lock-fontified nil))) | 933 | (setq font-lock-fontified nil))) |
| 934 | 934 | ||
| 935 | (defvar font-lock-dont-widen nil | ||
| 936 | "If non-nil, font-lock will work on the non-widened buffer. | ||
| 937 | Useful for things like RMAIL and Info where the whole buffer is not | ||
| 938 | a very meaningful entity to highlight.") | ||
| 939 | |||
| 935 | (defun font-lock-default-fontify-region (beg end loudly) | 940 | (defun font-lock-default-fontify-region (beg end loudly) |
| 936 | (save-buffer-state | 941 | (save-buffer-state |
| 937 | ((parse-sexp-lookup-properties font-lock-syntactic-keywords) | 942 | ((parse-sexp-lookup-properties font-lock-syntactic-keywords) |
| 938 | (old-syntax-table (syntax-table))) | 943 | (old-syntax-table (syntax-table))) |
| 939 | (unwind-protect | 944 | (unwind-protect |
| 940 | (save-restriction | 945 | (save-restriction |
| 941 | (widen) | 946 | (unless font-lock-dont-widen (widen)) |
| 942 | ;; Use the fontification syntax table, if any. | 947 | ;; Use the fontification syntax table, if any. |
| 943 | (when font-lock-syntax-table | 948 | (when font-lock-syntax-table |
| 944 | (set-syntax-table font-lock-syntax-table)) | 949 | (set-syntax-table font-lock-syntax-table)) |
| @@ -1025,7 +1030,8 @@ delimit the region to fontify." | |||
| 1025 | (font-lock-fontify-region (point) (mark))) | 1030 | (font-lock-fontify-region (point) (mark))) |
| 1026 | ((error quit) (message "Fontifying block...%s" error-data))))))) | 1031 | ((error quit) (message "Fontifying block...%s" error-data))))))) |
| 1027 | 1032 | ||
| 1028 | (define-key facemenu-keymap "\M-g" 'font-lock-fontify-block) | 1033 | (if (boundp 'facemenu-keymap) |
| 1034 | (define-key facemenu-keymap "\M-g" 'font-lock-fontify-block)) | ||
| 1029 | 1035 | ||
| 1030 | ;;; End of Fontification functions. | 1036 | ;;; End of Fontification functions. |
| 1031 | 1037 | ||
| @@ -1312,7 +1318,8 @@ LIMIT can be modified by the value of its PRE-MATCH-FORM." | |||
| 1312 | 1318 | ||
| 1313 | (defun font-lock-fontify-keywords-region (start end &optional loudly) | 1319 | (defun font-lock-fontify-keywords-region (start end &optional loudly) |
| 1314 | "Fontify according to `font-lock-keywords' between START and END. | 1320 | "Fontify according to `font-lock-keywords' between START and END. |
| 1315 | START should be at the beginning of a line." | 1321 | START should be at the beginning of a line. |
| 1322 | LOUDLY, if non-nil, allows progress-meter bar." | ||
| 1316 | (unless (eq (car font-lock-keywords) t) | 1323 | (unless (eq (car font-lock-keywords) t) |
| 1317 | (setq font-lock-keywords | 1324 | (setq font-lock-keywords |
| 1318 | (font-lock-compile-keywords font-lock-keywords t))) | 1325 | (font-lock-compile-keywords font-lock-keywords t))) |