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#62333: 30.0.50; Issue with tree-sitter syntax tree during certain changes Date: Sun, 26 Mar 2023 15:52:43 -0700 Message-ID: References: <87fs9yur7r.fsf@gmail.com> <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> <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> <35322CB1-DF75-47C1-9B66-21260C437006@gmail.com> <1ef42ce9-e7a5-5a21-e4a4-f8affb45541d@yandex.ru> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.400.51.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="2797"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Wilhelm Kirschbaum , Eli Zaretskii , 62333@debbugs.gnu.org To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Mar 27 00:54:15 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 1pgZFf-0000Zj-1A for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 27 Mar 2023 00:54:15 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pgZFU-0000dS-Jg; Sun, 26 Mar 2023 18:54: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 1pgZFT-0000dG-78 for bug-gnu-emacs@gnu.org; Sun, 26 Mar 2023 18:54: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 1pgZFS-0004xw-K0 for bug-gnu-emacs@gnu.org; Sun, 26 Mar 2023 18:54:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pgZFS-00049U-5P for bug-gnu-emacs@gnu.org; Sun, 26 Mar 2023 18:54:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 26 Mar 2023 22:54:02 +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.167987118415878 (code B ref 62333); Sun, 26 Mar 2023 22:54:02 +0000 Original-Received: (at 62333) by debbugs.gnu.org; 26 Mar 2023 22:53:04 +0000 Original-Received: from localhost ([127.0.0.1]:46090 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pgZEV-000481-Jo for submit@debbugs.gnu.org; Sun, 26 Mar 2023 18:53:03 -0400 Original-Received: from mail-pj1-f54.google.com ([209.85.216.54]:54260) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pgZET-00047W-7H for 62333@debbugs.gnu.org; Sun, 26 Mar 2023 18:53:01 -0400 Original-Received: by mail-pj1-f54.google.com with SMTP id q102so6052861pjq.3 for <62333@debbugs.gnu.org>; Sun, 26 Mar 2023 15:53:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679871175; 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=XgpDxCuZWM74HrbDWsgdK3H0JVr2sAHq8ZQm7VgMF8Y=; b=CJhbLc/Uoba5odlhxbn5lj12EX/igpRic48m6DAfbMcwn/OQLgEbLT4qN4jIu3vjKi qQsk+guN3QOOHSa8LP2sl/nJhQmm5Ablbft63vxzU2nwwo/6cL5c0dVtBCw46z9gwA+1 q20/b347zanN9PsPUNeAJP5rR+fONCObp/Nqc51AFBTRyRM3juBJ7uFhxLEZv7oCOLg6 tHOgfgHhyB8yTzm9cpkArqARFLU36SM21Y1baZt6cRWhmvH9/y2HM0zyX3fmbN4nZlMD GjU2SItQxoxXCStxoLUFmDQ9Xdr7HdJt4j3p2pxtSO7aht25218p9xw0rxc5fdFUrpeb /4Mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679871175; 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=XgpDxCuZWM74HrbDWsgdK3H0JVr2sAHq8ZQm7VgMF8Y=; b=4yglU5Cuvyd0B39EZUtC7O4Zksdv/f1s5Z14jQtFNDm+g6ZZffXLvbrf00v9qTsPn1 ZTaz8CLmkg5bywpVp/A1sBuB5rCsWDzfObvtLB04aL6lpkgzfNu0GbGRkcJ3inSxUXt9 HG1DqsIIPO40gXLiPBbxsygJ89svPJUmuM4KwAN1thGM/4QZta1ggSKGObhyXW/ScMi5 x1/L3xGMeSFw/hI94/ewnOboUJpHgl7rgKZhMhOtese50rRc1azKCt0kzNQNTAhV0bAX q1l6EIMUgKTdj9i2+Wq1k9qKWIu/wucys8HBUuHz1Soy/FCWYWvCgozKewgTEQXHOA+o VO0A== X-Gm-Message-State: AAQBX9cFm3Upvgpk2J/CGz2BfMAxUNnb6imu6yurqd6AiOJ4KEMX4GaH ulDfe4TBNJ+qpL8yuGXvLfo= X-Google-Smtp-Source: AKy350YY9eqkV+0rTjJ1sBV2JXyZ5udDKh9eHb033qjGBtMv3b2olOo0yU/r5lpqs8vz4O41ybt7DQ== X-Received: by 2002:a17:902:f693:b0:1a1:d4ca:a161 with SMTP id l19-20020a170902f69300b001a1d4caa161mr12790693plg.36.1679871175057; Sun, 26 Mar 2023 15:52:55 -0700 (PDT) Original-Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id y20-20020a170902b49400b00196807b5189sm17699882plr.292.2023.03.26.15.52.54 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 26 Mar 2023 15:52:54 -0700 (PDT) In-Reply-To: <1ef42ce9-e7a5-5a21-e4a4-f8affb45541d@yandex.ru> X-Mailer: Apple Mail (2.3731.400.51.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:258704 Archived-At: > On Mar 25, 2023, at 4:29 PM, Dmitry Gutov wrote: >=20 > On 25/03/2023 21:31, Yuan Fu wrote: >> I don=E2=80=99t think we should blindly widen in tree-sitter sexp = functions, but not because of mmm-mode=E2=80=94tree-sitter ranges should = have that mostly covered. My primary concern is that what if narrowing = is intended by the caller? >=20 > Yes. >=20 >> But I don=E2=80=99t have any good idea for blink-matching right now. >=20 > show-paren-mode has show-paren-data-function (which treesit should = also plug into, I think). >=20 > Since we're looking for ad-hoc solutions, we could add a similar = extension point for blink-matching-paren. >=20 > Or even try to reuse show-paren-data-function: just specialize in a = limited number of cases - check that (nth 1 data) matches point, and = then take the elements 3,4 and perform the existing checks on them. = There might be some differences in behavior, but probably nothing some = checks using 'syntax-after' couldn't handle. Sounds good, I can work on this. This links to something I=E2=80=99ve = been working on, namely some system that allows one to map abstract = general constructs like pair, list, defun, assignment, etc, to = grammar-specific definitions like a tree-sitter node type, and = automatically construct functions accessing those information. We = already have a primitive version of it: right now if you set = treesit-defun-type-regexp, treesit-beginning/end-of-defun and = treesit-defun-at-point would just work. I want to extend it further to = allow you to get defun name, argument list, etc, and everything else I = mentioned earlier. If we can pull it off, a user only need to specify what is a pair and = how to find the matching pair according to the language grammar, and the = rest is automatic (a tree-sitter function for show-paren-data-function = and blink-matching-paren). Yuan=