emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[nongnu] elpa/anzu 177a328830 266/288: Fix issue #93


From: ELPA Syncer
Subject: [nongnu] elpa/anzu 177a328830 266/288: Fix issue #93
Date: Thu, 6 Jan 2022 03:58:59 -0500 (EST)

branch: elpa/anzu
commit 177a3288302f6be7db71d3b2225a43b2cd525dc8
Author: Andrea Greselin <greselin.andrea@gmail.com>
Commit: Andrea Greselin <greselin.andrea@gmail.com>

    Fix issue #93
    
    Change ‘anzu--case-fold-search’ and refresh cached result after
    invoking ‘isearch-toggle-case-fold’ (‘M-c’).
---
 anzu.el | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/anzu.el b/anzu.el
index d9dfb24233..c2993b1eb5 100644
--- a/anzu.el
+++ b/anzu.el
@@ -164,10 +164,10 @@
 (defsubst anzu--construct-position-info (count overflow positions)
   (list :count count :overflow overflow :positions positions))
 
-(defsubst anzu--case-fold-search (input)
-  (when isearch-case-fold-search
-    (let ((case-fold-search nil))
-      (not (string-match-p "[A-Z]" input)))))
+(defsubst anzu--case-fold-search ()
+  (if isearch-mode
+      isearch-case-fold-search
+    case-fold-search))
 
 (defsubst anzu--word-search-p ()
   (and (not (memq anzu--last-command anzu-regexp-search-commands))
@@ -207,7 +207,7 @@
                                  (ignore-errors
                                    (migemo-forward word bound noerror count)))
                              #'re-search-forward))
-              (case-fold-search (anzu--case-fold-search input)))
+              (case-fold-search (anzu--case-fold-search)))
           (while (and (not finish) (funcall search-func input nil t))
             (push (cons (match-beginning 0) (match-end 0)) positions)
             (cl-incf count)
@@ -236,7 +236,8 @@
 (defun anzu--use-result-cache-p (input)
   (and (eq (anzu--isearch-regexp-function) (car anzu--last-search-state))
        (eq isearch-regexp (cdr anzu--last-search-state))
-       (string= input anzu--last-isearch-string)))
+       (string= input anzu--last-isearch-string)
+       (not (eq last-command 'isearch-toggle-case-fold))))
 
 (defun anzu--update (query)
   (when (>= (length query) anzu-minimum-input-length)
@@ -395,7 +396,7 @@
                 (finish nil)
                 (case-fold-search (if case-sensitive
                                       nil
-                                    (anzu--case-fold-search str))))
+                                    (anzu--case-fold-search))))
             (while (and (not finish) (re-search-forward str replace-end t))
               (cl-incf count)
               (let ((beg (match-beginning 0))
@@ -580,7 +581,7 @@
     (unless (string= content anzu--last-replace-input)
       (setq anzu--last-replace-input content)
       (with-current-buffer buf
-        (let ((case-fold-search (anzu--case-fold-search from)))
+        (let ((case-fold-search (anzu--case-fold-search)))
           (dolist (ov (anzu--overlays-in-range beg (min end overlay-limit)))
             (let ((replace-evaled
                    (if (not use-regexp)



reply via email to

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