From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#67977: 30.0.50; tree-sitter: Emacs crashes when accessing treesit-nodes in a narrowed buffer Date: Wed, 27 Dec 2023 14:57:09 +0200 Message-ID: <83r0j79522.fsf@gnu.org> References: <87r0jdddxf.fsf@yandex.ru> <835y0pfkgr.fsf@gnu.org> <1DE32BF7-75D8-4F49-975D-53C782D26016@gmail.com> <08D379EF-1556-4498-8E60-F7972A25752A@gmail.com> <83edfccbwi.fsf@gnu.org> <262157E9-A92C-4063-ADA4-725C156FB227@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10955"; mail-complaints-to="usenet@ciao.gmane.io" Cc: dvzubarev@yandex.ru, 67977@debbugs.gnu.org To: Yuan Fu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Dec 27 13:58:31 2023 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 1rITUV-0002da-MZ for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 27 Dec 2023 13:58:31 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rITUE-0000s7-V7; Wed, 27 Dec 2023 07:58:14 -0500 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 1rITU6-0000r3-3b for bug-gnu-emacs@gnu.org; Wed, 27 Dec 2023 07:58:07 -0500 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 1rITU4-0001Wl-2o for bug-gnu-emacs@gnu.org; Wed, 27 Dec 2023 07:58:05 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rITU2-0007vW-3J for bug-gnu-emacs@gnu.org; Wed, 27 Dec 2023 07:58:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 27 Dec 2023 12:58:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67977 X-GNU-PR-Package: emacs Original-Received: via spool by 67977-submit@debbugs.gnu.org id=B67977.170368188030462 (code B ref 67977); Wed, 27 Dec 2023 12:58:02 +0000 Original-Received: (at 67977) by debbugs.gnu.org; 27 Dec 2023 12:58:00 +0000 Original-Received: from localhost ([127.0.0.1]:35488 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rITTu-0007v9-Tj for submit@debbugs.gnu.org; Wed, 27 Dec 2023 07:58:00 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35096) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rITTt-0007uu-8r for 67977@debbugs.gnu.org; Wed, 27 Dec 2023 07:57:54 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rITTo-0001V7-SO; Wed, 27 Dec 2023 07:57:48 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=k6gm0N7DqEvAWl+ADSwixVUuJnmE2u/DYwekZmU8CRE=; b=SqFsGA0PicJLVoMPakiX NFnC0L3YKk0gXFD99N8bImu89TiBgAJ+TTgR0EtUWSUr5aMsdV/3PcMpsIkOd6CnTY3e9AB5vHoP/ vJ2pVR8xxwgZvxpIqyDomm8eB6tCxI9m+gyB/NI0xuBUx+lL95837GKSy4jabfMUFDc7P5Mwg7/xY /XOqt0uGfwEkfqrkBAQgxj9x67SmJV3KGLW8tgEm72zLsssMx85IdS7HYbHU7UmB0jo9ome6b6t6v lFOQ46y4IBznPvbKnpbuUxUzEBK70D1PTisn6C65F3HZCtWP8dKJMVYa/XByZB5rLejCdUqStxsyb gk+KL70KRzNrUA==; In-Reply-To: <262157E9-A92C-4063-ADA4-725C156FB227@gmail.com> (message from Yuan Fu on Tue, 26 Dec 2023 20:15:24 -0800) 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:276935 Archived-At: > From: Yuan Fu > Date: Tue, 26 Dec 2023 20:15:24 -0800 > Cc: Denis Zubarev , > 67977@debbugs.gnu.org > > > Btw, I hope that these calls to 'widen' don't require unnecessary > > reparsing by tree-sitter, do they? > > Yes, but only because we called treesit-node-at while the buffer is narrowed, which triggers a reparse. Font-lock and jit-lock themselves always access the parser with widened buffer so they don’t trigger reparse on their own. > > So it seems working in a narrowed buffer would trigger a lot of back-and-fortch reparse. I wonder if it’s worth optimizing for (eg, use two parsers behind the scenes, one for widened buffer and one for narrowed buffer). Could font-lock-dont-widen help, perhaps?