emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Should project delegate project-find-regexp?


From: Joel Reicher
Subject: Re: Should project delegate project-find-regexp?
Date: Thu, 07 Apr 2022 22:55:49 +1000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (windows-nt)

Ergus <spacibba@aol.com> writes:

> On Thu, Apr 07, 2022 at 09:48:33PM +1000, Joel Reicher wrote:
>>It seems to me that, at least in the case of git, 'git grep' offers a
>>superior implementation to anything offered by the generic
>>implementation of project-find-regexp.
>>
>>At the moment project delegates the list of files to vc (for example)
>>but perhaps it should delegate the regexp search itself?
>>
> I think it could and the implementation itself is not very complex to do
> for this specific use case, the problem is that vc if a general frontend
> for many vcs, and most of them does not support regex search... On the
> other end project.el itself is agnostic respecting to the vc (or the
> backend) in use, so to support this it may be needed some kind of
> desicion between the two ends to use git specific code in the vc-side
> adding a regex function wrapper that will only work for git..
>
> OTOH the current implementation relies on the xref-matches-in-files
> which will respect all the xref customs implied (like
> xref-search-program) reusing all the existing code to match patterns,
> and read the outputs from the processes.
>
> In practice I know that git grep is good, but I am not sure how
> "superior" is it compared to what we already have and if it worth to use
> it.
>
> Are there any real difference?

The real difference is the future proofing. Git grep will track any 
improvements available in the fs representation of the repo and working tree. 
If project doesn't take advantage of that, it has to duplicate it.

I agree/concede that other vcs do not support this, but the right solution 
might be a record of "capabilities", similar to what's in LSP. If project can 
delegate, it does. If not, it falls back on a generic method. So I think we 
need a list of capabilities for vc backends, and I would argue this should not 
be a surprise. They do indeed have different capabilities.

Thanks and regards,

       - Joel



reply via email to

[Prev in Thread] Current Thread [Next in Thread]