From: Stefan Kangas Date: Tue, 13 Dec 2022 21:01:45 +0000 (+0100) Subject: Fix bug when calling `rgrep` non-interactively X-Git-Tag: emacs-29.0.90~1197 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=cd5856e4038;p=emacs.git Fix bug when calling `rgrep` non-interactively * lisp/progmodes/grep.el (rgrep): Fix bug where running non-interactively requires running it interactively first. (Bug#60024) --- diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el index 2446e86abbe..35cac43bee1 100644 --- a/lisp/progmodes/grep.el +++ b/lisp/progmodes/grep.el @@ -1254,6 +1254,10 @@ or not." nil default-directory t)) (confirm (equal current-prefix-arg '(4)))) (list regexp files dir confirm)))))) + ;; If called non-interactively, also compute the defaults if we + ;; haven't already. + (unless grep-find-template + (grep-compute-defaults)) (when (and (stringp regexp) (> (length regexp) 0)) (unless (and dir (file-accessible-directory-p dir)) (setq dir default-directory))