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: Sat, 25 Mar 2023 17:25:17 +0200 Message-ID: <3b3d82d1-f0f6-a768-a5db-8dc9386a5a34@yandex.ru> References: <87fs9yur7r.fsf@gmail.com> <2fd8f2b8-d9c4-c825-a789-f2d42324859f@yandex.ru> <09539C5E-23DA-4B00-A3F6-873A41D6A2CE@gmail.com> <83h6uc549z.fsf@gnu.org> <665745A2-FDC8-45DE-BFF5-2F688FC85431@gmail.com> <491b788f-c3c3-4877-daa0-f515be9f3a17@yandex.ru> <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> 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="6990"; 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 Sat Mar 25 16:26:23 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 1pg5mg-0001Yr-S6 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 25 Mar 2023 16:26:22 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pg5mO-0008A5-P5; Sat, 25 Mar 2023 11:26: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 1pg5mN-00089X-9W for bug-gnu-emacs@gnu.org; Sat, 25 Mar 2023 11:26: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 1pg5mM-0003HP-22 for bug-gnu-emacs@gnu.org; Sat, 25 Mar 2023 11:26:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pg5mL-0001bW-O4 for bug-gnu-emacs@gnu.org; Sat, 25 Mar 2023 11:26:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 25 Mar 2023 15:26: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.16797579356124 (code B ref 62333); Sat, 25 Mar 2023 15:26:01 +0000 Original-Received: (at 62333) by debbugs.gnu.org; 25 Mar 2023 15:25:35 +0000 Original-Received: from localhost ([127.0.0.1]:43249 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pg5lr-0001aX-Ep for submit@debbugs.gnu.org; Sat, 25 Mar 2023 11:25:35 -0400 Original-Received: from mail-wm1-f48.google.com ([209.85.128.48]:53912) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pg5lm-0001aG-M5 for 62333@debbugs.gnu.org; Sat, 25 Mar 2023 11:25:30 -0400 Original-Received: by mail-wm1-f48.google.com with SMTP id p34so2684762wms.3 for <62333@debbugs.gnu.org>; Sat, 25 Mar 2023 08:25:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679757921; 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=7kIarL5duj7CWFYIrKo+z+i3aj4fmRaS/vzSmSjQQfA=; b=O2NfSDCGJtQmsPYpRqmyIM6T2+hqsXmNRoi568zTmdq+iiJcu9x0/91St14VI2lCSo bEd/s6xRNLaN4+eGv+7wzc2tCytntVxvKuY5YxCkl3bVe6y4WCWQ5uj0ggFHdCF7oaIr rmVkbSvHlJI3Q1mIJ7rsqOmtptarf4p8WrMl4roON51Y9hfGCwbI5BnJTPJKp0rC5lx3 xe8gWVy3CR2jnQk4j9/GtYNZcZfAKVlOiwV4oUavH4iQ6X5lgmu2XNdYkStkJ1EMYrEW 4DfYVEnFP4Nex7vCttAsvs4YquYmQGmbBj1VchdfoSiUocmMPSCPWRqX06Z8njB0GKDe W2Hw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679757921; 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=7kIarL5duj7CWFYIrKo+z+i3aj4fmRaS/vzSmSjQQfA=; b=CjzNAblBlw171OeKaNPudOLpl+f3VwHdItqPQX6FgejN656w2FoJ9h/+/AgbF8utYl s35nmSWyzKVp0TDYnXCMalDnT2PPBwlSH6GFv8eD/Dt0Fsec17KSA+dBU3CkI38ElAgN cQmgZ8DdzyT1VVbDm9Or40ObYma3wGIrOue/D4XG0xXz+EeMx0MeP5QJDmUOWrXUNhCf TGy0Ka2K8UWaTM1udVCI2g6bfhDhOl0UaudFk5enl0siuYPwrfj1N+IjQKWqrgOgXdyF oZX3PP3luOWoiEoanVjJEYTvon9Yp8YI45H0F/DeEfXF+DLL5oM7U0FcnrXF9npfDj/J qunA== X-Gm-Message-State: AO0yUKWstrk/6QwvC2kYNsUFigoihsA6PqxtGaUWGp77REvUbpiXO/4u cg0nYlI9saGWqaAH4z6e9qIHDFSHxK4U4g== X-Google-Smtp-Source: AK7set9+4VYpYbSuUP4/ih+j7voANxnWcklOvoxi8j8VBlACtZF03/TZyO3Coo5DO4MSdJvQqr1shw== X-Received: by 2002:a05:600c:214c:b0:3ed:358e:c1ec with SMTP id v12-20020a05600c214c00b003ed358ec1ecmr4969950wml.0.1679757920617; Sat, 25 Mar 2023 08:25:20 -0700 (PDT) Original-Received: from [192.168.0.2] ([85.132.229.92]) by smtp.googlemail.com with ESMTPSA id j36-20020a05600c1c2400b003ebf73acf9asm15241868wms.3.2023.03.25.08.25.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 25 Mar 2023 08:25:20 -0700 (PDT) Content-Language: en-US In-Reply-To: <83wn34c2qa.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:258589 Archived-At: On 25/03/2023 16:41, Eli Zaretskii wrote: >> Date: Sat, 25 Mar 2023 16:18:12 +0200 >> Cc: wkirschbaum@gmail.com, casouri@gmail.com, 62333@debbugs.gnu.org >> From: Dmitry Gutov >> >>> mixed-major-mode shouldn't be a problem. >> >> Why wouldn't it? > > Because the sexp ends inside the current mode's block. But if the mmm framework narrowed the region to the current mode's block, widening will force tree-sitter to parse the whole buffer. Which might even result in parse errors (instead of meaningful parse nodes) near point. Or consider the case when the code in the current snippet is incomplete (e.g. a missing paren). Then it might find a "match" somewhere far outside. >>>> Because if we wanted to widen in all similar situations, we might as >>>> well make it not obey the narrowing at all. >>> >>> It is impossible to not obey narrowing, not in Emacs. I told that and >>> explained that many times already, including simple examples of what >>> trouble this could cause to even the most innocent Lisp code. I hoped >>> that by now this should no longer be brought forward. >> >> Okay. But do you advocate all uses of tree-sitter to (widen) first? > > No, just in sexp-movement functions, at least for now. If we discover > this is need in many more situations, we might consider more drastic > measures. But I don't think we are there yet. We've discovered just > one such case, in just one such mode, and it's on master. We still > have ample time to see how widespread this is. I'm not sure whether tree-sitter is going to be used with mmm-mode (or similar) a lot, since it has its own provisions for mixing languages. But I'd also like to consider the other cases where we *don't* want to widen first. Any of them come to mind?