GNU bug report logs - #75198
31.0.50; [treesitter] peculiar error

Previous Next

Package: emacs;

Reported by: German Pacenza <germanp82 <at> hotmail.com>

Date: Mon, 30 Dec 2024 12:33:01 UTC

Severity: normal

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 75198 in the body.
You can then email your comments to 75198 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#75198; Package emacs. (Mon, 30 Dec 2024 12:33:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to German Pacenza <germanp82 <at> hotmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 30 Dec 2024 12:33:02 GMT) Full text and rfc822 format available.

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

From: German Pacenza <germanp82 <at> hotmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 31.0.50; [treesitter] peculiar error
Date: Mon, 30 Dec 2024 09:27:28 -0300
*****

emacs -Q:
open bash shell script
M-x bash-ts-mode
Move cursor

peculiar error: ("Cannot find the definition of the predicate in
`treesit-thing-settings'" sexp-list)

Emacs becomes pretty much unusable after that.

on Master commit 7671d50b149edd9e19c29f5fa8ee71c01e2f583d




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#75198; Package emacs. (Mon, 30 Dec 2024 13:48:02 GMT) Full text and rfc822 format available.

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

From: Andreas Kurth <emacs <at> akurth.de>
To: 75198 <at> debbugs.gnu.org
Cc: germanp82 <at> hotmail.com, juri <at> linkov.net
Subject: bug#75198: 31.0.50; [treesitter] peculiar error
Date: Mon, 30 Dec 2024 14:47:21 +0100
German Pacenza wrote:
> on Master commit 7671d50b149edd9e19c29f5fa8ee71c01e2f583d

I rather suspect 1addae07be1982a6cafc0e0b3955b59bd1fb481c "Treesit
support for show-paren-mode". At least by commenting out line 3592

  (setq-local show-paren-data-function 'treesit-show-paren-data)

in treesit.el I can work around the problem.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#75198; Package emacs. (Mon, 30 Dec 2024 17:57:02 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> linkov.net>
To: Andreas Kurth <emacs <at> akurth.de>
Cc: germanp82 <at> hotmail.com, 75198 <at> debbugs.gnu.org, Yuan Fu <casouri <at> gmail.com>
Subject: Re: bug#75198: 31.0.50; [treesitter] peculiar error
Date: Mon, 30 Dec 2024 19:54:55 +0200
close 75198 31.0.50
thanks

>> M-x bash-ts-mode
>> Move cursor
>>
>> peculiar error: ("Cannot find the definition of the predicate in
>> `treesit-thing-settings'" sexp-list)
>>
>> Emacs becomes pretty much unusable after that.
>
> I rather suspect 1addae07be1982a6cafc0e0b3955b59bd1fb481c "Treesit
> support for show-paren-mode". At least by commenting out line 3592
>
>   (setq-local show-paren-data-function 'treesit-show-paren-data)
>
> in treesit.el I can work around the problem.

Sorry, this is fixed now.

The problem is that 'treesit-parent-until' raises an error by default.
So needed to copy its implementation where treesit-node-match-p
sets the argument IGNORE-MISSING to t.

Or maybe better to add new arg IGNORE-MISSING to treesit-parent-until.




bug marked as fixed in version 31.0.50, send any further explanations to 75198 <at> debbugs.gnu.org and German Pacenza <germanp82 <at> hotmail.com> Request was from Juri Linkov <juri <at> linkov.net> to control <at> debbugs.gnu.org. (Mon, 30 Dec 2024 17:57:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#75198; Package emacs. (Sat, 04 Jan 2025 08:27:01 GMT) Full text and rfc822 format available.

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

From: Yuan Fu <casouri <at> gmail.com>
To: Juri Linkov <juri <at> linkov.net>
Cc: germanp82 <at> hotmail.com, 75198 <at> debbugs.gnu.org,
 Andreas Kurth <emacs <at> akurth.de>
Subject: Re: bug#75198: 31.0.50; [treesitter] peculiar error
Date: Sat, 4 Jan 2025 00:26:08 -0800

> On Dec 30, 2024, at 9:54 AM, Juri Linkov <juri <at> linkov.net> wrote:
> 
> close 75198 31.0.50
> thanks
> 
>>> M-x bash-ts-mode
>>> Move cursor
>>> 
>>> peculiar error: ("Cannot find the definition of the predicate in
>>> `treesit-thing-settings'" sexp-list)
>>> 
>>> Emacs becomes pretty much unusable after that.
>> 
>> I rather suspect 1addae07be1982a6cafc0e0b3955b59bd1fb481c "Treesit
>> support for show-paren-mode". At least by commenting out line 3592
>> 
>>  (setq-local show-paren-data-function 'treesit-show-paren-data)
>> 
>> in treesit.el I can work around the problem.
> 
> Sorry, this is fixed now.
> 
> The problem is that 'treesit-parent-until' raises an error by default.
> So needed to copy its implementation where treesit-node-match-p
> sets the argument IGNORE-MISSING to t.
> 
> Or maybe better to add new arg IGNORE-MISSING to treesit-parent-until.

Hmm, I’m not sure. If we go this route, we’d need to add IGNORE-MISSING for every single function that uses treesit-node-match-p. It’s better for these functions to check whether the definition of the thing they’re going to use exists or not, before calling treesit-node-match-p; alternatively, if they know they don’t care, they can pass t to IGNORE-MISSING.

Yuan



Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#75198; Package emacs. (Sat, 04 Jan 2025 17:54:03 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> linkov.net>
To: Yuan Fu <casouri <at> gmail.com>
Cc: 75198 <at> debbugs.gnu.org
Subject: Re: bug#75198: 31.0.50; [treesitter] peculiar error
Date: Sat, 04 Jan 2025 19:43:43 +0200
>> The problem is that 'treesit-parent-until' raises an error by default.
>> So needed to copy its implementation where treesit-node-match-p
>> sets the argument IGNORE-MISSING to t.
>> 
>> Or maybe better to add new arg IGNORE-MISSING to treesit-parent-until.
>
> Hmm, I’m not sure. If we go this route, we’d need to add IGNORE-MISSING for
> every single function that uses treesit-node-match-p.

Agreed, adding a new arg to all such functions is not the right thing.

Then maybe better to define the preferred behavior
by a new dynamically bound variable, e.g.
(let ((treesit-raise-error t)) (treesit-parent-until ... pred))

> It’s better for these functions to check whether the definition of the
> thing they’re going to use exists or not, before calling
> treesit-node-match-p; alternatively, if they know they don’t care,
> they can pass t to IGNORE-MISSING.

Not sure how much this will degrade the performance of
every function that uses treesit-node-match-p.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#75198; Package emacs. (Sat, 04 Jan 2025 19:24:01 GMT) Full text and rfc822 format available.

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

From: Yuan Fu <casouri <at> gmail.com>
To: Juri Linkov <juri <at> linkov.net>
Cc: 75198 <at> debbugs.gnu.org
Subject: Re: bug#75198: 31.0.50; [treesitter] peculiar error
Date: Sat, 4 Jan 2025 11:22:54 -0800

> On Jan 4, 2025, at 9:43 AM, Juri Linkov <juri <at> linkov.net> wrote:
> 
>>> The problem is that 'treesit-parent-until' raises an error by default.
>>> So needed to copy its implementation where treesit-node-match-p
>>> sets the argument IGNORE-MISSING to t.
>>> 
>>> Or maybe better to add new arg IGNORE-MISSING to treesit-parent-until.
>> 
>> Hmm, I’m not sure. If we go this route, we’d need to add IGNORE-MISSING for
>> every single function that uses treesit-node-match-p.
> 
> Agreed, adding a new arg to all such functions is not the right thing.
> 
> Then maybe better to define the preferred behavior
> by a new dynamically bound variable, e.g.
> (let ((treesit-raise-error t)) (treesit-parent-until ... pred))
> 
>> It’s better for these functions to check whether the definition of the
>> thing they’re going to use exists or not, before calling
>> treesit-node-match-p; alternatively, if they know they don’t care,
>> they can pass t to IGNORE-MISSING.
> 
> Not sure how much this will degrade the performance of
> every function that uses treesit-node-match-p.

It should be negligible, plus if a function wants to use a thing, it’s TRT to first check if the thing exists, right? Otherwise they can just pass IGNORE-MISSING.

There might be cases where the function can’t know whether they can ignore missing. In that case they can expose the IGNORE-MISSING parameter in their signature.

Treesit-raise-error-p could make sense, but it’s a rather significant commitment and I don’t see any strong argument for it as for now. 

Yuan



Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#75198; Package emacs. (Sun, 05 Jan 2025 07:46:02 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> linkov.net>
To: Yuan Fu <casouri <at> gmail.com>
Cc: 75198 <at> debbugs.gnu.org
Subject: Re: bug#75198: 31.0.50; [treesitter] peculiar error
Date: Sun, 05 Jan 2025 09:43:41 +0200
>>> It’s better for these functions to check whether the definition of the
>>> thing they’re going to use exists or not, before calling
>>> treesit-node-match-p; alternatively, if they know they don’t care,
>>> they can pass t to IGNORE-MISSING.
>> 
>> Not sure how much this will degrade the performance of
>> every function that uses treesit-node-match-p.
>
> It should be negligible, plus if a function wants to use a thing, it’s
> TRT to first check if the thing exists, right?

I completely agree.  So I fixed 'treesit-show-paren'
by adding a check for 'treesit-thing-defined-p'.




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

This bug report was last modified 135 days ago.

Previous Next


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