From: justbur Date: Mon, 14 Mar 2016 14:37:03 +0000 (-0400) Subject: counsel.el (counsel-pt): Add X-Git-Url: https://code.delx.au/gnu-emacs-elpa/commitdiff_plain/0c5f68cc6971de8ccdc9ff6107c4142c78dbfbfc counsel.el (counsel-pt): Add counsel.el (counsel-pt-base-command): Used in place of counsel-ag-base-command for counsel-pt. --- diff --git a/counsel.el b/counsel.el index 81097b840..39365975e 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."