]> git.eshelyaron.com Git - emacs.git/commitdiff
(jit-lock-register, jit-lock-unregister): New functions.
authorStefan Monnier <monnier@iro.umontreal.ca>
Thu, 5 Oct 2000 02:13:25 +0000 (02:13 +0000)
committerStefan Monnier <monnier@iro.umontreal.ca>
Thu, 5 Oct 2000 02:13:25 +0000 (02:13 +0000)
lisp/jit-lock.el

index a08dbffc2ea163fc8e4fa164a8323666a92c7946..e9b4b2ed309f1eb704ef06137186961f28bceb3e 100644 (file)
@@ -252,6 +252,20 @@ the variable `jit-lock-stealth-nice'."
                     'font-lock-after-change-function nil t))
         (remove-hook 'fontification-functions 'jit-lock-function))))
 
+(defun jit-lock-register (fun)
+  "Register FUN as a fontification function to be called by jit-lock.
+Only applies to the current buffer."
+  (add-hook 'jit-lock-functions fun nil t)
+  (jit-lock-mode t))
+
+(defun jit-lock-unregister (fun)
+  "Unregister FUN as a fontification function to be called by jit-lock.
+Only applies to the current buffer."
+  (remove-hook 'jit-lock-functions fun t)
+  (when (or (null jit-lock-functions)
+           (and (equal jit-lock-functions '(t))
+                (null (default-value 'jit-lock-functions))))
+    (jit-lock-mode nil)))
 
 ;; This function is used to prevent font-lock-fontify-buffer from
 ;; fontifying eagerly the whole buffer.  This is important for