unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#60024: 28.2; rgrep as part of function don't work
@ 2022-12-12 18:11 Einar Largenius
  2022-12-13  0:32 ` Stefan Kangas
  0 siblings, 1 reply; 6+ messages in thread
From: Einar Largenius @ 2022-12-12 18:11 UTC (permalink / raw)
  To: 60024

Hello.

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.

In GNU Emacs 28.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.30, cairo version 1.16.0)
Windowing system distributor 'The X.Org Foundation', version 11.0.12014000
System Description: Fedora Linux 35 (Workstation Edition)

Configured using:
 'configure
 CONFIG_SHELL=/gnu/store/4y5m9lb8k3qkb1y9m02sw9w9a6hacd16-bash-minimal-5.1.8/bin/bash
 SHELL=/gnu/store/4y5m9lb8k3qkb1y9m02sw9w9a6hacd16-bash-minimal-5.1.8/bin/bash
 --prefix=/gnu/store/58yz6w0ggx5r6vf2p1inv9i9dpibp75h-emacs-28.2
 --enable-fast-install --with-modules --with-cairo
 --with-native-compilation --disable-build-details'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES
NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND THREADS TIFF
TOOLKIT_SCROLL_BARS X11 XDBE XIM XPM GTK3 ZLIB

-- 
Med vänliga hälsningar Einar





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#60024: 28.2; rgrep as part of function don't work
  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
  2022-12-13 15:33   ` Einar Largenius
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Kangas @ 2022-12-13  0:32 UTC (permalink / raw)
  To: Einar Largenius, 60024

[-- 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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* bug#60024: 28.2; rgrep as part of function don't work
  2022-12-13  0:32 ` Stefan Kangas
@ 2022-12-13 15:33   ` Einar Largenius
  2022-12-13 19:24     ` Stefan Kangas
  0 siblings, 1 reply; 6+ messages in thread
From: Einar Largenius @ 2022-12-13 15:33 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 60024

The patch you suggested works fine for me.

-- 
Med vänliga hälsningar Einar





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#60024: 28.2; rgrep as part of function don't work
  2022-12-13 15:33   ` Einar Largenius
@ 2022-12-13 19:24     ` Stefan Kangas
  2022-12-13 20:15       ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Kangas @ 2022-12-13 19:24 UTC (permalink / raw)
  To: Einar Largenius; +Cc: Eli Zaretskii, 60024

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

> The patch you suggested works fine for me.

Thanks.  Eli, okay to install this on emacs-29?





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#60024: 28.2; rgrep as part of function don't work
  2022-12-13 19:24     ` Stefan Kangas
@ 2022-12-13 20:15       ` Eli Zaretskii
  2022-12-13 21:14         ` Stefan Kangas
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2022-12-13 20:15 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 60024, jaadu

> From: Stefan Kangas <stefankangas@gmail.com>
> Date: Tue, 13 Dec 2022 11:24:10 -0800
> Cc: 60024@debbugs.gnu.org, Eli Zaretskii <eliz@gnu.org>
> 
> Einar Largenius <jaadu@lysator.liu.se> writes:
> 
> > The patch you suggested works fine for me.
> 
> Thanks.  Eli, okay to install this on emacs-29?

Yes, thanks.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#60024: 28.2; rgrep as part of function don't work
  2022-12-13 20:15       ` Eli Zaretskii
@ 2022-12-13 21:14         ` Stefan Kangas
  0 siblings, 0 replies; 6+ messages in thread
From: Stefan Kangas @ 2022-12-13 21:14 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 60024, jaadu

close 60024 29.1
thanks

Eli Zaretskii <eliz@gnu.org> writes:

>> Thanks.  Eli, okay to install this on emacs-29?
>
> Yes, thanks.

Thanks, done (commit 189c93e585).





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-12-13 21:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).