]> code.delx.au - gnu-emacs-elpa/commitdiff
Fix default-directory for ivy-occur + counsel-git-grep
authorOleh Krehel <ohwoeowho@gmail.com>
Mon, 8 Feb 2016 13:58:32 +0000 (14:58 +0100)
committerOleh Krehel <ohwoeowho@gmail.com>
Mon, 8 Feb 2016 13:58:32 +0000 (14:58 +0100)
* ivy.el (ivy-occur): Set `default-directory' to
  `counsel--git-grep-dir'.

This way, `next-error' etc will work properly.

ivy.el

diff --git a/ivy.el b/ivy.el
index b95ce33d0dcecf724ee7f7427f8f5b2e77caf1b8..89d934fbe69527842a8f70d045226caa5382934a 100644 (file)
--- a/ivy.el
+++ b/ivy.el
@@ -2651,7 +2651,8 @@ There is no limit on the number of *ivy-occur* buffers."
         (when do-grep
           ;; Need precise number of header lines for `wgrep' to work.
           (insert (format "-*- mode:grep; default-directory: %S -*-\n\n\n"
-                          default-directory)))
+                          (setq default-directory
+                                counsel--git-grep-dir))))
         (insert (format "%d candidates:\n" (length ivy--old-cands)))
         (dolist (cand ivy--old-cands)
           (let ((str (if do-grep