aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2020-04-27 18:36:28 -0400
committerStefan Monnier2020-04-27 18:36:28 -0400
commit199f146aee3a692a69d80135752d88cae0fe8c49 (patch)
tree9e69ef25031f5bc5e77dc03258992e37e6a54886
parent1be8485d67ef36b1d50496008be47be3050cc1bd (diff)
downloademacs-199f146aee3a692a69d80135752d88cae0fe8c49.tar.gz
emacs-199f146aee3a692a69d80135752d88cae0fe8c49.zip
* lisp/jit-lock.el: Don't use `make-variable-buffer-local` on hooks.
(jit-lock-functions): Clarify that it's a hook. (jit-lock-unregister): Adjust accordingly.
-rw-r--r--lisp/jit-lock.el10
1 files changed, 6 insertions, 4 deletions
diff --git a/lisp/jit-lock.el b/lisp/jit-lock.el
index c0c9cac23e7..8b3384ae827 100644
--- a/lisp/jit-lock.el
+++ b/lisp/jit-lock.el
@@ -147,9 +147,10 @@ If 0, then fontification is only deferred while there is input pending."
147(defvar-local jit-lock-mode nil 147(defvar-local jit-lock-mode nil
148 "Non-nil means Just-in-time Lock mode is active.") 148 "Non-nil means Just-in-time Lock mode is active.")
149 149
150(defvar-local jit-lock-functions nil 150(defvar jit-lock-functions nil
151 "Functions to do the actual fontification. 151 "Special hook run to do the actual fontification.
152They are called with two arguments: the START and END of the region to fontify.") 152The functions are called with two arguments:
153the START and END of the region to fontify.")
153 154
154(defvar-local jit-lock-context-unfontify-pos nil 155(defvar-local jit-lock-context-unfontify-pos nil
155 "Consider text after this position as contextually unfontified. 156 "Consider text after this position as contextually unfontified.
@@ -341,7 +342,8 @@ If non-nil, CONTEXTUAL means that a contextual fontification would be useful."
341 "Unregister FUN as a fontification function. 342 "Unregister FUN as a fontification function.
342Only applies to the current buffer." 343Only applies to the current buffer."
343 (remove-hook 'jit-lock-functions fun t) 344 (remove-hook 'jit-lock-functions fun t)
344 (unless jit-lock-functions (jit-lock-mode nil))) 345 (when (member jit-lock-functions '(nil '(t)))
346 (jit-lock-mode nil)))
345 347
346(defun jit-lock-refontify (&optional beg end) 348(defun jit-lock-refontify (&optional beg end)
347 "Force refontification of the region BEG..END (default whole buffer)." 349 "Force refontification of the region BEG..END (default whole buffer)."