Yuan Fu <casouri@HIDDEN>
to control <at> debbugs.gnu.org
.
Full text available.Received: (at 68899) by debbugs.gnu.org; 6 Feb 2024 07:25:36 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Tue Feb 06 02:25:36 2024 Received: from localhost ([127.0.0.1]:53170 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1rXFpn-0002ud-SY for submit <at> debbugs.gnu.org; Tue, 06 Feb 2024 02:25:36 -0500 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 <casouri@HIDDEN>) id 1rXFpl-0002uM-4V for 68899 <at> debbugs.gnu.org; Tue, 06 Feb 2024 02:25:34 -0500 Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-1d94323d547so42570125ad.3 for <68899 <at> 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) 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) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.700.6\)) Subject: Re: bug#68899: Treesitter's forward-sexp-function From: Yuan Fu <casouri@HIDDEN> In-Reply-To: <CALDnm50nKe_YeMpbGVNDq4BBGmZ-rGX3Jj5gHCq+3vTknWL3pQ@HIDDEN> Date: Mon, 5 Feb 2024 23:25:02 -0800 Content-Transfer-Encoding: quoted-printable Message-Id: <C4F495E0-D37E-41AD-B408-540591AE9A10@HIDDEN> References: <CALDnm52ZbRaafVWXnWuUUoE01noSRUFcLem7XT_LCJ17qpP3ng@HIDDEN> <CALDnm52eCpuiaiwxNGGVVDJdJ1xW+oe4_mw3PDxjoqHW7TcNZA@HIDDEN> <CALDnm51bdpzdLjktDUFwsiBS8Mp5-QgJeetV-qZj2TZMnjKqQg@HIDDEN> <981BC2F8-9B7F-40AC-9C1A-C995A71F5C97@HIDDEN> <CALDnm51ndjVhmAFDi77e3nxPDeAiKiUok5v-n1GU4RPgYm0X2g@HIDDEN> <3CEDAD3C-C789-49B1-B007-9764EF1A0364@HIDDEN> <CALDnm50nKe_YeMpbGVNDq4BBGmZ-rGX3Jj5gHCq+3vTknWL3pQ@HIDDEN> To: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN> X-Mailer: Apple Mail (2.3731.700.6) X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 68899 Cc: 68899 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) > On Feb 4, 2024, at 5:08 PM, Jo=C3=A3o T=C3=A1vora = <joaotavora@HIDDEN> wrote: >=20 > On Mon, Feb 5, 2024 at 12:50=E2=80=AFAM Yuan Fu <casouri@HIDDEN> = wrote: >=20 > > void main (void) { > > <point> > > }<will move to here> >=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=
bug-gnu-emacs@HIDDEN
:bug#68899
; Package emacs
.
Full text available.Received: (at 68899) by debbugs.gnu.org; 5 Feb 2024 01:09:18 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Feb 04 20:09:18 2024 Received: from localhost ([127.0.0.1]:50293 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1rWnU5-0004Pa-OW for submit <at> debbugs.gnu.org; Sun, 04 Feb 2024 20:09:18 -0500 Received: from mail-lf1-x135.google.com ([2a00:1450:4864:20::135]:60442) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <joaotavora@HIDDEN>) id 1rWnU0-0004PJ-BM for 68899 <at> debbugs.gnu.org; Sun, 04 Feb 2024 20:09:15 -0500 Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-5113303e664so3842311e87.0 for <68899 <at> debbugs.gnu.org>; Sun, 04 Feb 2024 17:08:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707095334; x=1707700134; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=LS/S/l4niro/jJDftpjDM0cjDHd4TApuIW4E+9P9lt4=; b=eW97X2f1FJ2oeIMwTrIStIWAJACKy60ZfxE7zT1932oP8SFj/rQrD2R/4eYZZDykJv 8/1spKqKbEWXjKbBhqgsXQgnsUPCl4BNNDjiovtVolh3VwjrqjdjzUQlKIrmnELT4tf/ T+1N3KGhcjJlJXRxdfeq9601uj+bcw70CUVlhnTHUZW7GtbOaSMAY+VJJfJ8eXB49i4A ZIiTX2rhcFJcqRa3MJd9CHX1/AW6Yhu7cQPWkHCgvs3vT0WBj8V4pcsDIoInz/kohCkH dPy3+XG9WJLsYHG4pGCeDItanxZEiKLWj3vdC+JcKgTBk09YcUFp/pRIrkrYmkC1FC2X 8SEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707095334; x=1707700134; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=LS/S/l4niro/jJDftpjDM0cjDHd4TApuIW4E+9P9lt4=; b=jdgxZVeg4qUMWs6ZgbfLCk1SC1SYYEq9sLTvDrMpUCTmIyKkZfW7A1Y7IjqGMcWX8m 841gthDYGYYVDsyy/6qhlhwwW+XEUJ2aw/nsDxNfThxfpp/2pnxay3D34xl4U9sxTb9F nT0tbryHng1JbcTkuCS6A3dP5o6xIupd7NTQUXbqTSu9CWiMcYeVqyHen0OaMtNzYdn8 a7Ny6f1IkyFPdUGfJBWxdHa78oecY1GmrbbVfQY2dRjKj7kc1PLSt5OJ4l6CkPZQ9FE7 btCv/d1luRXxF8Kq+nrl21F0B9pCs1W4nxitn5x17Fpt8es59NBH4hoFblAOT+8pUi3j oVOg== X-Gm-Message-State: AOJu0YzU/c4OACfhKrYtxKmpn5eTd3xRkWja6lTfO+uiZgQbsqwmGlZ9 E1FyE8LYMXtKxstwU9KcVQtMAnJOI4dPjJN4KeRDonB5F6dGrpxnA6IX0rPCtYldfevWbltJxgG QES9VOCJ3XJDGFqdogQfkGf9VNJ8= X-Google-Smtp-Source: AGHT+IH1HOAa/pfF7mI062UQQtTlfGLppup51m2v47JyJaRJYXdl2THLiC4Sewc323qX+JTR3sPe5joPGiLbazSDQok= X-Received: by 2002:a05:6512:45a:b0:511:46f4:619b with SMTP id y26-20020a056512045a00b0051146f4619bmr2741845lfk.22.1707095333690; Sun, 04 Feb 2024 17:08:53 -0800 (PST) MIME-Version: 1.0 References: <CALDnm52ZbRaafVWXnWuUUoE01noSRUFcLem7XT_LCJ17qpP3ng@HIDDEN> <CALDnm52eCpuiaiwxNGGVVDJdJ1xW+oe4_mw3PDxjoqHW7TcNZA@HIDDEN> <CALDnm51bdpzdLjktDUFwsiBS8Mp5-QgJeetV-qZj2TZMnjKqQg@HIDDEN> <981BC2F8-9B7F-40AC-9C1A-C995A71F5C97@HIDDEN> <CALDnm51ndjVhmAFDi77e3nxPDeAiKiUok5v-n1GU4RPgYm0X2g@HIDDEN> <3CEDAD3C-C789-49B1-B007-9764EF1A0364@HIDDEN> In-Reply-To: <3CEDAD3C-C789-49B1-B007-9764EF1A0364@HIDDEN> From: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN> Date: Mon, 5 Feb 2024 01:08:51 +0000 Message-ID: <CALDnm50nKe_YeMpbGVNDq4BBGmZ-rGX3Jj5gHCq+3vTknWL3pQ@HIDDEN> Subject: Re: bug#68899: Treesitter's forward-sexp-function To: Yuan Fu <casouri@HIDDEN> Content-Type: multipart/alternative; boundary="000000000000f6628b0610981a60" X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 68899 Cc: 68899 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) --000000000000f6628b0610981a60 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Feb 5, 2024 at 12:50=E2=80=AFAM Yuan Fu <casouri@HIDDEN> wrote: > void main (void) { > <point> > }<will move to here> Ohhh, I didn't think about this case > But I get you now; if we define =E2=80=9Cleaf thing=E2=80=9D as not havin= g 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 g= eneral than =E2=80=9Cleaf node=E2=80=9D, and I like the simpler code too. > > So applied your patch with some comments added, thanks! 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. I think that's also how c++-mode works (and about all other sexp-navigation) works. So if we could go back ~12 hours and allow me to respond positively to your initial patch, I think that would be perfect :-) But I _guess_ you could defend many behaviours. Maybe this "tactic" argument should be exposed to the user in a variable. Anyway, what there is now is already much less jarring than what there was before. The empty body is fairly rare. Jo=C3=A3o --000000000000f6628b0610981a60 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr">On Mon, Feb 5, 2024 at 12:50=E2=80=AFAM Yuan Fu <<a hre= f=3D"mailto:casouri@HIDDEN">casouri@HIDDEN</a>> wrote:<br><br>>= void main (void) {<br>> =C2=A0 <point><br>> }<will move to = here><br><br>Ohhh, I didn't think about this case<br><br>> But I = get you now; if we define =E2=80=9Cleaf thing=E2=80=9D as not having any ne= sted 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 m= ore general than =E2=80=9Cleaf node=E2=80=9D, and I like the simpler code t= oo.<br>><br>> So applied your patch with some comments added, thanks!= <br><br>Errr... I'm very sorry, but now I think your previous patch mak= es more<br>sense -- precisely because of the above case, which now I unders= tand<br>what you were arguing for.=C2=A0 I assume your patch indeed preserv= es that<br>property of NOT leaving the braces.<br><br>I think that's al= so how c++-mode works (and about all other<br><div>sexp-navigation) works.<= /div><div><br></div><div>So if we could go back ~12 hours and allow me to r= espond positively</div><div>to your initial patch, I think that would be pe= rfect :-)<br></div><br>But I _guess_ you could defend many behaviours.=C2= =A0 Maybe this "tactic"<br>argument should be exposed to the user= in a variable.<br><br>Anyway, what there is now is already much less jarri= ng than what there<br><div>was before.=C2=A0 The empty body is fairly rare.= </div><div><br></div><div>Jo=C3=A3o<br></div></div> --000000000000f6628b0610981a60--
bug-gnu-emacs@HIDDEN
:bug#68899
; Package emacs
.
Full text available.Received: (at 68899) by debbugs.gnu.org; 5 Feb 2024 00:51:04 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Feb 04 19:51:04 2024 Received: from localhost ([127.0.0.1]:50285 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1rWnCR-0003zi-Lx for submit <at> debbugs.gnu.org; Sun, 04 Feb 2024 19:51:04 -0500 Received: from mail-oa1-x29.google.com ([2001:4860:4864:20::29]:47147) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <casouri@HIDDEN>) id 1rWnCN-0003z8-D3 for 68899 <at> debbugs.gnu.org; Sun, 04 Feb 2024 19:51:02 -0500 Received: by mail-oa1-x29.google.com with SMTP id 586e51a60fabf-2196dd318feso706510fac.2 for <68899 <at> debbugs.gnu.org>; Sun, 04 Feb 2024 16:50:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707094241; x=1707699041; 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=ooCD9nDpR5i7LQ/M/mYslH1LcLVpqH2knidtwVqvhws=; b=XkbmLFrOZ2oOqIMX6kqmks9CxHdP4hPiQukXABKdX13xPLN+Qyyn753m+Nn1FJ/xzF HAi0sbWPTDblnobIjwlEA+eoXLJO+Dpu63jZUSxYnivbGjgCUJ7epWGRJzW9hM+pvccd xM8GewGOuWbWBJuzoPblRDnf937IaVO/9CkEZ9Zx2/vl8gLA+KoO+8OD6r91F3kYuuQf D8GZCg6qqzpiCw7n6FJiHgtSzfcGNDCkb281mUCcWTBq2JqgBozyY3ph2YzRNUz6e6w8 nyEv72zvcnRzSQPM8+KmXDs18xOBBew8IXTkC/bGtRusJ+AxN6NHoKYqMvc4uDYuFHov USuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707094241; x=1707699041; 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=ooCD9nDpR5i7LQ/M/mYslH1LcLVpqH2knidtwVqvhws=; b=RnUhGwwblQdtZbgA9N3DsocYZSgmOkd8xoF8FP2doKUawDMRAReXlNuBWFwORKHVef /lr7tfW6ZO/EftSk+vN6fLVo+jsVU3vhZqo/+8w2zFatw60KVMGrmq5lSd/gWYhcyL/4 /RBWgwYVaMUdbhqIegY/Wt0r9U+OmrEcNs2YCvGVfrJTux02xWqi05EhNEuY9IL0uY9n epcSZYgCrK78Qh8LZ69bQ/wST+SAYtcx8jXvMmrZWyWxiUALSsV0TmoMkoqi1SBuuE4E Wk3nB0V49+H7aQ/fZwTjy8purG5cw3dHIxueX11criqxL+MmmpYr7yKBrCiL5OTVxlCc vSWw== X-Gm-Message-State: AOJu0YybwHNA+WVcckdogYWbtZ0UW7eMNtwTTjPuN+GiVj/xJlUBEgPp 92IFsJdFmPRDF6tHIS4WAh1bOM/p3s0jJkJgKlG16UroU5GC38N5 X-Google-Smtp-Source: AGHT+IEimmTTzNLiQ5MnvSk+GveypcrNXsTdlmyT0q2mgWiRgSBdbR/+8Jhk0LfyrrDGMLMdO7v1vw== X-Received: by 2002:a05:6870:8a14:b0:219:8d3b:f83c with SMTP id p20-20020a0568708a1400b002198d3bf83cmr812247oaq.50.1707094241068; Sun, 04 Feb 2024 16:50:41 -0800 (PST) Received: from smtpclient.apple (172-117-161-177.res.spectrum.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id r22-20020a635156000000b005d651d4236dsm5699457pgl.86.2024.02.04.16.50.40 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 04 Feb 2024 16:50:40 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.700.6\)) Subject: Re: bug#68899: Treesitter's forward-sexp-function From: Yuan Fu <casouri@HIDDEN> In-Reply-To: <CALDnm51ndjVhmAFDi77e3nxPDeAiKiUok5v-n1GU4RPgYm0X2g@HIDDEN> Date: Sun, 4 Feb 2024 16:50:28 -0800 Content-Transfer-Encoding: quoted-printable Message-Id: <3CEDAD3C-C789-49B1-B007-9764EF1A0364@HIDDEN> References: <CALDnm52ZbRaafVWXnWuUUoE01noSRUFcLem7XT_LCJ17qpP3ng@HIDDEN> <CALDnm52eCpuiaiwxNGGVVDJdJ1xW+oe4_mw3PDxjoqHW7TcNZA@HIDDEN> <CALDnm51bdpzdLjktDUFwsiBS8Mp5-QgJeetV-qZj2TZMnjKqQg@HIDDEN> <981BC2F8-9B7F-40AC-9C1A-C995A71F5C97@HIDDEN> <CALDnm51ndjVhmAFDi77e3nxPDeAiKiUok5v-n1GU4RPgYm0X2g@HIDDEN> To: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN> X-Mailer: Apple Mail (2.3731.700.6) X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 68899 Cc: 68899 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) > On Feb 4, 2024, at 4:40 AM, Jo=C3=A3o T=C3=A1vora = <joaotavora@HIDDEN> wrote: >=20 > On Sun, Feb 4, 2024 at 5:35=E2=80=AFAM Yuan Fu <casouri@HIDDEN> = wrote: >=20 >> Thanks for looking into this, Joao. IME a very useful characteristic = of forward-sexp is that it stays in the same =E2=80=9Clevel=E2=80=9D and = doesn=E2=80=99t go up automatically when there=E2=80=99s no siblings = (when there=E2=80=99s a closing delimiter). Eg, in an Elisp buffer, = forward-sexp stops at the closing parenthesis, in C, it should stop at = the closing bracket. >=20 > I agree. There are other useful characteristics, but this is one of = them. > It allows be to mark regions of text up to points that I'm not even = seeing. >=20 >> Also you don=E2=80=99t want to check for prev when moving forward, = and vice >> versa, ie, we don=E2=80=99t want to check (null next) and (null prev) = together. >=20 > I get it. I used those existing results as a proxy to know if we're > in the middle > of a leaf. I _think_ it's sound (maybe I'm wrong). >=20 >> So, how do you like this patch: >=20 > It works fine, but as far as I can tell does exactly the same as mine, = and > looks to be slightly more difficult to read and uses a further treesit > query to check if this is a leaf node. But it's absolutley fine = really. >=20 > One way my patch can be described in plain english is > "if we're not at an inter-thing boundary, we navigate to such = boundary" > And then the meaning of checking prev _and_ next becomes obvious > and it isn't necessary to perform the additional check that we're in a > leaf node. >=20 > So go ahead and push whichever patch you prefer, and thanks. >=20 > Jo=C3=A3o Initially I was worried about the case below: void main (void) { <point> }<will move to here> 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! Yuan=
bug-gnu-emacs@HIDDEN
:bug#68899
; Package emacs
.
Full text available.Received: (at 68899) by debbugs.gnu.org; 4 Feb 2024 12:40:59 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Feb 04 07:40:58 2024 Received: from localhost ([127.0.0.1]:48290 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1rWbnt-0006p8-LV for submit <at> debbugs.gnu.org; Sun, 04 Feb 2024 07:40:58 -0500 Received: from mail-io1-xd2d.google.com ([2607:f8b0:4864:20::d2d]:46128) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <joaotavora@HIDDEN>) id 1rWbnr-0006oi-Jz for 68899 <at> debbugs.gnu.org; Sun, 04 Feb 2024 07:40:56 -0500 Received: by mail-io1-xd2d.google.com with SMTP id ca18e2360f4ac-7bf2c826a5aso156053539f.0 for <68899 <at> debbugs.gnu.org>; Sun, 04 Feb 2024 04:40:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707050437; x=1707655237; darn=debbugs.gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=lMKdl9AfqNp3N29pz90ic3IxW6lTlmegKu+9EZL3ros=; b=TBcvyiZHaCAxUInLmtweI1rpc6PE8GWm8hVQj3TDCKclpjyU9blp2WHjKbEZKWDLsM b//GWMd9YiSgVm9iefyPgNI8T5k0splf+3ZJpZQ3cCNFeHmnlB1PDkrHVQ4xO1qM9apR CRmgn5/WX7ivAARX+THoOGJhqKjCiOMAOcts8ZHFikzfAJN+DhEWiNXUu/+Ie9SPIwt4 ZNjTakHoGIvFzchKRfqi6h+LUNXkRR+Jhhg7Jp9h+27P0eGt2/MYekTQW7K+L2BqGbJ2 2Zl71mntYLSHtf/au9uI14zla4W9V6nbkTSmoFeTu9mCw2HdIk+fnwRHH84MtCgj2Q5l 2VGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707050437; x=1707655237; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lMKdl9AfqNp3N29pz90ic3IxW6lTlmegKu+9EZL3ros=; b=tnh7GBxw4OlLRUBLId7q6cTihO2frUVBukxtFoVmvnOgjeTmwYTKn36rdjKm16HG21 Nu8FVPuXzw8vuD5txoXGRyOquUCUqQ0wYZ4nAmqW03hDo1TnYBvZ4xkIWupM7YEkwt+q f2VUvh/kVlXZDJTl3ktPGncFFMeo7CwY/aUSBd8YPN52+CMK+SAEoIDH355M4s7YBtej anWm8Kdm0sezEfPTMbDPsrugGWbEkYQGICzAMuVBlNvulNBYiFafVdghSxjirh8MTOMP UKXh4BeZlSHZUjB7JF/VbIXIwRxqDHHpH33V1Ft9k+BuG2rHKvSjB8KzfVkz9lpvaLYa 7BiQ== X-Gm-Message-State: AOJu0YzXsq5RgAJbmug0LoWHGsJuRclO39YP5+eb/V6hnxTBGJBgWlfB VaDT0hs2Q5gTwu68w3vUBj6mCSvKowXprM+M776L5+T7YpPAeyleUyi6Ed0wa4ofaymjXd8goKv DiXycGQEg0kaQMRv+XB44I/WaWpQ= X-Google-Smtp-Source: AGHT+IFfnlbq6w/Am+BdsYkGxMIR7cSs8f1DvHJGp3F4VpZhRM3R3G9F+htTEHHWPlt/izscC9CnB/0bDEJuaJDBARQ= X-Received: by 2002:a6b:ec04:0:b0:7c3:dd3b:5e85 with SMTP id c4-20020a6bec04000000b007c3dd3b5e85mr698894ioh.1.1707050437592; Sun, 04 Feb 2024 04:40:37 -0800 (PST) MIME-Version: 1.0 References: <CALDnm52ZbRaafVWXnWuUUoE01noSRUFcLem7XT_LCJ17qpP3ng@HIDDEN> <CALDnm52eCpuiaiwxNGGVVDJdJ1xW+oe4_mw3PDxjoqHW7TcNZA@HIDDEN> <CALDnm51bdpzdLjktDUFwsiBS8Mp5-QgJeetV-qZj2TZMnjKqQg@HIDDEN> <981BC2F8-9B7F-40AC-9C1A-C995A71F5C97@HIDDEN> In-Reply-To: <981BC2F8-9B7F-40AC-9C1A-C995A71F5C97@HIDDEN> From: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN> Date: Sun, 4 Feb 2024 12:40:33 +0000 Message-ID: <CALDnm51ndjVhmAFDi77e3nxPDeAiKiUok5v-n1GU4RPgYm0X2g@HIDDEN> Subject: Re: bug#68899: Treesitter's forward-sexp-function To: Yuan Fu <casouri@HIDDEN> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 68899 Cc: 68899 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) On Sun, Feb 4, 2024 at 5:35=E2=80=AFAM Yuan Fu <casouri@HIDDEN> wrote: > Thanks for looking into this, Joao. IME a very useful characteristic of f= orward-sexp is that it stays in the same =E2=80=9Clevel=E2=80=9D and doesn= =E2=80=99t go up automatically when there=E2=80=99s no siblings (when there= =E2=80=99s a closing delimiter). Eg, in an Elisp buffer, forward-sexp stops= at the closing parenthesis, in C, it should stop at the closing bracket. I agree. There are other useful characteristics, but this is one of them. It allows be to mark regions of text up to points that I'm not even seeing. > Also you don=E2=80=99t want to check for prev when moving forward, and vi= ce > versa, ie, we don=E2=80=99t want to check (null next) and (null prev) tog= ether. I get it. I used those existing results as a proxy to know if we're in the middle of a leaf. I _think_ it's sound (maybe I'm wrong). > So, how do you like this patch: It works fine, but as far as I can tell does exactly the same as mine, and looks to be slightly more difficult to read and uses a further treesit query to check if this is a leaf node. But it's absolutley fine really. One way my patch can be described in plain english is "if we're not at an inter-thing boundary, we navigate to such boundary" And then the meaning of checking prev _and_ next becomes obvious and it isn't necessary to perform the additional check that we're in a leaf node. So go ahead and push whichever patch you prefer, and thanks. Jo=C3=A3o
bug-gnu-emacs@HIDDEN
:bug#68899
; Package emacs
.
Full text available.Received: (at 68899) by debbugs.gnu.org; 4 Feb 2024 05:35:32 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Feb 04 00:35:32 2024 Received: from localhost ([127.0.0.1]:48051 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1rWVAB-0003VE-OA for submit <at> debbugs.gnu.org; Sun, 04 Feb 2024 00:35:32 -0500 Received: from mail-oi1-x22e.google.com ([2607:f8b0:4864:20::22e]:60425) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <casouri@HIDDEN>) id 1rWVAA-0003V1-0V for 68899 <at> debbugs.gnu.org; Sun, 04 Feb 2024 00:35:30 -0500 Received: by mail-oi1-x22e.google.com with SMTP id 5614622812f47-3bba50cd318so2884280b6e.0 for <68899 <at> debbugs.gnu.org>; Sat, 03 Feb 2024 21:35:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707024912; x=1707629712; darn=debbugs.gnu.org; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:from:to:cc:subject:date:message-id:reply-to; bh=BADZerMJY7xRXhef2T/iE6A72mg2U5q+P9GgBSVw4Eo=; b=k00m35SmYmOoJ4533cd/KNQmeOYpdJVjCmPtTfQFgPqQ39ePI3oo4QR1H4VV+GZrpF a8KutTBtI9XxKOsDjSfW0RjLJDmE1A7rgwRhm+oaro/iSpCHAAerUw1+1WrlF2Idf2Ae XGTaldLbkbd8/SFYCEbab5LVc3Z/h6wfS/yPHm2wLDX/gUbEqEKFm3dl9mdSGKK06g4Z FW4fMl2DfGW4a8JvvkNuqjRZPOlgTUQx2p1vrYowGqAsnDPvSwrOqgAqKe3pVQ8sB/0x JJ4CBlG3SS0BbG0VhMVZNmobiWUJe80Qg3P5CFXRGRX23kSAstQdgFICuPOgkMWiiV0M NyRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707024912; x=1707629712; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=BADZerMJY7xRXhef2T/iE6A72mg2U5q+P9GgBSVw4Eo=; b=Frp6ErjmOOVb8Uk2Vfub8ytr4Qzp1X9j/lQ/wgjWb4zAqMvEfgaTfqZaMADTDlQN8o Nu4vT+21+YrBgOt4UDupuVG2lxrgyST6b2MvlX+FGQz/VHMQiMpYct4ahxWUlLnBcjes 4rK3qAPieFF67jB5c9v+/3CxXg3ZNO/Z7VVCVMg+9wdVMAOrA65TeVsN2qWHCSIH7byd RpkYNaTsD6nZ5ralRfWlglYnt2nhuRwA01lM7IKwFVOt9EQZJDI5XF2ChDLC67rU2kho i3bOk8+SfifCnIpFGokmcHKMapate3dRsU9/wcQWMzO8E1znahOKqR/jg2O9NBtAcaDm WOGA== X-Gm-Message-State: AOJu0YzQyUuolbwH9WvIxarPd55ynRFNkRk8zMg5A4pSx191D1zoPUH+ YfFFVmFq3+XJoHKUMVV2rgT5xRKq1SYfCPY8IB0XjIzMMGich3oE X-Google-Smtp-Source: AGHT+IEz45gjUj7IxRvdtfTcf2adv53j0R3GyQwzIl2GMIXwN5Xfog1F6Ra1g4nLF9z9u1Pu7chalg== X-Received: by 2002:a05:6808:1a8c:b0:3be:5d77:cfa7 with SMTP id bm12-20020a0568081a8c00b003be5d77cfa7mr12894132oib.1.1707024912208; Sat, 03 Feb 2024 21:35:12 -0800 (PST) Received: from smtpclient.apple (172-117-161-177.res.spectrum.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id j17-20020a170902c3d100b001d92f2129dasm3962663plj.233.2024.02.03.21.35.11 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 03 Feb 2024 21:35:11 -0800 (PST) From: Yuan Fu <casouri@HIDDEN> Message-Id: <981BC2F8-9B7F-40AC-9C1A-C995A71F5C97@HIDDEN> Content-Type: multipart/mixed; boundary="Apple-Mail=_930FBEFD-7B64-4765-B372-875E9588D84D" Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.700.6\)) Subject: Re: bug#68899: Treesitter's forward-sexp-function Date: Sat, 3 Feb 2024 21:35:00 -0800 In-Reply-To: <CALDnm51bdpzdLjktDUFwsiBS8Mp5-QgJeetV-qZj2TZMnjKqQg@HIDDEN> To: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN> References: <CALDnm52ZbRaafVWXnWuUUoE01noSRUFcLem7XT_LCJ17qpP3ng@HIDDEN> <CALDnm52eCpuiaiwxNGGVVDJdJ1xW+oe4_mw3PDxjoqHW7TcNZA@HIDDEN> <CALDnm51bdpzdLjktDUFwsiBS8Mp5-QgJeetV-qZj2TZMnjKqQg@HIDDEN> X-Mailer: Apple Mail (2.3731.700.6) X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 68899 Cc: 68899 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) --Apple-Mail=_930FBEFD-7B64-4765-B372-875E9588D84D Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Feb 2, 2024, at 4:57 PM, Jo=C3=A3o T=C3=A1vora = <joaotavora@HIDDEN> wrote: >=20 > On Sat, Feb 3, 2024 at 12:42=E2=80=AFAM Jo=C3=A3o T=C3=A1vora = <joaotavora@HIDDEN> wrote: >=20 > > > This doesn't seem to break tests, assuming it's not in these 3 = there > > > were skipped because I don't have the grammar installed. > > > > Despite that, I think it's still wrong :-/ Now it moves too much, > > i.e. it never stops moving. >=20 > This looks more promising. Works well in my tests. >=20 > diff --git a/lisp/treesit.el b/lisp/treesit.el > index c6b9d8ff4bc..cad7497fb74 100644 > --- a/lisp/treesit.el > +++ b/lisp/treesit.el > @@ -2579,9 +2579,12 @@ treesit--navigate-thing > (setq parent (treesit-node-top-level parent thing t) > prev nil > next nil)) > - ;; If TACTIC is `restricted', the implementation is very = simple. > + ;; If TACTIC is `restricted', the implementation is = reasonably simple. > (if (eq tactic 'restricted) > - (setq pos (funcall advance (if (> arg 0) next prev))) > + (setq pos (funcall advance (cond ((and (null next) = (null prev)) > + parent) > + ((> arg 0) next) > + (t prev)))) > ;; For `nested', it's a bit more work: > ;; Move... > (if (> arg 0) Thanks for looking into this, Joao. IME a very useful characteristic of = forward-sexp is that it stays in the same =E2=80=9Clevel=E2=80=9D and = doesn=E2=80=99t go up automatically when there=E2=80=99s no siblings = (when there=E2=80=99s a closing delimiter). Eg, in an Elisp buffer, = forward-sexp stops at the closing parenthesis, in C, it should stop at = the closing bracket. Also you don=E2=80=99t want to check for prev when moving forward, and = vice versa, ie, we don=E2=80=99t want to check (null next) and (null = prev) together. So, how do you like this patch: Yuan --Apple-Mail=_930FBEFD-7B64-4765-B372-875E9588D84D Content-Disposition: attachment; filename=forward-sexp.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="forward-sexp.patch" Content-Transfer-Encoding: quoted-printable =46rom=200afe667244caba04f061270cd2fc052ff6021130=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20Yuan=20Fu=20<casouri@HIDDEN>=0ADate:=20Sat,=20= 3=20Feb=202024=2021:24:29=20-0800=0ASubject:=20[PATCH]=20Improve=20= treesit-forward-sexp=20behavior=20for=20leaf=20nodes=0A=20(bug#68899)=0A=0A= treesit-forward-sexp=20uses=20treesit--navigate-thing=20with=20= 'restricted'=0Atactic.=20=20In=20this=20tactic=20we=20don't=20move=20= over=20the=20parent=20thing.=20=20However,=0Athis=20makes=20forward-sexp=20= useless=20for=20symbols=20when=20point=20is=20in=20the=0Asymbol=20rather=20= than=20at=20the=20beginning=20of=20it:=20in=20that=20case,=20the=20= symbol=20is=0Aconsidered=20parent=20and=20treesit-forward-sexp=20won't=20= move=20to=20the=20end=20of=0Ait.=0A=0ATo=20solve=20that,=20we=20allow=20= to=20move=20across=20the=20parent=20even=20in=20'restricted'=0Amode=20if=20= the=20parent=20is=20a=20leaf=20node.=0A=0AHere,=20"leaf=20node"=20is=20= defined=20as=20"doesn't=20have=20named=20child=20node",=20i.e.,=0Aif=20= the=20node=20has=20only=20anonymous=20child=20nodes,=20it's=20still=20= considered=20a=0Aleaf=20node.=20=20I=20don't=20know=20how=20useful=20= this=20heuristic=20is,=20but=20it=20feels=0Alike=20a=20good=20idea.=0A=0A= *=20lisp/treesit.el=20(treesit--navigate-thing):=20Move=20over=20parent=20= in=0A'restricted'=20tactic=20if=20the=20parent=20is=20a=20leaf=20node.=0A= ---=0A=20lisp/treesit.el=20|=2016=20++++++++++++++--=0A=201=20file=20= changed,=2014=20insertions(+),=202=20deletions(-)=0A=0Adiff=20--git=20= a/lisp/treesit.el=20b/lisp/treesit.el=0Aindex=20fab2ddd88e6..bf6b8dffde4=20= 100644=0A---=20a/lisp/treesit.el=0A+++=20b/lisp/treesit.el=0A@@=20= -2662,9=20+2662,21=20@@=20treesit--navigate-thing=0A=20=20=20=20=20=20=20= =20=20=20=20=20=20(setq=20parent=20(treesit-node-top-level=20parent=20= thing=20t)=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= prev=20nil=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= next=20nil))=0A-=20=20=20=20=20=20=20=20=20=20;;=20If=20TACTIC=20is=20= `restricted',=20the=20implementation=20is=20very=20simple.=0A+=20=20=20=20= =20=20=20=20=20=20;;=20If=20TACTIC=20is=20`restricted',=20the=20= implementation=20is=20simple.=0A+=20=20=20=20=20=20=20=20=20=20;;=20In=20= principle=20we=20don't=20go=20to=20parent's=20beg/end=20for=0A+=20=20=20=20= =20=20=20=20=20=20;;=20`restricted'=20tactic,=20but=20if=20the=20parent=20= is=20a=20leaf=20node=0A+=20=20=20=20=20=20=20=20=20=20;;=20(e.g.,=20a=20= symbol),=20we=20do,=20lest=20you=20can't=20go=20to=20the=20end=20of=0A+=20= =20=20=20=20=20=20=20=20=20;;=20a=20symbol=20with=20`forward-sexp'=20= when=20point=20is=20in=20the=20symbol=0A+=20=20=20=20=20=20=20=20=20=20= ;;=20rather=20than=20at=20the=20beg=20of=20it.=0A=20=20=20=20=20=20=20=20= =20=20=20(if=20(eq=20tactic=20'restricted)=0A-=20=20=20=20=20=20=20=20=20= =20=20=20=20=20(setq=20pos=20(funcall=20advance=20(if=20(>=20arg=200)=20= next=20prev)))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20(let=20= ((restricted-parent=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20(and=20(not=20(treesit-node-child=20parent=200=20t))=0A+=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= parent)))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(setq=20pos=20= (funcall=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20advance=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20(if=20(>=20arg=200)=0A+=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20(or=20next=20restricted-parent)=0A+=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(or=20prev=20= restricted-parent)))))=0A=20=20=20=20=20=20=20=20=20=20=20=20=20;;=20For=20= `nested',=20it's=20a=20bit=20more=20work:=0A=20=20=20=20=20=20=20=20=20=20= =20=20=20;;=20Move...=0A=20=20=20=20=20=20=20=20=20=20=20=20=20(if=20(>=20= arg=200)=0A--=20=0A2.41.0=0A=0A= --Apple-Mail=_930FBEFD-7B64-4765-B372-875E9588D84D Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii --Apple-Mail=_930FBEFD-7B64-4765-B372-875E9588D84D--
bug-gnu-emacs@HIDDEN
:bug#68899
; Package emacs
.
Full text available.Received: (at submit) by debbugs.gnu.org; 3 Feb 2024 00:57:57 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Fri Feb 02 19:57:57 2024 Received: from localhost ([127.0.0.1]:45717 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1rW4M0-0002Wo-Oj for submit <at> debbugs.gnu.org; Fri, 02 Feb 2024 19:57:57 -0500 Received: from lists.gnu.org ([2001:470:142::17]:44254) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <joaotavora@HIDDEN>) id 1rW4Lz-0002WZ-4z for submit <at> debbugs.gnu.org; Fri, 02 Feb 2024 19:57:55 -0500 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 <joaotavora@HIDDEN>) id 1rW4Li-0004BD-PP for bug-gnu-emacs@HIDDEN; Fri, 02 Feb 2024 19:57:38 -0500 Received: from mail-lf1-x136.google.com ([2a00:1450:4864:20::136]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <joaotavora@HIDDEN>) id 1rW4Lh-0004lJ-17 for bug-gnu-emacs@HIDDEN; Fri, 02 Feb 2024 19:57:38 -0500 Received: by mail-lf1-x136.google.com with SMTP id 2adb3069b0e04-51138ecc651so1598930e87.2 for <bug-gnu-emacs@HIDDEN>; Fri, 02 Feb 2024 16:57:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706921854; x=1707526654; darn=gnu.org; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=hTtILvYilXiI1UyfP+7i1aItkohr+LRIbzT830DKNbE=; b=IUJHmvWWvoiKMweE/v5VRudSoGIG850FWAhbm5cdS7D7S+7ARjY6IIDjDeJnh15hBp Ts26zQM4YYiwQOO0MVSB3iJEmRD4yaoHLrNyL9ORffW/WemzxEvWzrRTyMAkHQXuPggf e8NcCKsUxpXScOEcBbEQOVpDPQBLXv1dqCs+4W0BzCVwbckZ9iWycFSnFqj4KGXNoVlX eTMtZfVV8OtG5WYsIb/vS/ic+z1qmW1Vkz3qwtcdZ4QiaFbG6ljiivCDQpZt390kpOoL AXPVuLR7nkvZItbvY+UQhd0mx7u9KPKAgZ0AI+VNsbT4rodPUJIulcjO1hbebqvey+B/ Q8fQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706921854; x=1707526654; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=hTtILvYilXiI1UyfP+7i1aItkohr+LRIbzT830DKNbE=; b=kkQ9q9T+v6aYK9Cu4IQ68eWWWWlE4apPHjkPQkn0JqCEXwUOcChw3g5bFfDweuMqty SgqCNdIM99kxdZ2Rou/H1usEZKM78dgGg53Uw5m/oBPDH+Q+JVIF9iw3nYiphs63hFeP 6etoBAMSrfDiGlq2U1JRguN1pIS9uILJ9eGMQmN6/bV1c8SA7SpCL6t/zkw5D3g6+XcF wuPT5IrhPj/6ALvto2BaKX4K/pZHyHQqqqKZNme6a+9fm9Pk/wbWyEfuF7kCfeRm6AeB e6d6tSVGOPp1kZ5BnTSmagCX8cmZFC5fHdYcgLLfVyg/QfXcvn2wj+ftLA5KAZsNkZuE lfyw== X-Gm-Message-State: AOJu0Yw2uHUwbo6pKDymtSw835UThP2DX5uiU5A7RlGIyBYTOcCriZCB cX1c9Jm2Hdd3TqbMhEGcf8HFyYQkGO6proIxRcwOC79bD03g87dsDQezndJCYQkzgfXGy7QnSlZ mwi4E9EPyjTkc/JPezlSoSnz2LM0wJKpM X-Google-Smtp-Source: AGHT+IHaChVs99pLT31Sd9INyDplng8u/C9q11EKy+zSqZ3alWkxG00DIys7b/9qHhXM1YK4IGmOkw6OcXm3pF/0za4= X-Received: by 2002:ac2:44c8:0:b0:511:45be:7a80 with SMTP id d8-20020ac244c8000000b0051145be7a80mr83236lfm.51.1706921854370; Fri, 02 Feb 2024 16:57:34 -0800 (PST) MIME-Version: 1.0 References: <CALDnm52ZbRaafVWXnWuUUoE01noSRUFcLem7XT_LCJ17qpP3ng@HIDDEN> <CALDnm52eCpuiaiwxNGGVVDJdJ1xW+oe4_mw3PDxjoqHW7TcNZA@HIDDEN> In-Reply-To: <CALDnm52eCpuiaiwxNGGVVDJdJ1xW+oe4_mw3PDxjoqHW7TcNZA@HIDDEN> From: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN> Date: Sat, 3 Feb 2024 00:57:23 +0000 Message-ID: <CALDnm51bdpzdLjktDUFwsiBS8Mp5-QgJeetV-qZj2TZMnjKqQg@HIDDEN> Subject: Re: Treesitter's forward-sexp-function To: "simon254--- via Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>, Yuan Fu <casouri@HIDDEN> Content-Type: multipart/alternative; boundary="000000000000ca06da06106fb6f7" Received-SPF: pass client-ip=2a00:1450:4864:20::136; envelope-from=joaotavora@HIDDEN; helo=mail-lf1-x136.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -0.0 (/) --000000000000ca06da06106fb6f7 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sat, Feb 3, 2024 at 12:42=E2=80=AFAM Jo=C3=A3o T=C3=A1vora <joaotavora@g= mail.com> wrote: > > This doesn't seem to break tests, assuming it's not in these 3 there > > were skipped because I don't have the grammar installed. > > Despite that, I think it's still wrong :-/ Now it moves too much, > i.e. it never stops moving. This looks more promising. Works well in my tests. diff --git a/lisp/treesit.el b/lisp/treesit.el index c6b9d8ff4bc..cad7497fb74 100644 --- a/lisp/treesit.el +++ b/lisp/treesit.el @@ -2579,9 +2579,12 @@ treesit--navigate-thing (setq parent (treesit-node-top-level parent thing t) prev nil next nil)) - ;; If TACTIC is `restricted', the implementation is very simple. + ;; If TACTIC is `restricted', the implementation is reasonably simple. (if (eq tactic 'restricted) - (setq pos (funcall advance (if (> arg 0) next prev))) + (setq pos (funcall advance (cond ((and (null next) (null prev)) + parent) + ((> arg 0) next) + (t prev)))) ;; For `nested', it's a bit more work: ;; Move... (if (> arg 0) --000000000000ca06da06106fb6f7 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr">On Sat, Feb 3, 2024 at 12:42=E2=80=AFAM Jo=C3=A3o T=C3=A1v= ora <<a href=3D"mailto:joaotavora@HIDDEN">joaotavora@HIDDEN</a>>= ; wrote:<br><br>> > This doesn't seem to break tests, assuming it= 's not in these 3 there<br>> > were skipped because I don't h= ave the grammar installed.<br>><br>> Despite that, I think it's s= till wrong :-/ Now it moves too much,<br>> i.e. it never stops moving.<b= r><br>This looks more promising.=C2=A0 Works well in my tests.<br><br>diff = --git a/lisp/treesit.el b/lisp/treesit.el<br>index c6b9d8ff4bc..cad7497fb74= 100644<br>--- a/lisp/treesit.el<br>+++ b/lisp/treesit.el<br>@@ -2579,9 +25= 79,12 @@ treesit--navigate-thing<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0(setq parent (treesit-node-top-level parent thing t)<br>=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0prev nil<br>= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0next n= il))<br>- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0;; If TACTIC is `restricted'= ;, the implementation is very simple.<br>+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0;; If TACTIC is `restricted', the implementation is reasonably simpl= e.<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(if (eq tactic 'restrict= ed)<br>- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(setq pos (funcall= advance (if (> arg 0) next prev)))<br>+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0(setq pos (funcall advance (cond ((and (null next) (null p= rev))<br>+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0parent)<br>+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ((> arg 0) next)= <br>+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 (t prev))))<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0;; For `nested', it's a bit more work:<br>=C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0;; Move...<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0(if (> arg 0)</div> --000000000000ca06da06106fb6f7--
bug-gnu-emacs@HIDDEN
:bug#68899
; Package emacs
.
Full text available.Received: (at submit) by debbugs.gnu.org; 3 Feb 2024 00:43:19 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Fri Feb 02 19:43:19 2024 Received: from localhost ([127.0.0.1]:45708 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1rW47q-00020w-Uz for submit <at> debbugs.gnu.org; Fri, 02 Feb 2024 19:43:19 -0500 Received: from lists.gnu.org ([2001:470:142::17]:49498) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <joaotavora@HIDDEN>) id 1rW47p-00020c-5f for submit <at> debbugs.gnu.org; Fri, 02 Feb 2024 19:43:17 -0500 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 <joaotavora@HIDDEN>) id 1rW47X-0002zf-Ii for bug-gnu-emacs@HIDDEN; Fri, 02 Feb 2024 19:42:59 -0500 Received: from mail-lf1-x12a.google.com ([2a00:1450:4864:20::12a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <joaotavora@HIDDEN>) id 1rW47W-0007ja-2o for bug-gnu-emacs@HIDDEN; Fri, 02 Feb 2024 19:42:59 -0500 Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-5113ab4ef05so957425e87.0 for <bug-gnu-emacs@HIDDEN>; Fri, 02 Feb 2024 16:42:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706920976; x=1707525776; darn=gnu.org; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=PtWkwIK8Gz7cauPptOCzg4QmkWgJtzfgqVZ4JL0ThJU=; b=JMpqvT/d2H0Ji1JYFOrWpRAei100Se92asXz8lDx23WOGNGgS6pDD8bO9MsRF41cj7 iasIEs4VgrjvPI8hI49vH8EWXP0RZYhkB1VHGGD7ii5xPc8lo/t52xC+qftJ91pzEJY4 FvAmOICGVwwNgeOPzCAW4czwcoMWZ7kytlkRIw1oulIpoYSgyzeiEo2OItG831waMeub Cpt9sZdWnzO16gqJeEYEnkGiHlkI0FGguGDQQ0V62LJt2rYDgqwHSB3qf+lgFt9uhuri 2XhFLOaBkrdWIsQQvjQKgA5ahFTy3UcoWX8VLQ5uWtPaGFwnF1AwecvBG12laJyphaA9 biXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706920976; x=1707525776; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PtWkwIK8Gz7cauPptOCzg4QmkWgJtzfgqVZ4JL0ThJU=; b=HuN3V2BOy5dAGTpPxbq5lgxMtMCMstzYr3mf7pZMCKtolj106BNXfo3kBDxYFa+Pgg INT+4TKHTg+vXmK70o/19tnc3cdrLf8HIJkwy3+qi0/Spvqa55a+hk27g7aqL4DZSvGF FK9umtOssjgdOJFCUNrbleQnpHCuQpyRqc0wASa1iV2F7IliYmj8gva/eLzpZ88vjyNp mp1uIdNgJTDDX0qLmdrdw5zDARJCHZAGk+t+XUuI/39J8uCrcz5QdM6G7HXA372RP+pB UUstj6FAYWz7tFtLLNOaO25qLh1QPmMFCIiBifhm0Bmdn0+FY+xilKgOptzZzr2N6xc3 wQ+g== X-Gm-Message-State: AOJu0YzZyWDlCxhOfPDMrm+//sdJPt0dzusK7Qgskm59xDi7PZgxUxRG 5ZIJ45YRjlwP9LOwMOrclG1o/sbR3sZLH3Km0NF/1RIgIg33Mtr9Af4MlTPiekOslYdlNvVd2oe 1WEaS1m2H6jpUh+IOoWTRwLGFDK3/Dps0 X-Google-Smtp-Source: AGHT+IE/Agp9bQMGTGAuCE+t/za3UejCxmugMU0lF0fLDAg9eOpGasyJgltWzhE/LUCeq6/zjA6ylRGLWq5sNhC/F8Y= X-Received: by 2002:a05:6512:3b12:b0:511:2dad:d9a0 with SMTP id f18-20020a0565123b1200b005112dadd9a0mr5371631lfv.19.1706920975512; Fri, 02 Feb 2024 16:42:55 -0800 (PST) MIME-Version: 1.0 References: <CALDnm52ZbRaafVWXnWuUUoE01noSRUFcLem7XT_LCJ17qpP3ng@HIDDEN> In-Reply-To: <CALDnm52ZbRaafVWXnWuUUoE01noSRUFcLem7XT_LCJ17qpP3ng@HIDDEN> From: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN> Date: Sat, 3 Feb 2024 00:42:44 +0000 Message-ID: <CALDnm52eCpuiaiwxNGGVVDJdJ1xW+oe4_mw3PDxjoqHW7TcNZA@HIDDEN> Subject: Re: Treesitter's forward-sexp-function To: "simon254--- via Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>, Yuan Fu <casouri@HIDDEN> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2a00:1450:4864:20::12a; envelope-from=joaotavora@HIDDEN; helo=mail-lf1-x12a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -0.0 (/) On Fri, Feb 2, 2024 at 9:47=E2=80=AFPM Jo=C3=A3o T=C3=A1vora <joaotavora@gm= ail.com> wrote: > Shouldn't the intervening treesit-end-of-thing go to the end of the > current thing?, i.e. to the '('? I think it should, at least judging > from its docstring, and this patch makes that happen: > > - (setq pos (funcall advance (if (> arg 0) next prev))) > + (setq pos (funcall advance (or (if (> arg 0) next prev) > + parent))) > > This doesn't seem to break tests, assuming it's not in these 3 there > were skipped because I don't have the grammar installed. Despite that, I think it's still wrong :-/ Now it moves too much, i.e. it never stops moving.
bug-gnu-emacs@HIDDEN
:bug#68899
; Package emacs
.
Full text available.Received: (at submit) by debbugs.gnu.org; 2 Feb 2024 21:48:07 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Fri Feb 02 16:48:07 2024 Received: from localhost ([127.0.0.1]:45619 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1rW1OJ-0005gn-33 for submit <at> debbugs.gnu.org; Fri, 02 Feb 2024 16:48:07 -0500 Received: from lists.gnu.org ([2001:470:142::17]:49156) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <joaotavora@HIDDEN>) id 1rW1OH-0005fq-6k for submit <at> debbugs.gnu.org; Fri, 02 Feb 2024 16:48:05 -0500 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 <joaotavora@HIDDEN>) id 1rW1O0-000790-VK for bug-gnu-emacs@HIDDEN; Fri, 02 Feb 2024 16:47:48 -0500 Received: from mail-lf1-x12b.google.com ([2a00:1450:4864:20::12b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <joaotavora@HIDDEN>) id 1rW1Nz-0002kH-GL for bug-gnu-emacs@HIDDEN; Fri, 02 Feb 2024 16:47:48 -0500 Received: by mail-lf1-x12b.google.com with SMTP id 2adb3069b0e04-5101cd91017so3240345e87.2 for <bug-gnu-emacs@HIDDEN>; Fri, 02 Feb 2024 13:47:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706910465; x=1707515265; darn=gnu.org; h=content-transfer-encoding:to:subject:message-id:date:from :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=4hZGgkrneS6hxRxrkJ+sFJeBcU0mWkqxsZZUEpIfulo=; b=nAjC2hqWYHBrVR/7ii5p4/6Cb1Xph8ZDu4nhkpPKP0z/A8R6lbfejYodj6eTDZWNAH grB8IXOtiTsyT8masuKbyNWt22s9jNFJW3jKL4RmaQEBv9rPj3AfSIfWkH5yzQv6Bk+A YhLCT9FDUjTTzYbIRnLDbS25yb170y98vNJEUEyvDDnlHzoLT8x5Ufewv/mHOeF/XVSs 1wMG4RGuNyQYuxXguwe3yUEbdDvIAniQsJwQQOypXMzRNmJNEy6SnUCOp+jGTc3okRAH RL/KGtcNfHIlecfCz+80WdbogjKt0yt8TlOY9V1nWaEDGJ2W0EdwvaaoBb3zjG0+wzN+ hMyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706910465; x=1707515265; h=content-transfer-encoding:to:subject:message-id:date:from :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=4hZGgkrneS6hxRxrkJ+sFJeBcU0mWkqxsZZUEpIfulo=; b=EqP56lnIIroS5OMquT3rkUsPbjoeHAyVhgrWsjP5vpw3Wsm4cQA3snqoBjEaAJNGTp +dftgtWyUp6j3/LoBb4bY1aU1gFlbQcqdzUL/19g9ZiuQOPNG3z/QF0qgPYyiPsqpf0c Pd/6mivL5LOCNsVky1XHI1V91VpEq9wIHOGOltr0dDPxWc9qGUem4LMl8zfQjr28/Dk8 OmQzvJJwfMpAMRq/YtCl/DtVzITHskpDORPEZqOKKFiAiewv7wKB47bNK+7m46ifJbOg 21IhPAEAkfYX5foG6BOpLU7dwAHFXBH2dC7bXpU+g8qnRH2KfIuXVjJoTvkLwYjwLEX1 R61g== X-Gm-Message-State: AOJu0YwStdQqIcw+kXLlk42EjHSi9AuC8hfDosrLp9Cm4AtTuFMeY6JQ Fonww9BcjzvcBpeK2gL+RFbs1L1Xtr1cMbqqQU4AqBcvMozjslJ8gymxq46v68b5hJ0m1BJVo6n /v20x5uPp6zL6L01vlpKFEQL2RsDh1Qk+bl8= X-Google-Smtp-Source: AGHT+IEFF8nDU3MIib7pAhwXQbdA8Z2ac5609UUe/BpOpDCcH68O5Vq7O23Y7HKxSz9okry96Z5w9TkENNAX9z5HA6Y= X-Received: by 2002:a05:6512:234f:b0:50e:9355:a24b with SMTP id p15-20020a056512234f00b0050e9355a24bmr5350863lfu.22.1706910464707; Fri, 02 Feb 2024 13:47:44 -0800 (PST) MIME-Version: 1.0 From: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN> Date: Fri, 2 Feb 2024 21:47:33 +0000 Message-ID: <CALDnm52ZbRaafVWXnWuUUoE01noSRUFcLem7XT_LCJ17qpP3ng@HIDDEN> Subject: Treesitter's forward-sexp-function To: "simon254--- via Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>, Yuan Fu <casouri@HIDDEN> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2a00:1450:4864:20::12b; envelope-from=joaotavora@HIDDEN; helo=mail-lf1-x12b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -0.0 (/) Hello Yuan, In c++-mode, python-mode, and all other modes I know, pressing C-M-f with point anywhere in the characters of a symbol brings you to the end of that symbol. In c++-ts-mode it only does something if you're in the beginning of the symbol. Everywhere else point stays where it is. I know there are some intended differences for c++-ts-mode's forward-sexp-function vs c++-mode's, but would this be one such difference? Here's a quick repro, in case you don't follow emacs -Q /tmp/something.cpp -f c++-ts-mode int main() {} If point is 5 (on the 'm' of main), C-M-f will bring me to the space after the closing ')'. This is different from c++-mode, but I think I can learn to live with this, in fact I think I like it. However if point is anywhere on 'ain', point stays put, and that's very jarring when compared to every other mode I've ever worked with in Emacs. Shouldn't the intervening treesit-end-of-thing go to the end of the current thing?, i.e. to the '('? I think it should, at least judging from its docstring, and this patch makes that happen: - (setq pos (funcall advance (if (> arg 0) next prev))) + (setq pos (funcall advance (or (if (> arg 0) next prev) + parent))) This doesn't seem to break tests, assuming it's not in these 3 there were skipped because I don't have the grammar installed. s treesit-defun-navigation-nested-3 s treesit-defun-navigation-nested-4 s treesit-multi-lang If this patch isn't acceptable, is it possible to make this customizable somehow? I know I can set forward-sexp-function to something else, but I now am actually getting used to this f-s-f, only this bit is putting me off. Jo=C3=A3o
João Távora <joaotavora@HIDDEN>
:bug-gnu-emacs@HIDDEN
.
Full text available.bug-gnu-emacs@HIDDEN
:bug#68899
; Package emacs
.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.