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#59693: 29.0.50; treesitter in base buffer doesn't respond to modifications in indirect buffer correctly Date: Mon, 5 Dec 2022 18:15:07 -0800 Message-ID: <0973FBCA-DFBE-4FF7-9052-2B60D2FC81DC@gmail.com> References: <87r0xlbjg6.fsf@miha-pc> <5F7AE71F-0327-409E-BCE9-310E1980C17A@gmail.com> <8335a0lept.fsf@gnu.org> <22B4F037-2979-4C65-8917-26D17CFBED0A@gnu.org> <83a64197ny.fsf@gnu.org> 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="17326"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 59693@debbugs.gnu.org, Stefan Monnier , miha@kamnitnik.top To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Dec 06 03:16:24 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 1p2NVP-0004Il-Hd for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 06 Dec 2022 03:16:23 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p2NV6-0002eK-9z; Mon, 05 Dec 2022 21:16: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 1p2NV4-0002dw-8Q for bug-gnu-emacs@gnu.org; Mon, 05 Dec 2022 21:16:02 -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 1p2NV4-0001Ac-0P for bug-gnu-emacs@gnu.org; Mon, 05 Dec 2022 21:16:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p2NV3-0000S7-PE for bug-gnu-emacs@gnu.org; Mon, 05 Dec 2022 21:16:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 06 Dec 2022 02:16:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 59693 X-GNU-PR-Package: emacs Original-Received: via spool by 59693-submit@debbugs.gnu.org id=B59693.167029291828821 (code B ref 59693); Tue, 06 Dec 2022 02:16:01 +0000 Original-Received: (at 59693) by debbugs.gnu.org; 6 Dec 2022 02:15:18 +0000 Original-Received: from localhost ([127.0.0.1]:39729 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p2NUL-0007TO-Sl for submit@debbugs.gnu.org; Mon, 05 Dec 2022 21:15:18 -0500 Original-Received: from mail-pj1-f42.google.com ([209.85.216.42]:55821) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p2NUK-00075r-3Y for 59693@debbugs.gnu.org; Mon, 05 Dec 2022 21:15:16 -0500 Original-Received: by mail-pj1-f42.google.com with SMTP id u5so3668183pjy.5 for <59693@debbugs.gnu.org>; Mon, 05 Dec 2022 18:15:16 -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=tfomrdvNUmUM0DVh/U2LdlxQg5b9e8K5Hwlv2gqCgww=; b=WLjlXzn0LhKE7FTnsvuObF2BCkA4HJzfDGSvfRwv4Sb1AdD6vwDAGjpKWhMmniUS/u UcuqgOT/e9Q1NabgdCud4ihFHGKqdw5D0qPulXvDywGGGKts4EP3EuvjUWBS9VWvm2gd 1k3mDfVQQfQBjT21GYLqrsOJnXMCtWWe1UcTFd8FDCCTT/33SYxyAkmjE3vPbWx01xCr s8d96TI+9VPyaM/ZrReX+6TO04rDdsDj5KlyayR+DqOLqT/6V2t3NZ6rg98eEidNx8Aq RnieNPS3RUqvXyBfPlqyPobDY4hNLR9bGhDC6E2IrFAjXzHwTnej1Yp99e+Z7Nav8WJN Eo8A== 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=tfomrdvNUmUM0DVh/U2LdlxQg5b9e8K5Hwlv2gqCgww=; b=x8Gm3VVGWstst8kX/RkSzp/ElDXZJfbHvNWL6O9NqdDexk8iQtAp6lLRn5naF27P7S Z/P/bJ4hNGPHoAMtVM0BkgrCpHryvCherJg/oGyD1CkFPWRfrR8gBgKJxWChgaUZgNdV AQlMp7wSOiIY+edjxp6qQ4fhtyfCQMOzqneqicFqzMsMpJfn4Yd27CbFYaXzwmOtglUA 2iFzw5vKTeHejZtjGxJ3fu9TwTvyWtCl805qTjF+Gp8L/8r6xBo6NEnwzqwvpzSYliXc 05BjcA28r2nIPuHfmiDL9U4Aa9pVJlORu/FJ+AEr7r6xbvzkmcZ0zWhNdIcN28nH2QqB F0wg== X-Gm-Message-State: ANoB5pk15dJof+C7VeusbZEZ6PGyaEBA0GWLSjUtELiiwnuWTgwNpEI1 qqbWnod1LaFnCDYXnVSlTKc= X-Google-Smtp-Source: AA0mqf5MDByl6EL4YEn1/Hh88cGDqSu1E7kGVm5J86Dud8W3UyxL+Brt8sh8gjIvb3GxvWejcvJ39A== X-Received: by 2002:a17:90b:3941:b0:215:db2e:bb17 with SMTP id oe1-20020a17090b394100b00215db2ebb17mr92196211pjb.166.1670292909931; Mon, 05 Dec 2022 18:15:09 -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 d1-20020a170903230100b0017f74cab9eesm11272320plh.128.2022.12.05.18.15.08 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Dec 2022 18:15:09 -0800 (PST) In-Reply-To: <83a64197ny.fsf@gnu.org> 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:250083 Archived-At: > On Dec 5, 2022, at 7:44 AM, Eli Zaretskii wrote: >=20 >> From: Stefan Monnier >> Cc: Yuan Fu , 59693@debbugs.gnu.org, = miha@kamnitnik.top >> Date: Mon, 05 Dec 2022 10:29:06 -0500 >>=20 >>> Will this "hold water" vis-a-vis the expectations of various = features that >>> would like to use tree sitter related capabilities? Regardless of = your >>> opinion on indirect buffers, many 3rd party packages and features = use >>> indirect buffers as the backbone of their implementation. We don't >>> currently have any alternatives to that, AFAIK. So I'd expect a lot = of >>> disappointment if we declare that indirect buffers will not be = supported by >>> tree sitter as a matter of design decision. >>=20 >> I can't see why: a package that uses indirect buffers can just as = well >> run its tree-sitter parsers in the base buffer. >=20 > I thought about those multi-mode modes, or features that show the same > buffer more than once with different modes. >=20 >>> Changing insdel.c to run stuff in base buffer could be a solution, = but >>> I don't feel we can make such changes on the release branch. >>=20 >> Agreed. >>=20 >>> But maybe we can do that now only for treesit.c functions. >>=20 >> Sounds OK to me, yes. >=20 > OK, thanks. Yuan, will this work for you? can you show a patch along = these > lines? That wouldn=E2=80=99t work, unfortunately. We need to update all the = parsers in every indirect and base buffer, enforce all changes to happen = in the base buffer doesn=E2=80=99t help with that: indirect buffers=E2=80=99= parsers would be out-of-sync. I can think of two ways: 1. Only allow base buffer to have parsers, no change is needed for = insdel.c, treesit_record_change can find the base buffer and update its = parsers. We can ask indirect buffers to use their base buffer=E2=80=99s = parser. Unless the base buffer is narrowed, I think it will work fine.=20= I remember that there were a discussion along the lines of user-narrow = vs low-level narrow, what was the outcome of that discussion? 2. The patch I sent earlier, which tracks indirect buffers so all the = relevant buffer=E2=80=99s parser are updated at a buffer content change. Yuan