From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Joel Reicher Newsgroups: gmane.emacs.devel Subject: Re: Should project delegate project-find-regexp? Date: Thu, 07 Apr 2022 22:55:49 +1000 Message-ID: <861qy9f3xm.fsf@gmail.com> References: <86bkxdf71q.fsf@gmail.com> <20220407123406.k3vtkxzky4zzl3ba@Ergus> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5122"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (windows-nt) Cc: emacs-devel@gnu.org To: Ergus Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Apr 07 14:57:14 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ncRhK-0001Dq-M9 for ged-emacs-devel@m.gmane-mx.org; Thu, 07 Apr 2022 14:57:14 +0200 Original-Received: from localhost ([::1]:46234 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ncRhJ-0007CK-Jw for ged-emacs-devel@m.gmane-mx.org; Thu, 07 Apr 2022 08:57:13 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42344) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ncRg6-0006UE-Vb for emacs-devel@gnu.org; Thu, 07 Apr 2022 08:55:59 -0400 Original-Received: from mail-pg1-x52d.google.com ([2607:f8b0:4864:20::52d]:34750) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ncRg5-0002hi-Dq for emacs-devel@gnu.org; Thu, 07 Apr 2022 08:55:58 -0400 Original-Received: by mail-pg1-x52d.google.com with SMTP id t4so4895758pgc.1 for ; Thu, 07 Apr 2022 05:55:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=Tq1v3KKgQp4PmDn9jGzBZulNikZxhoVysa/ypdpKcSU=; b=hZjkkiT1rRJq2u6YnE0Nrilme4+Q1wWZsJMNEOvmdsJdfPigv9SKL0bpUGTYJUs6+g N7NWIEh90g1rvIW349Hlm3WlrfBeyF7Ogk+/Vb77o82W8LsJykwoa+zwqVs7vPCEdNEc Y7zvdqyDneSnRj8JpEmtxyVx8lCVFZVs0qeA28oxmK7fT50HS3oWtZoz7mvIA0qTEXq6 pElsxhawdbWbopjs8FbwCE6YxUq43TEzpOJDwteUQ+vFepHN4XQWBKHhWqtnkoE92gKt PU6ZbKrP9XHjnJPScsTSgQc9FHMtj5MruVZSHM+LgJsin8C3jQvyFZWicjXgCQAqdyhM k9/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=Tq1v3KKgQp4PmDn9jGzBZulNikZxhoVysa/ypdpKcSU=; b=mXx8FRoDfkJe2REqq32R4aVm/lTmUJFczCPkrKEa27VZIVf5Gql63IITFTSQCdtpKt E2wklFq96TMV7oah/+DhaExBpdOyadswxkewjFA5T6idxt2iHHUA15IdG4Atzh1mbwCS QJ6JfsatlK1wHWFUgb0ETq0BQY11pC0nlZTeGRp3VC9zB4nhntpXsBdDuKZLDqwybPOZ kqYTVtab+9gIgcYkJ3ww4Lx4dsk3Puf/Y3TzfuI/RaX+sJwbS1+vg/nB1nJ1z0/rMLIl tbyUvX2vMpGNh3LRwCx3EgqWsrfsKacQAyIitvUL+sKe1A3hNX6EYqWuNTXmcdCV/H2r h59w== X-Gm-Message-State: AOAM531Vjl4ipyPZp9giJLiIkmvPEOMDqH3jzLjaE2+L/GqNjCO7+07Q cIygIUQO19qHWhQDq6P706ZesnLbzR0= X-Google-Smtp-Source: ABdhPJwcJ5aY4FOVHaTN3iRi5CJk3mkwosq9Z099jYBd6tZEYFoybtwytS23yVRcPM0mJmjlCuQd9w== X-Received: by 2002:a05:6a00:1acb:b0:4fb:358f:fe87 with SMTP id f11-20020a056a001acb00b004fb358ffe87mr14150314pfv.75.1649336154105; Thu, 07 Apr 2022 05:55:54 -0700 (PDT) Original-Received: from LAPTOP-ACR66VVN (139-218-25-158.sta.wbroadband.net.au. [139.218.25.158]) by smtp.gmail.com with ESMTPSA id a9-20020aa78649000000b004fe3d6c1731sm9764393pfo.175.2022.04.07.05.55.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Apr 2022 05:55:53 -0700 (PDT) In-Reply-To: <20220407123406.k3vtkxzky4zzl3ba@Ergus> (Ergus's message of "Thu, 7 Apr 2022 14:34:06 +0200") Received-SPF: pass client-ip=2607:f8b0:4864:20::52d; envelope-from=joel.reicher@gmail.com; helo=mail-pg1-x52d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:287886 Archived-At: Ergus 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