From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuan Fu 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, 9 Jan 2025 19:14:08 -0800 Message-ID: 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> <87plkwwigx.fsf@mail.linkov.net> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3776.700.51\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6125"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Theodor Thornhill , Eli Zaretskii , Mickey Petersen , Stefan Monnier , 73404@debbugs.gnu.org To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jan 10 04:15:19 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 1tW5UU-0001PK-OA for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 10 Jan 2025 04:15:18 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tW5UH-0005MY-KW; Thu, 09 Jan 2025 22:15: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 1tW5UF-0005M8-V9 for bug-gnu-emacs@gnu.org; Thu, 09 Jan 2025 22:15: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 1tW5UF-0004SP-Kj for bug-gnu-emacs@gnu.org; Thu, 09 Jan 2025 22:15:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=References:Date:In-Reply-To:From:Mime-Version:To:Subject; bh=bvhzzL6T98F9CyVVpvtPPDs1cW5yP++GviAEmmgqpBc=; b=j4y4NWI3oryu3tI7UAj3ynKOn2OYAdAk5ejSREtoAdhF0noyVmWQ5IR6A62Z4mzbwIppLY7833WjdLIrNVba0F+WcnDsnRP7AxmPaVwSkHHyhIzzcRx4xE5hC/4BSNOBNYcB7sRZrRGXM0jY1c+PP2SX9rBgfabvoGDf27MwjbUgM0ZjxtYdlKm6W2kJ4cIAsHjqBoJth2NWEhUp6m4y7mMyXZjvh3suxofCYEdIW4kpQZHJCrKYzrHja5N8lLBQxFa50YPQLO15szQTvvTTd+j0ZB6ddInqmewuw7PZe5PpU7P0I9cQbLAgheTeanh6hs100PsVfthFQzHccjjPoA==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tW5UE-0006ku-GR for bug-gnu-emacs@gnu.org; Thu, 09 Jan 2025 22:15:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 10 Jan 2025 03:15: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.173647886925906 (code B ref 73404); Fri, 10 Jan 2025 03:15:02 +0000 Original-Received: (at 73404) by debbugs.gnu.org; 10 Jan 2025 03:14:29 +0000 Original-Received: from localhost ([127.0.0.1]:55937 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tW5Tg-0006jm-SG for submit@debbugs.gnu.org; Thu, 09 Jan 2025 22:14:29 -0500 Original-Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]:53249) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1tW5Te-0006jV-9H for 73404@debbugs.gnu.org; Thu, 09 Jan 2025 22:14:26 -0500 Original-Received: by mail-pj1-x1035.google.com with SMTP id 98e67ed59e1d1-2ef28f07dbaso2207608a91.2 for <73404@debbugs.gnu.org>; Thu, 09 Jan 2025 19:14:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736478860; x=1737083660; darn=debbugs.gnu.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=bvhzzL6T98F9CyVVpvtPPDs1cW5yP++GviAEmmgqpBc=; b=adNo4vzS82OMonReOqHpRE3NgnY8YOSmCEFZ/5ZaM74o2giimFJs8zaqwJklqGz82D SK19D2RFg+Jz4r8V7BKlb2qwxrsE/OZQkJ64AMOrEk8gcFNP7Sl3cw0LNQTl4+wzmmtp S3Ne/OgOYsCHnUzhdLaWXF6Fzc9/D1Y5GST1adt2vpjVhbBoDGxnXjy8fDM3f8DkI7sJ 6X8mKbcRp5Kque5KtX2QfHGmeKkE/ney5fKyui4ELZCfvL47s/2AqUOX5YrhIdntCIv7 IUVmhGcLNtHC8zqHawtdWe2sFJ1jP7BeKGVR69w7JkswOalZV0CDc3FLYsPFFC/qtU7W cbfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736478860; x=1737083660; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bvhzzL6T98F9CyVVpvtPPDs1cW5yP++GviAEmmgqpBc=; b=xGiJLrlybelErviDfQ1EkJISUeZCsg+8BcXRo792+8rr0G35hiNSNNZJ+LycoXeNML ZIaJ9y5D0uee0Fq5IlnIIoEjAq5hMmj7xn8Lc286yIJQXT2xwRe3bNiaIYv5c5MJqVK7 8r/h0Ir8moWQsXLYrFkmvh93flQ1ZiEEcKGmOW7E2uiPJUs/bQh4NBmEK3Fs+x0wj7wr TrFqYVEKVatzgb4ArNYcy48rhldiBm7wCoJ6swAhnIEEr+YT7farJcHvBiVafd5oHp/w lWUstiM7wyn7T/wtQQZjytb154xvJhKXwNP9nyc916L/s0OYiaQRUByVpRQ3Bw3LiKR2 DJKQ== X-Forwarded-Encrypted: i=1; AJvYcCWh38Koiuce4kzDWSU+ARa4f+UPjfq614PWaImLA/mGJGmeFcOJ74wzYXZ6/J6J5VKfJVidpg==@debbugs.gnu.org X-Gm-Message-State: AOJu0Yzj2VaaiV3ary36imF80Ee2ptH8IzU1Of3rtjPOzCpSiatG9xRf wSlJwLMt8yWQApuE6xvPsCkRAHU2Py5K1QbOAypRgteDPxEuDDq4 X-Gm-Gg: ASbGnctkM53B6BVIZdQYSNl35NLLMGOsbF+tHBfSdAmXMU2FDqGCnRRJ+/OctNECSi0 nIBXw8JyLdcbw1dLzMV/gaxUk5RKolzqNkMcVQPcbdOpJzlCWU5Bhp237Uh8Ke4W1AKESslIuar unbA6nN7w+CTE6KJMt5FXksEqNIERoKCTH5YJKtYiJxxLeO6gomynnPgAaY6JiZZHqtjS3/2zV9 VWpxQamjg51RHSi2QWPeMa1GFxo2+qAkBEn4SovBw9WS7ACT26xEBt3SZq33/lhYxV0CEEB8EiM 73sm X-Google-Smtp-Source: AGHT+IEgvb4pFNF4h5PjQKSzNw8AXPwK2m/GnfeaUpXOge0ta2gjJ3lQDsRskxuSW2uwWyGRgctSWA== X-Received: by 2002:a17:90b:270d:b0:2ea:3f34:f194 with SMTP id 98e67ed59e1d1-2f548eae587mr14071370a91.10.1736478860213; Thu, 09 Jan 2025 19:14:20 -0800 (PST) Original-Received: from smtpclient.apple ([2601:646:8f81:6120:d801:ab3e:9baf:5ef1]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f559454f73sm2242058a91.38.2025.01.09.19.14.18 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Jan 2025 19:14:19 -0800 (PST) In-Reply-To: <87plkwwigx.fsf@mail.linkov.net> X-Mailer: Apple Mail (2.3776.700.51) 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:298860 Archived-At: > On Jan 8, 2025, at 11:42=E2=80=AFPM, Juri Linkov = wrote: >=20 >>>> 1. use keywords like >>>>=20 >>>> (setq-local treesit-thing-settings >>>> `((html >>>> (:sexp ,(regexp-opt '("element" "text" "attribute" = "value"))) >>>> (:list ,(regexp-opt '("element""))) >>>> (:sentence "tag") >>>> (:text ,(regexp-opt '("comment" "text")))))) >>>>=20 >>>> 2. use a symbol property like (put 'list 'treesit-thing t) >>>>=20 >>>> You decide ;-) >>>=20 >>> Of course, there are more alternatives: >>>=20 >>> - 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. >>> - >>=20 >> Thanks. IMHO it=E2=80=99s best to keep it simple and familiar, so = let=E2=80=99s keep >> using symbols and use a symbol property to solve this edge case. >> I think this problem is rare enough that we don=E2=80=99t need any = fancy >> solutions for it. >>=20 >> 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. >=20 > If we settle on the variant that keeps the current format with = symbols, > wouldn't it better to keep a symbol property name shorter? >=20 > 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'. >=20 >> Since we don=E2=80=99t have docstrings for symbol properties = (right?). >=20 > 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. >=20 > So probably the most suitable symbol name would be = 'treesit-thing-symbol', > that currently has no occurrences in source code. Sounds good. Let=E2=80=99s go with it then. Yuan=