emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 3b38cb0: * lisp/vc/vc-git.el (vc-git-grep): Set dir


From: Juri Linkov
Subject: [Emacs-diffs] master 3b38cb0: * lisp/vc/vc-git.el (vc-git-grep): Set dir to default-directory
Date: Wed, 12 Sep 2018 18:10:00 -0400 (EDT)

branch: master
commit 3b38cb0516c0560fd5f54de377c481b42ff28d5f
Author: Juri Linkov <address@hidden>
Commit: Juri Linkov <address@hidden>

    * lisp/vc/vc-git.el (vc-git-grep): Set dir to default-directory
    
    when it's not available (like it's implemented in lgrep/rgrep)
    to prevent error in case of `C-u C-u vc-git-grep'.
---
 lisp/vc/vc-git.el | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index 69d6295..ca457fb 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -1440,8 +1440,7 @@ This command shares argument histories with \\[rgrep] and 
\\[grep]."
      (cond
       ((equal current-prefix-arg '(16))
        (list (read-from-minibuffer "Run: " "git grep"
-                                  nil nil 'grep-history)
-            nil))
+                                  nil nil 'grep-history)))
       (t (let* ((regexp (grep-read-regexp))
                (files
                  (mapconcat #'shell-quote-argument
@@ -1451,6 +1450,8 @@ This command shares argument histories with \\[rgrep] and 
\\[grep]."
           (list regexp files dir))))))
   (require 'grep)
   (when (and (stringp regexp) (> (length regexp) 0))
+    (unless (and dir (file-accessible-directory-p dir))
+      (setq dir default-directory))
     (let ((command regexp))
       (if (null files)
          (if (string= command "git grep")



reply via email to

[Prev in Thread] Current Thread [Next in Thread]