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.devel Subject: Re: How to add pseudo vector types Date: Wed, 28 Jul 2021 14:46:03 -0400 Message-ID: <24808548-23F4-4068-877E-37C7190A02B0@gmail.com> References: <83h7gw6pyj.fsf@gnu.org> <46BBFF88-76C3-4818-8805-5437409BEA93@gmail.com> <83wnpq46uk.fsf@gnu.org> <533BD53B-4E85-4E9E-B46A-346A5BBAD0F5@gmail.com> <258CB68D-1CC1-42C8-BDCD-2A8A8099B783@gmail.com> <1a776770-50b7-93cd-6591-c9a5b3a56eb8@gmail.com> <8335s64v10.fsf@gnu.org> <5380C92B-6C15-4490-A1E0-1C3132DBB16A@gmail.com> <83k0li2shw.fsf@gnu.org> <86wnpg82v3.fsf@stephe-leake.org> <83lf5wyn0z.fsf@gnu.org> <86pmv66yqg.fsf@stephe-leake.org> <83a6maw705.fsf@gnu.org> <83r1fluikh.fsf@gnu.org> <88007ACB-31E5-440F-876D-9F43C8EE02CC@gmail.com> <86fsw05lom.fsf@stephe-leake.org> <8A3823DD-5D5A-4A33-8EF9-93F05497CE4C@gmail.com> <864kcf5cmv.fsf_-_@stephe-leake.org> <18D745F5-DBB1-46CC-91D3-4ADAA9D37AB9@gmail.com> <834kcetmly.fsf@gnu.org> <831r7itjc8.fsf@gnu.org> Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.60.0.2.21\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15633"; mail-complaints-to="usenet@ciao.gmane.io" Cc: cpitclaudel@gmail.com, Stephen Leake , monnier@iro.umontreal.ca, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Jul 28 20:48:20 2021 Return-path: Envelope-to: ged-emacs-devel@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 1m8obM-0003tX-Es for ged-emacs-devel@m.gmane-mx.org; Wed, 28 Jul 2021 20:48:20 +0200 Original-Received: from localhost ([::1]:43202 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m8obK-0008Q2-0l for ged-emacs-devel@m.gmane-mx.org; Wed, 28 Jul 2021 14:48:18 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55728) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m8oZG-0005zX-GG for emacs-devel@gnu.org; Wed, 28 Jul 2021 14:46:11 -0400 Original-Received: from mail-qk1-x72c.google.com ([2607:f8b0:4864:20::72c]:34334) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m8oZC-0007kW-IZ; Wed, 28 Jul 2021 14:46:10 -0400 Original-Received: by mail-qk1-x72c.google.com with SMTP id 184so3271967qkh.1; Wed, 28 Jul 2021 11:46:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=hUlXccHEtlc4Hl0no0+1Jf0P5Ws7PwZbOBlIq6Dl5nM=; b=Y+OT5qfKR/e6xgvam2jGnt9F1XgWGPtkV0g0EKJ0MmbU3lLg9jR7CJmVjbo2bunIAH 8LaAL9POJC8JwB5sYB6frZVdEx/hs4JvG1xTUYasF4gMIvvA4KQ0ekVa36LSTc1E4J25 j5LZEzs2UdnMmaHA+WPDj7lmK+kI/2IXyZX7aN5mi6ZIng7QOBGT5zAZ9cm8l+v6K2ak IIz79e+Ptr8QkAQAp3+JVdGjMnzjgAHYAfcFdL0XeWDqZmJGQZBinE0FdYw+InxyVGjG kRx0EfiCMsw2mzrQPF3AFKYQqbM6XnvAnsK7gvv8jtBhWw62cZxBwqvYxSv79Xk8fUZx 6Ezw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=hUlXccHEtlc4Hl0no0+1Jf0P5Ws7PwZbOBlIq6Dl5nM=; b=nhU6MUq20qJvvNnQCcZ3yVe9oTsx++7/1DcuwPdhQy8yjqqmEEQS+XdI3Ia46ME5kY COs4gTfrNeseaIYHXIXch/IM8PVc0tl0+SvBBFix78qEZ9njL/yIjILeT9jNuNq8Kb2+ qx7XdpQuOvev2BYGa9krR3GZu6/RTlf10IOQdnqOpdHecDXVdKt8zfbqF+ny4q3lLLR7 xIeZO2l3NZ/St/RqMXdXK0o94sENskHPTxMYbRQ6NCjMgTKPfr3Um+chrBLDj8F1t1m7 Ioc+L88BsQl3gxzGiIi9k+7tJcoe2kD5VuhGC1k4W9BIXREphJyyUS8WCbSLUGgkK/Gd Jr4A== X-Gm-Message-State: AOAM533Q2kcT8EejO8C7vjL2Y4LntoJr+r0gXOWsPDGOVSRFdwM3Ymmv GowpMxXE269Fl9EFaiUXnjDPjU23b+YPvQ== X-Google-Smtp-Source: ABdhPJz3B88JgxaksOxQwjEOanBjl9wMk3d9wooZc9lSBM06Fhr1h3WIVTdmEfatZMkDGp86rmEIHQ== X-Received: by 2002:ae9:c219:: with SMTP id j25mr1090803qkg.313.1627497964918; Wed, 28 Jul 2021 11:46:04 -0700 (PDT) Original-Received: from 2603-7080-0302-635e-540d-2222-3fe9-1314.res6.spectrum.com (2603-7080-0302-635e-540d-2222-3fe9-1314.res6.spectrum.com. [2603:7080:302:635e:540d:2222:3fe9:1314]) by smtp.gmail.com with ESMTPSA id f12sm420724qke.37.2021.07.28.11.46.03 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Jul 2021 11:46:04 -0700 (PDT) In-Reply-To: <831r7itjc8.fsf@gnu.org> X-Mailer: Apple Mail (2.3654.60.0.2.21) Received-SPF: pass client-ip=2607:f8b0:4864:20::72c; envelope-from=casouri@gmail.com; helo=mail-qk1-x72c.google.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.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, FREEMAIL_REPLY=1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:271777 Archived-At: > On Jul 28, 2021, at 1:54 PM, Eli Zaretskii wrote: >=20 >> From: Yuan Fu >> Date: Wed, 28 Jul 2021 13:47:42 -0400 >> Cc: Stephen Leake , >> cpitclaudel@gmail.com, >> monnier@iro.umontreal.ca, >> emacs-devel@gnu.org >>=20 >> Could you describe the desired effect on tree-sitter when the buffer = is narrowed? >=20 > The behavior should be the same as if the text before and after the > narrowed region didn't exist. >=20 > If we just deny accessibility of the hidden region from tree-sitter, = tree-sitter is still aware of the hidden text, because it has previously = parsed the hidden text and stored the result in the parse tree. >=20 > The adherence to narrowing is for the use cases where TS is _always_ > invoked on the same narrowed region. You seem to be thinking about > changes in the narrowing while TS is parsing, or between consecutive > re-parsing calls, but I see no interesting/important use cases which > would need to do that. And if there are some tricky cases which do > need this, the respective Lisp programs will have to deal with the > problem. That makes sense. However it bring up a problem. Consider such a buffer: = XXAAXX. Say lisp narrows to AA and creates a tree-sitter parser. Then = lisp widens the buffer, and user inserts B in front of AA. Now the = buffer is XXBAAXX. Emacs has two options to convey this change to the = tree-sitter parser: 1) it does not, then tree-sitter still thinks the = buffer is AA, essentially the portion where tree-sitter sees is pushed = forward by one character, 2) it tells tree-sitter the user inserted a = character at the beginning, then tree-sitter thinks the buffer is BAA. = Which option is correct depends on how does lisp later narrows: if lisp = narrows to AA, then option 1 is correct, if lisp narrows to BAA, then = option 2 is correct. But how do we know which option is correct before = lisp narrows? Yuan