changeset 32156:b3596a2daf42

(jit-lock-register, jit-lock-unregister): New functions.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Thu, 05 Oct 2000 02:13:25 +0000
parents d218ef159e45
children c3d137c056d1
files lisp/jit-lock.el
diffstat 1 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/jit-lock.el	Thu Oct 05 01:58:16 2000 +0000
+++ b/lisp/jit-lock.el	Thu Oct 05 02:13:25 2000 +0000
@@ -252,6 +252,20 @@
 		     '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