[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 4dd650c 257/348: Make counsel-ag prompt for extra args whe
From: |
Oleh Krehel |
Subject: |
[elpa] master 4dd650c 257/348: Make counsel-ag prompt for extra args when using prefix arg. |
Date: |
Sat, 8 Apr 2017 11:04:10 -0400 (EDT) |
branch: master
commit 4dd650c67452b4e61c27824372bbe5cc013723df
Author: Yevgnen Koh <address@hidden>
Commit: Oleh Krehel <address@hidden>
Make counsel-ag prompt for extra args when using prefix arg.
Previously counsel-ag is only prompt for directory when
using a prefix arg. This commit make it prompt for extra
args too. The commit will also affect commands like
counsel-pt which invokes counsel-ag.
Fixed counsel-projectile-ag prompt twice bug.
Fixes #774
---
counsel.el | 30 +++++++++++++++++++-----------
1 file changed, 19 insertions(+), 11 deletions(-)
diff --git a/counsel.el b/counsel.el
index 1acaa32..a40d29d 100644
--- a/counsel.el
+++ b/counsel.el
@@ -1694,16 +1694,24 @@ If non-nil, EXTRA-AG-ARGS string is appended to
BASE-CMD."
;;;###autoload
(defun counsel-ag (&optional initial-input initial-directory extra-ag-args
ag-prompt)
"Grep for a string in the current directory using ag.
-INITIAL-INPUT can be given as the initial minibuffer input.
-INITIAL-DIRECTORY, if non-nil, is used as the root directory for search.
-EXTRA-AG-ARGS string, if non-nil, is appended to `counsel-ag-base-command'.
-AG-PROMPT, if non-nil, is passed as `ivy-read' prompt argument. "
- (interactive
- (list nil
- (when current-prefix-arg
- (read-directory-name (concat
- (car (split-string counsel-ag-base-command))
- " in directory: ")))))
+ INITIAL-INPUT can be given as the initial minibuffer input.
+ INITIAL-DIRECTORY, if non-nil, is used as the root directory for search.
+ EXTRA-AG-ARGS string, if non-nil, is appended to `counsel-ag-base-command'.
+ AG-PROMPT, if non-nil, is passed as `ivy-read' prompt argument. "
+ (interactive)
+ (when current-prefix-arg
+ (setq initial-directory
+ (or initial-directory
+ (read-directory-name (concat
+ (car (split-string
counsel-ag-base-command))
+ " in directory: "))))
+ (setq extra-ag-args
+ (or extra-ag-args
+ (let* ((pos (position ? counsel-ag-base-command))
+ (command (substring-no-properties counsel-ag-base-command
0 pos))
+ (ag-args (replace-regexp-in-string
+ "%s" "" (substring-no-properties
counsel-ag-base-command pos))))
+ (read-string (format "(%s) args:" command) ag-args)))))
(ivy-set-prompt 'counsel-ag counsel-prompt-function)
(setq counsel--git-grep-dir (or initial-directory default-directory))
(ivy-read (or ag-prompt (car (split-string counsel-ag-base-command)))
@@ -1744,7 +1752,7 @@ AG-PROMPT, if non-nil, is passed as `ivy-read' prompt
argument. "
cands))))
;;** `counsel-pt'
-(defcustom counsel-pt-base-command "pt --nocolor --nogroup -e %s -- ."
+(defcustom counsel-pt-base-command "pt --nocolor --nogroup -e %s"
"Used to in place of `counsel-ag-base-command' to search with
pt using `counsel-ag'."
:type 'string
- [elpa] master 870112e 176/348: counsel.el (counsel-ag-function): Use sync on remote, (continued)
- [elpa] master 870112e 176/348: counsel.el (counsel-ag-function): Use sync on remote, Oleh Krehel, 2017/04/08
- [elpa] master 1914ecd 203/348: counsel.el (counsel-recoll-function): Add shell-quote-argument, Oleh Krehel, 2017/04/08
- [elpa] master f0e49d5 213/348: Improve recursive minibuffers with two emacsclients, Oleh Krehel, 2017/04/08
- [elpa] master df9ad89 220/348: counsel.el (counsel-rpm): New command, Oleh Krehel, 2017/04/08
- [elpa] master aea4919 225/348: Shrink ivy back to ivy-height after dispatching actions., Oleh Krehel, 2017/04/08
- [elpa] master 88bf299 228/348: counsel.el (counsel-recentf): Remove properties from recentf-list, Oleh Krehel, 2017/04/08
- [elpa] master 576a1e3 232/348: Revert "ivy.el (ivy-call): setq default-directory instead of let", Oleh Krehel, 2017/04/08
- [elpa] master 50bb6b3 250/348: ivy.el (ivy-call): Call the action in ivy-state-buffer, Oleh Krehel, 2017/04/08
- [elpa] master f9f2c8c 251/348: counsel.el (counsel-bookmark-avoid-dired): Add, Oleh Krehel, 2017/04/08
- [elpa] master 123f9e1 258/348: swiper-all should consider magit stash buffers too, Oleh Krehel, 2017/04/08
- [elpa] master 4dd650c 257/348: Make counsel-ag prompt for extra args when using prefix arg.,
Oleh Krehel <=
- [elpa] master a77a265 263/348: Set `outline-regexp' directory local, Oleh Krehel, 2017/04/08
- [elpa] master 109170b 264/348: Remap `backward-delete-char-untabify' to `ivy-backward-delete-char', Oleh Krehel, 2017/04/08
- [elpa] master 039c58a 254/348: counsel.el: added three new counsel commands., Oleh Krehel, 2017/04/08
- [elpa] master 5b66c18 267/348: Update copyright year, Oleh Krehel, 2017/04/08
- [elpa] master 1870f41 272/348: counsel.el: Fix counsel-command-history, Oleh Krehel, 2017/04/08
- [elpa] master c2b0d30 284/348: Add missing parameter for ag, Oleh Krehel, 2017/04/08
- [elpa] master 58372db 281/348: Add command `counsel-mark-ring', Oleh Krehel, 2017/04/08
- [elpa] master 5f732cd 297/348: Add compatibility with evil-ex-search., Oleh Krehel, 2017/04/08
- [elpa] master d23d1fe 296/348: swiper.el (swiper-font-lock-exclude): Add nix-mode, Oleh Krehel, 2017/04/08
- [elpa] master 4dcd315 292/348: counsel.el: Improve counsel-package, Oleh Krehel, 2017/04/08