From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Mickey Petersen Newsgroups: gmane.emacs.bugs Subject: bug#73404: 30.0.50; [forward/kill/etc]-sexp commands do not behave as expected in tree-sitter modes Date: Thu, 26 Sep 2024 10:56:35 +0100 Organization: Mastering Emacs Message-ID: <87frpm20t7.fsf@masteringemacs.org> References: <87plox4mtp.fsf@masteringemacs.org> Mime-Version: 1.0 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="26130"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e @VERSION@; emacs 30.0.50 Cc: 73404@debbugs.gnu.org To: Yuan Fu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Sep 26 12:10:55 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 1stlSY-0006aE-J4 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 26 Sep 2024 12:10:54 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1stlSK-0002lX-Fs; Thu, 26 Sep 2024 06:10:40 -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 1stlSF-0002l9-V7 for bug-gnu-emacs@gnu.org; Thu, 26 Sep 2024 06:10:36 -0400 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 1stlSF-0007LM-Iq for bug-gnu-emacs@gnu.org; Thu, 26 Sep 2024 06:10:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:In-reply-to:Date:From:References:To:Subject; bh=TdkEuSv7SxPK1/iCVt6IT+GDYBicIQDQeX4zMONkDEA=; b=W7vAkk8D8OEE/X6sqt44Qzba1S/tRHZ6QpXZKsS4kylqjSQMCnrSnZArmY7x1i0oppaSKcpYBRi+EOGSvwFba5SkXoi0nX2xtk8hzTLHgT1y9b3m27GhfqV4GMfiGq4HUWY9DBGR6Ad/0rPul9Xzn/6KQc2ZR6BKv4UHaEKfoZqJqFzBnIHh78yKmm73Fu0mY9it/RAj4msrtHLypDNAAv6s4vTL665xhNHP0gu03ZNvyP7JY4PvUwmk7tvLduK2YbBXUlm3z7zbJbm556cY4eOsTN1eZx8tr5VzvETUObQ0S3Hj52O9B4WtgzLP0DN7c5M/QyGBMCqbfEoqYwU24A==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1stlSf-0003Oi-To for bug-gnu-emacs@gnu.org; Thu, 26 Sep 2024 06:11:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Mickey Petersen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 26 Sep 2024 10:11:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73404 X-GNU-PR-Package: emacs Original-Received: via spool by 73404-submit@debbugs.gnu.org id=B73404.172734542212500 (code B ref 73404); Thu, 26 Sep 2024 10:11:01 +0000 Original-Received: (at 73404) by debbugs.gnu.org; 26 Sep 2024 10:10:22 +0000 Original-Received: from localhost ([127.0.0.1]:55441 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1stlS1-0003FW-88 for submit@debbugs.gnu.org; Thu, 26 Sep 2024 06:10:22 -0400 Original-Received: from mail-ukwestazon11021123.outbound.protection.outlook.com ([52.101.100.123]:19911 helo=CWXP265CU009.outbound.protection.outlook.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1stlHz-0002YH-BC for 73404@debbugs.gnu.org; Thu, 26 Sep 2024 06:00:00 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=UTfeCCUfRibQoN0hUT5Vyzbk6DUiQUj5XYn1e4Q1lFcZt2A88yFtXoQf40srr/8MzhbapPlIYHRc+z+qv40dhD30madpoukaxUWgNtCCqUvJJaDmsdmVlPYC+HnKKHUVui+gmullb6Tn7gH2h7TyiDmZ/4fjSddgbMmUjMWEt31dsDk0fvNaivijko/G5sDaMdk1iOUCJ4RlVWVznA+7yfaTJQrVjuyweIsOVKTgQ9aCV4lULjeGtzH8cT99vivK3GQfzVV28QbTqEWtCncYCmcp1Rp7JEshF3ITpqG4i3OUmqbB8LwKeohgBYGzCUITqoaTddKvBR2GFCvBW5lbCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=TdkEuSv7SxPK1/iCVt6IT+GDYBicIQDQeX4zMONkDEA=; b=M2Ut6oP5dtbFv0c+H4MZdgSBd6ajyzpyQd5E30Moeykv/bFUlqeVXCdQHv/HQQb4NQO1amFtB7S4LQvUqMiuZX0+Qvo2hqgDZiI5ZQ0eHOwyCTOxYBLqxdJB6EpJU1g3Aw6maB799M7W/udEoLil4AHsrPpwxJvvH6QSwUK4GcLKLndwrt/mHj5+Srak0KF5g/V5JbSyZQgmVhVV39CN6aH0xvS26ziTBjLLGWmvtKnDALiFajxijHoW45I4cZgWTOMcfRTm+v8SlItBOaprMI4wdtjCLCuVgmcAtSQ0JmySEC2dVea4kCbsZNY1WTWyNI92woWRkKA5BYsV0gOiCQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 178.79.136.144) smtp.rcpttodomain=debbugs.gnu.org smtp.mailfrom=masteringemacs.org; dmarc=pass (p=none sp=none pct=100) action=none header.from=masteringemacs.org; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semantical.onmicrosoft.com; s=selector1-semantical-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=TdkEuSv7SxPK1/iCVt6IT+GDYBicIQDQeX4zMONkDEA=; b=00N7qzfTynOP51RXaWWnXC5mRhf/3eFqJtRol8iUbkqHbW9Ma1p1/WRuzlHDACIRauV8oosPureJLgVN2rY5cBwwdC2MAtaIk92gRUX5jxkr1mR7DI/CqBEQ+8FiHvN5tdIC4CLLZpZmNUW21nzqwJl+3jyRUE+EEmKtYxMCIVs= Original-Received: from LO2P265CA0064.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:60::28) by LO3P265MB1996.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:10e::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8005.21; Thu, 26 Sep 2024 09:59:05 +0000 Original-Received: from LO1PEPF000028CC.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:60:cafe::6e) by LO2P265CA0064.outlook.office365.com (2603:10a6:600:60::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8005.17 via Frontend Transport; Thu, 26 Sep 2024 09:59:05 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 178.79.136.144) smtp.mailfrom=masteringemacs.org; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=masteringemacs.org; Received-SPF: Pass (protection.outlook.com: domain of masteringemacs.org designates 178.79.136.144 as permitted sender) receiver=protection.outlook.com; client-ip=178.79.136.144; helo=semantical.co.uk; pr=C Original-Received: from semantical.co.uk (178.79.136.144) by LO1PEPF000028CC.mail.protection.outlook.com (10.167.240.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8005.15 via Frontend Transport; Thu, 26 Sep 2024 09:59:05 +0000 Original-Received: by semantical.co.uk (Postfix, from userid 5001) id 223CE114002; Thu, 26 Sep 2024 10:59:05 +0100 (BST) In-reply-to: X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LO1PEPF000028CC:EE_|LO3P265MB1996:EE_ X-MS-Office365-Filtering-Correlation-Id: 6c05bfe7-55a0-48ed-b42a-08dcde11db4f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|36860700013|61400799027|82310400026|79816003|14776008; X-Microsoft-Antispam-Message-Info: QrngA3iQB6Ur+SWgtpyVdlXgkfjHyrpTHZSF0H3HpAAkbeJosqUW/8RpUdidjOfNCPtavxogd9HHnjIn4E3j7G7/+2Ad9eCHz3M4iyuSEnAfAD+8og6gOE4qY1xw059MfFr76nMf0W86pDNiZZ8suJjInhdPzhD7mXyxojwaVIgUhJiWPcN7/Mhm39+beLMdBm580pjidh4qCEiuGC9T1jVOgjCkDi+2NpV0PrEWSQ7Hg0Bp7RhwZsKG4fRt+DtL9yni+5nppmTbjXoyzhRgdK507nV9NCpxICCsj/QUHDPIMeJEzdDAdK3u7DkqfWMhUd33uAThKvazm1AoZIIlyhyZKMmDb8KpHp3ePMOhBedqlMP+6gDXlwKEXckndAogtkLqU3FRY6ax2nX9WJ12d6pu+IA8VjpN5CnVVq7Lm0ybJZJcSVGs6qrINSjznMOo0/M4u88cceUlEZ9t5awb+TzOPRdSyVtdwxU5AfskoVawU5XoKspVV93VqMbQPvA82e0bkxJnmY8JfS1ZryWCJrr9JB6uZUA4/4zlN1XtYFGKMExzh7y/5sy+zUcLxmWGMsrOVO19RDRoW18p2jEUseGO7CRxhovDf6uG+cCHJWyDrN2nbMpLuykFsoTftzez198dGgja1pNGqliM/fkH2wBgAD3Onx+TqrsCAAB2mdxBSyLbMypXjNo0nzGeESODMSGo9dghndSNCllaiB0GIVnBpMOkT/X7+pYBVrCSpraSfAPuY3jHpD0hR29gW sS+aPM3ZfrKITb+ZfiiQp+8fzXCy/kGV/I8i+BOUee5jgoPITs8G39wGYlpx7NeEKZDA2/i2gHycpgnTT7UcwFe3p9dGiFdM7w X-Forefront-Antispam-Report: CIP:178.79.136.144; CTRY:GB; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:semantical.co.uk; PTR:semantical.co.uk; CAT:NONE; SFS:(13230040)(376014)(36860700013)(61400799027)(82310400026)(79816003)(14776008); DIR:OUT; SFP:1102; X-OriginatorOrg: masteringemacs.org X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2024 09:59:05.2667 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6c05bfe7-55a0-48ed-b42a-08dcde11db4f X-MS-Exchange-CrossTenant-Id: a4e27e3d-bab0-45e8-8942-e64cf9fbd34f X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=a4e27e3d-bab0-45e8-8942-e64cf9fbd34f; Ip=[178.79.136.144]; Helo=[semantical.co.uk] X-MS-Exchange-CrossTenant-AuthSource: LO1PEPF000028CC.GBRP265.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LO3P265MB1996 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:292448 Archived-At: Yuan Fu writes: >> On Sep 20, 2024, at 10:06=E2=80=AFPM, Mickey Petersen wrote: >> >> >> >> Examples with javascript-mode. It holds for all modes i tested with a >> TS equivalent. Let -!- be the starting point and ^N be the subsequent >> position after a movement command. >> >> -!-export const add =3D (a, b) =3D> a + b; >> >> Repeated `C-M-f' yields >> >> export const add =3D (a, b) =3D> a + b; >> >> ^1 ^2 ^3 ^4 ^5 ^6 >> >> >> In other words, it works as it always has. >> >> Meanwhile, in `js-ts-mode': >> >> export const add =3D (a, b) =3D> a + b; >> ^1 ^2 ^3 ^4 >> >> From ^1 and back with `C-M-b' >> >> export const add-!- =3D (a, b) =3D> a + b; >> >> export const add =3D (a, b) =3D> a + b; >> ^1 >> >> At this point, `C-M-b' no longer goes back. It is stuck. >> >> >> Another example: >> >> -!-console.log("Addition result:", result1); >> >> With `C-M-f': >> >> console.log("Addition result:", result1); >> >> ^1 ^2 >> >> >> This affects every single -sexp function that uses either >> `forward-sexp-function' or `transpose-sexp-function' to do its job. >> >> Thanks. >> > > I=E2=80=99m aware of this problem and it=E2=80=99s quite inconvenient at = times, but right now I don=E2=80=99t have a good solution for it. Ideas are= welcome. > > Basically tree-sitter=E2=80=99s sexp movement works on subtrees. It deter= mines > the position of the point in the whole parse tree and goes > forward/back across the next subtree in the parse tree. If there=E2=80=99= s no > more sibling subtrees in the same level to move over, sexp movement > stops like in lisp. The parse tree is invisible and often groups token > in unexpected ways, so many times the sexp movement isn=E2=80=99t intuiti= ve. > Hi Yuan, In my opinion, that's not what `sexp' movement is. Sexp movement is movement by balanced expressions -- and a fallback to word-like behaviour absent that -- and this is not that. It would be better to relegate this sort of thing to its own set of keybindings. > We might need to add a user option so people can easily turn off > tree-sitter sexp movement, since it isn=E2=80=99t a strict upgrade from t= he > generic sexp movement=E2=80=94it=E2=80=99s more of a different flavored s= exp movement. It should be opt-in, not opt-out. > > Yuan