GNU bug report logs - #61235
30.0.50; tree-sit: `treesit-node-check' lacks a way to tell if a node belongs to a deleted parser

Previous Next

Package: emacs;

Reported by: Mickey Petersen <mickey <at> masteringemacs.org>

Date: Thu, 2 Feb 2023 19:47:02 UTC

Severity: normal

Found in version 30.0.50

Fixed in version 29.1

Done: Yuan Fu <casouri <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Yuan Fu <casouri <at> gmail.com>
Cc: 61235 <at> debbugs.gnu.org, mickey <at> masteringemacs.org
Subject: Re: bug#61235: 30.0.50; tree-sit: `treesit-node-check' lacks a way to
 tell if a node belongs to a deleted parser
Date: Tue, 07 Feb 2023 14:24:06 +0200
> From: Yuan Fu <casouri <at> gmail.com>
> Date: Mon, 6 Feb 2023 20:55:38 -0800
> Cc: Mickey Petersen <mickey <at> masteringemacs.org>,
>  61235 <at> debbugs.gnu.org
> 
> >>> Yuan, any reason not to extend treesit-node-check instead?
> >> 
> >> I did extend treesit-node-check in the patch. But I also added a function treesit-parser-live-p, which makes the same check but directly on a parser. It just made sense to me that if we let treesit-node-check check the nodes’ parser’s status, we’d also add a function to allow directly checking the status of a parser.
> > 
> > That additional function would signal an error in the case discussed
> > here, so I'm not sure we should add it in that shape, or at all.  Why
> > isn't treesit-node-check enough?
> 
> Oops, it shouldn’t have. The updated patch fixes that. Treesit-node-check is enough, it just made more sense implentattion-wise, to implement that function that checks a parser, and let treesit-node-check use that function to check the node’s parser. We can choose to not expose that function, and only expose this feature through treesit-node-check, if you prefer so.

I think treesit-node-check alone should be enough.

One comment:

> @@ -1943,9 +1959,11 @@ DEFUN ("treesit-node-check",
>      result = ts_node_is_extra (treesit_node);
>    else if (EQ (property, Qhas_error))
>      result = ts_node_has_error (treesit_node);
> +  else if (EQ (property, Qlive))
> +    result = Ftreesit_parser_live_p (XTS_NODE (node)->parser);

Ftreesit_parser_live_p returns a Lisp object, whereas 'result' is a C
'bool' type.  This won't compile if you configure with
"--enable-check-lisp-object-type".




This bug report was last modified 2 years and 95 days ago.

Previous Next


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