diff options
| author | Colin Walters | 2002-05-23 03:39:00 +0000 |
|---|---|---|
| committer | Colin Walters | 2002-05-23 03:39:00 +0000 |
| commit | 7c4ef9b397f9da08ff24f0c8977218f299fdaf18 (patch) | |
| tree | 2b25691ea53725e9b2b594c430c73b65a17af968 | |
| parent | 577123f479ee82bc628a2dab06ceeb43baa9ed71 (diff) | |
| download | emacs-7c4ef9b397f9da08ff24f0c8977218f299fdaf18.tar.gz emacs-7c4ef9b397f9da08ff24f0c8977218f299fdaf18.zip | |
(font-lock-function): New variable.
(font-lock-default-function): New function, created from `font-lock-mode'.
(font-lock-mode): Just funcall `font-lock-default-function'.
| -rw-r--r-- | lisp/ChangeLog | 3 | ||||
| -rw-r--r-- | lisp/font-core.el | 14 |
2 files changed, 16 insertions, 1 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 4d1c545b02d..5ab630ecba0 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,8 @@ | |||
| 1 | 2002-05-22 Colin Walters <walters@cis.ohio-state.edu> | 1 | 2002-05-22 Colin Walters <walters@cis.ohio-state.edu> |
| 2 | 2 | ||
| 3 | * info.el (Info-mode-hook): Change `font-lock-mode' to | ||
| 4 | `turn-on-font-lock'. | ||
| 5 | |||
| 3 | * font-core.el (font-lock-function): New variable. | 6 | * font-core.el (font-lock-function): New variable. |
| 4 | (font-lock-default-function): New function, created from | 7 | (font-lock-default-function): New function, created from |
| 5 | `font-lock-mode'. | 8 | `font-lock-mode'. |
diff --git a/lisp/font-core.el b/lisp/font-core.el index 4447ecd4e7b..a00dc787315 100644 --- a/lisp/font-core.el +++ b/lisp/font-core.el | |||
| @@ -144,6 +144,12 @@ wish to have fontification turned on and off by Font Lock. If this | |||
| 144 | variable is non-nil, then calling `font-lock-mode' will simply toggle | 144 | variable is non-nil, then calling `font-lock-mode' will simply toggle |
| 145 | the symbol property `face' of CATEGORY-SYMBOL.") | 145 | the symbol property `face' of CATEGORY-SYMBOL.") |
| 146 | 146 | ||
| 147 | (defvar font-lock-function 'font-lock-default-function | ||
| 148 | "A function which is called when `font-lock-mode' is toggled. | ||
| 149 | It will be passed one argument, which is the current value of | ||
| 150 | `font-lock-mode'.") | ||
| 151 | (make-variable-buffer-local 'font-lock-default-function) | ||
| 152 | |||
| 147 | (define-minor-mode font-lock-mode | 153 | (define-minor-mode font-lock-mode |
| 148 | "Toggle Font Lock mode. | 154 | "Toggle Font Lock mode. |
| 149 | With arg, turn Font Lock mode off if and only if arg is a non-positive | 155 | With arg, turn Font Lock mode off if and only if arg is a non-positive |
| @@ -198,13 +204,19 @@ syntactic change on other lines, you can use \\[font-lock-fontify-block]. | |||
| 198 | 204 | ||
| 199 | See the variable `font-lock-defaults-alist' for the Font Lock mode default | 205 | See the variable `font-lock-defaults-alist' for the Font Lock mode default |
| 200 | settings. You can set your own default settings for some mode, by setting a | 206 | settings. You can set your own default settings for some mode, by setting a |
| 201 | buffer local value for `font-lock-defaults', via its mode hook." | 207 | buffer local value for `font-lock-defaults', via its mode hook. |
| 208 | |||
| 209 | The above is the default behavior of `font-lock-mode'; you may specify | ||
| 210 | your own function which is called when `font-lock-mode' is toggled via | ||
| 211 | `font-lock-function'. " | ||
| 202 | nil nil nil | 212 | nil nil nil |
| 203 | ;; Don't turn on Font Lock mode if we don't have a display (we're running a | 213 | ;; Don't turn on Font Lock mode if we don't have a display (we're running a |
| 204 | ;; batch job) or if the buffer is invisible (the name starts with a space). | 214 | ;; batch job) or if the buffer is invisible (the name starts with a space). |
| 205 | (when (or noninteractive (eq (aref (buffer-name) 0) ?\ )) | 215 | (when (or noninteractive (eq (aref (buffer-name) 0) ?\ )) |
| 206 | (setq font-lock-mode nil)) | 216 | (setq font-lock-mode nil)) |
| 217 | (funcall font-lock-function font-lock-mode)) | ||
| 207 | 218 | ||
| 219 | (defun font-lock-default-function (font-lock-mode) | ||
| 208 | ;; Turn on Font Lock mode. | 220 | ;; Turn on Font Lock mode. |
| 209 | (when font-lock-mode | 221 | (when font-lock-mode |
| 210 | (font-lock-set-defaults) | 222 | (font-lock-set-defaults) |