branch: master
commit 0afb000d4fb64df60cef5801b7f3cdb3d58362f1
Author: Oleh Krehel <ohwoeo...@gmail.com>
Commit: Oleh Krehel <ohwoeo...@gmail.com>

    Fix default-directory for ivy-occur + counsel-git-grep
    
    * ivy.el (ivy-occur): Set `default-directory' to
      `counsel--git-grep-dir'.
    
    This way, `next-error' etc will work properly.
---
 ivy.el |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/ivy.el b/ivy.el
index b95ce33..89d934f 100644
--- 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

Reply via email to