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: Mon, 30 Dec 2024 20:59:23 +0200 Organization: LINKOV.NET Message-ID: <87seq50zcs.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> <8734i5fyv1.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="1429"; 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: Mickey Petersen , Yuan Fu , Theodor Thornhill , 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 Mon Dec 30 20:05:19 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 1tSL4p-0000BE-5T for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 30 Dec 2024 20:05:19 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tSL4h-0005V6-7v; Mon, 30 Dec 2024 14:05:12 -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 1tSL4Z-0005O1-Hb for bug-gnu-emacs@gnu.org; Mon, 30 Dec 2024 14:05:04 -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 1tSL4Z-00084j-7s for bug-gnu-emacs@gnu.org; Mon, 30 Dec 2024 14:05:03 -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=HqG5GuJ/Tt7DIcBvoXRdDA9L0E3TDCBeQmQW+uNKYkg=; b=SRlf3dkfXp/MCuYdyH/51IT6t2MmgrCsq184JaYOOUwhPMVr6Uibq1L3FxVcIdJPoXzbc9DTYWuLynZbpt8ugdUI7nTLyPSqxZGzWyILoITv2ae6p9a0TMZPYJU/WMTrMq0FBitlYX3DbEtC2FDBd2ByxuWlHrPoICcM2F8fr9QSDFA0HJT98FJoJgsgxyDHDEFvLCSx1FDdXzjIak7K0vClDACBFaM2xwaskklOOLW1fnAG2jbA8Nqg54A8ZVtEWhUXsJW8qd+QUgP6t2nszjAZubZVgVwVgl9y4TjuPZz6u9LXYftGKnK0oCCbXlpnMW5O7R4g4HpRAkHG5WS6Dw==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tSL4Z-0001iM-23 for bug-gnu-emacs@gnu.org; Mon, 30 Dec 2024 14:05:03 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 30 Dec 2024 19:05:03 +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.17355854946550 (code B ref 73404); Mon, 30 Dec 2024 19:05:03 +0000 Original-Received: (at 73404) by debbugs.gnu.org; 30 Dec 2024 19:04:54 +0000 Original-Received: from localhost ([127.0.0.1]:59991 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tSL4P-0001ha-Vj for submit@debbugs.gnu.org; Mon, 30 Dec 2024 14:04:54 -0500 Original-Received: from relay2-d.mail.gandi.net ([217.70.183.194]:55527) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tSL4O-0001hM-JW for 73404@debbugs.gnu.org; Mon, 30 Dec 2024 14:04:53 -0500 Original-Received: by mail.gandi.net (Postfix) with ESMTPSA id 2D65540005; Mon, 30 Dec 2024 19:04:23 +0000 (UTC) In-Reply-To: (Stefan Monnier's message of "Mon, 30 Dec 2024 11:30:52 -0500") 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:298019 Archived-At: >> BTW, my initial intention was to add the thing 'list'. >> But then I discovered that (treesit-thing-next (point) 'list) >> uses the function 'list' instead of the thing 'list'. > > I don't have a good suggestion for the actual naming. > > Regarding the fact that this arg can take a either symbol or a function > (which suffers from a risk of ambiguity, like you discovered), I think > it's very important to try and avoid the intersection of the two, and > a "standard" way to do that is to use keywords, like `:list`. Then for backward-compatibility for existing things could support both variants, e.g. 'sentence' and ':sentence', 'text' and ':text' (luckily no one yet defined such functions). And for the new thing to use ':list', e.g. (setq-local treesit-thing-settings `((html (:sexp ,(regexp-opt '("element" "text" "attribute" "value"))) (:list ,(regexp-opt '("element""))) (:sentence "tag") (:text ,(regexp-opt '("comment" "text")))))) Another variant to avoid ambiguity would be to use a special syntax in calls, e.g. instead of (treesit-thing-next pos 'list) to use (treesit-thing-next pos '(thing list)).