From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Noah Peart Newsgroups: gmane.emacs.bugs Subject: bug#71863: 31.0.50; Wrong argument type for treesit-query-range in treesit-update-ranges Date: Sun, 30 Jun 2024 16:12:06 -0400 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000db49db061c211839" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13263"; mail-complaints-to="usenet@ciao.gmane.io" To: 71863@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jun 30 22:13:18 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sO0vF-0003Ec-7N for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 30 Jun 2024 22:13:17 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sO0v1-0001hV-KA; Sun, 30 Jun 2024 16:13:03 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sO0v0-0001hD-Ah for bug-gnu-emacs@gnu.org; Sun, 30 Jun 2024 16:13:02 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sO0uz-0006ua-Ts for bug-gnu-emacs@gnu.org; Sun, 30 Jun 2024 16:13:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sO0uz-00047k-Vc for bug-gnu-emacs@gnu.org; Sun, 30 Jun 2024 16:13:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Noah Peart Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 30 Jun 2024 20:13:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 71863 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.171977834515778 (code B ref -1); Sun, 30 Jun 2024 20:13:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 30 Jun 2024 20:12:25 +0000 Original-Received: from localhost ([127.0.0.1]:59199 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sO0uP-00046Q-3E for submit@debbugs.gnu.org; Sun, 30 Jun 2024 16:12:25 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:45750) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sO0uM-00046I-VE for submit@debbugs.gnu.org; Sun, 30 Jun 2024 16:12:23 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sO0uM-0001ep-GD for bug-gnu-emacs@gnu.org; Sun, 30 Jun 2024 16:12:22 -0400 Original-Received: from mail-oi1-x234.google.com ([2607:f8b0:4864:20::234]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sO0uI-0005bi-TU for bug-gnu-emacs@gnu.org; Sun, 30 Jun 2024 16:12:21 -0400 Original-Received: by mail-oi1-x234.google.com with SMTP id 5614622812f47-3d5666a4860so1504899b6e.2 for ; Sun, 30 Jun 2024 13:12:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719778337; x=1720383137; darn=gnu.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=kAeHtcp7Mg7ZZnT9HYaBlNvZrTVNcNmYU2VBR9Voqr0=; b=ljjr7uOSWzkFjKWjR/TfOC0z4JWjSh1JKfZgSD7JzDSEiH1O1E3NYPMLQuakWA2XMk AVOajd72e1bFFl0GDpK0nMYwvKyt52FWs1FlGIv/ipS+dDeTfAqKhL2YI4S+btS2xmzl ybbTr83y64Diq0HxfOhFzayAuDhcN9ZPyN/Up+sIEsu/2xO00KhBeypZ9lw0ku98Hg6P zNklTEr/oOkW2wRfUGzbAcjd39P60JypJSKme86ufPkJNgC6JA4bxIiipaICOD01Htdd T5if3FblgKHhi5c8+vD0WurNEDbAykxcsoHGkw1jaDcRaUIkn+Dsr9H09Q3iTL3b4thP PsSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719778337; x=1720383137; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=kAeHtcp7Mg7ZZnT9HYaBlNvZrTVNcNmYU2VBR9Voqr0=; b=ZZH9RwCEgPm/cv7aOHKzftGlvGBe9G2X9wTQkyt0/4aquCI92eWepSUnKXGy4XIOMj l8qcmxy/h8+N20YuuuC+jScvkFYkPE65xZuFE4rKq5UirtolnjW9Tt5YU9OaGgV/Pvm4 QYKbeNvTqNa/80J+zw9ijjhqBCIaLaoVmwkiH3zTwG0XxrOh7mzJwfAT69Ub/WrMEeU7 St5zI07P7Jztl0dCOz4cSOifKuhAbKGE3/7sMnOhfZ3VlgI5X21m9h5WN8iKV9qnOF0V 2D1szAyIjn6HRO96PPLfPBiyWUesZIuib8vpX0xw4mxFo0OPRXWv4GeWhpPkpWm8EZNi 6oLQ== X-Gm-Message-State: AOJu0Yw3IXvydVoimeb9d/gX8lQPUSuiX2skGfHcKCwLJfpOsbHKZGG3 NibOUasGX3YlciA3DACNHDmbha8Wamf0k0iV9JTb4XcasRtbSpXNIWA8AVhX59bqwo6z6bDdEA5 iL3KTIACZzEamGPJvL6ycDGJyBGIJDPdu6SWI/Ybp X-Google-Smtp-Source: AGHT+IHFXzTx/fnvuSbOPo/3er9vnniLPdN64otGRZSeHlo139lQTl+gVFq3sgYwNnCCVWDb8qlX5/2cgm7efx7tEUc= X-Received: by 2002:a05:6870:d28e:b0:24f:c31a:5c29 with SMTP id 586e51a60fabf-25db3640694mr3574684fac.43.1719778336785; Sun, 30 Jun 2024 13:12:16 -0700 (PDT) Received-SPF: pass client-ip=2607:f8b0:4864:20::234; envelope-from=noah.v.peart@gmail.com; helo=mail-oi1-x234.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:288221 Archived-At: --000000000000db49db061c211839 Content-Type: text/plain; charset="UTF-8" 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)) #) 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)) --000000000000db49db061c211839 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

I just noticed this after building latest Emacs. In`treesit-update-ranges`, during redisplay, the first argument to
`trees= it-query-range` is a tree-sitter language symbol, not a node.

At tre= esit.el:760

=C2=A0 =C2=A0 (let* ((host-lang (treesit-query-language = query))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(parser (treesit-parser= -create language))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(old-ranges = (treesit-parser-included-ranges parser))
>>> host-lang isnt a n= ode
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(new-ranges (treesit-query-= range
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 host-lang query beg end offset))


This causes a= an error in modes that have set `treesit-range-settings`
eg., `js-ts-mo= de`:

> Error muted by safe_call: (treesit--font-lock-mark-ranges= -to-fontify
> ((1 . 940)) #<treesit-parser for javascript>) sig= naled
> (wrong-type-argument treesit-node-p javascript) Error during<= br>> redisplay: (jit-lock-function 1) signaled (wrong-type-argument
&= gt; treesit-node-p javascript)


And in `syntax-propertize-functio= n`, for example in `ruby-ts-mode`,

> QuitError muted by safe_call= : (internal--syntax-propertize 46)
> signaled (wrong-type-argument tr= eesit-node-p ruby)



In GNU Emacs 31.0.50 (build 1, x86_64-pc= -linux-gnu, GTK+ Version
=C2=A03.24.33, cairo version 1.16.0) of 2024-06= -30 built on nverno-XPS-8940
Repository revision: 7c8d4e96ba6db19bdca20a= 87bafed024a84eb517
Repository branch: master
Windowing system distrib= utor 'The X.Org Foundation', version 11.0.12101004
System Descri= ption: Ubuntu 22.04.4 LTS

Configured using:
=C2=A0'configure = --prefix=3D/usr/local --with-modules --with-tree-sitter
=C2=A0--with-thr= eads --with-x-toolkit=3Dgtk3 --with-xwidgets --with-gnutls
=C2=A0--with-= json --with-mailutils --with-jpeg --with-png --with-rsvg
=C2=A0--with-ti= ff --with-xml2 --with-xpm --with-imagemagick CC=3Dgcc-12
=C2=A0CXX=3Dgcc= -12'

Configured features:
CAIRO DBUS FREETYPE GIF GLIB GMP GN= UTLS GPM GSETTINGS HARFBUZZ
IMAGEMAGICK JPEG LCMS2 LIBSELINUX LIBXML2 MO= DULES NATIVE_COMP NOTIFY
INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 = THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER WEBP X11 XDBE XIM XINPUT2 X= PM XWIDGETS
GTK3 ZLIB

Important settings:
=C2=A0 value of $LAN= G: en_US.UTF-8
=C2=A0 value of $XMODIFIERS: @im=3Dibus
=C2=A0 locale-= coding-system: utf-8-unix

Major mode: JavaScript

Minor modes = in effect:
=C2=A0 tooltip-mode: t
=C2=A0 global-eldoc-mode: t
=C2= =A0 show-paren-mode: t
=C2=A0 electric-indent-mode: t
=C2=A0 mouse-wh= eel-mode: t
=C2=A0 tool-bar-mode: t
=C2=A0 menu-bar-mode: t
=C2=A0= file-name-shadow-mode: t
=C2=A0 global-font-lock-mode: t
=C2=A0 font= -lock-mode: t
=C2=A0 blink-cursor-mode: t
=C2=A0 minibuffer-regexp-mo= de: t
=C2=A0 line-number-mode: t
=C2=A0 indent-tabs-mode: t
=C2=A0= transient-mark-mode: t
=C2=A0 auto-composition-mode: t
=C2=A0 auto-e= ncryption-mode: t
=C2=A0 auto-compression-mode: t

Load-path shado= ws:
None found.

Features:
(shadow sort mail-extr emacsbug mess= age mailcap yank-media puny dired
dired-loaddefs rfc822 mml mml-sec pass= word-cache epa derived epg rfc6068
epg-config gnus-util text-property-se= arch time-date mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbr= ev 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 m= ap 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-lo= addefs 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<= br>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<= br>register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select=
scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colorsframe minibuffer nadvice seq simple cl-generic indonesian philippine
ch= am georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
ko= rean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
europe= an ethiopic indian cyrillic chinese composite emoji-zwj charscript
charp= rop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure
cl-pr= eloaded button loaddefs theme-loaddefs faces cus-face macroexp
files win= dow text-properties overlay sha1 md5 base64 format env
code-pages mule c= ustom widget keymap hashtable-print-readable backquote
threads xwidget-i= nternal 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:
((cons= es 16 104084 13132) (symbols 48 8580 0) (strings 32 24764 2578)
=C2=A0(s= tring-bytes 1 884578) (vectors 16 14855)
=C2=A0(vector-slots 8 188214 99= 81) (floats 8 28 203) (intervals 56 852 0)
=C2=A0(buffers 992 12))
--000000000000db49db061c211839--