From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov 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: Sun, 29 Dec 2024 19:58:01 +0200 Organization: LINKOV.NET Message-ID: <87ikr21idy.fsf@mail.linkov.net> 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> <87y103wsji.fsf@mail.linkov.net> <87h66pr1qc.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26376"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu) Cc: Theodor Thornhill , Yuan Fu , Mickey Petersen , Eli Zaretskii , 73404@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Dec 29 19:00:25 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 1tRxaT-0006hP-4p for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 29 Dec 2024 19:00:25 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tRxa9-0002Gd-Ed; Sun, 29 Dec 2024 13:00:05 -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 1tRxa7-0002GE-2w for bug-gnu-emacs@gnu.org; Sun, 29 Dec 2024 13:00: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 1tRxa6-0001Jn-PS for bug-gnu-emacs@gnu.org; Sun, 29 Dec 2024 13:00:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=XsQcLz9MYI3vB6WEZHE+t2iJTypl+KecKV4VxGS1pRs=; b=cjmo6FSvc3Y+1yWdr7MOlifvd/sDJWBTsM9ZR7O5Al0HgWwq+y7X+wLSXssdXxS++fxYhb26Xee7tasaAAl92wZVAL35mouCVnryRdV0w9B/6IKkpMwZxcBgZ1NB6DmdWVqPAVUyQHiZKS1XOWib/yCW2pzz8mM7QvCBAUpyU764UtaJp3WjOEenaUjjWzAnB6Ev3PsyDGbZWyoR15JKo80iH3NkTGh/KxzUlYYJl7JEvp2ru6bsXHI2d2SdHE3X40UppKgxapnaBvOCehnUbo4bSnCT25O/rX1oHKw3lSezFGkikJhXMsAWUNh+0+Z15OZ2wygFHB06DPbU4NUHWQ==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tRxa6-0004hr-Bs for bug-gnu-emacs@gnu.org; Sun, 29 Dec 2024 13:00:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 29 Dec 2024 18:00: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.173549519018037 (code B ref 73404); Sun, 29 Dec 2024 18:00:02 +0000 Original-Received: (at 73404) by debbugs.gnu.org; 29 Dec 2024 17:59:50 +0000 Original-Received: from localhost ([127.0.0.1]:56071 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tRxZu-0004gr-4c for submit@debbugs.gnu.org; Sun, 29 Dec 2024 12:59:50 -0500 Original-Received: from relay4-d.mail.gandi.net ([217.70.183.196]:46681) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tRxZs-0004gd-4u for 73404@debbugs.gnu.org; Sun, 29 Dec 2024 12:59:48 -0500 Original-Received: by mail.gandi.net (Postfix) with ESMTPSA id C36ECE0003; Sun, 29 Dec 2024 17:59:17 +0000 (UTC) In-Reply-To: <87h66pr1qc.fsf@mail.linkov.net> (Juri Linkov's message of "Fri, 27 Dec 2024 09:54:11 +0200") X-GND-Sasl: juri@linkov.net 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:297955 Archived-At: > So clearly instead of overriding `scan-lists` and `scan-sexps`, > better would be to add 3 new variables: `forward-list-function`, > `down-list-function` and `up-list-function`. Ok, now these 3 functions are added in lisp.el and overridden in treesit.el. >> What I do know is that in general we'd also want an `up-sexp` operation. >> Currently we have an ugly kludge in `up-list` to try and use >> `forward-sexp-function` (which is ugly both because >> `forward-sexp-function` doesn't really provide the functionality we >> need, and because it mixes up sexp and list navigation), and it would be >> good to clean it up. > > Agreed, this distinction is required for treesit. Hopefully, > this can be achieved by separating `forward-sexp-function` > and `up-list-function` that in ts-modes could be set to new > functions either `treesit-up-list` or `treesit-up-sexp`. Like `treesit-forward-sexp-list` uses `forward-sexp-default-function` to move between symbols inside lists, I'm going to add syntax-based fallback in `treesit-down-list` and `treesit-up-list` as well. This is useful in strings and comments. This is what `up-list` already does. Unfortunately, currently there is such limitation in `down-list`: (when (ppss-comment-or-string-start (syntax-ppss)) (user-error "This command doesn't work in strings or comments")) But this is not a problem for `treesit-down-list`.