Subject: Re: bug#49836: Support ripgrep in semantic-symref-tool-grep

From: Dmitry Gutov <[email-masked]>
Date: Mon, 20 Sep 2021 20:04:35 +0300

On 20.09.2021 08:09, Jim Porter wrote:
> On 9/19/2021 5:14 PM, Dmitry Gutov wrote:
>> On 19.09.2021 13:11, Mattias Engdegård wrote:
>>> even if the goals are slightly different
>>
>> Are the goals different?
> 
> I think in the long run, the goals are very much the same. But in the 
> short run, my goal with urgrep was just to make something that would 
> work like `rgrep', but support multiple tools. There are already a 
> multitude of Emacs packages that provide `rgrep'-like functionality for 
> a particular tool, but I wanted something that worked (almost) the same 
> no matter what happens to be installed on the system.
> 
>> I'm not sure it's flexible enough to be used in both 
>> xref-matches-in-files and semantic/symref (yet?), but when I tried to 
>> imagine a package that would, it looked fairly similar.
> 
> If there are any (useful) commands that can't be generated with 
> `urgrep-command', but which most grep-like tools support, I definitely 
> want to add that capability. The current set of options is really just 
> what I use semi-regularly, so there's bound to be stuff I missed, 
> especially regarding semantic/symref.

semantic/symref/grep is not too complicated in that regard: the command 
looks like, for example

   find -H ~/vc/emacs-master -type f \( -name \*..\*emacs -o -name 
\*.ede -o -name \*.el \) -exec grep -nw  -nH --null -e mhtml-mode \{\} +

xref's use is slightly different, but ultimately simpler: it assumes 
files are piped from stdin. So it's either

   xargs -0 rg -i -nH --no-messages -g '!*/' -e xref-search-program

or

   xargs -0 grep -i -snHE -e <R>

And the xargs prefix can be just added on outside of your package.

> That said, I don't want to slow things down too much in this bug. Maybe 
> for Emacs 29 though, it would make sense to put (parts of?) urgrep into 
> Emacs, since a unified solution would probably be helpful. I'll try to 
> find some time to post a message to emacs-devel to discuss this and get 
> some feedback.

Sure. Thank you.