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: Sat, 04 Jan 2025 19:46:12 +0200 Organization: LINKOV.NET Message-ID: <875xmumpzv.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; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36442"; 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 , Eli Zaretskii , Theodor Thornhill , 73404@debbugs.gnu.org, Stefan Monnier To: Yuan Fu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jan 04 18:54:30 2025 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 1tU8Ly-0009Ed-Di for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 04 Jan 2025 18:54:26 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tU8Le-0000lN-8t; Sat, 04 Jan 2025 12:54: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 1tU8Lb-0000l1-IP for bug-gnu-emacs@gnu.org; Sat, 04 Jan 2025 12:54: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 1tU8Lb-0002Jc-AE for bug-gnu-emacs@gnu.org; Sat, 04 Jan 2025 12:54: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=kvJT19hLpODtbk3nf+XjGD/CVEQo73hgkwku+NfX6Ig=; b=U/Ir8YzhHljNycEfGyi4emk0Hr7ToHsWIanM71jLQXe1d34DxW5Y9k1hTOt2UGQUMjhL7M2BNgavidAqFVKvmardsshawTKplugXthDSsqgXIc+w1xSYt958U8oFml6HlY4WppM/PibZ48rANdOcvTQdGcDwwYVVs8nyqNMgtoRIfuI59aMNQPRMVZbIoUF467T5zF1xzgTkjxTscCXi080r+WqZJ0fNmSWbafZkdqxJ1B5n5JnG4LS+0Ty1fVp4Gc5EWB6rO5x+F4FhdNBVKf6kCBdwDwhjmfBiRLEPWw7lg1yJwAP83T+BuAT6HiJxV9RlbDaUEEPHQ+M3sMCltw==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tU8La-0004YC-VB for bug-gnu-emacs@gnu.org; Sat, 04 Jan 2025 12:54: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: Sat, 04 Jan 2025 17:54: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.173601323217468 (code B ref 73404); Sat, 04 Jan 2025 17:54:02 +0000 Original-Received: (at 73404) by debbugs.gnu.org; 4 Jan 2025 17:53:52 +0000 Original-Received: from localhost ([127.0.0.1]:57181 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tU8LM-0004XX-O5 for submit@debbugs.gnu.org; Sat, 04 Jan 2025 12:53:51 -0500 Original-Received: from relay4-d.mail.gandi.net ([2001:4b98:dc4:8::224]:48085) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tU8LH-0004Wz-VJ for 73404@debbugs.gnu.org; Sat, 04 Jan 2025 12:53:44 -0500 Original-Received: by mail.gandi.net (Postfix) with ESMTPSA id 46C68E0002; Sat, 4 Jan 2025 17:53:34 +0000 (UTC) In-Reply-To: (Yuan Fu's message of "Mon, 30 Dec 2024 00:00:51 -0800") 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:298441 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'. >> >> However, the current 'sexp-list' as a two-word composite is too ugly. >> Now I found a better replacement: 'group'. This word is already used >> in lisp.el such as in the docstring of 'forward-list': > > I don’t have an opinion on this. Groups sounds a bit abstract, but so > does sexp-list. Indeed, the right name is 'list'. So let's use it. The minimal change that doesn't require updating all existing definitions of treesit-thing-settings, is just to add an exception for 'list': diff --git a/src/treesit.c b/src/treesit.c index b3214dad836..2d15e64180d 100644 --- a/src/treesit.c +++ b/src/treesit.c @@ -3618,7 +3618,7 @@ treesit_traverse_validate_predicate (Lisp_Object pred, } if (STRINGP (pred)) return true; - else if (FUNCTIONP (pred)) + else if (FUNCTIONP (pred) && !BASE_EQ (pred, Qlist)) return true; else if (SYMBOLP (pred)) { @@ -3722,7 +3722,7 @@ treesit_traverse_match_predicate (TSTreeCursor *cursor, Lisp_Object pred, const char *type = ts_node_type (node); return fast_c_string_match (pred, type, strlen (type)) >= 0; } - else if (FUNCTIONP (pred)) + else if (FUNCTIONP (pred) && !BASE_EQ (pred, Qlist)) { Lisp_Object lisp_node = make_treesit_node (parser, node); return !NILP (CALLN (Ffuncall, pred, lisp_node));