GNU bug report logs - #76693
[PATCH] Use TS to support 'hs-minor-mode' in 'lua-ts-mode'

Previous Next

Package: emacs;

Reported by: jm <at> pub.pink

Date: Sun, 2 Mar 2025 21:39:02 UTC

Severity: normal

Tags: patch

To reply to this bug, email your comments to 76693 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#76693; Package emacs. (Sun, 02 Mar 2025 21:39:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to jm <at> pub.pink:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 02 Mar 2025 21:39:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: jm <at> pub.pink
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] Use TS to support 'hs-minor-mode' in 'lua-ts-mode'
Date: Sun, 02 Mar 2025 15:38:33 -0600
Tags: patch

This changes the hs-minor-mode suppport to use tree-sitter list
things instead of regexps.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76693; Package emacs. (Sun, 02 Mar 2025 21:47:02 GMT) Full text and rfc822 format available.

Message #8 received at 76693 <at> debbugs.gnu.org (full text, mbox):

From: john muhl <jm <at> pub.pink>
To: 76693 <at> debbugs.gnu.org
Subject: Re: bug#76693: [PATCH] Use TS to support 'hs-minor-mode' in
 'lua-ts-mode'
Date: Sun, 02 Mar 2025 15:45:45 -0600
[0001-Use-TS-to-support-hs-minor-mode-in-lua-ts-mode.patch (text/x-patch, attachment)]
[Message part 2 (text/plain, inline)]

jm <at> pub.pink writes:

> Tags: patch
>
> This changes the hs-minor-mode suppport to use tree-sitter list
> things instead of regexps.


Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76693; Package emacs. (Mon, 03 Mar 2025 17:54:02 GMT) Full text and rfc822 format available.

Message #11 received at 76693 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: john muhl <jm <at> pub.pink>
Cc: 76693 <at> debbugs.gnu.org
Subject: Re: bug#76693: [PATCH] Use TS to support 'hs-minor-mode' in
 'lua-ts-mode'
Date: Mon, 03 Mar 2025 19:33:50 +0200
>> This changes the hs-minor-mode suppport to use tree-sitter list
>> things instead of regexps.
>
> * lisp/progmodes/lua-ts-mode.el (lua-ts-mode): Add list type to
> 'treesit-thing-settings'.

Coincidentally this is what I'm currently doing for all ts-modes
according to the principles agreed in bug#73404.

And it's nice to see that your changes are aligned with them.

There is no need to follow these principles since only you
as the author of the ts-mode decide what is suitable for this ts-mode.

But it would just make it easier for programmers in different languages
to switch between ts-modes that will meet their expectations.

I noticed only a few things that look like omission:

1. "arguments" and "parameters" are parenthesized expressions,
   but are missing in the 'list' setting;

2. "if_statement" without the anchors "\\`...\\'" (bos/eos in rx)
   matches "elseif_statement" too.  But unlike "if_statement",
   "elseif_statement" doesn't end with the "end" keyword
   (whereas "else_statement" doesn't end with "end" too
    but correctly excluded from matching);

3. Also would be nice to support '(forward-comment 1)'
   with something like (comment ,(rx bos "comment" eos))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76693; Package emacs. (Tue, 04 Mar 2025 00:39:01 GMT) Full text and rfc822 format available.

Message #14 received at 76693 <at> debbugs.gnu.org (full text, mbox):

From: john muhl <jm <at> pub.pink>
To: Juri Linkov <juri <at> linkov.net>
Cc: 76693 <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
Subject: Re: bug#76693: [PATCH] Use TS to support 'hs-minor-mode' in
 'lua-ts-mode'
Date: Mon, 03 Mar 2025 18:33:03 -0600
Juri Linkov <juri <at> linkov.net> writes:

>>> This changes the hs-minor-mode suppport to use tree-sitter list
>>> things instead of regexps.
>>
>> * lisp/progmodes/lua-ts-mode.el (lua-ts-mode): Add list type to
>> 'treesit-thing-settings'.
>
> Coincidentally this is what I'm currently doing for all ts-modes
> according to the principles agreed in bug#73404.
>
> And it's nice to see that your changes are aligned with them.

That’s good to hear.

> There is no need to follow these principles since only you
> as the author of the ts-mode decide what is suitable for this ts-mode.
>
> But it would just make it easier for programmers in different languages
> to switch between ts-modes that will meet their expectations.
>
> I noticed only a few things that look like omission:
>
> 1. "arguments" and "parameters" are parenthesized expressions,
>    but are missing in the 'list' setting;
>
> 2. "if_statement" without the anchors "\\`...\\'" (bos/eos in rx)
>    matches "elseif_statement" too.  But unlike "if_statement",
>    "elseif_statement" doesn't end with the "end" keyword
>    (whereas "else_statement" doesn't end with "end" too
>     but correctly excluded from matching);
>
> 3. Also would be nice to support '(forward-comment 1)'
>    with something like (comment ,(rx bos "comment" eos))

Sounds good. I was aiming for parity with lua-mode but no reason
to stop there. I’ll get an updated patch over soon.

Thanks for the help.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76693; Package emacs. (Tue, 04 Mar 2025 00:40:02 GMT) Full text and rfc822 format available.

This bug report was last modified today.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.