Subject: bug#71179: [PATCH] In rgrep, check matching files before excluding files

From: Eli Zaretskii <[email-masked]>
Date: Sat, 25 May 2024 16:56:31 +0300

> From: Spencer Baugh <[email-masked]>
> Cc: Dmitry Gutov <[email-masked]>,  [email-masked]
> Date: Sat, 25 May 2024 09:36:44 -0400
> 
> Eli Zaretskii <[email-masked]> writes:
> > The ones for whom the proposed change will affect the results.
> 
> The only user-observable difference besides the speedup is that it fixes
> a bug: grep-find-ignored-files is documented to affect rgrep, and now
> that variable affects rgrep even if grep-find-template is set to a
> broken value (one which doesn't include <X>).

You call that "broken", but I disagree.  There's nothing wrong with
removing <X> from the template.

> I suppose we could preserve that bug by conditioning this optimization
> on (string-search "<X>" grep-find-template), though.

Not good enough, sorry.  I'm quite sure other situations will emerge
where this change affects the results.  For example, you never
considered the cases where the files which match the pattern to search
also match the ignored-extensions, and many other possibilities.  IOW,
this proposal is based on a very narrow and very specific usage
pattern, whereas the real-life usage patterns are infinitely more
numerous.

My suggestion is to provide a user option to get back the old behavior
(and document all this in NEWS).