Subject: bug#75198: 31.0.50; [treesitter] peculiar error

From: Juri Linkov <[email-masked]>
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.