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: Fri, 2 Dec 2022 17:01:36 -0800 Message-ID: <5AEFFFF0-9788-4006-87A6-89AF741A33C4@gmail.com> References: <87r0xlbjg6.fsf@miha-pc> <5F7AE71F-0327-409E-BCE9-310E1980C17A@gmail.com> <8335a0lept.fsf@gnu.org> <83y1rqfbms.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="26789"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 59693@debbugs.gnu.org, miha@kamnitnik.top To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Dec 03 02:02:53 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 1p1Gvd-0006WL-Kh for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 03 Dec 2022 02:02:53 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p1GvA-0006Mf-IC; Fri, 02 Dec 2022 20:02:24 -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 1p1Gup-0006JO-09 for bug-gnu-emacs@gnu.org; Fri, 02 Dec 2022 20:02:18 -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 1p1Guo-0001Bu-ML for bug-gnu-emacs@gnu.org; Fri, 02 Dec 2022 20:02:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p1Guo-0008Hn-GP for bug-gnu-emacs@gnu.org; Fri, 02 Dec 2022 20:02: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: Sat, 03 Dec 2022 01:02:02 +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.167002930631842 (code B ref 59693); Sat, 03 Dec 2022 01:02:02 +0000 Original-Received: (at 59693) by debbugs.gnu.org; 3 Dec 2022 01:01:46 +0000 Original-Received: from localhost ([127.0.0.1]:49947 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p1GuY-0008HW-8j for submit@debbugs.gnu.org; Fri, 02 Dec 2022 20:01:46 -0500 Original-Received: from mail-pj1-f54.google.com ([209.85.216.54]:55260) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p1GuW-0008HQ-C9 for 59693@debbugs.gnu.org; Fri, 02 Dec 2022 20:01:45 -0500 Original-Received: by mail-pj1-f54.google.com with SMTP id o12so6409004pjo.4 for <59693@debbugs.gnu.org>; Fri, 02 Dec 2022 17:01:44 -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=ScyDjlOUcXgR0SuyxL6JwXaxS2PQzmmEAL7yesghtb8=; b=JNaT5NLvQVBN8IldRr/OYF1EWyQOUtCBvjdO+eKed80pIEpyCNRrFznrmPDgN2A8DC z6aMVGw7gIAjB3UlZFJwR2/n+CAzi4kWQ1sf1TlJvZdkKr0FTXr/9o3NclXjQUI8AwQB f/hGjk/84bgtlGqqA9vs4+RwsHiZkD3Z5h/VYvPifw13JVQKrhnbyUknaI9HB0T11i/F roGCmsHe+QOylGYJahR+qo85yFUErcHDv9KPQBaeTIZ84GRtIGddwDD1+fq+/1cjkPgy FCcWVL0plb4V+WsctgijINiocJQ5PwEPADuvoGE5yQvobIjKUZoxoBJz8w7PDd4rsbFO TOGA== 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=ScyDjlOUcXgR0SuyxL6JwXaxS2PQzmmEAL7yesghtb8=; b=vZo8UdWiA7wT6kfTmmDanwD3hBl6EwWz0a3UcN+pBaVUHS/apSaIDoNIUgveTpy/VD oId/Xw5+q6zZPlS61fY4p++55OT5sBTrHg1dU37sCUETKwz9mqDsv2NwFuWjREm1gHsR 1asU7k3sHCuYof4zBWL+/tysL5p8w/qU/5zHZhSOSNgjC9YQul+APD5UnnNldfFEX1Ho T4NOrAY+TXWx6aiExOWGrN0TAEcHtQZu9tdG37VZaqFxotr37DczlxAIfMPLR8a2oLRk kEvsWxiLJ8ERKkf5TxvN/hpsCJ8xfBkH5Pds/kqYRp6wIJcdcj80ww5kZpsynfZT42Oe dCbw== X-Gm-Message-State: ANoB5plftIiMjlplfcdFbZeFN0HsqerqAugno6uHJbhZY66U/nqMi2CD ZqULQGXRwcKqL9Rul/MpupE= X-Google-Smtp-Source: AA0mqf4zWYxEeim9nTOubpjpTAJbmwNspxUBqkfqrxezeLnwhjmz70QXqhwOq+wR8d/KmD43sgTAmQ== X-Received: by 2002:a17:90a:de90:b0:219:44f2:8618 with SMTP id n16-20020a17090ade9000b0021944f28618mr25464045pjv.79.1670029298539; Fri, 02 Dec 2022 17:01:38 -0800 (PST) Original-Received: from smtpclient.apple (108-241-83-33.lightspeed.irvnca.sbcglobal.net. [108.241.83.33]) by smtp.gmail.com with ESMTPSA id a14-20020a170902ecce00b00186bc66d2cbsm6203587plh.73.2022.12.02.17.01.37 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 02 Dec 2022 17:01:37 -0800 (PST) In-Reply-To: <83y1rqfbms.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:249801 Archived-At: > On Dec 2, 2022, at 12:33 AM, Eli Zaretskii wrote: >=20 >> From: Yuan Fu >> Date: Thu, 1 Dec 2022 21:05:43 -0800 >> Cc: miha@kamnitnik.top, >> 59693@debbugs.gnu.org >>=20 >>> In the insdel.c hooks where you record changes to buffer text, you = should >>> see if the buffer has a base_buffer, and if so, update any parsers = of the >>> base buffer as well. >>=20 >> Actually there=E2=80=99s a little bit of problem. When we edit the = base buffer, we would want to update the parsers in all of its indirect = buffers as well, and AFAICT there is no pointer from base buffer to the = indirect buffer, only the other way around.=20 >=20 > That's not the problem presented by the OP, though. Yeah, but they are the same problem in spirit, ie, parser not updated = when base/indirect buffer receive changes. >=20 >> We don=E2=80=99t want indirect buffer and base buffers to share = parsers, since they can have different narrowing, and semantically = indirect buffers should share anything but the text with the base = buffer. >=20 > Yes, the parsers should not be shared. >=20 >> How about this: we change current_buffer->parser_list from a plain = list of parsers to a cons (PARSER-LIST . INDIRECT-PARSER-LIST), where = PARSER-LIST is as before. But for base buffers, INDIRECT-PARSER-LIST = includes all the parsers of its indirect buffers; and for indirect = buffers, INDIRECT-PARSER-LIST is nil. >=20 > You can maybe have the indirect buffers in the list, not their = parsers. > That could make it easier to access other treesit-related information = of the > indirect buffers, if needed. Good idea, it=E2=80=99s easier to know when to remove the reference with = buffers, aka when buffer is killed. Yuan=