From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuan Fu Newsgroups: gmane.emacs.bugs Subject: bug#59630: 29.0.50; treesitter-buffer-root-node doesn't change when changing buffer restriction Date: Sun, 27 Nov 2022 14:40:41 -0800 Message-ID: <5C98EB8D-3A4A-4F07-BF0F-F3B9F1ED004D@gmail.com> References: <87zgcc1s1n.fsf@miha-pc> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5754"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 59630@debbugs.gnu.org, Eli Zaretskii To: miha@kamnitnik.top Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Nov 27 23:41:28 2022 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 1ozQL1-0001LO-B5 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 27 Nov 2022 23:41:27 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ozQKe-0003Fj-Da; Sun, 27 Nov 2022 17:41:04 -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 1ozQKd-0003FZ-7y for bug-gnu-emacs@gnu.org; Sun, 27 Nov 2022 17:41:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ozQKc-0004Ts-Vo for bug-gnu-emacs@gnu.org; Sun, 27 Nov 2022 17:41:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ozQKc-0001ek-9Q for bug-gnu-emacs@gnu.org; Sun, 27 Nov 2022 17:41:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 27 Nov 2022 22:41:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 59630 X-GNU-PR-Package: emacs Original-Received: via spool by 59630-submit@debbugs.gnu.org id=B59630.16695888516353 (code B ref 59630); Sun, 27 Nov 2022 22:41:02 +0000 Original-Received: (at 59630) by debbugs.gnu.org; 27 Nov 2022 22:40:51 +0000 Original-Received: from localhost ([127.0.0.1]:44612 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ozQKR-0001eP-BM for submit@debbugs.gnu.org; Sun, 27 Nov 2022 17:40:51 -0500 Original-Received: from mail-pf1-f173.google.com ([209.85.210.173]:41780) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ozQKP-0001eJ-ED for 59630@debbugs.gnu.org; Sun, 27 Nov 2022 17:40:49 -0500 Original-Received: by mail-pf1-f173.google.com with SMTP id 130so8800788pfu.8 for <59630@debbugs.gnu.org>; Sun, 27 Nov 2022 14:40:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=dswPUjO/8hhz/kJSJPsxb7rdSGyNayJaDebepP3YIx0=; b=ZW5LgIBiBPMVrbQ4FEeoPwnqiGAwfZyFO2UyLGMC9EXC2b/TGYTRqOi83WwK5GiXGo hK8c3YulzhsIwzywMqITwJoKoBAdEDqHbgkoN+tOdTFQdSEFimSvDuabQ382H8BJUF5d eaPTF764PJ/XhTuDxxPgeEvVvJLBw4Bh0Tf1cOuHfit9Ksvhw7sCuBT69F9acbFuOsIT 5pJZ7RYm15Kj1KsL4n6Yg/evmTPiHK49Je3cXILCd9LewVw3W17nNrM+RSX5tR66/Xhv N766T8YKM0iT3/4AVCgndGbUN47m9k2Ozqz6vNE33YMaXsbcGP+URJRXdLv4uu316FTQ lNGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dswPUjO/8hhz/kJSJPsxb7rdSGyNayJaDebepP3YIx0=; b=1xdItT52FwEX9ZxX/Bf1Sw7vPPipteofCILaZdHVk03+RKH7FIPrT6OHroTzNElJ/y GTJ6fUvNe7QR/p+kSgfebEKidAT+YRqMCiQrEkdbHOqBCcR6jaUogI3ZFDwD8+oO9++M KOvUMPQ1wAWDTcemPGOA1NE5SobQjjXPsUnSjshybHo57RUL7mV1TrsXrUQJHEhSqej6 Pr2gJdVuNMkkHawhk5caNeM1h2it/JHbPUQpmpop5JhLzExhsLbnCVb9r6i2V7BmAReY wq5sB/NUkyMsYb1uxEpb+JranzLyiLNOSVLmUMhPoyu1wY5truJvzanruHuAB1m0aFx+ 2/Ig== X-Gm-Message-State: ANoB5pmxhpsTERaaR6AnFljy0X/+39KJH+RNKgDEuMYbJtVsejWM+zLa wZHRCUpIgh3N0XIsB2PI70s= X-Google-Smtp-Source: AA0mqf4385cMZpELCXU0lfFmv78eZixm0Bbhusq/HWeUMkEQRSitFSzGWTBSYT5+N42OG1L1nS9O6w== X-Received: by 2002:a63:4e57:0:b0:477:ae2f:3cd7 with SMTP id o23-20020a634e57000000b00477ae2f3cd7mr22356342pgl.44.1669588843453; Sun, 27 Nov 2022 14:40:43 -0800 (PST) Original-Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id m1-20020a170902f64100b00189393ab02csm7309274plg.99.2022.11.27.14.40.42 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 27 Nov 2022 14:40:43 -0800 (PST) In-Reply-To: <87zgcc1s1n.fsf@miha-pc> X-Mailer: Apple Mail (2.3696.120.41.1.1) 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:249254 Archived-At: > On Nov 27, 2022, at 4:49 AM, miha--- via Bug reports for GNU Emacs, = the Swiss army knife of text editors wrote: >=20 > Treesitter doesn't seem to change its parse tree when changing > restriction. It gets it correct the first time when we query the root > node, but then, after changing restriction, it doesn't seem to get > updated. >=20 > The following is an M-x ielm session to demonstrate the problem >=20 > ELISP> (set-buffer (get-buffer-create "test")) > ELISP> (insert "echo '123'") > ELISP> (narrow-to-region 1 4) > ELISP> (buffer-string) > "echo" > ELISP> (treesit-buffer-root-node 'bash) > # (program) > in 1-4> ;; This is expected >=20 > ELISP> (widen) > ELISP> (treesit-buffer-root-node 'bash) > # (program) > in 1-4> ;; <---- This is not expected, the root node should span 1-9 >=20 > ELISP> (buffer-string) > "echo '123'" Thanks. We didn=E2=80=99t edit the buffer after widening, so tree-sitter = didn=E2=80=99t reparse and used the old tree, which sees the narrowed = buffer. Eli, what would be a good and reliable way to know that = narrowing has changed? I see current_buffer->clip_changed set to 1 in = narrow-to-region and widen, but when are they set to 0? Yuan