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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 71863 in the body.
You can then email your comments to 71863 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#71863; Package emacs. (Sun, 30 Jun 2024 20:13:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Noah Peart <noah.v.peart <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 30 Jun 2024 20:13:02 GMT) Full text and rfc822 format available.

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

From: Noah Peart <noah.v.peart <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 31.0.50;
 Wrong argument type for treesit-query-range in treesit-update-ranges
Date: Sun, 30 Jun 2024 16:12:06 -0400
[Message part 1 (text/plain, inline)]
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)



In GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
 3.24.33, cairo version 1.16.0) of 2024-06-30 built on nverno-XPS-8940
Repository revision: 7c8d4e96ba6db19bdca20a87bafed024a84eb517
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101004
System Description: Ubuntu 22.04.4 LTS

Configured using:
 'configure --prefix=/usr/local --with-modules --with-tree-sitter
 --with-threads --with-x-toolkit=gtk3 --with-xwidgets --with-gnutls
 --with-json --with-mailutils --with-jpeg --with-png --with-rsvg
 --with-tiff --with-xml2 --with-xpm --with-imagemagick CC=gcc-12
 CXX=gcc-12'

Configured features:
CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ
IMAGEMAGICK JPEG LCMS2 LIBSELINUX LIBXML2 MODULES NATIVE_COMP NOTIFY
INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER WEBP X11 XDBE XIM XINPUT2 XPM XWIDGETS
GTK3 ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: JavaScript

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  minibuffer-regexp-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message mailcap yank-media puny dired
dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068
epg-config gnus-util text-property-search time-date mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail
rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils cl-seq
typescript-ts-mode js c-ts-common json subr-x map byte-opt gv bytecomp
byte-compile imenu cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles
cc-align cc-engine cc-vars cc-defs treesit cl-loaddefs cl-lib rmc
iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook
vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win
term/common-win x-dnd touch-screen tool-bar dnd fontset image regexp-opt
fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode
register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select
scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors
frame minibuffer nadvice seq simple cl-generic indonesian philippine
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure
cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp
files window text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget keymap hashtable-print-readable backquote
threads xwidget-internal dbusbind inotify lcms2 dynamic-setting
system-font-setting font-render-setting cairo gtk x-toolkit xinput2 x
multi-tty move-toolbar make-network-process native-compile emacs)

Memory information:
((conses 16 104084 13132) (symbols 48 8580 0) (strings 32 24764 2578)
 (string-bytes 1 884578) (vectors 16 14855)
 (vector-slots 8 188214 9981) (floats 8 28 203) (intervals 56 852 0)
 (buffers 992 12))
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#71863; Package emacs. (Sun, 30 Jun 2024 20:38:02 GMT) Full text and rfc822 format available.

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

From: Noah Peart <noah.v.peart <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: bug#71863: 31.0.50;
 Wrong argument type for treesit-query-range in treesit-update-ranges
Date: Sun, 30 Jun 2024 16:37:05 -0400
[Message part 1 (text/plain, inline)]
This is related to the new node check from commit 8819e5a45d5, not
the functions I mentioned before!
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#71863; Package emacs. (Sat, 06 Jul 2024 08:39:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Noah Peart <noah.v.peart <at> gmail.com>, Yuan Fu <casouri <at> gmail.com>
Cc: 71863 <at> debbugs.gnu.org
Subject: Re: bug#71863: 31.0.50;
 Wrong argument type for treesit-query-range in treesit-update-ranges
Date: Sat, 06 Jul 2024 11:38:12 +0300
> 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?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#71863; Package emacs. (Sat, 06 Jul 2024 20:52:02 GMT) Full text and rfc822 format available.

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

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: Re: 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





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#71863; Package emacs. (Sun, 07 Jul 2024 05:38:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Yuan Fu <casouri <at> gmail.com>
Cc: noah.v.peart <at> gmail.com, 71863 <at> debbugs.gnu.org
Subject: Re: bug#71863: 31.0.50; Wrong argument type for treesit-query-range
 in treesit-update-ranges
Date: Sun, 07 Jul 2024 08:35:21 +0300
> From: Yuan Fu <casouri <at> gmail.com>
> Date: Sat, 6 Jul 2024 13:50:10 -0700
> Cc: Noah Peart <noah.v.peart <at> gmail.com>,
>  71863 <at> debbugs.gnu.org
> 
> 
> 
> > 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 :-(

When did you fix it on emacs-30?  The merges to master happen very
frequently lately; the last one was yesterday.  Could it be that this
is already fixed?




Reply sent to Yuan Fu <casouri <at> gmail.com>:
You have taken responsibility. (Mon, 15 Jul 2024 06:20:02 GMT) Full text and rfc822 format available.

Notification sent to Noah Peart <noah.v.peart <at> gmail.com>:
bug acknowledged by developer. (Mon, 15 Jul 2024 06:20:02 GMT) Full text and rfc822 format available.

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

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

> On Jul 6, 2024, at 10:35 PM, Eli Zaretskii <eliz <at> gnu.org> wrote:
> 
>> From: Yuan Fu <casouri <at> gmail.com>
>> Date: Sat, 6 Jul 2024 13:50:10 -0700
>> Cc: Noah Peart <noah.v.peart <at> gmail.com>,
>> 71863 <at> debbugs.gnu.org
>> 
>> 
>> 
>>> 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 :-(
> 
> When did you fix it on emacs-30?  The merges to master happen very
> frequently lately; the last one was yesterday.  Could it be that this
> is already fixed?

I checked with master (with php-ts-mode) and it’s working fine. So I’m closing this report. Fell free to reopen if there’re problems.

Yuan



bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 12 Aug 2024 11:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 188 days ago.

Previous Next


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