From db1194069df971736812c5b1f4f891306b804d6b Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Tue, 13 Dec 2022 01:27:58 +0100 Subject: [PATCH] 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) --- lisp/progmodes/grep.el | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el index 2446e86abb..35cac43bee 100644 --- a/lisp/progmodes/grep.el +++ b/lisp/progmodes/grep.el @@ -1254,6 +1254,10 @@ rgrep 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)) -- 2.35.1