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#73404: 30.0.50; [forward/kill/etc]-sexp commands do not behave as expected in tree-sitter modes Date: Wed, 25 Dec 2024 00:34:45 -0800 Message-ID: <8D171A7A-D565-4BEF-AE56-1308C69FE5AC@gmail.com> References: <87plox4mtp.fsf@masteringemacs.org> <87frpm20t7.fsf@masteringemacs.org> <8634lmbs8t.fsf@gnu.org> <87bk0a1u0o.fsf@masteringemacs.org> <86tte2a5o3.fsf@gnu.org> <877cay1lqt.fsf@masteringemacs.org> <86frpma06f.fsf@gnu.org> <86ikueiekp.fsf@mail.linkov.net> <86ed4zg1cc.fsf@mail.linkov.net> <87zflac68t.fsf@mail.linkov.net> <87jzcdlxdp.fsf@mail.linkov.net> <87o71jocgs.fsf@mail.linkov.net> <87wmfwqg7e.fsf@mail.linkov.net> <87ikr8hpdu.fsf@mail.linkov.net> <856C1B51-D9BC-4794-95CF-28E9B9B59325@gmail.com> <871pxw430m.fsf@mail.linkov.net> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3776.700.51\)) 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="5944"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Mickey Petersen , Eli Zaretskii , Theodor Thornhill , 73404@debbugs.gnu.org, Stefan Monnier To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Dec 25 09:37:21 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 1tQMtN-0001Me-L6 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 25 Dec 2024 09:37:21 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tQMt6-0002Nl-7A; Wed, 25 Dec 2024 03:37:04 -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 1tQMt4-0002Mm-5p for bug-gnu-emacs@gnu.org; Wed, 25 Dec 2024 03:37:03 -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 1tQMt3-0004J8-Rz for bug-gnu-emacs@gnu.org; Wed, 25 Dec 2024 03:37:01 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=References:Date:In-Reply-To:From:Mime-Version:To:Subject; bh=Td3TEQ/VcOwz+4fSDL5XVfh8qKI2DJXlhIvk5pWYgVE=; b=ALYwgc9BQ3tBQTVGYMDhyRaf6nB1EfD9hqvnke454Zj5rKf8/GzfTY6y/Cvo+/BzLeY4Yqd53zD7zelRYzZVrhjwQl5DP7UmZgjqtq4TCB15n7xw+UhOUClaXVGB2z5y0IGh2SRfoGRiQzO4PnnpMeczEoiP1EM1qmzD3O2Omn08YD84yU3Uuta24r8XQ6K7NweKaWo1SPbkZ3QTLuZtakMHuVdn05/ciPopnAzWBt4kESC4O7wbfJCXGW7+3pbUmHBblVKvnEO+4zTARmWEPC0RZR7E4K+1iuu4sR1+mPfj/rzGkox3shbhwAjZnpNXYd+Ubcp72xYAtgkdZw6qCg==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tQMt3-0007FH-Ly for bug-gnu-emacs@gnu.org; Wed, 25 Dec 2024 03:37: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: Wed, 25 Dec 2024 08:37: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.173511576727754 (code B ref 73404); Wed, 25 Dec 2024 08:37:01 +0000 Original-Received: (at 73404) by debbugs.gnu.org; 25 Dec 2024 08:36:07 +0000 Original-Received: from localhost ([127.0.0.1]:36130 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tQMsB-0007Da-DF for submit@debbugs.gnu.org; Wed, 25 Dec 2024 03:36:07 -0500 Original-Received: from mail-pl1-f178.google.com ([209.85.214.178]:60870) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tQMs9-0007D2-BU for 73404@debbugs.gnu.org; Wed, 25 Dec 2024 03:36:06 -0500 Original-Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-21654fdd5daso59770455ad.1 for <73404@debbugs.gnu.org>; Wed, 25 Dec 2024 00:36:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1735115700; x=1735720500; 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=Td3TEQ/VcOwz+4fSDL5XVfh8qKI2DJXlhIvk5pWYgVE=; b=OndX+2JYkZTfBkpEd6Uq3zedfcJrMzaeDsAr3c+aQL7So2W/5S04cm2QU0RIBvLpTc 2s12afxMEYLGFsctiPMG3sMR4cicGi+DPPcCT1Aq0bhZHni2Zqp5aQLR9mmRx5yYicEi ttUMi8ALTP4nEWVEwvKoYMav5Iw8iR5DmsMaW7wuZb+1Y1M2YFZ0skgzktEtIk8JYi2o UDN6yy05tUMfnWKUNe/cn2C5tNAUvAWNscSyRYAyaGU1CU1gg0vgsIIMojonf9ScceO7 vTyLPYbFHcYcVpbuKZltAcsHiPAKx9TWatKO+N/iPDfa/+HbeeMuNw6NLnLEYJxgg8G0 j6mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735115700; x=1735720500; 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=Td3TEQ/VcOwz+4fSDL5XVfh8qKI2DJXlhIvk5pWYgVE=; b=ipAuzgLhstOoMB50GSn8pywr/iSwlM9rRQiUhWE/aozhbGeVa1f72ZAplber6ZIycm pDWL25MqtGv9LEG6ihAMQL3t5aYj7SH6B2/cN+c1VJuSK5jtSPSyq5bu7VSLLtkR3Ey3 c8a0H9MMAsaPLr+VVBQracDLtADJiz6IO0EXuqTjBfG3w7Yn0gS5WL0xNUS8Uu7/Gg8k sKxveR2ZMgvPuWQ4I+KlhcV3oFT3UgOApoPSvxsZm9gC6EfxbDkhtXoXP3rXmI5qnIQG rY4s8GkVula907ADtNo6vEJ3veD62si3TCBC5MAjCK8eN5gNQSvbBKlDdPTa0qrTrdz1 mWxQ== X-Forwarded-Encrypted: i=1; AJvYcCUeLJjO+svRAuQoTcCkRItXB9WjQrYS7Dh5+TRSADoflI4EweqcUMT9HDfHoGtKEkT+DTq2Rg==@debbugs.gnu.org X-Gm-Message-State: AOJu0YyhJsAHh4bQKxg3CGQzJ2ubSgCrZE1GZhxFKB+EkBtYfrAMHGT6 rzH031Evlqo2Kw8gDfnG/BUD7Rs5NEl/QefD95kKzOGYOMCt5ruz X-Gm-Gg: ASbGncv0QzB9QxHAXSmiWYbPwc3etycnYKA5lcSOSicjBAalIJrpaTlP6JpX3cmx7Wa bPi9zudYVvHb91/u5lJ5/CTRYSfcmLrbYKQPTl0uVe4asWjZ0wwS/vJstCV3m4YfNDeJKmSoX6F b30cifn5JYRtN/+eue0Fz4IluEBSXFnZJR+fd5PICZS5g0cEZVATnhG/YZRDreFVQVnCkoVcJl1 xV5S7Hb+a6VrMdwd57g9/Lr/nIqQkdYLXW7990JZCqnz+Yb3imXYU4GmWbgfBIw7OksF7eJHYNR lVA= X-Google-Smtp-Source: AGHT+IEQxDrqTmAVO2fyucC6K1xKoyEDcDFlrgPRKzkD4CPzaoZWBwgHKqhOyudrTq5lfopPOI6bwA== X-Received: by 2002:a05:6300:6681:b0:1e0:c6c0:1e1f with SMTP id adf61e73a8af0-1e5e07f8a98mr27768655637.36.1735115699839; Wed, 25 Dec 2024 00:34:59 -0800 (PST) Original-Received: from smtpclient.apple ([2601:646:8f81:6120:e179:285e:283:33ae]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72aad81641esm10809401b3a.3.2024.12.25.00.34.58 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Dec 2024 00:34:59 -0800 (PST) In-Reply-To: <871pxw430m.fsf@mail.linkov.net> X-Mailer: Apple Mail (2.3776.700.51) 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:297723 Archived-At: > On Dec 24, 2024, at 11:44=E2=80=AFPM, Juri Linkov = wrote: >=20 >>> For html-ts-mode a list node is "element", and the node to skip >>> is "tag". So for example: >>>=20 >>> -!-text >>>=20 >>> 'C-M-f' will use node "element" to move to the beginning of = "element": >>>=20 >>> text -!- >>>=20 >>> then to get inside also need to skip the tag: >>>=20 >>> text -!- >>=20 >> Right, the thing navigation only supports going up/outside, but not = going >> down/inside. We can add a new thing for beginning and end of balanced >> pairs. Then down-list will be going from the start of a = balanced-pair-open >> to the end of it. Up-list will be going from the start of >> a balanced-pair-close to the end of it. >=20 > Probably we could use just such heuristics that 'down-list' should = skip > the first node of the balanced pair. This should work for most = ts-modes. >=20 > For example, for 'jsx_element' the first child to skip is = 'jsx_opening_element'. > For 'argument_list' the first child to skip is an anonymous node "(". > For 'statement_block' the first child to skip is an anonymous node = "{=E2=80=9C. Yes, that should work for the vast majority of grammars. I can=E2=80=99t = think of an counter example other than for_statment in tree-sitter-c. Yuan