GNU bug report logs - #23590
25.0.94; Errors in default lgrep command

Previous Next

Package: emacs;

Reported by: Alex <agrambot <at> gmail.com>

Date: Sat, 21 May 2016 00:12:01 UTC

Severity: normal

Tags: fixed, patch

Found in version 25.0.94

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #44 received at 23590 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Alex <agrambot <at> gmail.com>
Cc: john.b.mastro <at> gmail.com, Eli Zaretskii <eliz <at> gnu.org>,
 23590 <at> debbugs.gnu.org
Subject: Re: bug#23590: 25.0.94; Errors in default lgrep command
Date: Fri, 04 Sep 2020 16:09:52 +0200
Alex <agrambot <at> gmail.com> writes:

>> Actually, I see that "Is a directory" also caused exit code of 2.  So
>> I guess patches are welcome to add --directory=skip to the Grep
>> command when a preliminary test reveals that Grep supports it.
>
> Is the following patch acceptable?

There was discussion here before the patch was posted, but then no
follow-up.  I've respun the patch for Emacs 28 -- does anybody have any
comments?

diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el
index c71a90344f..17f0422ac7 100644
--- a/lisp/progmodes/grep.el
+++ b/lisp/progmodes/grep.el
@@ -696,10 +696,15 @@ grep-compute-defaults
       (let ((grep-options
 	     (concat (if grep-use-null-device "-n" "-nH")
                      (if grep-use-null-filename-separator " --null")
-		     (if (grep-probe grep-program
-				     `(nil nil nil "-e" "foo" ,null-device)
-				     nil 1)
-			 " -e"))))
+                     (when (grep-probe grep-program
+                                       `(nil nil nil "--directories=skip" "foo"
+                                             ,null-device)
+                                       nil 1)
+                       " --directories=skip")
+                     (when (grep-probe grep-program
+                                       `(nil nil nil "-e" "foo" ,null-device)
+                                       nil 1)
+                       " -e"))))
 	(unless grep-command
 	  (setq grep-command
 		(format "%s %s %s " grep-program


-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




This bug report was last modified 4 years and 299 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.