GNU bug report logs - #34621
[PATCH] lisp/progmodes/grep.el (grep-read-files): Add file-directory-p check

Previous Next

Package: emacs;

Reported by: Christopher Thorne <c.thorne <at> reckondigital.com>

Date: Fri, 22 Feb 2019 21:16:01 UTC

Severity: normal

Tags: patch

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Christopher Thorne <c.thorne <at> reckondigital.com>
Subject: bug#34621: closed (Re: bug#34621: [PATCH] Fix rgrep in dired
 taking default search file pattern from directory name (e.g. *.11 for
 django-1.11))
Date: Thu, 11 Apr 2019 20:53:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#34621: [PATCH] lisp/progmodes/grep.el (grep-read-files): Add file-directory-p check

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 34621 <at> debbugs.gnu.org.

-- 
34621: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=34621
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Juri Linkov <juri <at> linkov.net>
To: Christopher Thorne <c.thorne <at> reckondigital.com>
Cc: 34621-done <at> debbugs.gnu.org
Subject: Re: bug#34621: [PATCH] Fix rgrep in dired taking default search file
 pattern from directory name (e.g. *.11 for django-1.11)
Date: Thu, 11 Apr 2019 23:51:46 +0300
> Patch attached.

Your patch is pushed to master, thanks.

[Message part 3 (message/rfc822, inline)]
From: Christopher Thorne <c.thorne <at> reckondigital.com>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] lisp/progmodes/grep.el (grep-read-files): Add
 file-directory-p check
Date: Fri, 22 Feb 2019 17:29:10 +0000
Hello,

This patch fixes a bug in the rgrep command which causes certain
directory names to be mistaken for files with extensions. For example,
when running rgrep in a directory called "django-1.11", rgrep will
prompt with 'Search for "x" in files (default *.11):', under the
assumption that .11 is a file extension. Similarly, creating a
directory called "test.c" and running rgrep inside it results in the
prompt 'Search for "x" in files (default *.[ch])'. With this patch,
the default file extension for directories is either taken from the
rgrep history or set to "all".

Changelog entry:
* lisp/progmodes/grep.el (grep-read-files): Add file-directory-p check

Patch:

diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el
index 3fd2a7e701..fe0fb5b30c 100644
--- a/lisp/progmodes/grep.el
+++ b/lisp/progmodes/grep.el
@@ -963,6 +963,7 @@ grep-read-files
                  (file-name-nondirectory bn)))
         (default-alias
           (and fn
+               (not (file-directory-p (concat "../" fn)))
                (let ((aliases (remove (assoc "all" grep-files-aliases)
                                       grep-files-aliases))
                      alias)
@@ -979,6 +980,7 @@ grep-read-files
                  (cdr alias))))
         (default-extension
           (and fn
+               (not (file-directory-p (concat "../" fn)))
                (let ((ext (file-name-extension fn)))
                  (and ext (concat "*." ext)))))
         (default

Regards,
Christopher Thorne




This bug report was last modified 6 years and 37 days ago.

Previous Next


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