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

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

[elpa] master 79f9cda 165/272: counsel-ag: Fix escaping problem


From: Oleh Krehel
Subject: [elpa] master 79f9cda 165/272: counsel-ag: Fix escaping problem
Date: Mon, 25 Apr 2016 10:13:23 +0000

branch: master
commit 79f9cdab81526246018642421b3b0f144991b1d6
Author: justbur <address@hidden>
Commit: justbur <address@hidden>

    counsel-ag: Fix escaping problem
    
    Before this it is not possible to pass the string "string1\|string2" to
    ag, because inputing string1\|string2 gets translated into
    "string1\\|string2" via %S.
    
    Instead I use %s and shell-quote-argument to take care of escaping for
    the command line, which fixes the issue for me.
    
    Please test.
    
    Also see https://github.com/syl20bnr/spacemacs/issues/5378
---
 counsel.el |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/counsel.el b/counsel.el
index 0d062c1..f1ede40 100644
--- a/counsel.el
+++ b/counsel.el
@@ -1185,7 +1185,7 @@ INITIAL-INPUT can be given as the initial minibuffer 
input."
 
 ;;* Grep
 ;;** `counsel-ag'
-(defcustom counsel-ag-base-command "ag --vimgrep %S"
+(defcustom counsel-ag-base-command "ag --vimgrep %s"
   "Format string to use in `cousel-ag-function' to construct the
 command. %S will be replaced by the regex string. The default is
 \"ag --vimgrep %S\"."
@@ -1201,7 +1201,7 @@ command. %S will be replaced by the regex string. The 
default is
                   (setq ivy--old-re
                         (ivy--regex string)))))
       (counsel--async-command
-       (format counsel-ag-base-command regex))
+       (format counsel-ag-base-command (shell-quote-argument regex)))
       nil)))
 
 ;;;###autoload



reply via email to

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