aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2000-10-05 02:13:25 +0000
committerStefan Monnier2000-10-05 02:13:25 +0000
commitf8bacc70b538079679b76a9d1e6fdf5ebb361f47 (patch)
treeed331309adc4ef7c2ca6e99c650567e56f0b7702
parentb5d006eaf9b507e4fe839e22e759997663551625 (diff)
downloademacs-f8bacc70b538079679b76a9d1e6fdf5ebb361f47.tar.gz
emacs-f8bacc70b538079679b76a9d1e6fdf5ebb361f47.zip
(jit-lock-register, jit-lock-unregister): New functions.
-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