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#62086: 29.0.60; ruby-ts-mode regressions Date: Fri, 14 Apr 2023 17:08:58 -0700 Message-ID: <8C5A5F3B-634F-4B2A-A5F7-7E3E26C78073@gmail.com> References: <86y1o5op2v.fsf@mail.linkov.net> <5abcf765-f8ce-9563-63aa-20c558409898@yandex.ru> <86cz4l7zjk.fsf@mail.linkov.net> <86ttxww12o.fsf@mail.linkov.net> <865yaakfs7.fsf@mail.linkov.net> <0bd5f2b8-6f0b-09d6-6240-38c742eca19f@yandex.ru> <861qkyfg8l.fsf@mail.linkov.net> <9ceb589f-9325-1607-d1b5-5fd56cb8c3ec@yandex.ru> <86y1myxsrq.fsf@mail.linkov.net> <263c2966-acff-436a-43fd-20f9da8986fb@yandex.ru> <1df48560-a14c-9414-5e9e-97b5109e4aa4@yandex.ru> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.500.231\)) 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="22739"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 62086@debbugs.gnu.org, Theodor Thornhill , Juri Linkov To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Apr 15 02:10:26 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 1pnTUn-0005lH-Ql for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 15 Apr 2023 02:10:25 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pnTUY-00021Y-9X; Fri, 14 Apr 2023 20:10:10 -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 1pnTUV-000214-4w for bug-gnu-emacs@gnu.org; Fri, 14 Apr 2023 20:10:07 -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 1pnTUQ-0000Na-R1 for bug-gnu-emacs@gnu.org; Fri, 14 Apr 2023 20:10:06 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pnTUP-00008E-SI for bug-gnu-emacs@gnu.org; Fri, 14 Apr 2023 20:10:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 15 Apr 2023 00:10:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62086 X-GNU-PR-Package: emacs Original-Received: via spool by 62086-submit@debbugs.gnu.org id=B62086.1681517358448 (code B ref 62086); Sat, 15 Apr 2023 00:10:01 +0000 Original-Received: (at 62086) by debbugs.gnu.org; 15 Apr 2023 00:09:18 +0000 Original-Received: from localhost ([127.0.0.1]:47919 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pnTTh-00007A-Pt for submit@debbugs.gnu.org; Fri, 14 Apr 2023 20:09:18 -0400 Original-Received: from mail-pf1-f176.google.com ([209.85.210.176]:52504) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pnTTg-00006q-1b for 62086@debbugs.gnu.org; Fri, 14 Apr 2023 20:09:16 -0400 Original-Received: by mail-pf1-f176.google.com with SMTP id d2e1a72fcca58-63b60366047so404339b3a.1 for <62086@debbugs.gnu.org>; Fri, 14 Apr 2023 17:09:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681517350; x=1684109350; 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=XkTGVwC30v2vb2LlqTuEYSeXmhSpZHv19aJcYV4UdtY=; b=ZYzRxxaPjxiuzuY3v4LW4p3KL+qJDGfd0AzjZNBiTbVS944qP/0TSXT5Tcm0VZMZJr s4TOjGTRB6KHwYZPt1dI5bO5E88Mz43RDtuR+SR5t2d6S6E4BdDUbFvcjoKyk3dMlM2V l5z5brrgme7uGthHld2rkmj4ckh5Dn6lFQMXMQmihkBK/VI4VGBBt5vsmEZyPYG2C0NP dca9eqocFrJZb+E46Uohg90V94SXr2PXhf+gQij1i5myCrov3LwTXJGJtzB6gB2kDDX7 NytNvfwdBEVNbaQURSggVJ73A0aPl3i2cleTqxmtwg6wAJahj/XXj1DuCX66p7rOq8l2 t5gg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681517350; x=1684109350; 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=XkTGVwC30v2vb2LlqTuEYSeXmhSpZHv19aJcYV4UdtY=; b=V6+Wau3uJVx0fLJTPoIdU8eFeVZVogcQEwHLRqq1QWprKR1kn3iKK3hXvAlneJ/Nkb 5I6hp2YAx6tHI3G2jdax3RKTWLRtnZ3H/28/3vfl/1bGxVS5PYNyOvclwR32wO0BVwCA XmPI+ow6KlkZx/bRYdUQBUkWCYCP9IFYSE1cdSvpNPgLNFLAlnabSRVDL1/P+3MQKEEE AC38q7zXTd5/hqpoIu0atvyhp7uG691bDgVpBKUp0hYaW81PssiuQpcBdI1Ac9zV6U4F Zt2/0pOsFY32tgF4NJQ/xGlOjDXP9Q+/iIDLhriS4qMwj//BYCI/1VXVBU8tAdJ3YzPA YaHA== X-Gm-Message-State: AAQBX9fJqWHQNs1ktcVU+K1twcH2YWMdrgwszGr4pfLj/9mLjwpst5g7 OfGNYkPvDD2KJuBnui4p3ko= X-Google-Smtp-Source: AKy350ZJowD5w4uUcg/0kDbAStT584w+w1C7hdlFq+fBNA0I+o/C7VzlfO23Mp+5OMof9u4rmW5a0w== X-Received: by 2002:a05:6a00:1587:b0:635:cfa6:ee5d with SMTP id u7-20020a056a00158700b00635cfa6ee5dmr11964276pfk.7.1681517350015; Fri, 14 Apr 2023 17:09:10 -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 j8-20020aa78008000000b0062e00158bf3sm3669262pfi.175.2023.04.14.17.09.09 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Apr 2023 17:09:09 -0700 (PDT) In-Reply-To: X-Mailer: Apple Mail (2.3731.500.231) 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:259989 Archived-At: > On Apr 12, 2023, at 3:11 PM, Yuan Fu wrote: >=20 >=20 >=20 >> On Apr 12, 2023, at 2:56 PM, Dmitry Gutov wrote: >>=20 >> On 13/04/2023 00:50, Yuan Fu wrote: >>>> On Apr 12, 2023, at 1:13 PM, Dmitry Gutov wrote: >>>>=20 >>>> On 12/04/2023 18:31, Dmitry Gutov wrote: >>>>> On 12/04/2023 10:05, Yuan Fu wrote: >>>>>> Actually, would it make sense to define sexp as =E2=80=9Canything = but some very small punctuation and delimiters=E2=80=9D? >>>>> Pretty much. If I understood you correctly. >>>>> E.g. in ruby-ts-mode identifiers and numbers are also sexps. >>>>=20 >>>> Allow me to update that. >>>>=20 >>>> =46rom the previous threads, for ruby-ts-mode at least, we seem to = have concluded that it's best to treat those nodes as sexps which have = visible boundaries that are visible and don't overlay exactly the = boundaries of the contained nodes. >>>>=20 >>>> For example, we now exclude statement nodes and binary expression = nodes because both make forward/backward-sexp less obvious and = predictable: you move point to the beginning of 'a + b', press C-M-f, = and if the jump happens over the whole expression, this is just as = likely to mismatch the user's intention (which might have wanted to only = jump over 'a'). So these are the node we rule out. >>> User might as well want to move over the whole expression, since = they can use forward-word if they want to move over smaller elements. = But I guess that=E2=80=99s just personal preferences. >>=20 >> forward-word works for minor elements, but the sub-expression can be, = for example, a parenthesized expression (with "real" parens). >>=20 >> It's definitely something that can be discussed, but the above = guideline seems to me like something that puts the user more in control. = Because as handy jumping over statements can be, it's usually not what = one is trying to do. >>=20 >>>> The easiest choice would be to go back to treating only = braces/brackets/parens are sexp delimiters, but in Ruby, at least, we = have lots of constructs that are delimited with keywords (such as 'if', = 'def', 'end'), so that doesn't work. Maybe it'll work better in C/C++, = where you mostly need to be able to differentiate between different = types of angle brackets. >>> To clarify, my point is to define sexp by exclusion rather than = inclusion, ie, defining a set of nodes that are not sexp, rather than = defining a set of nodes that are sexp. I mentioned delimiters because = they are excluded from sexp, not because they delimit sexp. >>=20 >> Yes, that can work. Only when the excluded type names a one-char = long, though, because Elisp has no lookahead. In ruby-ts-mode there are = longer excluded types. >=20 > Actually, I=E2=80=99m working on extending the =E2=80=9Cpattern=E2=80=9D= treesit-search-forward and friends can accept. Right now it has to be a = regexp or a pred function. I plan to extend it to regexp | function | = (regexp . function) | (or =E2=80=A6) | (not =E2=80=A6) = | (verbatim string) >=20 > I=E2=80=99m not yet sure about the performance implication of the = recursive patterns (or and not). And I=E2=80=99m not sure if verbatim is = necessary, but I guess having it wouldn=E2=80=99t hurt. >=20 > Yuan Ok, I added experimental support for those patterns (except for = verbatim) and a central place to define things: treesit-thing-settings. = If you define a =E2=80=98block in treesit-thing-settings, you can use = =E2=80=98block for treesit-thing-at-point, treesit-beginning-of-thing, = etc. Yuan=