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 13:13:53 +0100 Organization: Mastering Emacs Message-ID: <87bk0a1u0o.fsf@masteringemacs.org> References: <87plox4mtp.fsf@masteringemacs.org> <87frpm20t7.fsf@masteringemacs.org> <8634lmbs8t.fsf@gnu.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="12859"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e @VERSION@; emacs 30.0.50 Cc: casouri@gmail.com, 73404@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Sep 26 14:26:53 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 1stna8-0003AF-Av for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 26 Sep 2024 14:26:52 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1stnZu-00057r-7V; Thu, 26 Sep 2024 08:26:38 -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 1stnZq-00055p-T0 for bug-gnu-emacs@gnu.org; Thu, 26 Sep 2024 08:26:35 -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 1stnZq-0003vs-I9 for bug-gnu-emacs@gnu.org; Thu, 26 Sep 2024 08:26:34 -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=aJWWfCh8W7UgZpAHEhRnZYgAxLeV03Ug+zHWqGO+6Y8=; b=N0/2/vJsf3zyfbY/nCrA4b9MaE+BeupPQGwzQJkbdn9R46A5fZXJk2Jb7EOLO2uQH6h22Qdfp/nL3Nfl2svojT7BplZ4AMwESfSWJkcdTgxWMOzQB4Zx/kHboMQKZYO0d1pV6/Bh0HQTvXL8pp0ESFZbECOrQXQmxpm/nVeDYnMUx2VBCKQsePBAEwKaJwW5ieG4LL9urgDd4vvMLlHn0TRkO86SHAsoWlvG5IcaDm0awUetTVEpuSRbzb8EOmGoy8lanRa3ooVYKnz5PY2TIB3oYHfnXg1EGxwQjPRG8ckHyQzylli1S1Iq8eoSr8RnllXGwfypeIC4462hH0hQbg==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1stnaH-0003Uy-Jm for bug-gnu-emacs@gnu.org; Thu, 26 Sep 2024 08:27: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 12:27: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.172735358913340 (code B ref 73404); Thu, 26 Sep 2024 12:27:01 +0000 Original-Received: (at 73404) by debbugs.gnu.org; 26 Sep 2024 12:26:29 +0000 Original-Received: from localhost ([127.0.0.1]:58746 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1stnZl-0003T1-4Y for submit@debbugs.gnu.org; Thu, 26 Sep 2024 08:26:29 -0400 Original-Received: from mail-ukwestazon11020112.outbound.protection.outlook.com ([52.101.195.112]:20007 helo=CWXP265CU008.outbound.protection.outlook.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1stnZi-0003SW-2n for 73404@debbugs.gnu.org; Thu, 26 Sep 2024 08:26:27 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=R2ekTKIgSbqArKeWq0qfBbKO2icNC6pM57stJzilf9qO9CRiNxmPt91Kj27JGF3Ix5O5WfpxexXi50VK5rvOtvzXJCNRBiIPmqutGLr7P2JvICs67Pq57pK/lwQ68QVZZPVCF9IULfznRERiedZylPjcOcehQx5sGDrtnL/MqrCh7DLSM+WZR6SequniwkY5y5CYUwDCM3UDUFSGGh2V6KEyhkBB8brnt06MXwujF4Z84CizGIT30V5J7R8f/aGJTcVze4499pM4JbZElg5P0Af7LUlY1okbHHyBv9FACF4aLpoKB98c+z6YATYBdiH4JvgVPYpcFtksRHizBfcXEw== 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=aJWWfCh8W7UgZpAHEhRnZYgAxLeV03Ug+zHWqGO+6Y8=; b=B9uGVyOMY9M2TJXHQVPSmgEAihGsODa+3fYL7meug4TDqeD4otTfpKyKVGGfHZHNvsjTKECbN8PuZEvMZZ1FU3uPqrSaBxHs9VpCHzsbXsODchdvrRTBQQpIv1pNwAijuTqaIcu8hSDpgJU5oW64U2cATMgdJnBIyBiwvAmj91SdqoYY5/ETGsgMTRY5nPCN23pADWK18vjcW1pdpy16AtnTn2Y9z/zgOZhI5CweaJl1FRHSdmyiSqWP1O/mSrUFzYnvBSFEn0ZxKLbqfUmtDMRS1/19uPL4qDSfrmoayLlUeiY1O5zpeSrZ14G8SvuhBWT8Y3p3TZTt+aIrlzy0zA== 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=aJWWfCh8W7UgZpAHEhRnZYgAxLeV03Ug+zHWqGO+6Y8=; b=N37TpcKMDKOFmy9RtiAkab8wOcNfTP8DldYqPhCID/qFTGXQ6G/I+lLdhsBry78USRj28391VsTAIx9OZ0KyJkqIrzMPiGCemETqYlrBHzGk6pQVmOSOj1DnXD9Fc3pgOO8/QT7lqXe+5Iev2NSyC1RzqcgCw8OfmHcvsT7FuN8= Original-Received: from LO4P123CA0426.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:18b::17) by LO9P265MB7647.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:3a3::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.27; Thu, 26 Sep 2024 12:25:50 +0000 Original-Received: from LO1PEPF000028CC.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:18b:cafe::8d) by LO4P123CA0426.outlook.office365.com (2603:10a6:600:18b::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8005.21 via Frontend Transport; Thu, 26 Sep 2024 12:25:50 +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 12:25:49 +0000 Original-Received: by semantical.co.uk (Postfix, from userid 5001) id 784EA114002; Thu, 26 Sep 2024 13:25:49 +0100 (BST) In-reply-to: <8634lmbs8t.fsf@gnu.org> X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LO1PEPF000028CC:EE_|LO9P265MB7647:EE_ X-MS-Office365-Filtering-Correlation-Id: 296f569f-d0d2-4a47-7ee1-08dcde265b0a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|376014|36860700013|61400799027|14776008|79816003; X-Microsoft-Antispam-Message-Info: G2Wkb7s0rQBet8NpzSNfElRQPFWHuSzBiNRgl4xF0/fdo5HtSzi5lpT+2pY8RxApJoGohOzaqKncYgFkjYG0gyBWqvp9zNglJPVGBq0XEVZXzphFWMvVG7TOHmOMuQ+u42fxdzVtnW/h2g0zn0gfqunM7sPynJ9s34qsFOjgMMUogAgw4KfzBSXzzfWlraAb+dLKjDWJF8/f51WFsz/pe5DpVjCIX1d7tG1mn8w53F2AaHucCMXi/vb1sB0mjE+cWLiNbzk6hAizEJV7d0sGQ6tU0/FR6QHgJN17yWc4haqbuf3lnKkOFKqdjiVYLRnkoozD3AlFukdLgRfn9gh4YNqhfGN8eG8IIq9tj5gIJ4nSKMnLGWIYvX09iwo0HLpZtmcZFqoJURL+zPgRI9TJLHXQ/eJfxiDqLc5G9hEGuvDsOXW68U4Wg8GyPIn/6ADAt+Au6yEA4OT3DNoxYMQXH/KDSdtKSDDjOrGCGFZxOFwII/bip/5wypOG5v0xFKyI8pyXPIASijqg/xUrtu7WxLpF0rtQGtKu4TovPQleDqBWaj3i81iFCY43CyJ8T1V/LBAPMoGxVStn1Odo+2ebKJ6o4+2IpCmxOHPAIOxOxnW6EZNQB1K6Cu1oyRLmmtYvNAjB1PxxMnZUyvJgCHw1c2M1AcAhs8ChmGTUWoKCRVtW/Ffhn3bgswLK2A4ZqTGEYJgyH0pDPPvbnyL9jUfvGQiT06sZtv9YQFX7O8QM2wlDx0BwuDD2yCS0e5Q5+ LSmI16+I6yvKPCBTDeH6AeJoW9Qc6OcddgK1yv57k+vnb0qLT0VUVPYZJLN9s7Iz5N88fqwBnIyG//2olVd/D2oPxq4AVPChNI 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)(82310400026)(376014)(36860700013)(61400799027)(14776008)(79816003); DIR:OUT; SFP:1102; X-OriginatorOrg: masteringemacs.org X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2024 12:25:49.6680 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 296f569f-d0d2-4a47-7ee1-08dcde265b0a 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: LO9P265MB7647 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:292458 Archived-At: Eli Zaretskii writes: >> Cc: 73404@debbugs.gnu.org >> From: Mickey Petersen >> Date: Thu, 26 Sep 2024 10:56:35 +0100 >> >> 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. > > The term "balanced expression" is not well defined in languages other > than Lisp and Lisp-like ones. It is clear what expected when point is > on a brace or a parenthesis, but entirely NOT clear when you start > from something else. For example: > > int foo =3D bar + 2 * baz; > > Suppose you start with point at "foo": what would you expect > forward-sexp to do? nothing? > I expect it to behave as it presently does: default to word-like behaviour such as M-@ / M-f etc. Balanced expression is not well defined, de jure, but it is in practical terms, making it de facto rather well understood and supported. It behaves reasonably consistently across languages, and I use *-sexp commands thousands of times a day in a wide range of major modes= and contexts, both in code and also prose. Most people who use *-sexp (or *-word commands for that matter) in major modes come to recognise how they work and know what happens to the text/point in their buffer before they run them. I would challenge anyone, given even small samples of code, to do the same with the current TS only implementation. >> > 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 fro= m the >> > generic sexp movement=E2=80=94it=E2=80=99s more of a different flavore= d sexp movement. >> >> It should be opt-in, not opt-out. > > I disagree. Moving by sub-trees is a natural generalization of sexp > movement for languages where parentheses and braces are rare and far > in-between. Yes, if one can intuit the sub trees' structure, which is not so simple; and if the selection of commands are sufficiently expressive enough to let you navigate the tree. I am not sure they are. The CSTs are deep, wide, and nodes' ranges frequently overlap; they are multi-dimensional structures that map to a simple 2-dimensional 'grid' in your buffer. Making heads or tails of that is no easy feat.