diff options
author | Colin Walters <walters@gnu.org> | 2002-05-23 03:39:00 +0000 |
---|---|---|
committer | Colin Walters <walters@gnu.org> | 2002-05-23 03:39:00 +0000 |
commit | 7c4ef9b397f9da08ff24f0c8977218f299fdaf18 (patch) | |
tree | 2b25691ea53725e9b2b594c430c73b65a17af968 /lisp/font-core.el | |
parent | 577123f479ee82bc628a2dab06ceeb43baa9ed71 (diff) | |
download | emacs-7c4ef9b397f9da08ff24f0c8977218f299fdaf18.tar.gz |
(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'.
Diffstat (limited to 'lisp/font-core.el')
-rw-r--r-- | lisp/font-core.el | 14 |
1 files changed, 13 insertions, 1 deletions
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 variable is non-nil, then calling `font-lock-mode' will simply toggle the symbol property `face' of CATEGORY-SYMBOL.") +(defvar font-lock-function 'font-lock-default-function + "A function which is called when `font-lock-mode' is toggled. +It will be passed one argument, which is the current value of +`font-lock-mode'.") +(make-variable-buffer-local 'font-lock-default-function) + (define-minor-mode font-lock-mode "Toggle Font Lock mode. 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]. See the variable `font-lock-defaults-alist' for the Font Lock mode default settings. You can set your own default settings for some mode, by setting a -buffer local value for `font-lock-defaults', via its mode hook." +buffer local value for `font-lock-defaults', via its mode hook. + +The above is the default behavior of `font-lock-mode'; you may specify +your own function which is called when `font-lock-mode' is toggled via +`font-lock-function'. " nil nil nil ;; Don't turn on Font Lock mode if we don't have a display (we're running a ;; batch job) or if the buffer is invisible (the name starts with a space). (when (or noninteractive (eq (aref (buffer-name) 0) ?\ )) (setq font-lock-mode nil)) + (funcall font-lock-function font-lock-mode)) +(defun font-lock-default-function (font-lock-mode) ;; Turn on Font Lock mode. (when font-lock-mode (font-lock-set-defaults) |