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

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

[elpa] externals/ivy-hydra 5f1d9ce 179/395: counsel.el (counsel--grep-sm


From: Basil L. Contovounesios
Subject: [elpa] externals/ivy-hydra 5f1d9ce 179/395: counsel.el (counsel--grep-smart-case-flag): Extract
Date: Thu, 25 Feb 2021 08:31:58 -0500 (EST)

branch: externals/ivy-hydra
commit 5f1d9ce04599c52818244c2cb8cb066a601610b8
Author: Oleh Krehel <ohwoeowho@gmail.com>
Commit: Oleh Krehel <ohwoeowho@gmail.com>

    counsel.el (counsel--grep-smart-case-flag): Extract
    
    Fixes #2392
---
 counsel.el | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/counsel.el b/counsel.el
index d556d6c..57ec13c 100644
--- a/counsel.el
+++ b/counsel.el
@@ -2958,6 +2958,13 @@ Works for `counsel-git-grep', `counsel-ag', etc."
     (ivy-quit-and-run
       (funcall (ivy-state-caller ivy-last) input new-dir))))
 
+(defun counsel--grep-smart-case-flag ()
+  (if (ivy--case-fold-p ivy-text)
+      " -i "
+    (if (string-match-p "\\`pt" counsel-ag-base-command)
+        " -S "
+      " -s ")))
+
 (defun counsel-grep-like-occur (cmd-template)
   (unless (eq major-mode 'ivy-occur-grep-mode)
     (ivy-occur-grep-mode)
@@ -2972,9 +2979,7 @@ Works for `counsel-git-grep', `counsel-ag', etc."
                    (regex (counsel--grep-regex (cdr command-args)))
                    (switches (concat (car command-args)
                                      (counsel--ag-extra-switches regex)
-                                     (if (ivy--case-fold-p ivy-text)
-                                         " -i "
-                                       " -s "))))
+                                     (counsel--grep-smart-case-flag))))
               (format cmd-template
                       (concat
                        switches



reply via email to

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