Subject: Re: bug#62426: [PATCH] eshell: Add 'rgrep' builtin.

From: Sean Whitton <[email-masked]>
Date: Thu, 30 Mar 2023 14:19:08 -0700

Hello,

On Sat 25 Mar 2023 at 12:07PM -07, Jim Porter wrote:

> Even without Pcomplete support, there's still a benefit to a command
> like this though: you could use Eshell to pipe the results of 'M-x
> rgrep' to some other command. Looking at the code for 'eshell-grep', I
> don't think it'd be terribly difficult to support this case.

Can you give a concrete use case?  If you're piping won't you typically
want to reuse your knowledge of traditional grep(1)?  If I'm piping then
I'm probably thinking in non-Emacs terms.

> Maybe there should be a defcustom for this ("use M-x rgrep" vs "use
> /usr/bin/rgrep")? Or maybe it should be easier to configure various
> Eshell commands so they open in a compilation buffer when appropriate?
> You can do this now with an alias, but the syntax is a bit tricky:
>
>   alias rgrep 'eshell-grep grep ${append (list "-rH") $*}'
>
> Something like this would be nicer:
>
>   alias rgrep 'to-compilation-buffer rgrep -rH $*'
>
> That would make it easier for users to define their own commands that
> work like this, which would (probably) be generally useful and provide
> a partial solution for this bug while we consider the available
> options. (My main goal with doing this now is so that we don't merge
> something and then change our minds later, disrupting users' habits.)

A command-specific defcustom doesn't seem ideal because we could end up
with very many such things.  Something like your compilation buffer idea
sounds good.

-- 
Sean Whitton