[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master d27eb38 119/184: counsel.el (counsel-git-grep): Change arg
From: |
Oleh Krehel |
Subject: |
[elpa] master d27eb38 119/184: counsel.el (counsel-git-grep): Change args order so counsel-cd works |
Date: |
Wed, 16 Oct 2019 13:15:03 -0400 (EDT) |
branch: master
commit d27eb387af35c942f1c8268ac16de393efc0004b
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
counsel.el (counsel-git-grep): Change args order so counsel-cd works
Fixes #2261
---
counsel.el | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/counsel.el b/counsel.el
index 782a801..d84c6e2 100644
--- a/counsel.el
+++ b/counsel.el
@@ -1414,7 +1414,7 @@ files in a project.")
proj)
(cond
((stringp cmd))
- (cmd
+ (current-prefix-arg
(if (setq proj
(cl-find-if
(lambda (x)
@@ -1474,12 +1474,13 @@ On success, RESULT-FN is called in output buffer with
no arguments."
(counsel--call command))
;;;###autoload
-(defun counsel-git-grep (&optional cmd initial-input)
+(defun counsel-git-grep (&optional initial-input initial-directory cmd)
"Grep for a string in the current Git repository.
+INITIAL-INPUT can be given as the initial minibuffer input.
+INITIAL-DIRECTORY, if non-nil, is used as the root directory for search.
When CMD is a string, use it as a \"git grep\" command.
-When CMD is non-nil, prompt for a specific \"git grep\" command.
-INITIAL-INPUT can be given as the initial minibuffer input."
- (interactive "P")
+When CMD is non-nil, prompt for a specific \"git grep\" command."
+ (interactive)
(let ((proj-and-cmd (counsel--git-grep-cmd-and-proj cmd))
proj)
(setq proj (car proj-and-cmd))
@@ -1493,9 +1494,10 @@ INITIAL-INPUT can be given as the initial minibuffer
input."
(lambda ()
(counsel-delete-process)
(swiper--cleanup)))
- (default-directory (if proj
- (car proj)
- (counsel-locate-git-root))))
+ (default-directory (or initial-directory
+ (if proj
+ (car proj)
+ (counsel-locate-git-root)))))
(ivy-read "git grep: " collection-function
:initial-input initial-input
:dynamic-collection t
@@ -2839,7 +2841,8 @@ CALLER is passed to `ivy-read'."
:caller (or caller 'counsel-ag))))
(defun counsel-cd ()
- "Change the directory for the currently running Ivy command."
+ "Change the directory for the currently running Ivy grep-like command.
+Works for `counsel-git-grep', `counsel-ag', etc."
(interactive)
(let ((input ivy-text)
(new-dir (read-directory-name "cd: ")))
- [elpa] master 03fdaea 087/184: doc/ivy.org: Add more recommended key bindings, (continued)
- [elpa] master 03fdaea 087/184: doc/ivy.org: Add more recommended key bindings, Oleh Krehel, 2019/10/16
- [elpa] master 941d408 086/184: doc/ivy.org: Fix "C-M-n" description, Oleh Krehel, 2019/10/16
- [elpa] master 4e9aaec 092/184: ivy-test: Fix tests using file names on Windows, Oleh Krehel, 2019/10/16
- [elpa] master 139816a 106/184: counsel.el (counsel-mark-ring): Add the latest mark to selection, Oleh Krehel, 2019/10/16
- [elpa] master 9592cba 101/184: ivy-hydra.el: Use ivy-read-action-by-key in hydra-ivy, Oleh Krehel, 2019/10/16
- [elpa] master 79333e9 099/184: counsel.el (counsel-fonts): Add, Oleh Krehel, 2019/10/16
- [elpa] master 89deb75 096/184: counsel.el (counsel-rg): When in dired, operate on marked files, Oleh Krehel, 2019/10/16
- [elpa] master 4cddec4 102/184: Respect counsel-describe-function-function from counsel-M-x, Oleh Krehel, 2019/10/16
- [elpa] master 42fedf5 116/184: counsel.el (counsel-file-stale-p): Extract, Oleh Krehel, 2019/10/16
- [elpa] master 0895c1a 113/184: Add key binding to allow switching directory in counsel-git-grep, Oleh Krehel, 2019/10/16
- [elpa] master d27eb38 119/184: counsel.el (counsel-git-grep): Change args order so counsel-cd works,
Oleh Krehel <=
- [elpa] master 582c9d4 014/184: swiper.el (swiper--candidates): Don't store line number as a string, Oleh Krehel, 2019/10/16
- [elpa] master 4a44c9e 018/184: counsel.el (counsel--async-last-error-string): Add for ease of debugging, Oleh Krehel, 2019/10/16
- [elpa] master 5e79f16 020/184: ivy.el (ivy--input): Fix point moving in TRAMP sessions, Oleh Krehel, 2019/10/16
- [elpa] master f30c6e1 022/184: swiper.el: Fix overlay faces using regex-ignore-order, Oleh Krehel, 2019/10/16
- [elpa] master 9c4cdb7 025/184: swiper.el (swiper-isearch-action): Fix for ivy-occur, Oleh Krehel, 2019/10/16
- [elpa] master ed1ba4e 028/184: Makefile (deps): Add target, Oleh Krehel, 2019/10/16
- [elpa] master b5e869e 026/184: swiper.el (swiper--occur-cands): Fix wgrep, Oleh Krehel, 2019/10/16
- [elpa] master 6928beb 031/184: ivy-test.el (ivy-read-file-name-in-buffer-visiting-file): Passes, Oleh Krehel, 2019/10/16
- [elpa] master 35415e3 027/184: ivy-test.el (ivy-swiper-wgrep): Add test, Oleh Krehel, 2019/10/16
- [elpa] master fb78c3f 045/184: swiper.el: Run ispell-comments-and-strings, Oleh Krehel, 2019/10/16