From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stephen Leake Newsgroups: gmane.emacs.devel Subject: Re: How to add pseudo vector types Date: Thu, 29 Jul 2021 16:06:15 -0700 Message-ID: <86wnp8oh3s.fsf@stephe-leake.org> References: <83h7gw6pyj.fsf@gnu.org> <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> <24808548-23F4-4068-877E-37C7190A02B0@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37764"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (windows-nt) Cc: Eli Zaretskii , emacs-devel@gnu.org, cpitclaudel@gmail.com, monnier@iro.umontreal.ca To: Yuan Fu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Jul 30 01:07:32 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 1m9F7j-0009dK-Nj for ged-emacs-devel@m.gmane-mx.org; Fri, 30 Jul 2021 01:07:32 +0200 Original-Received: from localhost ([::1]:33386 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m9F7h-000455-FQ for ged-emacs-devel@m.gmane-mx.org; Thu, 29 Jul 2021 19:07:29 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48592) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m9F72-0003GN-B1 for emacs-devel@gnu.org; Thu, 29 Jul 2021 19:06:48 -0400 Original-Received: from gateway36.websitewelcome.com ([192.185.201.2]:44193) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m9F70-0000Ry-Gh for emacs-devel@gnu.org; Thu, 29 Jul 2021 19:06:47 -0400 Original-Received: from cm13.websitewelcome.com (cm13.websitewelcome.com [100.42.49.6]) by gateway36.websitewelcome.com (Postfix) with ESMTP id 4BD2F400DCA39 for ; Thu, 29 Jul 2021 18:06:20 -0500 (CDT) Original-Received: from host2007.hostmonster.com ([67.20.76.71]) by cmsmtp with SMTP id 9F6Zmmje7rJtZ9F6amTPxv; Thu, 29 Jul 2021 18:06:20 -0500 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=stephe-leake.org; s=default; h=Content-Type:MIME-Version:Message-ID: In-Reply-To:Date:References:Subject:Cc:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=v8CgbgPHqQLXxPX5YNIP4EjKAoLfoM9pTI89kK3s2B8=; b=FTBju17+GIW0EcpkYlFZp9T8fd 9wqAiYBz4bpP5bQ/8XnIzAMo3MRkbzMG0ldY5mX5kJjcMqJwhTIeGqMIhCZj7umRcnk0lAjnFxRg8 SFz66sTm+hOMvEGLU0mmfMm6jxoGG/2+xd+ranz9rqaGF5oBZl9wYA0RM1OzYn6uXsBZqaNShycEg 40LurQQ+LsUwUW9aqtqV2E/RmLcrOY2PDZbevPDzFdLtOZ0tEznRmKRdnXzCwPpT5kFM65mJ05p4Z QtDYMOrVaRCYeQZXaaqNYJ5taZ3PxNisJfuRJ1PV3iRpdm5idFJXS4CEcNSpk5LnRLaFXyh7Nb9VU f3P5KuPQ==; Original-Received: from [76.77.182.20] (port=50580 helo=Takver4) by host2007.hostmonster.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1m9F6Z-004N9f-Dr; Thu, 29 Jul 2021 17:06:19 -0600 In-Reply-To: <24808548-23F4-4068-877E-37C7190A02B0@gmail.com> (Yuan Fu's message of "Wed, 28 Jul 2021 14:46:03 -0400") X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - host2007.hostmonster.com X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - stephe-leake.org X-BWhitelist: no X-Source-IP: 76.77.182.20 X-Source-L: No X-Exim-ID: 1m9F6Z-004N9f-Dr X-Source-Sender: (Takver4) [76.77.182.20]:50580 X-Source-Auth: stephen_leake@stephe-leake.org X-Email-Count: 10 X-Source-Cap: c3RlcGhlbGU7c3RlcGhlbGU7aG9zdDIwMDcuaG9zdG1vbnN0ZXIuY29t X-Local-Domain: yes Received-SPF: permerror client-ip=192.185.201.2; envelope-from=stephen_leake@stephe-leake.org; helo=gateway36.websitewelcome.com X-Spam_score_int: -8 X-Spam_score: -0.9 X-Spam_bar: / X-Spam_report: (-0.9 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-0.001, SPF_NEUTRAL=0.779 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:271804 Archived-At: Yuan Fu writes: >> On Jul 28, 2021, at 1:54 PM, Eli Zaretskii wrote: >> >>> From: Yuan Fu >> 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. There is always a delimiter in the text that defines the boundary between XX and AA; say "{{" for example, with "}}" at the other end of AA. > 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. before or after the delimiter? XX {{ BAA }} XX : B is a change to AA XXB {{ AA }} XX : B is a change to XX > 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? The major mode determines the boundaries and the narrowing, so leave it up to that code to be consistent, not your code. -- -- Stephe