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: Tue, 24 Dec 2024 13:14:29 -0800 Message-ID: <856C1B51-D9BC-4794-95CF-28E9B9B59325@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> 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="35612"; 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 Tue Dec 24 22:16:26 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 1tQCGP-00098b-UA for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 24 Dec 2024 22:16:26 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tQCG6-0003sX-1T; Tue, 24 Dec 2024 16:16:06 -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 1tQCG3-0003rs-Jv for bug-gnu-emacs@gnu.org; Tue, 24 Dec 2024 16:16: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 1tQCG3-0002C7-Aq for bug-gnu-emacs@gnu.org; Tue, 24 Dec 2024 16:16:03 -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=Mk8gkCPRAKEXpcLUrTuci4jPVSOlcx59CpBFlshxcIA=; b=q02jg5ob3emxAJbDcG7sP5hOuBa6yVkN96i84r1iBHGTmzI2QvxQ53/aSyLK21XxRAoWFyrNUMX4VGkOge4NctbzY7M7hb7GmSH+tEwS+5wmq5K0m4FIGrd17pl/zaeiPCEyK2buGrmzNj2/H7dSAb5Cg5GbSQgUXFti3Z63w7em/Y0Mb9Fn6pgc9HRZk0mStGkKTltHVCToT3Eva6af16ptsXCpC2pdkbWUqsv0qWZHTKW/X3EU9l8zECxD1ZL1ss33i8XulgBA1zGtcIVL9wf5ldNEcXrZilxqqWn0+ZWpIw/119Rmuy0/yrM4t969l8VdeYlMbQTxIdNrRHRxig==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tQCG2-0007e3-5j for bug-gnu-emacs@gnu.org; Tue, 24 Dec 2024 16:16:02 -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, 24 Dec 2024 21:16:02 +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.173507495229369 (code B ref 73404); Tue, 24 Dec 2024 21:16:02 +0000 Original-Received: (at 73404) by debbugs.gnu.org; 24 Dec 2024 21:15:52 +0000 Original-Received: from localhost ([127.0.0.1]:34849 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tQCFr-0007dd-M8 for submit@debbugs.gnu.org; Tue, 24 Dec 2024 16:15:52 -0500 Original-Received: from mail-pl1-f181.google.com ([209.85.214.181]:46162) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tQCFn-0007dK-8z for 73404@debbugs.gnu.org; Tue, 24 Dec 2024 16:15:49 -0500 Original-Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-219f8263ae0so24062345ad.0 for <73404@debbugs.gnu.org>; Tue, 24 Dec 2024 13:15:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1735074881; x=1735679681; 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=Mk8gkCPRAKEXpcLUrTuci4jPVSOlcx59CpBFlshxcIA=; b=dt5apz5bjhL8v5ej+/AcYmOutym9AZuFUM2A05qh1LbD2sYpLlQEYzPdphYwKrXIB7 ObfrdzZCsutVYBTZ2Z0zqixbjgh3Kzb/lHyyWu3wliqXZL9Pn3iOISGwyefhXurxec5j d5GRNFu61yVuapOueL3v1Bve47iFRUna0Dl+lvzbbektav3DtgWosikwHfokt5qeOZXl KuMuDDHWohnBgw1XHFS+qRKBhIS9n5MpTBnNHEzg333grqLu3jSSpOEh65vT5p0AP7Yt apIIKSyzZSTDLlTkkz2amLFSgNNbSA+d43pkGh+I9xt9YMQXoD2NTbT9DjhCAFqaf+qT khaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735074881; x=1735679681; 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=Mk8gkCPRAKEXpcLUrTuci4jPVSOlcx59CpBFlshxcIA=; b=iIIoJ00+sbRZnmlcpFpJI+nIV/lO5v1HwsGtdVyEcnrrp//pD+z0h4i8i7ymHi8KXE DpoaiglNedhIMT4m2wEO5bI7XLWwBpGBUI36/+Ax9JlszdFP4xPX1YivS/X3zcY9l/2s y5plilGGlPjcpcDUFfBe1ZPzQx2HFHDNspyV1HcNklb2uC4xtiLqLnZMBSl/2rvivUbS 6NL8hz8Jcz5eYeyAY9zxHqSmdwnNt0CGeGWnEbHdCwJ+OQUwAuKuIN0PVGJHA2Zcn4ZY NQVFFv+Cu5EqK+hueKlIjtVBYNd3GhXrnqH/d2mG5dCL7R1qMKBo/+wsr2AHnWeC4FSs t3CQ== X-Forwarded-Encrypted: i=1; AJvYcCWPpExv78JH2QFufPcxsCRP0zaiN1I1gGkFbwE1KNsUEwC1x/AD9Q/S11kcLUUR6iRF6jUtbQ==@debbugs.gnu.org X-Gm-Message-State: AOJu0Yzl4Zv0XSVRhVDwNX9HMjgKo5np4xmO+VxTZyUaLK6HaNxDIpdQ xOQEFKCjrPZTkVYWR6Ucf8SgsMNut59cpQqVUC8dZRQmmSEY+qlf X-Gm-Gg: ASbGncuk/ca8kAIK/O/6drMrJZMzOeoN4a/yVmEadZzP50ZSQzHahiZHYa/R1CrPcqp 9zdIEwKOvHtwX/Jo54iFohT9xZP6pc+rAVpKAHb0JlkKObI8KeRIwLnJmp3N/e4jDZPEI2shb0I SyRxO/WE8EHQJ4YBb52xVWYwXFTRleY6FOASCCZrvfgRS+bu0hMpTyRdNP35000e8YW6pMWa/xr KdxXQWPjXM9MyE9KNGNE3l14NsK7z+pJvoSoMbWEMJc1SME2v59nAXO21Tivg1lopwnNu9haiIQ Fx1f X-Google-Smtp-Source: AGHT+IFYrcw0UyHAXmb9JfmQaoEM74V3YhwlrSkza8tyUgGTg74aVoTeUOOLX+fin8PsX3WZvOgsdA== X-Received: by 2002:a17:903:11c5:b0:210:fce4:11ec with SMTP id d9443c01a7336-219e6e89208mr306321635ad.1.1735074881536; Tue, 24 Dec 2024 13:14:41 -0800 (PST) Original-Received: from smtpclient.apple ([2601:646:8f81:6120:1d98:6810:9846:b152]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-219dc96eb40sm94222655ad.86.2024.12.24.13.14.40 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Dec 2024 13:14:40 -0800 (PST) In-Reply-To: <87ikr8hpdu.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:297701 Archived-At: > On Dec 24, 2024, at 11:05=E2=80=AFAM, Juri Linkov = wrote: >=20 >> Ok, so now pushed to master in such backwards-compatible way >> that when a ts-mode doesn't define the 'sexp-list' thing, >> then the existing 'sexp' is used. >=20 > Also I'm looking into allowing more list-navigation commands > to be usable in ts-modes. E.g. instead of limiting list-navigation > only to the current 'forward-sexp', another useful command is > 'down-list'. >=20 > Currently to get inside an HTML element in html-ts-mode > is possible by using 'M-e' (forward-sentence) to skip HTML tag. > This is not quite obvious. >=20 > More natural would be to support 'C-M-d' (down-list). >=20 > But this requires overriding more low-level 'scan-lists' and > 'scan-sexps' in treesit, instead of overriding the current top-level > 'forward-sexp-function'. >=20 > Also treesit-thing-settings for 'down-list' would require > pairs of node names: one node to define a list, and another node > to skip a node to get inside the list. >=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 -!- 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. We might also want a way to jump from pair-open to pair-end. Going to = pair-open=E2=80=99s parent=E2=80=99s end will be almost always correct. = (Except for the grammars that do weird stuff, like tree-sitter-c=E2=80=99s= for statement, the condition is not a node by itself, but split into = opening parentheses, initializer, loop condition, increment, closing = paren, all of which direct child of the for_statement, not grouped into = a condition node.)=20 Yuan=