From 0a63f2210ddd49f84694bfe390b08b916ea58263 Mon Sep 17 00:00:00 2001 From: Eric Danan Date: Wed, 3 Jan 2018 22:29:59 +0100 Subject: [PATCH] cp-grep: no longer rely on counsel--git-dir This variable was remove from counsel. Use default-directory instead as done there. --- counsel-projectile.el | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/counsel-projectile.el b/counsel-projectile.el index 41a2151..95633dc 100644 --- a/counsel-projectile.el +++ b/counsel-projectile.el @@ -486,7 +486,7 @@ construct the command.") "Grep for STRING in the current project." (if (< (length string) 3) (counsel-more-chars 3) - (let ((default-directory counsel--git-dir) + (let ((default-directory (ivy-state-directory ivy-last)) (regex (counsel-unquote-regex-parens (setq ivy--old-re (ivy--regex string))))) @@ -507,7 +507,7 @@ construct the command.") ;; prepend "./" to the candidates since grep already does so. (unless (eq major-mode 'ivy-occur-grep-mode) (ivy-occur-grep-mode) - (setq default-directory counsel--git-dir)) + (setq default-directory (ivy-state-directory ivy-last))) (setq ivy-text (and (string-match "\"\\(.*\\)\"" (buffer-name)) (match-string 1 (buffer-name)))) @@ -560,11 +560,11 @@ called with a prefix argument." (read-string (projectile-prepend-project-name "grep options: ") ignored 'counsel-projectile-grep-options-history) - (concat ignored options-or-cmd)))) + (concat ignored options-or-cmd))) + (default-directory (projectile-project-root))) (setq counsel-projectile-grep-command (format counsel-projectile-grep-base-command options)) (ivy-set-prompt 'counsel-projectile-grep counsel-prompt-function) - (setq counsel--git-dir (projectile-project-root)) (ivy-read (projectile-prepend-project-name "grep") #'counsel-projectile-grep-function :initial-input counsel-projectile-grep-initial-input