all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Joel Reicher <joel.reicher@gmail.com>
To: Ergus <spacibba@aol.com>
Cc: emacs-devel@gnu.org
Subject: Re: Should project delegate project-find-regexp?
Date: Thu, 07 Apr 2022 22:55:49 +1000	[thread overview]
Message-ID: <861qy9f3xm.fsf@gmail.com> (raw)
In-Reply-To: <20220407123406.k3vtkxzky4zzl3ba@Ergus> (Ergus's message of "Thu,  7 Apr 2022 14:34:06 +0200")

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	other threads:[~2022-04-07 12:55 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-07 11:48 Should project delegate project-find-regexp? Joel Reicher
2022-04-07 12:34 ` Ergus
2022-04-07 12:55   ` Joel Reicher [this message]
2022-04-07 14:30 ` Dmitry Gutov
2022-04-07 16:10   ` Ergus
2022-04-07 16:33     ` Dmitry Gutov
2022-04-08  8:40   ` Joel Reicher
2022-04-18  3:01     ` Dmitry Gutov
2022-04-09 23:01   ` Jim Porter
2022-04-18  3:06     ` Dmitry Gutov
2022-04-07 16:56 ` Sean Whitton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=861qy9f3xm.fsf@gmail.com \
    --to=joel.reicher@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=spacibba@aol.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.