aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/jit-lock.el14
1 files changed, 14 insertions, 0 deletions
diff --git a/lisp/jit-lock.el b/lisp/jit-lock.el
index a08dbffc2ea..e9b4b2ed309 100644
--- a/lisp/jit-lock.el
+++ b/lisp/jit-lock.el
@@ -252,6 +252,20 @@ the variable `jit-lock-stealth-nice'."
252 'font-lock-after-change-function nil t)) 252 'font-lock-after-change-function nil t))
253 (remove-hook 'fontification-functions 'jit-lock-function)))) 253 (remove-hook 'fontification-functions 'jit-lock-function))))
254 254
255(defun jit-lock-register (fun)
256 "Register FUN as a fontification function to be called by jit-lock.
257Only applies to the current buffer."
258 (add-hook 'jit-lock-functions fun nil t)
259 (jit-lock-mode t))
260
261(defun jit-lock-unregister (fun)
262 "Unregister FUN as a fontification function to be called by jit-lock.
263Only applies to the current buffer."
264 (remove-hook 'jit-lock-functions fun t)
265 (when (or (null jit-lock-functions)
266 (and (equal jit-lock-functions '(t))
267 (null (default-value 'jit-lock-functions))))
268 (jit-lock-mode nil)))
255 269
256;; This function is used to prevent font-lock-fontify-buffer from 270;; This function is used to prevent font-lock-fontify-buffer from
257;; fontifying eagerly the whole buffer. This is important for 271;; fontifying eagerly the whole buffer. This is important for