From: Juri Linkov Date: Wed, 12 Sep 2018 22:09:53 +0000 (+0300) Subject: * lisp/vc/vc-git.el (vc-git-grep): Set dir to default-directory X-Git-Tag: emacs-27.0.90~4426 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=3b38cb0516c0560fd5f54de377c481b42ff28d5f;p=emacs.git * 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'. --- 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]." (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")