144 |
variable is non-nil, then calling `font-lock-mode' will simply toggle |
variable is non-nil, then calling `font-lock-mode' will simply toggle |
145 |
the symbol property `face' of CATEGORY-SYMBOL.") |
the symbol property `face' of CATEGORY-SYMBOL.") |
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 |
|
|
153 |
(define-minor-mode font-lock-mode |
(define-minor-mode font-lock-mode |
154 |
"Toggle Font Lock mode. |
"Toggle Font Lock mode. |
155 |
With arg, turn Font Lock mode off if and only if arg is a non-positive |
With arg, turn Font Lock mode off if and only if arg is a non-positive |
204 |
|
|
205 |
See the variable `font-lock-defaults-alist' for the Font Lock mode default |
See the variable `font-lock-defaults-alist' for the Font Lock mode default |
206 |
settings. You can set your own default settings for some mode, by setting a |
settings. You can set your own default settings for some mode, by setting a |
207 |
buffer local value for `font-lock-defaults', via its mode hook." |
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'. " |
212 |
nil nil nil |
nil nil nil |
213 |
;; Don't turn on Font Lock mode if we don't have a display (we're running a |
;; Don't turn on Font Lock mode if we don't have a display (we're running a |
214 |
;; batch job) or if the buffer is invisible (the name starts with a space). |
;; batch job) or if the buffer is invisible (the name starts with a space). |
215 |
(when (or noninteractive (eq (aref (buffer-name) 0) ?\ )) |
(when (or noninteractive (eq (aref (buffer-name) 0) ?\ )) |
216 |
(setq font-lock-mode nil)) |
(setq font-lock-mode nil)) |
217 |
|
(funcall font-lock-function font-lock-mode)) |
218 |
|
|
219 |
|
(defun font-lock-default-function (font-lock-mode) |
220 |
;; Turn on Font Lock mode. |
;; Turn on Font Lock mode. |
221 |
(when font-lock-mode |
(when font-lock-mode |
222 |
(font-lock-set-defaults) |
(font-lock-set-defaults) |