aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuri Linkov2018-09-13 01:09:53 +0300
committerJuri Linkov2018-09-13 01:09:53 +0300
commit3b38cb0516c0560fd5f54de377c481b42ff28d5f (patch)
tree28dbd92e1aa24e81b5677427516f97ba04927921
parenta1b8418f5e1a4de54528f2887cf653105c3c92fb (diff)
downloademacs-3b38cb0516c0560fd5f54de377c481b42ff28d5f.tar.gz
emacs-3b38cb0516c0560fd5f54de377c481b42ff28d5f.zip
* 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'.
-rw-r--r--lisp/vc/vc-git.el5
1 files changed, 3 insertions, 2 deletions
diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index 69d62957026..ca457fb3d1e 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]."
1440 (cond 1440 (cond
1441 ((equal current-prefix-arg '(16)) 1441 ((equal current-prefix-arg '(16))
1442 (list (read-from-minibuffer "Run: " "git grep" 1442 (list (read-from-minibuffer "Run: " "git grep"
1443 nil nil 'grep-history) 1443 nil nil 'grep-history)))
1444 nil))
1445 (t (let* ((regexp (grep-read-regexp)) 1444 (t (let* ((regexp (grep-read-regexp))
1446 (files 1445 (files
1447 (mapconcat #'shell-quote-argument 1446 (mapconcat #'shell-quote-argument
@@ -1451,6 +1450,8 @@ This command shares argument histories with \\[rgrep] and \\[grep]."
1451 (list regexp files dir)))))) 1450 (list regexp files dir))))))
1452 (require 'grep) 1451 (require 'grep)
1453 (when (and (stringp regexp) (> (length regexp) 0)) 1452 (when (and (stringp regexp) (> (length regexp) 0))
1453 (unless (and dir (file-accessible-directory-p dir))
1454 (setq dir default-directory))
1454 (let ((command regexp)) 1455 (let ((command regexp))
1455 (if (null files) 1456 (if (null files)
1456 (if (string= command "git grep") 1457 (if (string= command "git grep")