unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#34621: [PATCH] lisp/progmodes/grep.el (grep-read-files): Add file-directory-p check
@ 2019-02-22 17:29 Christopher Thorne
  2019-03-04 11:13 ` bug#34621: Patch Update Christopher Thorne
  0 siblings, 1 reply; 20+ messages in thread
From: Christopher Thorne @ 2019-02-22 17:29 UTC (permalink / raw)
  To: 34621

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






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

end of thread, other threads:[~2019-04-11 20:51 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-22 17:29 bug#34621: [PATCH] lisp/progmodes/grep.el (grep-read-files): Add file-directory-p check Christopher Thorne
2019-03-04 11:13 ` bug#34621: Patch Update Christopher Thorne
2019-03-04 15:26   ` Drew Adams
2019-03-05 10:49     ` Christopher Thorne
2019-03-05 17:48       ` Drew Adams
2019-03-05 18:22         ` Christopher Thorne
2019-03-05 18:44           ` Drew Adams
2019-03-06 11:10             ` Christopher Thorne
2019-03-17 21:28               ` bug#34621: [PATCH] lisp/progmodes/grep.el (grep-read-files): Add file-directory-p check Juri Linkov
2019-04-08 10:41                 ` bug#34621: [PATCH] Fix rgrep in dired taking default search file pattern from directory name (e.g. *.11 for django-1.11) Christopher Thorne
2019-04-08 19:44                   ` Juri Linkov
2019-04-09 11:09                     ` Christopher Thorne
2019-04-09 11:52                       ` Noam Postavsky
2019-04-09 12:23                         ` Christopher Thorne
2019-04-09 14:18                           ` Eli Zaretskii
2019-04-09 14:32                             ` Christopher Thorne
2019-04-09 20:32                       ` Juri Linkov
2019-04-10 10:42                         ` Christopher Thorne
2019-04-10 20:37                           ` Juri Linkov
2019-04-11 20:51                             ` Juri Linkov

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).