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

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

[elpa] master 0c5f68c 183/272: counsel.el (counsel-pt): Add


From: Oleh Krehel
Subject: [elpa] master 0c5f68c 183/272: counsel.el (counsel-pt): Add
Date: Mon, 25 Apr 2016 10:13:24 +0000

branch: master
commit 0c5f68cc6971de8ccdc9ff6107c4142c78dbfbfc
Author: justbur <address@hidden>
Commit: justbur <address@hidden>

    counsel.el (counsel-pt): Add
    
    counsel.el (counsel-pt-base-command): Used in place of
    counsel-ag-base-command for counsel-pt.
---
 counsel.el |   24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/counsel.el b/counsel.el
index 81097b8..3936597 100644
--- a/counsel.el
+++ b/counsel.el
@@ -1295,9 +1295,12 @@ INITIAL-INPUT can be given as the initial minibuffer 
input."
   (interactive
    (list nil
          (when current-prefix-arg
-           (read-directory-name "ag in directory: "))))
+           (read-directory-name (concat
+                                 (car (split-string counsel-ag-base-command))
+                                 " in directory: ")))))
   (setq counsel--git-grep-dir (or initial-directory default-directory))
-  (ivy-read (funcall counsel-prompt-function "ag")
+  (ivy-read (funcall counsel-prompt-function
+                     (car (split-string counsel-ag-base-command)))
             'counsel-ag-function
             :initial-input initial-input
             :dynamic-collection t
@@ -1329,6 +1332,23 @@ INITIAL-INPUT can be given as the initial minibuffer 
input."
       (lambda (cand) (concat "./" cand))
       cands))))
 
+;;** `counsel-pt'
+(defcustom counsel-pt-base-command "pt --nocolor --nogroup %s -- ."
+  "Used to in place of `counsel-ag-base-command' to search with
+pt using `counsel-ag'."
+  :type 'string
+  :group 'ivy)
+
+;;;###autoload
+(defun counsel-pt (&optional initial-input initial-directory)
+  "Grep for a string in the current directory using pt.
+This uses `counsel-ag' with `counsel-pt-base-command' replacing
+`counsel-ag-base-command'. INITIAL-INPUT can be given as the
+initial minibuffer input."
+  (interactive)
+  (let ((counsel-ag-base-command counsel-pt-base-command))
+    (call-interactively 'counsel-ag)))
+
 ;;** `counsel-grep'
 (defun counsel-grep-function (string)
   "Grep in the current directory for STRING."



reply via email to

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