From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" 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, 07 Jan 2025 14:25:24 -0500 Message-ID: References: <87plox4mtp.fsf@masteringemacs.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> <875xmumpzv.fsf@mail.linkov.net> <87pll190ui.fsf@mail.linkov.net> <674226FE-597C-44DC-823A-667E5C55397A@gmail.com> <87ldvmik3o.fsf@mail.linkov.net> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26428"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Theodor Thornhill , Yuan Fu , Mickey Petersen , Eli Zaretskii , 73404@debbugs.gnu.org To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jan 07 20:26:26 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 1tVFDd-0006iS-OS for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 07 Jan 2025 20:26:26 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tVFDO-0003CW-Nf; Tue, 07 Jan 2025 14:26:10 -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 1tVFDG-0003CA-Qq for bug-gnu-emacs@gnu.org; Tue, 07 Jan 2025 14:26:02 -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 1tVFDG-0007kd-IL for bug-gnu-emacs@gnu.org; Tue, 07 Jan 2025 14:26: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=rijrqaUKUI6sI2IJe5NS1/F1OE/qdz0rNiELAJ6kCqQ=; b=GiEq+GsOj9Ai0ZTYtmRJIkHWlTwzdJPuVdM/7nCUKvkv4Vdco/MngmL0VbEX7jDL+o1tCtO52dYa80LaZSv7JUVHA4ikRzodzBilG3nOhHaNVyxo38gbXCGn9piHEvb0VAMrVEF0Xx+V7WB37Y/Ky3UULm1YJ7vJWUPldJy+B8D26MWrE6IJf0APgbp32pnvmLsk+RMjYxvMZt1HzmlVMPYjTSewFeTfbgJAhNGxSFR42H/7MiGQt5+Hh8MSX+FXfh4F+QRc1KXRZuZ6kL9xq1M0EJTw+Cm6eiTjGA0uuKCKQkDPjCbkPj9tXDW9JzorJ/2AHdsScaJTR8xjxJAyrw==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tVFDG-0001GQ-4V for bug-gnu-emacs@gnu.org; Tue, 07 Jan 2025 14:26:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 07 Jan 2025 19:26: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.17362779404807 (code B ref 73404); Tue, 07 Jan 2025 19:26:02 +0000 Original-Received: (at 73404) by debbugs.gnu.org; 7 Jan 2025 19:25:40 +0000 Original-Received: from localhost ([127.0.0.1]:44721 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tVFCt-0001FO-Ar for submit@debbugs.gnu.org; Tue, 07 Jan 2025 14:25:39 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:7308) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tVFCr-0001Eu-Aw for 73404@debbugs.gnu.org; Tue, 07 Jan 2025 14:25:37 -0500 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 682EB441390; Tue, 7 Jan 2025 14:25:31 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1736277926; bh=fUoBRtJyQGJrNGu7lfgNlg8AmmxBW83AsKxO9N3LBbg=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=Pnc4rwhiJflRp9jbbwXpluORY2wRax/Dwqy1HPeCG40LMMTU0833RfWRQNRgblF7I jplFLG9Gyi6+IyTkWdnwm8TMJ9FEy4yrmxGxEljbaSmr/jk0zna1fhOZv7xJ+3A44B vwZRgU9uUFqXGuRMOTXygahxi7ppTVN+fWKUb7CrRR0GJ4xxbIRA2ikNiGH+2OL0Gl 7yoWAetPikp8u5K1dwlgu5L9XbLu8WIflxz8zTUM6A3YTNRzD5972ZygqQEndKhJXf WL8VtbeDYBxUZfHTvdts1oC6tYv3EOTlPC4OgIA7PZaSAkllrgaevr3lGK/mHYmFoD gdds3+iX/aliw== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 1B9A3441F5E; Tue, 7 Jan 2025 14:25:26 -0500 (EST) Original-Received: from pastel (104-195-232-86.cpe.teksavvy.com [104.195.232.86]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id D36A2120399; Tue, 7 Jan 2025 14:25:25 -0500 (EST) In-Reply-To: <87ldvmik3o.fsf@mail.linkov.net> (Juri Linkov's message of "Tue, 07 Jan 2025 19:56:11 +0200") 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:298744 Archived-At: > Indeed, symbols are more traditional. > > However, the problem arose only because > 'treesit_traverse_validate_predicate' accepts a symbol > for both a function and a thing, that caused ambiguity. > > So there are two variants to resolve this ambiguity: > > 1. use keywords like > > (setq-local treesit-thing-settings > `((html > (:sexp ,(regexp-opt '("element" "text" "attribute" "value"))) > (:list ,(regexp-opt '("element""))) > (:sentence "tag") > (:text ,(regexp-opt '("comment" "text")))))) > > 2. use a symbol property like (put 'list 'treesit-thing t) > > You decide ;-) Of course, there are more alternatives: - Use a symbol property like (put 'list 'treesit--this-is-a-function t) - Refuse functions represented as symbols (callers need to use an eta-wrapper). - Distinguish the two cases via a more verbose representation like `(thing list)` vs `(function list)`. - Use a string rather than a symbol. - Stefan