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: Thu, 09 Jan 2025 09:42:14 +0200 Organization: LINKOV.NET Message-ID: <87plkwwigx.fsf@mail.linkov.net> References: <87plox4mtp.fsf@masteringemacs.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> 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="39074"; 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 , Eli Zaretskii , Mickey Petersen , Stefan Monnier , 73404@debbugs.gnu.org To: Yuan Fu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jan 09 08:50:10 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 1tVnIw-000A00-EG for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 09 Jan 2025 08:50:10 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tVnIq-0002O8-1f; Thu, 09 Jan 2025 02:50:04 -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 1tVnIo-0002Mf-9b for bug-gnu-emacs@gnu.org; Thu, 09 Jan 2025 02:50: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 1tVnIo-0002yt-0k for bug-gnu-emacs@gnu.org; Thu, 09 Jan 2025 02:50: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=2be3e1FhhEGZ7EAKPSLIuNfOK80r2u6SDNbcUH6QV5A=; b=nr6mLV2rAzur73XtlKrcbKSZTUx6pRmMSCBILKEEl6ofVi2fZRABH1g3ahecYCNmfOc+RfRbN5YmyFYPPvh+wDKL1kYA1KuXciorNGj+nNOFuyQx4Nz+6X+hbsAKi8Wktdclv1AoowUjpHc18Gn+yEP603hYp501SUSC83HMZ88oD3ya9mQQNoY0k/E2fRedcA4qoTQqapwV2YuO9qRSG+9qkofc5XnBjaZ/Jbf6AlCmkDWqbxj9om0dviE8lrD0pNpXyr9BsW5+UIp3TBJXiz/fZxDsfNRhW49igALech/ZZzhCc7BL49EQIM1Pu5KYMvL9Ule8Hsmi5ZB2nCcN8w==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tVnIn-00080y-SQ for bug-gnu-emacs@gnu.org; Thu, 09 Jan 2025 02:50:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 09 Jan 2025 07:50:01 +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.173640894330728 (code B ref 73404); Thu, 09 Jan 2025 07:50:01 +0000 Original-Received: (at 73404) by debbugs.gnu.org; 9 Jan 2025 07:49:03 +0000 Original-Received: from localhost ([127.0.0.1]:50279 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tVnHq-0007zY-L3 for submit@debbugs.gnu.org; Thu, 09 Jan 2025 02:49:03 -0500 Original-Received: from relay5-d.mail.gandi.net ([217.70.183.197]:57827) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tVnHo-0007yk-4t for 73404@debbugs.gnu.org; Thu, 09 Jan 2025 02:49:00 -0500 Original-Received: by mail.gandi.net (Postfix) with ESMTPSA id ED5131C0002; Thu, 9 Jan 2025 07:48:50 +0000 (UTC) In-Reply-To: (Yuan Fu's message of "Tue, 7 Jan 2025 18:27:13 -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:298813 Archived-At: >>> 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. >> - > > Thanks. IMHO it’s best to keep it simple and familiar, so let’s keep > using symbols and use a symbol property to solve this edge case. > I think this problem is rare enough that we don’t need any fancy > solutions for it. > > Juri, please feel free to apply your symbol property patch. For the symbol > property name, I feel that something like > treesit-symbol-predicate/treesit-use-as-symbol-predicate would be more > descriptive. If we settle on the variant that keeps the current format with symbols, wouldn't it better to keep a symbol property name shorter? First I proposed 'treesit-predicate', but then realized it's wrong since it's opposite to the predicate function. 'treesit-thing' was better since it indicates that it's used in 'treesit-thing-settings'. > Since we don’t have docstrings for symbol properties (right?). There are no docstrings for symbol properties indeed. But I think the important property for the name is that it should be unique enough to be easily greppable. But I tried to grep, and 'treesit-thing' finds too many matches. So probably the most suitable symbol name would be 'treesit-thing-symbol', that currently has no occurrences in source code.