From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#62333: 30.0.50; Issue with tree-sitter syntax tree during certain changes Date: Wed, 29 Mar 2023 00:19:41 +0300 Message-ID: <5c683b3b-48e8-5099-8ab1-459c348d1f88@yandex.ru> References: <87fs9yur7r.fsf@gmail.com> <83sfduelab.fsf@gnu.org> <8FC25A01-6934-43BB-899C-CA5926BEA3CF@gmail.com> <83jzz5c8ml.fsf@gnu.org> <83edpdc6sn.fsf@gnu.org> <1ca302bf-99dc-7f9e-8544-063064a1cb21@yandex.ru> <831qlcdisi.fsf@gnu.org> <398721ad-79b0-3f6d-97b3-4902d9bfbe39@yandex.ru> <83wn34c2qa.fsf@gnu.org> <3b3d82d1-f0f6-a768-a5db-8dc9386a5a34@yandex.ru> <83r0tcbz8g.fsf@gnu.org> <1967361679760225@umbzx4hqxrw5qxo7.sas.yp-c.yandex.net> <83mt40bxzd.fsf@gnu.org> <83jzz4bugh.fsf@gnu.org> <3d64520c-54da-a04a-ed0d-a66b4e753f8a@yandex.ru> <831qlcaysh.fsf@gnu.org> <29679184-7366-0167-9e94-def97048f663@yandex.ru> <83v8inal29.fsf@gnu.org> <9886ffa5-ead2-50d5-a325-f6704b736ada@yandex.ru> <83fs9q9vak.fsf@gnu.org> <10aa98b6-908b-c467-7c77-767906692088@yandex.ru> <83h6u585si.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9450"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Cc: wkirschbaum@gmail.com, casouri@gmail.com, 62333@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Mar 28 23:20:20 2023 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 1phGjs-0002GE-Ej for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 28 Mar 2023 23:20:20 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1phGjc-0006Xq-1l; Tue, 28 Mar 2023 17:20:04 -0400 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 1phGjb-0006Xh-0d for bug-gnu-emacs@gnu.org; Tue, 28 Mar 2023 17:20:03 -0400 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 1phGja-00065e-I8 for bug-gnu-emacs@gnu.org; Tue, 28 Mar 2023 17:20:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1phGjZ-00083I-W7 for bug-gnu-emacs@gnu.org; Tue, 28 Mar 2023 17:20:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 28 Mar 2023 21:20:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62333 X-GNU-PR-Package: emacs Original-Received: via spool by 62333-submit@debbugs.gnu.org id=B62333.168003839130928 (code B ref 62333); Tue, 28 Mar 2023 21:20:01 +0000 Original-Received: (at 62333) by debbugs.gnu.org; 28 Mar 2023 21:19:51 +0000 Original-Received: from localhost ([127.0.0.1]:50795 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1phGjO-00082l-KL for submit@debbugs.gnu.org; Tue, 28 Mar 2023 17:19:50 -0400 Original-Received: from mail-wr1-f42.google.com ([209.85.221.42]:37405) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1phGjM-00082Z-Vi for 62333@debbugs.gnu.org; Tue, 28 Mar 2023 17:19:49 -0400 Original-Received: by mail-wr1-f42.google.com with SMTP id y14so13606714wrq.4 for <62333@debbugs.gnu.org>; Tue, 28 Mar 2023 14:19:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680038383; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=WrzVMGKdr4BWZFwGTLZRQ0N2Xll/AhkkiRF/KfaNBe4=; b=L2WBuMEhrHnsbWyREMBgcgHLRfbn27cPKHUTBfNEtsQYtP+1PIO43yztbUmHg8IlFq LZf6TEbLT8f753832ftL1GVZsD9Yf7lyfV8cNVJCGgg0B79vYyUtN3iSOLMnnap9ULZR wSN9svJSC1T7nKFDs2oHAo0PAkfjYrS8x5h5BosgjYgnDrpA44zZcOmfDyThgsGsaV9Z 3raaoFvhdtRhizcOQFMHeqwLFsw9VUc09vVKSdJtGMrpLeFPt6QQtbrU8+bzvAXylJZg 76lzyZMDodx/knCCkO40YPJKkWa/7vPojXaznPbRGXa8GGMHrDlWPRy/o9k5FUtcFJR+ Lsnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680038383; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=WrzVMGKdr4BWZFwGTLZRQ0N2Xll/AhkkiRF/KfaNBe4=; b=DNvWABT1E1sZ2MVdFS4s611OzhiwCvbc7Q++ychrQIVQTeRtz/AWZW7yakzsn76zxf L3HbrCzanaWSpcZp3usqoZK8Tqq1O2Pp+N25u5YwA2jMpFSdPscxjiuJ/+hSnOhDfA+F SLAn7pbp/w1oSg+A91xQjvoVbQ1lTgO0aEUaBtg1qy4uoEWygFqkWDGvOsTajaNbdvFx jqomkgWeWTfH/GS/+8nkETWD79NNOobhciRKS9l1o70NMe0dA9u5jpi+fNNl7OzhOt7w 4DruXDiM/yh80s+d3zdL/al12t7+xXn0ywlKc54OEB8OW4Hb0gfAKl+/grwO2K9Ab3f1 ppyg== X-Gm-Message-State: AAQBX9fk0jluWq4+em2I+3SpDl9xrLQfAjdffO449BdLXkDDw3e65NFI K5tnv7sW296L/0XtXunQkPE= X-Google-Smtp-Source: AKy350Y+od8m3EIXwfTbIb2KV7bCzqSTSdyJ0e3BOy44NOctfZ+x+6ZLtEaOLc2gpgcKkhOu+C2rRQ== X-Received: by 2002:a5d:550c:0:b0:2d9:5608:ee0 with SMTP id b12-20020a5d550c000000b002d956080ee0mr13753564wrv.69.1680038382945; Tue, 28 Mar 2023 14:19:42 -0700 (PDT) Original-Received: from [192.168.1.2] ([31.216.80.60]) by smtp.googlemail.com with ESMTPSA id d9-20020adfe889000000b002d97529b3bbsm18180635wrm.96.2023.03.28.14.19.41 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 28 Mar 2023 14:19:42 -0700 (PDT) Content-Language: en-US In-Reply-To: <83h6u585si.fsf@gnu.org> 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:258826 Archived-At: On 28/03/2023 14:38, Eli Zaretskii wrote: >> Date: Tue, 28 Mar 2023 02:33:38 +0300 >> Cc: wkirschbaum@gmail.com, casouri@gmail.com, 62333@debbugs.gnu.org >> From: Dmitry Gutov >> >>> With parser-based features, we have an opportunity to do this in a >>> cleaner manner. >> >> parser-based features don't need this at all, if considered in >> isolation. But if we try to combine them with existing mode, or existing >> packages, they need to play by the common rules. Which they currently do. > > Sorry, I don't see the relevance of that to what I wrote above. > >>>> If we take indent-for-tab-command, for example, it doesn't have such a >>>> variable, and doesn't really need to: the top-level command calls >>>> 'widen', and then indent-line-function (set by major mode and altered by >>>> e.g. mmm-mode) is free to impose its specific bounds. >>> >>> I thought about a lower-level, infrastructure-level, mechanism that >>> could be used to restrict a parser to a certain region of the buffer. >>> Then this could be used by every feature based on parsers, instead of >>> us having to invent a separate solution for each one. >> >> Like narrowing, but just for parsers? But parsers obey narrowing >> already. Sounds a bit like conceptual duplication. How does this solve >> blink-matching-paren issue anyway? > > We could widen without fearing that a parser will "invade" regions of > buffer text that we don't want it to wander into. So any code that wants to restrict a "parser" based buffer, would need to use a different primitive to narrow? And vice versa, any code that uses a parser, will need to (widen) first, to ensure that the parser is not affected by any restriction set up by any code previously? Anyway, I don't see why we should institute a special category for these buffers. Most language modes which define syntax-propertize-function are basically "parser-based", in most of the relevant respects. Except the accuracy is less, and we write the parsing code ourselves. >>>> The "grand unified theory of mixed major modes" has been attempted a few >>>> times in the past, and never reached anything practical. >>> >>> But here we have a unique opportunity to maybe find a solution, at >>> least for stuff based on tree-sitter and similar libraries. That >>> maybe not "grand", but certainly "respectable". >> >> tree-sitter has its own support for mixed languages. > > So your argument about mmm framework was a red herring, cause that > problem doesn't exist wrt tree-sitter parsers? Nope, see the first paragraph of my previous reply (the "no relevance" one). >>>> My stance here is we shouldn't break it before we create a new one. >>> >>> No one broke anything. We are just discussing ideas. Please don't >>> exaggerate. >> >> I never said anybody has broken anything already. > > You did say that my ideas break something, see above. Ideas cannot > break any code, so this argument shouldn't be brought up if you want a > calm and rational discussion. Ideas cannot, but implementing them can. "This or that change will break an existing convention" is a rational argument. Shall we stop quibbling over words?