all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Kangas <stefankangas@gmail.com>
To: Einar Largenius <jaadu@lysator.liu.se>, 60024@debbugs.gnu.org
Subject: bug#60024: 28.2; rgrep as part of function don't work
Date: Mon, 12 Dec 2022 16:32:30 -0800	[thread overview]
Message-ID: <CADwFkmk9t51D+yk_zOkUgGEkOWB8Ru-vKCVGBXnNP2mXPQjWBg@mail.gmail.com> (raw)
In-Reply-To: <87iliglc48.fsf@lysator.liu.se>

[-- Attachment #1: Type: text/plain, Size: 639 bytes --]

tags 60024 + patch confirmed
found 60024 29.0.60
thanks

Einar Largenius <jaadu@lysator.liu.se> writes:

> I have the following function:
>
> (defun search-journal (regexp)
>   "Searches journal for `regexp'."
>   (interactive "sSök i journalen: ")
>   (rgrep regexp "* .*" org-directory))
>
> When I run it after startup. It gives me an error:
>
> rgrep-default-command: Wrong type argument: stringp, nil
>
> After I run M-x rgrep<RET>C-g. The above command works just fine. I
> tested with emacs -Q and the same thing happens.

Could you please test the attached patch and see if it fixes your
problem?

Thanks.

[-- Attachment #2: 0001-Fix-bug-when-calling-rgrep-non-interactively.patch --]
[-- Type: text/x-diff, Size: 1034 bytes --]

From db1194069df971736812c5b1f4f891306b804d6b Mon Sep 17 00:00:00 2001
From: Stefan Kangas <stefankangas@gmail.com>
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


  reply	other threads:[~2022-12-13  0:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-12 18:11 bug#60024: 28.2; rgrep as part of function don't work Einar Largenius
2022-12-13  0:32 ` Stefan Kangas [this message]
2022-12-13 15:33   ` Einar Largenius
2022-12-13 19:24     ` Stefan Kangas
2022-12-13 20:15       ` Eli Zaretskii
2022-12-13 21:14         ` Stefan Kangas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CADwFkmk9t51D+yk_zOkUgGEkOWB8Ru-vKCVGBXnNP2mXPQjWBg@mail.gmail.com \
    --to=stefankangas@gmail.com \
    --cc=60024@debbugs.gnu.org \
    --cc=jaadu@lysator.liu.se \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.