GNU bug report logs -
#74612
30.0.90; [PATCH] Allow passing nil to treesit-node-match-p
Previous Next
Reported by: Yuan Fu <casouri <at> gmail.com>
Date: Sat, 30 Nov 2024 00:39:01 UTC
Severity: normal
Tags: patch
Found in version 30.0.90
Done: Eli Zaretskii <eliz <at> gnu.org>
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 74612 in the body.
You can then email your comments to 74612 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#74612
; Package
emacs
.
(Sat, 30 Nov 2024 00:39:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Yuan Fu <casouri <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Sat, 30 Nov 2024 00:39:01 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Eli, are you ok with this patch on emacs-30? Almost all tree-sitter node functions allows user to pass nil for NODE, so treesit-node-match-p should too.
Yuan
[treesit-node-match-p.patch (application/octet-stream, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#74612
; Package
emacs
.
(Sat, 30 Nov 2024 07:23:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 74612 <at> debbugs.gnu.org (full text, mbox):
> From: Yuan Fu <casouri <at> gmail.com>
> Date: Fri, 29 Nov 2024 16:38:22 -0800
>
> Eli, are you ok with this patch on emacs-30? Almost all tree-sitter node functions allows user to pass nil for NODE, so treesit-node-match-p should too.
Does this solve an actual problem you've seen somewhere (and if so,
which problem), or does it solve a potential problem that didn't
actually happen yet?
Also, does CHECK_TS_NODE allow nil or does it currently signal an
error?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#74612
; Package
emacs
.
(Sun, 01 Dec 2024 08:33:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 74612 <at> debbugs.gnu.org (full text, mbox):
> On Nov 29, 2024, at 11:22 PM, Eli Zaretskii <eliz <at> gnu.org> wrote:
>
>> From: Yuan Fu <casouri <at> gmail.com>
>> Date: Fri, 29 Nov 2024 16:38:22 -0800
>>
>> Eli, are you ok with this patch on emacs-30? Almost all tree-sitter node functions allows user to pass nil for NODE, so treesit-node-match-p should too.
>
> Does this solve an actual problem you've seen somewhere (and if so,
> which problem), or does it solve a potential problem that didn't
> actually happen yet?
I encountered this problem (more like an inconvenience, since without this feature I’d need to test for nullness before passing a node to treesit-node-match-p) when using treesit-node-match-p for some new code I’m writing for master branch. Since (treesit-node-match-p node “type name”) is easier to write and shorter than (equal (treesit-node-type node) “type name”) or (string-match-p “type name regex” (treesit-node-type node)), I’ve been using it liberally in new code :)
>
> Also, does CHECK_TS_NODE allow nil or does it currently signal an
> error?
CHECK_TS_NODE currently signals an error. All the tree-sitter node functions that accepts nil has the "if (NILP (node)) return Qnil” line before CHECK_TS_NODE (or treesit_check_node)
If you’re not too comfortable with the change, we can apply it to master. It wouldn’t create any backward-incompatibility since this change makes treesit-node-match-p more lenient on its argument, not stricter. The drawback is treesit-node-match-p will be a bit more annoying to use.
Yuan
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#74612
; Package
emacs
.
(Sun, 01 Dec 2024 10:01:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 74612 <at> debbugs.gnu.org (full text, mbox):
> From: Yuan Fu <casouri <at> gmail.com>
> Date: Sun, 1 Dec 2024 00:31:05 -0800
> Cc: 74612 <at> debbugs.gnu.org
>
>
>
> > On Nov 29, 2024, at 11:22 PM, Eli Zaretskii <eliz <at> gnu.org> wrote:
> >
> >> From: Yuan Fu <casouri <at> gmail.com>
> >> Date: Fri, 29 Nov 2024 16:38:22 -0800
> >>
> >> Eli, are you ok with this patch on emacs-30? Almost all tree-sitter node functions allows user to pass nil for NODE, so treesit-node-match-p should too.
> >
> > Does this solve an actual problem you've seen somewhere (and if so,
> > which problem), or does it solve a potential problem that didn't
> > actually happen yet?
>
> I encountered this problem (more like an inconvenience, since without this feature I’d need to test for nullness before passing a node to treesit-node-match-p) when using treesit-node-match-p for some new code I’m writing for master branch. Since (treesit-node-match-p node “type name”) is easier to write and shorter than (equal (treesit-node-type node) “type name”) or (string-match-p “type name regex” (treesit-node-type node)), I’ve been using it liberally in new code :)
>
> >
> > Also, does CHECK_TS_NODE allow nil or does it currently signal an
> > error?
>
> CHECK_TS_NODE currently signals an error. All the tree-sitter node functions that accepts nil has the "if (NILP (node)) return Qnil” line before CHECK_TS_NODE (or treesit_check_node)
>
> If you’re not too comfortable with the change, we can apply it to master. It wouldn’t create any backward-incompatibility since this change makes treesit-node-match-p more lenient on its argument, not stricter. The drawback is treesit-node-match-p will be a bit more annoying to use.
OK, please install on emacs-30, and thanks.
Reply sent
to
Eli Zaretskii <eliz <at> gnu.org>
:
You have taken responsibility.
(Thu, 05 Dec 2024 09:45:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Yuan Fu <casouri <at> gmail.com>
:
bug acknowledged by developer.
(Thu, 05 Dec 2024 09:45:02 GMT)
Full text and
rfc822 format available.
Message #19 received at 74612-done <at> debbugs.gnu.org (full text, mbox):
> Cc: 74612 <at> debbugs.gnu.org
> Date: Sun, 01 Dec 2024 11:59:58 +0200
> From: Eli Zaretskii <eliz <at> gnu.org>
>
> > From: Yuan Fu <casouri <at> gmail.com>
> > Date: Sun, 1 Dec 2024 00:31:05 -0800
> > Cc: 74612 <at> debbugs.gnu.org
> >
> >
> >
> > > On Nov 29, 2024, at 11:22 PM, Eli Zaretskii <eliz <at> gnu.org> wrote:
> > >
> > >> From: Yuan Fu <casouri <at> gmail.com>
> > >> Date: Fri, 29 Nov 2024 16:38:22 -0800
> > >>
> > >> Eli, are you ok with this patch on emacs-30? Almost all tree-sitter node functions allows user to pass nil for NODE, so treesit-node-match-p should too.
> > >
> > > Does this solve an actual problem you've seen somewhere (and if so,
> > > which problem), or does it solve a potential problem that didn't
> > > actually happen yet?
> >
> > I encountered this problem (more like an inconvenience, since without this feature I’d need to test for nullness before passing a node to treesit-node-match-p) when using treesit-node-match-p for some new code I’m writing for master branch. Since (treesit-node-match-p node “type name”) is easier to write and shorter than (equal (treesit-node-type node) “type name”) or (string-match-p “type name regex” (treesit-node-type node)), I’ve been using it liberally in new code :)
> >
> > >
> > > Also, does CHECK_TS_NODE allow nil or does it currently signal an
> > > error?
> >
> > CHECK_TS_NODE currently signals an error. All the tree-sitter node functions that accepts nil has the "if (NILP (node)) return Qnil” line before CHECK_TS_NODE (or treesit_check_node)
> >
> > If you’re not too comfortable with the change, we can apply it to master. It wouldn’t create any backward-incompatibility since this change makes treesit-node-match-p more lenient on its argument, not stricter. The drawback is treesit-node-match-p will be a bit more annoying to use.
>
> OK, please install on emacs-30, and thanks.
I see you did, so I'm closing this bug.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#74612
; Package
emacs
.
(Fri, 06 Dec 2024 07:26:02 GMT)
Full text and
rfc822 format available.
Message #22 received at 74612-done <at> debbugs.gnu.org (full text, mbox):
> On Dec 5, 2024, at 1:43 AM, Eli Zaretskii <eliz <at> gnu.org> wrote:
>
>> Cc: 74612 <at> debbugs.gnu.org
>> Date: Sun, 01 Dec 2024 11:59:58 +0200
>> From: Eli Zaretskii <eliz <at> gnu.org>
>>
>>> From: Yuan Fu <casouri <at> gmail.com>
>>> Date: Sun, 1 Dec 2024 00:31:05 -0800
>>> Cc: 74612 <at> debbugs.gnu.org
>>>
>>>
>>>
>>>> On Nov 29, 2024, at 11:22 PM, Eli Zaretskii <eliz <at> gnu.org> wrote:
>>>>
>>>>> From: Yuan Fu <casouri <at> gmail.com>
>>>>> Date: Fri, 29 Nov 2024 16:38:22 -0800
>>>>>
>>>>> Eli, are you ok with this patch on emacs-30? Almost all tree-sitter node functions allows user to pass nil for NODE, so treesit-node-match-p should too.
>>>>
>>>> Does this solve an actual problem you've seen somewhere (and if so,
>>>> which problem), or does it solve a potential problem that didn't
>>>> actually happen yet?
>>>
>>> I encountered this problem (more like an inconvenience, since without this feature I’d need to test for nullness before passing a node to treesit-node-match-p) when using treesit-node-match-p for some new code I’m writing for master branch. Since (treesit-node-match-p node “type name”) is easier to write and shorter than (equal (treesit-node-type node) “type name”) or (string-match-p “type name regex” (treesit-node-type node)), I’ve been using it liberally in new code :)
>>>
>>>>
>>>> Also, does CHECK_TS_NODE allow nil or does it currently signal an
>>>> error?
>>>
>>> CHECK_TS_NODE currently signals an error. All the tree-sitter node functions that accepts nil has the "if (NILP (node)) return Qnil” line before CHECK_TS_NODE (or treesit_check_node)
>>>
>>> If you’re not too comfortable with the change, we can apply it to master. It wouldn’t create any backward-incompatibility since this change makes treesit-node-match-p more lenient on its argument, not stricter. The drawback is treesit-node-match-p will be a bit more annoying to use.
>>
>> OK, please install on emacs-30, and thanks.
>
> I see you did, so I'm closing this bug.
Thank you Eli.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Fri, 03 Jan 2025 12:24:06 GMT)
Full text and
rfc822 format available.
This bug report was last modified 171 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.