unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#75198: 31.0.50; [treesitter] peculiar error
@ 2024-12-30 12:27 German Pacenza
  2024-12-30 13:47 ` Andreas Kurth
  0 siblings, 1 reply; 7+ messages in thread
From: German Pacenza @ 2024-12-30 12:27 UTC (permalink / raw)
  To: 75198

*****

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





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#75198: 31.0.50; [treesitter] peculiar error
  2024-12-30 12:27 bug#75198: 31.0.50; [treesitter] peculiar error German Pacenza
@ 2024-12-30 13:47 ` Andreas Kurth
  2024-12-30 17:54   ` Juri Linkov
  0 siblings, 1 reply; 7+ messages in thread
From: Andreas Kurth @ 2024-12-30 13:47 UTC (permalink / raw)
  To: 75198; +Cc: germanp82, juri

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.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#75198: 31.0.50; [treesitter] peculiar error
  2024-12-30 13:47 ` Andreas Kurth
@ 2024-12-30 17:54   ` Juri Linkov
  2025-01-04  8:26     ` Yuan Fu
  0 siblings, 1 reply; 7+ messages in thread
From: Juri Linkov @ 2024-12-30 17:54 UTC (permalink / raw)
  To: Andreas Kurth; +Cc: germanp82, 75198, Yuan Fu

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.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#75198: 31.0.50; [treesitter] peculiar error
  2024-12-30 17:54   ` Juri Linkov
@ 2025-01-04  8:26     ` Yuan Fu
  2025-01-04 17:43       ` Juri Linkov
  0 siblings, 1 reply; 7+ messages in thread
From: Yuan Fu @ 2025-01-04  8:26 UTC (permalink / raw)
  To: Juri Linkov; +Cc: germanp82, 75198, Andreas Kurth



> On Dec 30, 2024, at 9:54 AM, Juri Linkov <juri@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




^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#75198: 31.0.50; [treesitter] peculiar error
  2025-01-04  8:26     ` Yuan Fu
@ 2025-01-04 17:43       ` Juri Linkov
  2025-01-04 19:22         ` Yuan Fu
  0 siblings, 1 reply; 7+ messages in thread
From: Juri Linkov @ 2025-01-04 17:43 UTC (permalink / raw)
  To: Yuan Fu; +Cc: 75198

>> 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.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#75198: 31.0.50; [treesitter] peculiar error
  2025-01-04 17:43       ` Juri Linkov
@ 2025-01-04 19:22         ` Yuan Fu
  2025-01-05  7:43           ` Juri Linkov
  0 siblings, 1 reply; 7+ messages in thread
From: Yuan Fu @ 2025-01-04 19:22 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 75198



> On Jan 4, 2025, at 9:43 AM, Juri Linkov <juri@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




^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#75198: 31.0.50; [treesitter] peculiar error
  2025-01-04 19:22         ` Yuan Fu
@ 2025-01-05  7:43           ` Juri Linkov
  0 siblings, 0 replies; 7+ messages in thread
From: Juri Linkov @ 2025-01-05  7:43 UTC (permalink / raw)
  To: Yuan Fu; +Cc: 75198

>>> 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'.





^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-01-05  7:43 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-30 12:27 bug#75198: 31.0.50; [treesitter] peculiar error German Pacenza
2024-12-30 13:47 ` Andreas Kurth
2024-12-30 17:54   ` Juri Linkov
2025-01-04  8:26     ` Yuan Fu
2025-01-04 17:43       ` Juri Linkov
2025-01-04 19:22         ` Yuan Fu
2025-01-05  7:43           ` Juri Linkov

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).