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: Christopher Thorne <c.thorne <at> reckondigital.com>
To: 34621 <at> debbugs.gnu.org
Cc: Drew Adams <drew.adams <at> oracle.com>
Subject: bug#34621: Patch Update
Date: Tue, 05 Mar 2019 10:49:18 +0000
Thanks Drew, I agree derived-mode-p is better.

The reason for special casing dired is to stop rgrep taking extension 
suggestions from dired buffers, e.g. suggesting "*.11" as the rgrep file 
pattern in a dired buffer called "django-1.11".

Here is the same fix but using derived-mode-p:

diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el
index 3fd2a7e701..83154872aa 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 (derived-mode-p 'dired-mode))
                (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 (derived-mode-p 'dired-mode))
                (let ((ext (file-name-extension fn)))
                  (and ext (concat "*." ext)))))
         (default

Changelog entry:
* lisp/progmodes/grep.el (grep-read-files): Disable default extension in
dired buffers


On 2019-03-04 15:26, Drew Adams wrote:
>> +               (not (eq major-mode 'dired-mode))
>> +               (not (eq major-mode 'dired-mode))
> 
> I haven't followed this thread at all - dunno
> what the problem is that you're trying to solve.
> But I'm a bit surprised that Dired needs to be
> special-cased for grep in any way.
> 
> Anyway, the reasom I'm writing is to suggest
> that you probably don't want
> (eq major-mode 'dired-mode).  You probably
> want (derived-mode-p 'dired-mode).




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

Previous Next


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