emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 199f146: * lisp/jit-lock.el: Don't use `make-variable-buffer-loca


From: Stefan Monnier
Subject: master 199f146: * lisp/jit-lock.el: Don't use `make-variable-buffer-local` on hooks.
Date: Mon, 27 Apr 2020 18:36:33 -0400 (EDT)

branch: master
commit 199f146aee3a692a69d80135752d88cae0fe8c49
Author: Stefan Monnier <address@hidden>
Commit: Stefan Monnier <address@hidden>

    * 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.
---
 lisp/jit-lock.el | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/lisp/jit-lock.el b/lisp/jit-lock.el
index c0c9cac..8b3384a 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."
 (defvar-local jit-lock-mode nil
   "Non-nil means Just-in-time Lock mode is active.")
 
-(defvar-local jit-lock-functions nil
-  "Functions to do the actual fontification.
-They are called with two arguments: the START and END of the region to 
fontify.")
+(defvar jit-lock-functions nil
+  "Special hook run to do the actual fontification.
+The functions are called with two arguments:
+the START and END of the region to fontify.")
 
 (defvar-local jit-lock-context-unfontify-pos nil
   "Consider text after this position as contextually unfontified.
@@ -341,7 +342,8 @@ If non-nil, CONTEXTUAL means that a contextual 
fontification would be useful."
   "Unregister FUN as a fontification function.
 Only applies to the current buffer."
   (remove-hook 'jit-lock-functions fun t)
-  (unless jit-lock-functions (jit-lock-mode nil)))
+  (when (member jit-lock-functions '(nil '(t)))
+    (jit-lock-mode nil)))
 
 (defun jit-lock-refontify (&optional beg end)
   "Force refontification of the region BEG..END (default whole buffer)."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]