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

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

[nongnu] elpa/anzu 439e904931 155/288: Enable case-sensitive replacement


From: ELPA Syncer
Subject: [nongnu] elpa/anzu 439e904931 155/288: Enable case-sensitive replacement for at cursor commands
Date: Thu, 6 Jan 2022 03:58:48 -0500 (EST)

branch: elpa/anzu
commit 439e90493192f37f1b375adc6f89a46e906ce03d
Author: Syohei YOSHIDA <syohex@gmail.com>
Commit: Syohei YOSHIDA <syohex@gmail.com>

    Enable case-sensitive replacement for at cursor commands
---
 anzu.el | 25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/anzu.el b/anzu.el
index 8bb86e618e..5eed20e732 100644
--- a/anzu.el
+++ b/anzu.el
@@ -322,7 +322,7 @@
 
 ;; Return highlighted count
 (defun anzu--count-and-highlight-matched (buf str replace-beg replace-end
-                                          use-regexp overlay-limit)
+                                          use-regexp overlay-limit 
case-sensitive)
   (anzu--cleanup-markers)
   (when (not use-regexp)
     (setq str (regexp-quote str)))
@@ -336,7 +336,9 @@
           (let ((count 0)
                 (overlayed 0)
                 (finish nil)
-                (case-fold-search (anzu--case-fold-search str)))
+                (case-fold-search (if case-sensitive
+                                      nil
+                                    (anzu--case-fold-search str))))
             (while (and (not finish) (re-search-forward str replace-end t))
               (cl-incf count)
               (let ((beg (match-beginning 0))
@@ -359,14 +361,16 @@
       (when (funcall searchfn input end t)
         (setq anzu--outside-point (match-beginning 0))
         (let ((overlay-limit (anzu--overlay-limit)))
-          (anzu--count-and-highlight-matched buf input beg end use-regexp 
overlay-limit))))))
+          (anzu--count-and-highlight-matched buf input beg end use-regexp
+                                             overlay-limit nil))))))
 
 (defun anzu--check-minibuffer-input (buf beg end use-regexp overlay-limit)
   (let* ((content (minibuffer-contents))
          (empty-p (string= content ""))
          (overlayed (if empty-p
                         (setq anzu--cached-count 0)
-                      (anzu--count-and-highlight-matched buf content beg end 
use-regexp overlay-limit))))
+                      (anzu--count-and-highlight-matched buf content beg end 
use-regexp
+                                                         overlay-limit nil))))
     (when anzu--outside-point
       (setq anzu--outside-point nil)
       (with-selected-window (get-buffer-window buf)
@@ -538,7 +542,7 @@
     (unless symbol
       (error "No symbol at cursor!!"))
     (let ((symbol-regexp (concat "\\_<" (regexp-quote symbol) "\\_>")))
-      (anzu--count-and-highlight-matched buf symbol-regexp beg end t 
overlay-limit)
+      (anzu--count-and-highlight-matched buf symbol-regexp beg end t 
overlay-limit t)
       (setq anzu--total-matched anzu--cached-count)
       (force-mode-line-update)
       symbol-regexp)))
@@ -642,11 +646,12 @@
           (setq anzu--state 'replace anzu--current-position 0
                 anzu--replaced-markers (reverse anzu--replaced-markers)
                 clear-overlay t)
-          (if use-regexp
-              (apply 'perform-replace 
(anzu--construct-perform-replace-arguments
-                                       from to delimited beg end backward 
query))
-            (apply 'query-replace (anzu--construct-query-replace-arguments
-                                   from to delimited beg end backward))))
+          (let ((case-fold-search (not at-cursor)))
+            (if use-regexp
+                (apply 'perform-replace 
(anzu--construct-perform-replace-arguments
+                                         from to delimited beg end backward 
query))
+              (apply 'query-replace (anzu--construct-query-replace-arguments
+                                     from to delimited beg end backward)))))
       (progn
         (unless clear-overlay
           (anzu--clear-overlays curbuf beg end))



reply via email to

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