]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/isearch.el: Fix corner cases of isearch-lazy-count.
authorJuri Linkov <juri@linkov.net>
Wed, 15 Jan 2020 00:02:53 +0000 (02:02 +0200)
committerJuri Linkov <juri@linkov.net>
Wed, 15 Jan 2020 00:02:53 +0000 (02:02 +0200)
* lisp/isearch.el (isearch-mode): Reset isearch-lazy-count-current
and isearch-lazy-count-total to nil, so when isearch-mode is started,
there should be no counts from previous Isearch.
(isearch-lazy-highlight-new-loop): Call isearch-message after resetting
lazy-count variables only when isearch-mode is started.  This avoids
the problem of inappropriate calls of isearch-message-function
when query-replace in the minibuffer performs lazy-highlighting that
used to call minibuffer-history-isearch-message unnecessarily.

lisp/isearch.el

index c98739372522f5dbdce931fbe76178b76906e454..ddf9190dc6d1c1540b80d2d46f182edc7295c1cc 100644 (file)
@@ -1225,6 +1225,9 @@ used to set the value of `isearch-regexp-function'."
        isearch-pre-scroll-point nil
        isearch-pre-move-point nil
 
+       isearch-lazy-count-current nil
+       isearch-lazy-count-total nil
+
        ;; Save the original value of `minibuffer-message-timeout', and
        ;; set it to nil so that isearch's messages don't get timed out.
        isearch-original-minibuffer-message-timeout minibuffer-message-timeout
@@ -3776,7 +3779,7 @@ by other Emacs features."
                                 isearch-lazy-highlight-window-end))))))
     ;; something important did indeed change
     (lazy-highlight-cleanup t (not (equal isearch-string ""))) ;stop old timer
-    (when isearch-lazy-count
+    (when (and isearch-lazy-count isearch-mode (null isearch-message-function))
       (when (or (equal isearch-string "")
                 ;; Check if this place was reached by a condition above
                 ;; other than changed window boundaries (that shouldn't
@@ -3794,7 +3797,7 @@ by other Emacs features."
         (clrhash isearch-lazy-count-hash)
         (setq isearch-lazy-count-current nil
               isearch-lazy-count-total nil)
-        (funcall (or isearch-message-function #'isearch-message))))
+        (isearch-message)))
     (setq isearch-lazy-highlight-window-start-changed nil)
     (setq isearch-lazy-highlight-window-end-changed nil)
     (setq isearch-lazy-highlight-error isearch-error)