all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Validating tree-sitter major modes and grammar
@ 2024-12-20  9:09 Yuan Fu
  2024-12-20 12:24 ` Eli Zaretskii
                   ` (4 more replies)
  0 siblings, 5 replies; 24+ messages in thread
From: Yuan Fu @ 2024-12-20  9:09 UTC (permalink / raw)
  To: Emacs Devel; +Cc: Peter Oliver, Björn Bidar, Stefan Kangas

Continuing from the tree-sitter maternity thread, I cooked up some script to go over each builtin tree-sitter mode, clone the grammars it uses, and check whether the font-lock queries are compatible with the latest version of the grammar. If everything works fine, the script adds some comment in the source file listing the version that was checked.

For example, I ran the script for c-ts-mode and c++-ts-mode, and this is the comment inserted to c-ts-mode.el:

;;; Tree-sitter language versions
;;
;; c-ts-mode is known to work with the following languages and version:
;; - tree-sitter-c: v0.20.8-61-g3efee11
;;
;; c++-ts-mode is known to work with the following languages and version:
;; - tree-sitter-cpp: v0.20.5-49-gf41b4f6
;;
;; We try our best to make builtin modes work with latest grammar
;; versions, so a more recent grammar version has a good chance to work.
;; Send us a bug report if it doesn't.

The version is taken from “git describe”. If the grammar isn’t versioned, it’ll just be the hash of HEAD. In order for “git describe” to work, I had to do full clones, and some tree-sitter grammar’s repo is very slow to clone. I wonder if there’s anything we can do to speed it up? 

Any thoughts/comments? I pushed the code to master so others can play with it.

BTW, the script revealed that cmake-ts-mode isn’t compatible with the latest grammar. I’ll try fix it later.

Yuan


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Validating tree-sitter major modes and grammar
  2024-12-20  9:09 Validating tree-sitter major modes and grammar Yuan Fu
@ 2024-12-20 12:24 ` Eli Zaretskii
  2024-12-20 16:22   ` Yuan Fu
  2024-12-23  0:44 ` Björn Bidar
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 24+ messages in thread
From: Eli Zaretskii @ 2024-12-20 12:24 UTC (permalink / raw)
  To: Yuan Fu; +Cc: emacs-devel, p.d.oliver, bjorn.bidar, stefankangas

> From: Yuan Fu <casouri@gmail.com>
> Date: Fri, 20 Dec 2024 01:09:10 -0800
> Cc: Peter Oliver <p.d.oliver@mavit.org.uk>,
>  Björn Bidar <bjorn.bidar@thaodan.de>,
>  Stefan Kangas <stefankangas@gmail.com>
> 
> Continuing from the tree-sitter maternity thread, I cooked up some script to go over each builtin tree-sitter mode, clone the grammars it uses, and check whether the font-lock queries are compatible with the latest version of the grammar. If everything works fine, the script adds some comment in the source file listing the version that was checked.
> 
> For example, I ran the script for c-ts-mode and c++-ts-mode, and this is the comment inserted to c-ts-mode.el:

I'm not sure what exactly you are suggesting, but commands and Lisp
programs that are for the Emacs maintainers (as opposed to users)
should be in the admin/ directory, not in the lisp/ directory.

If you think this should be used by Emacs users, please describe how
would a user use such a command, because I don't think I understand
that.



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Validating tree-sitter major modes and grammar
  2024-12-20 12:24 ` Eli Zaretskii
@ 2024-12-20 16:22   ` Yuan Fu
  0 siblings, 0 replies; 24+ messages in thread
From: Yuan Fu @ 2024-12-20 16:22 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Emacs Devel, Peter Oliver, Björn Bidar, stefankangas



> On Dec 20, 2024, at 4:24 AM, Eli Zaretskii <eliz@gnu.org> wrote:
> 
>> From: Yuan Fu <casouri@gmail.com>
>> Date: Fri, 20 Dec 2024 01:09:10 -0800
>> Cc: Peter Oliver <p.d.oliver@mavit.org.uk>,
>> Björn Bidar <bjorn.bidar@thaodan.de>,
>> Stefan Kangas <stefankangas@gmail.com>
>> 
>> Continuing from the tree-sitter maternity thread, I cooked up some script to go over each builtin tree-sitter mode, clone the grammars it uses, and check whether the font-lock queries are compatible with the latest version of the grammar. If everything works fine, the script adds some comment in the source file listing the version that was checked.
>> 
>> For example, I ran the script for c-ts-mode and c++-ts-mode, and this is the comment inserted to c-ts-mode.el:
> 
> I'm not sure what exactly you are suggesting, but commands and Lisp
> programs that are for the Emacs maintainers (as opposed to users)
> should be in the admin/ directory, not in the lisp/ directory.
> 
> If you think this should be used by Emacs users, please describe how
> would a user use such a command, because I don't think I understand
> that.

It’s for maintainers, I moved the script to admin/treesit-admin.el.

Yuan




^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Validating tree-sitter major modes and grammar
  2024-12-20  9:09 Validating tree-sitter major modes and grammar Yuan Fu
  2024-12-20 12:24 ` Eli Zaretskii
@ 2024-12-23  0:44 ` Björn Bidar
       [not found] ` <868qs6vd76.fsf@aarsen.me>
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 24+ messages in thread
From: Björn Bidar @ 2024-12-23  0:44 UTC (permalink / raw)
  To: Yuan Fu; +Cc: Emacs Devel, Peter Oliver, Stefan Kangas

Yuan Fu <casouri@gmail.com> writes:

> Continuing from the tree-sitter maternity thread, I cooked up some
> script to go over each builtin tree-sitter mode, clone the grammars it
> uses, and check whether the font-lock queries are compatible with the
> latest version of the grammar. If everything works fine, the script
> adds some comment in the source file listing the version that was
> checked.

Oh that sounds very good. This could be a good workaround for the sort
of fast and lose nature of tree-sitter.



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Validating tree-sitter major modes and grammar
       [not found] ` <868qs6vd76.fsf@aarsen.me>
@ 2024-12-24  1:16   ` Yuan Fu
  0 siblings, 0 replies; 24+ messages in thread
From: Yuan Fu @ 2024-12-24  1:16 UTC (permalink / raw)
  To: Arsen Arsenović
  Cc: Emacs Devel, Peter Oliver, Björn Bidar, Stefan Kangas



> On Dec 23, 2024, at 3:41 AM, Arsen Arsenović <arsen@aarsen.me> wrote:
> 
> Hi Yuan,
> 
> Yuan Fu <casouri@gmail.com> writes:
> 
>> Continuing from the tree-sitter maternity thread, I cooked up some script to go
>> over each builtin tree-sitter mode, clone the grammars it uses, and check
>> whether the font-lock queries are compatible with the latest version of the
>> grammar. If everything works fine, the script adds some comment in the source
>> file listing the version that was checked.
>> 
>> For example, I ran the script for c-ts-mode and c++-ts-mode, and this is the comment inserted to c-ts-mode.el:
>> 
>> ;;; Tree-sitter language versions
>> ;;
>> ;; c-ts-mode is known to work with the following languages and version:
>> ;; - tree-sitter-c: v0.20.8-61-g3efee11
>> ;;
>> ;; c++-ts-mode is known to work with the following languages and version:
>> ;; - tree-sitter-cpp: v0.20.5-49-gf41b4f6
>> ;;
>> ;; We try our best to make builtin modes work with latest grammar
>> ;; versions, so a more recent grammar version has a good chance to work.
>> ;; Send us a bug report if it doesn't.
>> 
>> The version is taken from “git describe”. If the grammar isn’t versioned, it’ll
>> just be the hash of HEAD. In order for “git describe” to work, I had to do full
>> clones, and some tree-sitter grammar’s repo is very slow to clone. I wonder if
>> there’s anything we can do to speed it up?
> 
> Maybe this:
> 
>  ~$ time git clone --filter=blob:none https://github.com/tree-sitter/tree-sitter-c/
>  [...]
> 
>  real 0m1.380s
>  user 0m0.104s
>  sys 0m0.069s
>  ~$ cd tree-sitter-c
>  ~/tree-sitter-c$ git describe HEAD
>  v0.20.8-61-g3efee11
> 
> A normal clone was 7.2 seconds, for reference.  Note that all future
> checkouts will be slowed down (as they will need to fetch fresh blobs),
> but if you're only cloning for HEAD anyway, that's fine.
> -- 
> Arsen Arsenović

Thanks! This is exactly what I need.

Yuan


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Validating tree-sitter major modes and grammar
  2024-12-20  9:09 Validating tree-sitter major modes and grammar Yuan Fu
                   ` (2 preceding siblings ...)
       [not found] ` <868qs6vd76.fsf@aarsen.me>
@ 2024-12-24  3:12 ` Yuan Fu
  2024-12-24 12:19   ` Eli Zaretskii
       [not found] ` <6768b29d.050a0220.1b40f2.5574SMTPIN_ADDED_BROKEN@mx.google.com>
  4 siblings, 1 reply; 24+ messages in thread
From: Yuan Fu @ 2024-12-24  3:12 UTC (permalink / raw)
  To: Emacs Devel
  Cc: Peter Oliver, Björn Bidar, Stefan Kangas, Perry Smith,
	Perry Smith, Jostein Kjønigsen, Theodor Thornhill,
	Vincenzo Pupillo, Randy Taylor, Wilhelm Kirschbaum, john muhl,
	Dmitry Gutov, john muhl, Juri Linkov



> On Dec 20, 2024, at 1:09 AM, Yuan Fu <casouri@gmail.com> wrote:
> 
> Continuing from the tree-sitter maternity thread, I cooked up some script to go over each builtin tree-sitter mode, clone the grammars it uses, and check whether the font-lock queries are compatible with the latest version of the grammar. If everything works fine, the script adds some comment in the source file listing the version that was checked.
> 
> For example, I ran the script for c-ts-mode and c++-ts-mode, and this is the comment inserted to c-ts-mode.el:
> 
> ;;; Tree-sitter language versions
> ;;
> ;; c-ts-mode is known to work with the following languages and version:
> ;; - tree-sitter-c: v0.23.4
> ;;
> ;; c++-ts-mode is known to work with the following languages and version:
> ;; - tree-sitter-cpp: v0.23.4-1-gf41b4f6
> ;;
> ;; We try our best to make builtin modes work with latest grammar
> ;; versions, so a more recent grammar version has a good chance to work.
> ;; Send us a bug report if it doesn't.
> 
> The version is taken from “git describe”. If the grammar isn’t versioned, it’ll just be the hash of HEAD. In order for “git describe” to work, I had to do full clones, and some tree-sitter grammar’s repo is very slow to clone. I wonder if there’s anything we can do to speed it up? 
> 
> Any thoughts/comments? I pushed the code to master so others can play with it.
> 
> BTW, the script revealed that cmake-ts-mode isn’t compatible with the latest grammar. I’ll try fix it later.

(This is now fixed.)



CC’ing maintainers for builtin modes for comments. Also, Eli, what’s your thoughts on this after the clarification? 

Yuan


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Validating tree-sitter major modes and grammar
       [not found] ` <6768b29d.050a0220.1b40f2.5574SMTPIN_ADDED_BROKEN@mx.google.com>
@ 2024-12-24  3:20   ` Yuan Fu
  2024-12-24 12:36     ` Peter Oliver
  2024-12-24 21:36     ` Björn Bidar
  0 siblings, 2 replies; 24+ messages in thread
From: Yuan Fu @ 2024-12-24  3:20 UTC (permalink / raw)
  To: Björn Bidar; +Cc: Emacs Devel, Peter Oliver, Stefan Kangas



> On Dec 22, 2024, at 4:44 PM, Björn Bidar <bjorn.bidar@thaodan.de> wrote:
> 
> Yuan Fu <casouri@gmail.com> writes:
> 
>> Continuing from the tree-sitter maternity thread, I cooked up some
>> script to go over each builtin tree-sitter mode, clone the grammars it
>> uses, and check whether the font-lock queries are compatible with the
>> latest version of the grammar. If everything works fine, the script
>> adds some comment in the source file listing the version that was
>> checked.
> 
> Oh that sounds very good. This could be a good workaround for the sort
> of fast and lose nature of tree-sitter.
> 

Great. Do you think the “verified version” comment will be helpful for packagers?

Yuan


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Validating tree-sitter major modes and grammar
  2024-12-24  3:12 ` Yuan Fu
@ 2024-12-24 12:19   ` Eli Zaretskii
  2024-12-24 21:30     ` Yuan Fu
  0 siblings, 1 reply; 24+ messages in thread
From: Eli Zaretskii @ 2024-12-24 12:19 UTC (permalink / raw)
  To: Yuan Fu
  Cc: emacs-devel, p.d.oliver, bjorn.bidar, stefankangas, pedz, pedz,
	jostein, theo, v.pupillo, dev, wkirschbaum, jm, dgutov, jm, juri

> From: Yuan Fu <casouri@gmail.com>
> Date: Mon, 23 Dec 2024 19:12:18 -0800
> Cc: Peter Oliver <p.d.oliver@mavit.org.uk>,
>  Björn Bidar <bjorn.bidar@thaodan.de>,
>  Stefan Kangas <stefankangas@gmail.com>,
>  Perry Smith <pedz@easesoftware.com>, Perry Smith <pedz@easesoftware.com>,
>  Jostein Kjønigsen <jostein@secure.kjonigsen.net>,
>  Theodor Thornhill <theo@thornhill.no>,
>  Vincenzo Pupillo <v.pupillo@gmail.com>, Randy Taylor <dev@rjt.dev>,
>  Wilhelm Kirschbaum <wkirschbaum@gmail.com>, john muhl <jm@pub.pink>,
>  Dmitry Gutov <dgutov@yandex.ru>, john muhl <jm@pub.pink>,
>  Juri Linkov <juri@linkov.net>
> 
> 
> 
> > On Dec 20, 2024, at 1:09 AM, Yuan Fu <casouri@gmail.com> wrote:
> > 
> > Continuing from the tree-sitter maternity thread, I cooked up some script to go over each builtin tree-sitter mode, clone the grammars it uses, and check whether the font-lock queries are compatible with the latest version of the grammar. If everything works fine, the script adds some comment in the source file listing the version that was checked.
> > 
> > For example, I ran the script for c-ts-mode and c++-ts-mode, and this is the comment inserted to c-ts-mode.el:
> > 
> > ;;; Tree-sitter language versions
> > ;;
> > ;; c-ts-mode is known to work with the following languages and version:
> > ;; - tree-sitter-c: v0.23.4
> > ;;
> > ;; c++-ts-mode is known to work with the following languages and version:
> > ;; - tree-sitter-cpp: v0.23.4-1-gf41b4f6
> > ;;
> > ;; We try our best to make builtin modes work with latest grammar
> > ;; versions, so a more recent grammar version has a good chance to work.
> > ;; Send us a bug report if it doesn't.
> > 
> > The version is taken from “git describe”. If the grammar isn’t versioned, it’ll just be the hash of HEAD. In order for “git describe” to work, I had to do full clones, and some tree-sitter grammar’s repo is very slow to clone. I wonder if there’s anything we can do to speed it up? 
> > 
> > Any thoughts/comments? I pushed the code to master so others can play with it.
> > 
> > BTW, the script revealed that cmake-ts-mode isn’t compatible with the latest grammar. I’ll try fix it later.
> 
> (This is now fixed.)
> 
> 
> 
> CC’ing maintainers for builtin modes for comments. Also, Eli, what’s your thoughts on this after the clarification? 

Sorry, I thought we had this discussion concluded and closed.  What
are the issues that still need decisions?



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Validating tree-sitter major modes and grammar
  2024-12-24  3:20   ` Yuan Fu
@ 2024-12-24 12:36     ` Peter Oliver
  2024-12-24 14:20       ` Michael Albinus
  2024-12-24 22:14       ` Yuan Fu
  2024-12-24 21:36     ` Björn Bidar
  1 sibling, 2 replies; 24+ messages in thread
From: Peter Oliver @ 2024-12-24 12:36 UTC (permalink / raw)
  To: Yuan Fu; +Cc: Björn Bidar, Emacs Devel

[-- Attachment #1: Type: text/plain, Size: 1664 bytes --]

On Mon, 23 Dec 2024, Yuan Fu wrote:

>> On Dec 22, 2024, at 4:44 PM, Björn Bidar <bjorn.bidar@thaodan.de> wrote:
>>
>> Yuan Fu <casouri@gmail.com> writes:
>>
>>> Continuing from the tree-sitter maternity thread, I cooked up some
>>> script to go over each builtin tree-sitter mode, clone the grammars it
>>> uses, and check whether the font-lock queries are compatible with the
>>> latest version of the grammar. If everything works fine, the script
>>> adds some comment in the source file listing the version that was
>>> checked.
>>
>> Oh that sounds very good. This could be a good workaround for the sort
>> of fast and lose nature of tree-sitter.
>
> Great. Do you think the “verified version” comment will be helpful for packagers?

It helps answer the question, “I am building a new Emacs release.  Do I need to update these Tree-sitter parsers?”.

However, as a parser packager, I also need to answer the question, “This parser has released a new version.  Can I package it now, or do I need to wait for Emacs 30?  Emacs 31?”.  A static comment in the source code of a released version of Emacs will likely be too out-of-date to answer that.

Other ideas:

- Run these checks regularly (from https://emba.gnu.org/, perhaps?) for the most-recent Emacs release, outputting a report or webpage that can be referred to by packagers.

- Include a function in Emacs that packagers can call themselves to check the compatibility of installed parsers.  They could run this check every time they build an updated parser (either manually, as a part of the package build, or as a part of their distribution’s automated CI testing).

-- 
Peter Oliver

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Validating tree-sitter major modes and grammar
  2024-12-24 12:36     ` Peter Oliver
@ 2024-12-24 14:20       ` Michael Albinus
  2024-12-24 22:20         ` Yuan Fu
  2024-12-24 22:14       ` Yuan Fu
  1 sibling, 1 reply; 24+ messages in thread
From: Michael Albinus @ 2024-12-24 14:20 UTC (permalink / raw)
  To: Peter Oliver; +Cc: Yuan Fu, Björn Bidar, Emacs Devel

Peter Oliver <p.d.oliver@mavit.org.uk> writes:

Hi Peter,

> - Run these checks regularly (from https://emba.gnu.org/, perhaps?) for the most-recent Emacs release, outputting a report or webpage that can be referred to by packagers.

This is performed already, see the GitLab jobs build-image-tree-sitter
and test-tree-sitter.

Recent results are for example
<https://emba.gnu.org/emacs/emacs/-/jobs/95076> and
<https://emba.gnu.org/emacs/emacs/-/jobs/95071>.

Best regards, Michael.



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Validating tree-sitter major modes and grammar
  2024-12-24 12:19   ` Eli Zaretskii
@ 2024-12-24 21:30     ` Yuan Fu
  2024-12-24 23:09       ` Dmitry Gutov
  0 siblings, 1 reply; 24+ messages in thread
From: Yuan Fu @ 2024-12-24 21:30 UTC (permalink / raw)
  To: Eli Zaretskii
  Cc: Emacs Devel, Peter Oliver, Björn Bidar, Stefan Kangas,
	Perry Smith, Jostein Kjønigsen, Theodor Thornhill,
	Vincenzo Pupillo, Randy Taylor, Wilhelm Kirschbaum, john muhl,
	Dmitry Gutov, Juri Linkov



> On Dec 24, 2024, at 4:19 AM, Eli Zaretskii <eliz@gnu.org> wrote:
> 
>> From: Yuan Fu <casouri@gmail.com>
>> Date: Mon, 23 Dec 2024 19:12:18 -0800
>> Cc: Peter Oliver <p.d.oliver@mavit.org.uk>,
>> Björn Bidar <bjorn.bidar@thaodan.de>,
>> Stefan Kangas <stefankangas@gmail.com>,
>> Perry Smith <pedz@easesoftware.com>, Perry Smith <pedz@easesoftware.com>,
>> Jostein Kjønigsen <jostein@secure.kjonigsen.net>,
>> Theodor Thornhill <theo@thornhill.no>,
>> Vincenzo Pupillo <v.pupillo@gmail.com>, Randy Taylor <dev@rjt.dev>,
>> Wilhelm Kirschbaum <wkirschbaum@gmail.com>, john muhl <jm@pub.pink>,
>> Dmitry Gutov <dgutov@yandex.ru>, john muhl <jm@pub.pink>,
>> Juri Linkov <juri@linkov.net>
>> 
>> 
>> 
>>> On Dec 20, 2024, at 1:09 AM, Yuan Fu <casouri@gmail.com> wrote:
>>> 
>>> Continuing from the tree-sitter maternity thread, I cooked up some script to go over each builtin tree-sitter mode, clone the grammars it uses, and check whether the font-lock queries are compatible with the latest version of the grammar. If everything works fine, the script adds some comment in the source file listing the version that was checked.
>>> 
>>> For example, I ran the script for c-ts-mode and c++-ts-mode, and this is the comment inserted to c-ts-mode.el:
>>> 
>>> ;;; Tree-sitter language versions
>>> ;;
>>> ;; c-ts-mode is known to work with the following languages and version:
>>> ;; - tree-sitter-c: v0.23.4
>>> ;;
>>> ;; c++-ts-mode is known to work with the following languages and version:
>>> ;; - tree-sitter-cpp: v0.23.4-1-gf41b4f6
>>> ;;
>>> ;; We try our best to make builtin modes work with latest grammar
>>> ;; versions, so a more recent grammar version has a good chance to work.
>>> ;; Send us a bug report if it doesn't.
>>> 
>>> The version is taken from “git describe”. If the grammar isn’t versioned, it’ll just be the hash of HEAD. In order for “git describe” to work, I had to do full clones, and some tree-sitter grammar’s repo is very slow to clone. I wonder if there’s anything we can do to speed it up? 
>>> 
>>> Any thoughts/comments? I pushed the code to master so others can play with it.
>>> 
>>> BTW, the script revealed that cmake-ts-mode isn’t compatible with the latest grammar. I’ll try fix it later.
>> 
>> (This is now fixed.)
>> 
>> 
>> 
>> CC’ing maintainers for builtin modes for comments. Also, Eli, what’s your thoughts on this after the clarification? 
> 
> Sorry, I thought we had this discussion concluded and closed.  What
> are the issues that still need decisions?

About running the script semi-regularly and adding recommended version comments to builtin modes. Are there any concerns?

If most people think it’s a good idea, I’ll run the script for all the builtin modes, which will add the comments. And I plan to run it myself from time to time to update the comments. Maintainers for a particular mode can also run it to update the comment themselves. And I’ll add more detailed documentation about how to use the script.

Yuan


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Validating tree-sitter major modes and grammar
  2024-12-24  3:20   ` Yuan Fu
  2024-12-24 12:36     ` Peter Oliver
@ 2024-12-24 21:36     ` Björn Bidar
  1 sibling, 0 replies; 24+ messages in thread
From: Björn Bidar @ 2024-12-24 21:36 UTC (permalink / raw)
  To: Yuan Fu; +Cc: Emacs Devel, Peter Oliver, Stefan Kangas

Yuan Fu <casouri@gmail.com> writes:

>> On Dec 22, 2024, at 4:44 PM, Björn Bidar <bjorn.bidar@thaodan.de> wrote:
>> 
>> Yuan Fu <casouri@gmail.com> writes:
>> 
>>> Continuing from the tree-sitter maternity thread, I cooked up some
>>> script to go over each builtin tree-sitter mode, clone the grammars it
>>> uses, and check whether the font-lock queries are compatible with the
>>> latest version of the grammar. If everything works fine, the script
>>> adds some comment in the source file listing the version that was
>>> checked.
>> 
>> Oh that sounds very good. This could be a good workaround for the sort
>> of fast and lose nature of tree-sitter.
>> 
>
> Great. Do you think the “verified version” comment will be helpful for packagers?
>

It would be helpful in case something goes wrong as a kind of sanity
check but it won't help much for an indicator when to update since I
don't think that would be blocker for updating.

It is helpful but none the less the goal should be that such errors
should be preventable between grammar versions.



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Validating tree-sitter major modes and grammar
  2024-12-24 12:36     ` Peter Oliver
  2024-12-24 14:20       ` Michael Albinus
@ 2024-12-24 22:14       ` Yuan Fu
  1 sibling, 0 replies; 24+ messages in thread
From: Yuan Fu @ 2024-12-24 22:14 UTC (permalink / raw)
  To: Peter Oliver; +Cc: Björn Bidar, Emacs Devel



> On Dec 24, 2024, at 4:36 AM, Peter Oliver <p.d.oliver@mavit.org.uk> wrote:
> 
> On Mon, 23 Dec 2024, Yuan Fu wrote:
> 
>>> On Dec 22, 2024, at 4:44 PM, Björn Bidar <bjorn.bidar@thaodan.de> wrote:
>>> 
>>> Yuan Fu <casouri@gmail.com> writes:
>>> 
>>>> Continuing from the tree-sitter maternity thread, I cooked up some
>>>> script to go over each builtin tree-sitter mode, clone the grammars it
>>>> uses, and check whether the font-lock queries are compatible with the
>>>> latest version of the grammar. If everything works fine, the script
>>>> adds some comment in the source file listing the version that was
>>>> checked.
>>> 
>>> Oh that sounds very good. This could be a good workaround for the sort
>>> of fast and lose nature of tree-sitter.
>> 
>> Great. Do you think the “verified version” comment will be helpful for packagers?
> 
> It helps answer the question, “I am building a new Emacs release.  Do I need to update these Tree-sitter parsers?”.
> 
> However, as a parser packager, I also need to answer the question, “This parser has released a new version.  Can I package it now, or do I need to wait for Emacs 30?  Emacs 31?”.  A static comment in the source code of a released version of Emacs will likely be too out-of-date to answer that.
> 
> Other ideas:
> 
> - Run these checks regularly (from https://emba.gnu.org/, perhaps?) for the most-recent Emacs release, outputting a report or webpage that can be referred to by packagers.
> 
> - Include a function in Emacs that packagers can call themselves to check the compatibility of installed parsers.  They could run this check every time they build an updated parser (either manually, as a part of the package build, or as a part of their distribution’s automated CI testing).

I can add another script that finds the latest “version” that’s compatible with a builtin mode. The comments will be helpful for packaging a new Emacs release. And the new script can help with packaging new grammar versions with Emacs.

Yuan


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Validating tree-sitter major modes and grammar
  2024-12-24 14:20       ` Michael Albinus
@ 2024-12-24 22:20         ` Yuan Fu
  2024-12-25  8:20           ` Michael Albinus
  0 siblings, 1 reply; 24+ messages in thread
From: Yuan Fu @ 2024-12-24 22:20 UTC (permalink / raw)
  To: Michael Albinus; +Cc: Peter Oliver, Björn Bidar, Emacs Devel



> On Dec 24, 2024, at 6:20 AM, Michael Albinus <michael.albinus@gmx.de> wrote:
> 
> Peter Oliver <p.d.oliver@mavit.org.uk> writes:
> 
> Hi Peter,
> 
>> - Run these checks regularly (from https://emba.gnu.org/, perhaps?) for the most-recent Emacs release, outputting a report or webpage that can be referred to by packagers.
> 
> This is performed already, see the GitLab jobs build-image-tree-sitter
> and test-tree-sitter.
> 
> Recent results are for example
> <https://emba.gnu.org/emacs/emacs/-/jobs/95076> and
> <https://emba.gnu.org/emacs/emacs/-/jobs/95071>.
> 
> Best regards, Michael.

Ah yes, though this is more for us (Emacs devs) than for packagers.

Yuan


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Validating tree-sitter major modes and grammar
  2024-12-24 21:30     ` Yuan Fu
@ 2024-12-24 23:09       ` Dmitry Gutov
  2024-12-25  8:39         ` Yuan Fu
  0 siblings, 1 reply; 24+ messages in thread
From: Dmitry Gutov @ 2024-12-24 23:09 UTC (permalink / raw)
  To: Yuan Fu, Eli Zaretskii; +Cc: Emacs Devel

On 24/12/2024 23:30, Yuan Fu wrote:
> If most people think it’s a good idea, I’ll run the script for all the builtin modes, which will add the comments. And I plan to run it myself from time to time to update the comments. Maintainers for a particular mode can also run it to update the comment themselves. And I’ll add more detailed documentation about how to use the script.

Sounds great to me.

Hopefully we manage to convey well that the "last tested version" is not 
necessarily the latest that will work, just the one that we tested.

(I dropped most people from Cc to avoid spamming.)



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Validating tree-sitter major modes and grammar
  2024-12-24 22:20         ` Yuan Fu
@ 2024-12-25  8:20           ` Michael Albinus
  2024-12-25  9:33             ` Yuan Fu
  0 siblings, 1 reply; 24+ messages in thread
From: Michael Albinus @ 2024-12-25  8:20 UTC (permalink / raw)
  To: Yuan Fu; +Cc: Peter Oliver, Björn Bidar, Emacs Devel

Yuan Fu <casouri@gmail.com> writes:

Hi Yuan & Peter,

>>> - Run these checks regularly (from https://emba.gnu.org/, perhaps?) for the most-recent Emacs release, outputting a report or webpage that can be referred to by packagers.
>>
>> This is performed already, see the GitLab jobs build-image-tree-sitter
>> and test-tree-sitter.
>
> Ah yes, though this is more for us (Emacs devs) than for packagers.

Sure. But if this can be improved for packagers, let us know.

> Yuan

Best regards, Michael.



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Validating tree-sitter major modes and grammar
  2024-12-24 23:09       ` Dmitry Gutov
@ 2024-12-25  8:39         ` Yuan Fu
  2024-12-26  2:23           ` Dmitry Gutov
  0 siblings, 1 reply; 24+ messages in thread
From: Yuan Fu @ 2024-12-25  8:39 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: Eli Zaretskii, Emacs Devel



> On Dec 24, 2024, at 3:09 PM, Dmitry Gutov <dgutov@yandex.ru> wrote:
> 
> On 24/12/2024 23:30, Yuan Fu wrote:
>> If most people think it’s a good idea, I’ll run the script for all the builtin modes, which will add the comments. And I plan to run it myself from time to time to update the comments. Maintainers for a particular mode can also run it to update the comment themselves. And I’ll add more detailed documentation about how to use the script.
> 
> Sounds great to me.
> 
> Hopefully we manage to convey well that the "last tested version" is not necessarily the latest that will work, just the one that we tested.

Right now the comment says this at the end:

;; We try our best to make builtin modes work with latest grammar
;; versions, so a more recent grammar version has a good chance to work.
;; Send us a bug report if it doesn't.

But let me know if it can be improved in some way.

Yuan


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Validating tree-sitter major modes and grammar
  2024-12-25  8:20           ` Michael Albinus
@ 2024-12-25  9:33             ` Yuan Fu
  2024-12-25 13:51               ` Michael Albinus
  2024-12-26 12:54               ` Peter Oliver
  0 siblings, 2 replies; 24+ messages in thread
From: Yuan Fu @ 2024-12-25  9:33 UTC (permalink / raw)
  To: Michael Albinus; +Cc: Peter Oliver, Björn Bidar, Emacs Devel



> On Dec 25, 2024, at 12:20 AM, Michael Albinus <michael.albinus@gmx.de> wrote:
> 
> Yuan Fu <casouri@gmail.com> writes:
> 
> Hi Yuan & Peter,
> 
>>>> - Run these checks regularly (from https://emba.gnu.org/, perhaps?) for the most-recent Emacs release, outputting a report or webpage that can be referred to by packagers.
>>> 
>>> This is performed already, see the GitLab jobs build-image-tree-sitter
>>> and test-tree-sitter.
>> 
>> Ah yes, though this is more for us (Emacs devs) than for packagers.
> 
> Sure. But if this can be improved for packagers, let us know.

Is it possible for EMBA to run a CI which produces a HTML webpage, and host that webpage somewhere? I’m referring to this idea of Peter’s. 

> - Run these checks regularly (from https://emba.gnu.org/, perhaps?) for the most-recent Emacs release, outputting a report or webpage that can be referred to by packagers.

I’m thinking of a table where rows are languages, columns are Emacs releases (29, 30, master), and cells are the latest revision of a language grammar that’s compatible with an Emacs release.

Yuan


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Validating tree-sitter major modes and grammar
  2024-12-25  9:33             ` Yuan Fu
@ 2024-12-25 13:51               ` Michael Albinus
  2024-12-26 12:54               ` Peter Oliver
  1 sibling, 0 replies; 24+ messages in thread
From: Michael Albinus @ 2024-12-25 13:51 UTC (permalink / raw)
  To: Yuan Fu; +Cc: Peter Oliver, Björn Bidar, Emacs Devel

Yuan Fu <casouri@gmail.com> writes:

Hi Yuan,

>>>>> - Run these checks regularly (from https://emba.gnu.org/, perhaps?) for the most-recent Emacs release, outputting a report or webpage that can be referred to by packagers.
>>>> 
>>>> This is performed already, see the GitLab jobs build-image-tree-sitter
>>>> and test-tree-sitter.
>>> 
>>> Ah yes, though this is more for us (Emacs devs) than for packagers.
>> 
>> Sure. But if this can be improved for packagers, let us know.
>
> Is it possible for EMBA to run a CI which produces a HTML webpage, and host that webpage somewhere? I’m referring to this idea of Peter’s. 
>
>> - Run these checks regularly (from https://emba.gnu.org/, perhaps?) for the most-recent Emacs release, outputting a report or webpage that can be referred to by packagers.
>
> I’m thinking of a table where rows are languages, columns are Emacs releases (29, 30, master), and cells are the latest revision of a language grammar that’s compatible with an Emacs release.

Unfortunately, I don't know GitLab sufficiently for answering this question.

> Yuan

Best regatds, Michael.



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Validating tree-sitter major modes and grammar
  2024-12-25  8:39         ` Yuan Fu
@ 2024-12-26  2:23           ` Dmitry Gutov
  0 siblings, 0 replies; 24+ messages in thread
From: Dmitry Gutov @ 2024-12-26  2:23 UTC (permalink / raw)
  To: Yuan Fu; +Cc: Eli Zaretskii, Emacs Devel

Hi Yuan,

On 25/12/2024 10:39, Yuan Fu wrote:
>> Hopefully we manage to convey well that the "last tested version" is not necessarily the latest that will work, just the one that we tested.
> Right now the comment says this at the end:
> 
> ;; We try our best to make builtin modes work with latest grammar
> ;; versions, so a more recent grammar version has a good chance to work.
> ;; Send us a bug report if it doesn't.
> 
> But let me know if it can be improved in some way.

Just a nit, but we could add "too" at the end:

   so a more recent grammar has a good chance to work too.

(I removed the word "version" for easier refilling, but that's 
definitely not neccesary.)

About the paragraph before, just a thought but do we want to use a 
standard phrase like "has been tested":

   ;; c-ts-mode has been tested with the following languages and version:

? Seems a bit more regular for a casual reader, which conveying the same 
meaning. I'm not a native speaker, though.



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Validating tree-sitter major modes and grammar
  2024-12-25  9:33             ` Yuan Fu
  2024-12-25 13:51               ` Michael Albinus
@ 2024-12-26 12:54               ` Peter Oliver
  2024-12-26 17:50                 ` Michael Albinus
  1 sibling, 1 reply; 24+ messages in thread
From: Peter Oliver @ 2024-12-26 12:54 UTC (permalink / raw)
  To: Yuan Fu; +Cc: Michael Albinus, Emacs Devel

[-- Attachment #1: Type: text/plain, Size: 1017 bytes --]

On Wed, 25 Dec 2024, Yuan Fu wrote:

> Is it possible for EMBA to run a CI which produces a HTML webpage, and host that webpage somewhere? I’m referring to this idea of Peter’s.

In general it is possible, using a GitLab feature called Pages (https://emba.gnu.org/help/user/project/pages/index.md).

Some configuration is required (https://emba.gnu.org/help/administration/pages/index.md).  I don’t know if this has been done for EMBA (but I suspect not, because https://emba.gnu.org/emacs/emacs/pages returns 404; alternatively, it’s possible the feature simply needs switching on at https://emba.gnu.org/emacs/emacs/edit#js-general-project-settings).

Once this is done, you don’t have to do much more than, from your CI job, write HTML files to a directory called pages.

> I’m thinking of a table where rows are languages, columns are Emacs releases (29, 30, master), and cells are the latest revision of a language grammar that’s compatible with an Emacs release.

Sounds perfect.

-- 
Peter Oliver

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Validating tree-sitter major modes and grammar
  2024-12-26 12:54               ` Peter Oliver
@ 2024-12-26 17:50                 ` Michael Albinus
  2024-12-28 12:02                   ` Michael Albinus
  0 siblings, 1 reply; 24+ messages in thread
From: Michael Albinus @ 2024-12-26 17:50 UTC (permalink / raw)
  To: Peter Oliver; +Cc: Yuan Fu, Emacs Devel

Peter Oliver <p.d.oliver@mavit.org.uk> writes:

Hi Peter,

>> Is it possible for EMBA to run a CI which produces a HTML webpage, and host that webpage somewhere? I’m referring to this idea of Peter’s.
>
> In general it is possible, using a GitLab feature called Pages (https://emba.gnu.org/help/user/project/pages/index.md).
>
> Some configuration is required
> (https://emba.gnu.org/help/administration/pages/index.md).  I don’t
> know if this has been done for EMBA (but I suspect not, because
> https://emba.gnu.org/emacs/emacs/pages returns 404; alternatively,
> it’s possible the feature simply needs switching on at
> https://emba.gnu.org/emacs/emacs/edit#js-general-project-settings).
>
> Once this is done, you don’t have to do much more than, from your CI job, write HTML files to a directory called pages.
>
>> I’m thinking of a table where rows are languages, columns are Emacs releases (29, 30, master), and cells are the latest revision of a language grammar that’s compatible with an Emacs release.
>
> Sounds perfect.

Nice. I'll see whether I can do something useful with this.

Best regards, Michael.



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Validating tree-sitter major modes and grammar
  2024-12-26 17:50                 ` Michael Albinus
@ 2024-12-28 12:02                   ` Michael Albinus
  2024-12-30  8:08                     ` Yuan Fu
  0 siblings, 1 reply; 24+ messages in thread
From: Michael Albinus @ 2024-12-28 12:02 UTC (permalink / raw)
  To: Peter Oliver; +Cc: Yuan Fu, Emacs Devel

Michael Albinus <michael.albinus@gmx.de> writes:

Hi Peter & Yuan,

>>> Is it possible for EMBA to run a CI which produces a HTML webpage, and host that webpage somewhere? I’m referring to this idea of Peter’s.
>>
>> In general it is possible, using a GitLab feature called Pages (https://emba.gnu.org/help/user/project/pages/index.md).
>>
>> Some configuration is required
>> (https://emba.gnu.org/help/administration/pages/index.md).  I don’t
>> know if this has been done for EMBA (but I suspect not, because
>> https://emba.gnu.org/emacs/emacs/pages returns 404; alternatively,
>> it’s possible the feature simply needs switching on at
>> https://emba.gnu.org/emacs/emacs/edit#js-general-project-settings).
>>
>> Once this is done, you don’t have to do much more than, from your CI job, write HTML files to a directory called pages.
>>
>>> I’m thinking of a table where rows are languages, columns are Emacs releases (29, 30, master), and cells are the latest revision of a language grammar that’s compatible with an Emacs release.
>>
>> Sounds perfect.
>
> Nice. I'll see whether I can do something useful with this.

As a starting point, we could use the JUnit reports, which are already
generated. They are not formatted to what we want, but they contain all
test results in XML files for better access.

See for example
<https://emba.gnu.org/emacs/emacs/-/pipelines/31215/test_report> and
click on "Tests". Choose job test-tree-sitter.

There are no data when you inspect "View details", but this can be changed.

Best regards, Michael.



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Validating tree-sitter major modes and grammar
  2024-12-28 12:02                   ` Michael Albinus
@ 2024-12-30  8:08                     ` Yuan Fu
  0 siblings, 0 replies; 24+ messages in thread
From: Yuan Fu @ 2024-12-30  8:08 UTC (permalink / raw)
  To: Michael Albinus; +Cc: Peter Oliver, Emacs Devel

[-- Attachment #1: Type: text/plain, Size: 2105 bytes --]



> On Dec 28, 2024, at 4:02 AM, Michael Albinus <michael.albinus@gmx.de> wrote:
> 
> Michael Albinus <michael.albinus@gmx.de> writes:
> 
> Hi Peter & Yuan,
> 
>>>> Is it possible for EMBA to run a CI which produces a HTML webpage, and host that webpage somewhere? I’m referring to this idea of Peter’s.
>>> 
>>> In general it is possible, using a GitLab feature called Pages (https://emba.gnu.org/help/user/project/pages/index.md).
>>> 
>>> Some configuration is required
>>> (https://emba.gnu.org/help/administration/pages/index.md).  I don’t
>>> know if this has been done for EMBA (but I suspect not, because
>>> https://emba.gnu.org/emacs/emacs/pages returns 404; alternatively,
>>> it’s possible the feature simply needs switching on at
>>> https://emba.gnu.org/emacs/emacs/edit#js-general-project-settings).
>>> 
>>> Once this is done, you don’t have to do much more than, from your CI job, write HTML files to a directory called pages.
>>> 
>>>> I’m thinking of a table where rows are languages, columns are Emacs releases (29, 30, master), and cells are the latest revision of a language grammar that’s compatible with an Emacs release.
>>> 
>>> Sounds perfect.
>> 
>> Nice. I'll see whether I can do something useful with this.
> 
> As a starting point, we could use the JUnit reports, which are already
> generated. They are not formatted to what we want, but they contain all
> test results in XML files for better access.
> 
> See for example
> <https://emba.gnu.org/emacs/emacs/-/pipelines/31215/test_report> and
> click on "Tests". Choose job test-tree-sitter.
> 
> There are no data when you inspect "View details", but this can be changed.
> 
> Best regards, Michael.

Hmm, ok, it’s a bit unclear to me how do we use this. Anyway, as a first step, I added a command that generates a html file that looks like the below. I’ll try setting up a cron job on my machine, then we can figure out how do we run it on EMBA and how to host the generated webpage.

Peter, do you have any suggestions after seeing this example webpage?


[-- Attachment #2: Screenshot 2024-12-30 at 12.03.17 AM.png --]
[-- Type: image/png, Size: 286801 bytes --]

[-- Attachment #3: Type: text/plain, Size: 9 bytes --]




Yuan


^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2024-12-30  8:08 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-20  9:09 Validating tree-sitter major modes and grammar Yuan Fu
2024-12-20 12:24 ` Eli Zaretskii
2024-12-20 16:22   ` Yuan Fu
2024-12-23  0:44 ` Björn Bidar
     [not found] ` <868qs6vd76.fsf@aarsen.me>
2024-12-24  1:16   ` Yuan Fu
2024-12-24  3:12 ` Yuan Fu
2024-12-24 12:19   ` Eli Zaretskii
2024-12-24 21:30     ` Yuan Fu
2024-12-24 23:09       ` Dmitry Gutov
2024-12-25  8:39         ` Yuan Fu
2024-12-26  2:23           ` Dmitry Gutov
     [not found] ` <6768b29d.050a0220.1b40f2.5574SMTPIN_ADDED_BROKEN@mx.google.com>
2024-12-24  3:20   ` Yuan Fu
2024-12-24 12:36     ` Peter Oliver
2024-12-24 14:20       ` Michael Albinus
2024-12-24 22:20         ` Yuan Fu
2024-12-25  8:20           ` Michael Albinus
2024-12-25  9:33             ` Yuan Fu
2024-12-25 13:51               ` Michael Albinus
2024-12-26 12:54               ` Peter Oliver
2024-12-26 17:50                 ` Michael Albinus
2024-12-28 12:02                   ` Michael Albinus
2024-12-30  8:08                     ` Yuan Fu
2024-12-24 22:14       ` Yuan Fu
2024-12-24 21:36     ` Björn Bidar

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.