From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#68579: [PATCH v2] Support a local repo as URL in treesit-language-source-alist Date: Sat, 27 Jan 2024 11:37:27 +0200 Message-ID: <86sf2j86co.fsf@gnu.org> References: <0ffc2f474cf84ed3c63aa82091c967807e5ca0e6.camel@yandex.ru> <20240120115637.25253-1-Hi-Angel@yandex.ru> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6612"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 68579@debbugs.gnu.org To: Konstantin Kharlamov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jan 27 10:38:22 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1rTf8n-0001XS-IZ for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 27 Jan 2024 10:38:21 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rTf8P-0001YT-P1; Sat, 27 Jan 2024 04:37:57 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rTf8N-0001WK-Kb for bug-gnu-emacs@gnu.org; Sat, 27 Jan 2024 04:37:55 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rTf8N-0005MA-CS for bug-gnu-emacs@gnu.org; Sat, 27 Jan 2024 04:37:55 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rTf8T-0006v5-Jz for bug-gnu-emacs@gnu.org; Sat, 27 Jan 2024 04:38:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 27 Jan 2024 09:38:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68579 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 68579-submit@debbugs.gnu.org id=B68579.170634826726575 (code B ref 68579); Sat, 27 Jan 2024 09:38:01 +0000 Original-Received: (at 68579) by debbugs.gnu.org; 27 Jan 2024 09:37:47 +0000 Original-Received: from localhost ([127.0.0.1]:53484 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rTf8E-0006uY-Ky for submit@debbugs.gnu.org; Sat, 27 Jan 2024 04:37:47 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42984) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rTf8C-0006uL-DT for 68579@debbugs.gnu.org; Sat, 27 Jan 2024 04:37:45 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rTf7y-0005L8-Lj; Sat, 27 Jan 2024 04:37:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=R9nXu28+H5c2OBZoNstN6xJKgvpvsxP8m1u4CWs6eEU=; b=clVxr7m0zC5w b3GJPCKZrBcogMGpHjBBT4x59XNjGMeB9hlI/TnGlSZGtRPZJbM+Dea7dT9HCDfjxI+vjmhzDvkjO qv+3arjr6TKUSAK1CRDhzralTOL0xT7jRk6PZPtjUEyYpKS7xYCzO2iylXEDI0Dh7VxG5eA05rItg t0GhyK2N6hfL1QUObSWgrsaqqoX81rx9DmAhrawdS+Gr6HIPCkdROuRDU3LSw1YXAKn6Lla6GRgHX iT7zvoMww3pLrWHK2Po5aIrNx47W5buRWNxUDnHHKBd74yDWH+UujQFnLrW2fkXuoVrffz/fJoYAU jUOSBLYN/ZqmV7VPtf98cw==; In-Reply-To: <20240120115637.25253-1-Hi-Angel@yandex.ru> (message from Konstantin Kharlamov on Sat, 20 Jan 2024 14:56:29 +0300) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:278981 Archived-At: > From: Konstantin Kharlamov > Date: Sat, 20 Jan 2024 14:56:29 +0300 > > Sometimes people may need to bisect to find specific revision in a > grammar repo. In this case they'd want to point the URL to the local > repo to avoid cloning it on every rebuild. So add support for full > path in treesit-language-source-alist. > > * lisp/treesit.el (treesit--install-language-grammar-1): Test if URL > starts with / meaning that the URL is a local path. Then if it is, > avoid cloning the repo and removing the path on success. > (treesit--git-clone-repo): Factor out the code for cloning to a separate > function. > (treesit--git-checkout-branch): A helper to checkout the revision for > cases where we didn't clone the repo but want it to point the > revision. > --- Thanks, but could you please send the patch as attachments created with "git format-patch", and include only the stuff you think should be in the patch and the commit log message? Also, I have a few minor comments below. > ++++ > +** 'treesit-install-language-grammar' can handle local directory as URL. > +It is now possible to pass a directory of a local repository as URL ^^^^^^ I think you mean "instead of a URL" there. > +inside 'treesit-language-source-alist', so that calling > +'treesit-install-language-grammar' would avoid cloning the repository. > +It may be useful for example for the purposes of bisecting a ^ ^ Commas missing there. > --- a/lisp/treesit.el > +++ b/lisp/treesit.el > @@ -3410,14 +3410,16 @@ treesit-explore-mode > ;;; Install & build language grammar > > (defvar treesit-language-source-alist nil > - "Configuration for downloading and installing tree-sitter language grammars. > + "Configuration for downloading and installing tree-sitter language > +grammars. The grammar can also be built from a local directory if > +URL is an existing local path to the repo. The first line of a doc string should be a single complete sentence (because various apropos commands display only the first lines of doc strings). > The value should be an alist where each element has the form > > (LANG . (URL REVISION SOURCE-DIR CC C++)) > > Only LANG and URL are mandatory. LANG is the language symbol. > -URL is the Git repository URL for the grammar. > +URL is the Git repository URL or directory name for the grammar. Suggest to reword: URL is the URL of the grammar's Git repository or a directory where the repository has been cloned. Thanks.