]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix last change in minibuffer-lazy-highlight-setup
authorAugusto Stoffel <arstoffel@gmail.com>
Sun, 15 May 2022 20:48:50 +0000 (22:48 +0200)
committerJuri Linkov <juri@linkov.net>
Wed, 18 May 2022 18:55:34 +0000 (21:55 +0300)
* lisp/isearch.el (minibuffer-lazy-highlight-setup): Apply advices
buffer-locally.

lisp/isearch.el

index 3e1dab4d15d59379bacae895b177b39eb61afe76..31fbdf01bf25dc7addfa64c49e9958b07ff5299a 100644 (file)
@@ -4410,14 +4410,17 @@ LAX-WHITESPACE: The value of `isearch-lax-whitespace' and
     (let ((unwind (make-symbol "minibuffer-lazy-highlight--unwind"))
           (after-change (make-symbol "minibuffer-lazy-highlight--after-change"))
           (display-count (make-symbol "minibuffer-lazy-highlight--display-count"))
+          (buffer (current-buffer))
           overlay)
       (fset unwind
             (lambda ()
-              (remove-function isearch-filter-predicate filter)
+              (when filter
+                (with-current-buffer buffer
+                  (remove-function (local 'isearch-filter-predicate) filter)))
               (remove-hook 'lazy-count-update-hook display-count)
               (when overlay (delete-overlay overlay))
-              (remove-hook 'after-change-functions after-change)
-              (remove-hook 'minibuffer-exit-hook unwind)
+              (remove-hook 'after-change-functions after-change t)
+              (remove-hook 'minibuffer-exit-hook unwind t)
               (let ((lazy-highlight-cleanup cleanup))
                 (lazy-highlight-cleanup))))
       (fset after-change
@@ -4447,8 +4450,8 @@ LAX-WHITESPACE: The value of `isearch-lax-whitespace' and
           (setq overlay (make-overlay (point-min) (point-min) (current-buffer) t))
           (add-hook 'lazy-count-update-hook display-count))
         (when filter
-          (make-local-variable 'isearch-filter-predicate)
-          (add-function :after-while isearch-filter-predicate filter))
+          (with-current-buffer buffer
+            (add-function :after-while (local 'isearch-filter-predicate) filter)))
         (funcall after-change nil nil nil)))))
 
 \f