Subject: bug#20728: 25.0.50; grep and grep-find templates should have a place holder for the --color argument

From: Dmitry Gutov <[email-masked]>
Date: Sat, 6 Jun 2015 13:19:34 +0300

On 06/06/2015 01:17 AM, Juri Linkov wrote:

> There is also grep-find-command used by grep-find.

Indeed. That one I'd rather leave alone too.

> Since there is a lot of %s-substitutions in grep-compute-defaults
> that produce command lines depending on many customizations,

Not that many. grep-program and grep-highlight-matches seem to be the 
only ones a user might want to change. Or rather, a user might change 
the former, and some function might want to change either.

> yet another option is to let-bind the variables grep-command,
> grep-find-command, grep-template, grep-find-template in your function,
> then call grep-compute-defaults with a new value of grep-highlight-matches,
> and then get new command lines without the --color option from
> these local bindings to run them and parse the output programmatically.

That's what zrgrep does, and its quite clunky. And if we have code to 
pre-compute commands and templates (which takes several external program 
calls), it's kind of silly to redo that again each time certain commands 
are called.

Do you know if zrgrep has a good reason for it? Like, it there are 
platforms where we have to use different calling conventions for grep 
and zgrep? Otherwise, we could simply substitute grep-program value in 
the commands.

> In case when users customize grep-highlight-matches interactively,
> its defcustom should compute new command lines using grep-compute-defaults.

Do you think, overall, it will be the better approach?