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

Fixed in version 31.0.50

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 76693 in the body.
You can then email your comments to 76693 AT debbugs.gnu.org in the normal way.

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.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76693; Package emacs. (Fri, 07 Mar 2025 14:32:01 GMT) Full text and rfc822 format available.

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

From: john muhl <jm <at> pub.pink>
To: 76693 <at> debbugs.gnu.org
Cc: Juri Linkov <juri <at> linkov.net>
Subject: Re: bug#76693: [PATCH] Use TS to support 'hs-minor-mode' in
 'lua-ts-mode'
Date: Fri, 07 Mar 2025 08:29:55 -0600
[Message part 1 (text/plain, inline)]
Updated patch with Juri’s feedback.

[0001-Use-TS-to-support-hs-minor-mode-in-lua-ts-mode.patch (text/x-patch, attachment)]
[Message part 3 (text/plain, inline)]

john muhl <jm <at> pub.pink> writes:

> 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. (Sat, 08 Mar 2025 18:54:02 GMT) Full text and rfc822 format available.

Message #23 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: Sat, 08 Mar 2025 20:52:38 +0200
close 76693 31.0.50
thanks

> Updated patch with Juri’s feedback.

Thanks, now pushed to master and closed.




bug marked as fixed in version 31.0.50, send any further explanations to 76693 <at> debbugs.gnu.org and jm <at> pub.pink Request was from Juri Linkov <juri <at> linkov.net> to control <at> debbugs.gnu.org. (Sat, 08 Mar 2025 18:54:03 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 06 Apr 2025 11:24:28 GMT) Full text and rfc822 format available.

This bug report was last modified 70 days ago.

Previous Next


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