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#68899: Treesitter's forward-sexp-function Date: Mon, 5 Feb 2024 23:25:02 -0800 Message-ID: References: <981BC2F8-9B7F-40AC-9C1A-C995A71F5C97@gmail.com> <3CEDAD3C-C789-49B1-B007-9764EF1A0364@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.700.6\)) 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="11697"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 68899@debbugs.gnu.org To: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Feb 06 08:26:10 2024 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 1rXFqK-0002uJ-Jl for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 06 Feb 2024 08:26:08 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rXFq9-0006Yk-P7; Tue, 06 Feb 2024 02:25:57 -0500 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 1rXFq1-0006Wz-K7 for bug-gnu-emacs@gnu.org; Tue, 06 Feb 2024 02:25:50 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rXFq1-0007Qo-6z for bug-gnu-emacs@gnu.org; Tue, 06 Feb 2024 02:25:49 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rXFqD-0002vW-RD for bug-gnu-emacs@gnu.org; Tue, 06 Feb 2024 02:26:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 06 Feb 2024 07:26:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68899 X-GNU-PR-Package: emacs Original-Received: via spool by 68899-submit@debbugs.gnu.org id=B68899.170720433611203 (code B ref 68899); Tue, 06 Feb 2024 07:26:01 +0000 Original-Received: (at 68899) by debbugs.gnu.org; 6 Feb 2024 07:25:36 +0000 Original-Received: from localhost ([127.0.0.1]:53170 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rXFpn-0002ud-SY for submit@debbugs.gnu.org; Tue, 06 Feb 2024 02:25:36 -0500 Original-Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]:51547) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rXFpl-0002uM-4V for 68899@debbugs.gnu.org; Tue, 06 Feb 2024 02:25:34 -0500 Original-Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-1d94323d547so42570125ad.3 for <68899@debbugs.gnu.org>; Mon, 05 Feb 2024 23:25:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707204314; x=1707809114; darn=debbugs.gnu.org; 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=zlWmBpLBa1oRRH7+IWKgbd3Q5NJzTl2hTvQQPZuw4Jk=; b=knKuiZcP9W/VAHbXKWRb6LngNChQ4mUa+Xc4/0EpHH3guXE9GT/b3G6Mz0kHIDIIR4 VnSfdWBjzbHHHY+XFLPOzKWP40LR3ybdELvNTOeeggVgpwrK18abNQtJw/eC2h/ZHH53 NWACqk0dXHcdm/wxCJai23b+Lk19s5zdVw7n5n9KQjfiJgjv7Ne5I93jOYBBxBCD7kEd EHR7exrCBxvxwOU7JBiEaZLv/QFJJMw6jxfw6HzFBu2rrQfjYK0YMnRtodQwTKNblRGq A5/4KqgjKwQc7bgQmk0hwlFudDuYM5mr9zRX5FmS8fz3MYvsp2u4OhX4B5ukkYMYIBGK E+8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707204314; x=1707809114; 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=zlWmBpLBa1oRRH7+IWKgbd3Q5NJzTl2hTvQQPZuw4Jk=; b=DYJENjfwDL1mRy90/v2BipltfBgIE0rgmh/tVb0I6ai59WtzDFHyuYM+hS+fUuK6jV x/jGEIOtRgiE7AhTmUMDK6vrchN/lsXaU7GckPF7r57KWres6gRhWA1VDsEfI4cISIX6 fQWxFmCa7srB4Aafk4QdgD1MMGVbhO2zaGkzShO+IS9oSSidCCxkyn+dWNqofUAbuShw EDkAgI7glsZakNpgmYsuU7ee7+r6QuUUjSCNLFhQoG+7se7KPkD2KT6ftuMPrb7W6am1 ZQjf/m7MW6DD2j000vMcQ07KoYQJikmecC3zwqr1Z1ttZGZ4DQRLLxAZevnsYMnGy360 sUYA== X-Gm-Message-State: AOJu0YzWP62hri1eWUukD+2Iq9Dq1aJOsvdHmvYZrJFMPdXbo655pL8n wmAsqjJFWK555e9rzae76Dy4i6zhWVsb0C0c03j927Q5aHHmahRW X-Google-Smtp-Source: AGHT+IEj6ZGq72OxK7jByfVmLAp/8kDTFcDMjZhDHSFSctAEj8hw/PpAeT/btrIWoqB123X9JqH+Uw== X-Received: by 2002:a17:902:e80b:b0:1d9:c8bd:3c18 with SMTP id u11-20020a170902e80b00b001d9c8bd3c18mr829652plg.54.1707204314127; Mon, 05 Feb 2024 23:25:14 -0800 (PST) Original-Received: from smtpclient.apple (172-117-161-177.res.spectrum.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id b18-20020a170903229200b001d7405022ecsm1108459plh.159.2024.02.05.23.25.13 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Feb 2024 23:25:13 -0800 (PST) In-Reply-To: X-Mailer: Apple Mail (2.3731.700.6) 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:279480 Archived-At: > On Feb 4, 2024, at 5:08 PM, Jo=C3=A3o T=C3=A1vora = wrote: >=20 > On Mon, Feb 5, 2024 at 12:50=E2=80=AFAM Yuan Fu = wrote: >=20 > > void main (void) { > > > > } >=20 > Ohhh, I didn't think about this case >=20 > > But I get you now; if we define =E2=80=9Cleaf thing=E2=80=9D as not = having any nested child thing, and we allow ourselves to move to the end = of leaf thing, then in this case we indeed should move out of the = closing bracket. I like your definition of =E2=80=9Cleaf thing=E2=80=9D = better since it=E2=80=99s more general than =E2=80=9Cleaf node=E2=80=9D, = and I like the simpler code too. > > > > So applied your patch with some comments added, thanks! >=20 > Errr... I'm very sorry, but now I think your previous patch makes more > sense -- precisely because of the above case, which now I understand > what you were arguing for. I assume your patch indeed preserves that > property of NOT leaving the braces. >=20 > I think that's also how c++-mode works (and about all other > sexp-navigation) works. >=20 > So if we could go back ~12 hours and allow me to respond positively > to your initial patch, I think that would be perfect :-) >=20 > But I _guess_ you could defend many behaviours. Maybe this "tactic" > argument should be exposed to the user in a variable. >=20 > Anyway, what there is now is already much less jarring than what there > was before. The empty body is fairly rare. >=20 > Jo=C3=A3o No sweat. The empty body is fairly rare, and the current behavior = isn=E2=80=99t annoying for empty body, I=E2=80=99d say. Consider that = treesit--navigate-thing will be used on many other things besides sexp, = a more general =E2=80=9Cleaf thing=E2=80=9D is probably better suited = for it. Yuan=