GNU bug report logs - #71863
31.0.50; Wrong argument type for treesit-query-range in treesit-update-ranges

Previous Next

Package: emacs;

Reported by: Noah Peart <noah.v.peart <at> gmail.com>

Date: Sun, 30 Jun 2024 20:13:01 UTC

Severity: normal

Found in version 31.0.50

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

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Yuan Fu <casouri <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Noah Peart <noah.v.peart <at> gmail.com>, 71863 <at> debbugs.gnu.org
Subject: bug#71863: 31.0.50; Wrong argument type for treesit-query-range in treesit-update-ranges
Date: Sat, 6 Jul 2024 13:50:10 -0700

> On Jul 6, 2024, at 1:38 AM, Eli Zaretskii <eliz <at> gnu.org> wrote:
> 
>> From: Noah Peart <noah.v.peart <at> gmail.com>
>> Date: Sun, 30 Jun 2024 16:12:06 -0400
>> 
>> I just noticed this after building latest Emacs. In
>> `treesit-update-ranges`, during redisplay, the first argument to
>> `treesit-query-range` is a tree-sitter language symbol, not a node.
>> 
>> At treesit.el:760
>> 
>>    (let* ((host-lang (treesit-query-language query))
>>           (parser (treesit-parser-create language))
>>           (old-ranges (treesit-parser-included-ranges parser))
>>>>> host-lang isnt a node
>>           (new-ranges (treesit-query-range
>>                        host-lang query beg end offset))
>> 
>> This causes a an error in modes that have set `treesit-range-settings`
>> eg., `js-ts-mode`:
>> 
>>> Error muted by safe_call: (treesit--font-lock-mark-ranges-to-fontify
>>> ((1 . 940)) #<treesit-parser for javascript>) signaled
>>> (wrong-type-argument treesit-node-p javascript) Error during
>>> redisplay: (jit-lock-function 1) signaled (wrong-type-argument
>>> treesit-node-p javascript)
>> 
>> And in `syntax-propertize-function`, for example in `ruby-ts-mode`,
>> 
>>> QuitError muted by safe_call: (internal--syntax-propertize 46)
>>> signaled (wrong-type-argument treesit-node-p ruby) 
> 
> Yuan, could you please look into this issue?

This is a bug I introduced on emacs-30 and later fixed. So once emacs-30 is merged into master the issue should go away. Sorry for the trouble :-(

Yuan





This bug report was last modified 306 days ago.

Previous Next


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