GNU bug report logs -
#68579
[PATCH] Support a local repo as URL in treesit-language-source-alist
Previous Next
Full log
Message #41 received at 68579 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On Sat, 2024-01-27 at 11:37 +0200, Eli Zaretskii wrote:
> > From: Konstantin Kharlamov <Hi-Angel <at> yandex.ru>
> > 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.
Right, sorry, I was thinking of "URL" being the name of the argument,
but your text sure is clearer.
> > +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).
Ah, okay, in this case I'm a bit confused regarding what you wanted me
to do by asking to provide a small description of the workflow. I've
documented that URL arg may accept a local dir. I can put this new
sentence to a separate paragraph, but I'm not sure it reads too well,
given the same information is provided one paragraph below.
I've reverted this change for now.
> > 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.
Thanks! Patch is attached, everything is addressed except one question
above. I also fixed "one space" to two spaces" in one place in the
commit description.
[1.patch (text/x-patch, attachment)]
This bug report was last modified 1 year and 163 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.