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: Tue, 7 Jan 2025 18:27:13 -0800 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> 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="32030"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Theodor Thornhill , Eli Zaretskii , Mickey Petersen , 73404@debbugs.gnu.org, Juri Linkov To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jan 08 03:28:31 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 1tVLo7-00086x-2c for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 08 Jan 2025 03:28:31 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tVLni-00060X-FJ; Tue, 07 Jan 2025 21:28: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 1tVLnf-00060I-VQ for bug-gnu-emacs@gnu.org; Tue, 07 Jan 2025 21:28: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 1tVLnf-0001ub-Mh for bug-gnu-emacs@gnu.org; Tue, 07 Jan 2025 21:28: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=D3XSK7TjEGX4nY/hjnHLidY9NcIMDPE6SHYqTjLTgdA=; b=NRX1RaFPIKu+0HP9nguW5fAlpeE3CeCapvevxISyBQcMBEAoAkA2bVAillEQtqxDmnGnfEOgOqJqH6PPqymSVBvJQHNfqiCw1MEMvEw3CMCl+fd/V0hF2PhVGeSn/9SmoOdELtQ+Zs3J+dML/4TF+epaDRiEsdZbWr6TjF0tU2GicQs1UUaLRCjIaDr3QRNjHfP8iMMSher4o82/YrIeV5I3mjExfdbkhXX3eXZLg4ozGtYmaHIRCzl+ov4YrbKMZ8BpwTYiYCABLapx7zRKE4qfAZ1OldEzz96On6u41KnX9uQ6fiy7dXsPktzB4HGILkz/981edp41lyWfHVGzsQ==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tVLnf-0006KO-1n for bug-gnu-emacs@gnu.org; Tue, 07 Jan 2025 21:28:03 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 08 Jan 2025 02:28: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.173630325924288 (code B ref 73404); Wed, 08 Jan 2025 02:28:02 +0000 Original-Received: (at 73404) by debbugs.gnu.org; 8 Jan 2025 02:27:39 +0000 Original-Received: from localhost ([127.0.0.1]:45386 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tVLnH-0006Jf-2U for submit@debbugs.gnu.org; Tue, 07 Jan 2025 21:27:39 -0500 Original-Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]:46324) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1tVLn9-0006JM-NC for 73404@debbugs.gnu.org; Tue, 07 Jan 2025 21:27:36 -0500 Original-Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-219f8263ae0so191211435ad.0 for <73404@debbugs.gnu.org>; Tue, 07 Jan 2025 18:27:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736303245; x=1736908045; 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=D3XSK7TjEGX4nY/hjnHLidY9NcIMDPE6SHYqTjLTgdA=; b=Ttr7UUUnIqPji5hAl+3nigVdS8TPBimXQEaLezK/ThUSZhrA2h+FTyKfNL/qXNlqAA lR4h7+zLFztjP9cvr2Tp/c8tyDT9EYfSd60wciyrdXWmWv6w9O9EoYowsv8lWz5W+mJU iVGsnH4mzsqumocZsaxlPzCsMbJ/Ypwy5z3zdq3a2vklWf+aKt8c7dhXLui+yYFDgEiW 0405qN+XVHXJVUFNY7mDRUvz7UUusNfFzIcOADtkP69GeUkYDaC6eSQxPvuXid0Eo3hZ xcSPJnc5MGwVB6zj5Rr6nyoar711MtzTXcJhcsqtyHg29Y92MwVCM/kk5BGQ+AcuwIIi 37NA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736303245; x=1736908045; 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=D3XSK7TjEGX4nY/hjnHLidY9NcIMDPE6SHYqTjLTgdA=; b=S4f2lDhx+D1CHwV3uuQVXgN9vDIIPRw26yyGljLSBxYbSry5lbPTGLQfqkCcN+mNa4 eEwwWERbVVbA0cNNE6IpVVHUEPWIaERRSHLqT3WmT7ii+aRqXx+tvi6DT++q4uvCsFbM qs/BmN6Z2/QObs2oy8/RpAnY6s5Za6gvBM56ZDiPe9vAON2UaaxbOZwI1csl1ZBzB0ap un92fJcu1EZvIJdLOMNCrs+HBiDpEw3NwGPLz4HIFcpG9TpLZFcYy73k4pcViW3Fd1U6 cSLtaGTv/lW9vLc14bJOeT/iWlvVvqER1jNenDe7S+kCeN/j92zaY8k6XafzaxLeAzWb si8w== X-Forwarded-Encrypted: i=1; AJvYcCXTAkx43P0pyiWXKOc9GP9QrrNZkpzVwdavMnkESGJTorb+Ih1+ekZVI3y2qkSFbFprJEe9ZQ==@debbugs.gnu.org X-Gm-Message-State: AOJu0YwqnlTBTwtwtqx8rgBimY87r42Z2Pyal8JYwURG2zViZlqn8lhk F3k5kRAlyJFqJa6kO+uA5D49L2L/9w2at8Rdxgf6JgumDVq6CF9x X-Gm-Gg: ASbGncsA1UYZp7kl+z3eADR4eV5PAlRrP8FenHWpZuSpzxH3KoTOVPNF0zeQuYo1HhG NYdtyk0xjSIDVscSmU/yoW8nb0dRhv6msYXlTI3HbTUcATKxYBDeQAX4SLaQGsegDzM7DbWpjqx w/U3Qr8CdSKvz/+fLp21yBFHpH29pk9CNiVEfYNdjFj3mgE90OYEyuF9B0YO3UvwC9fsdhzaJ40 Dg/0b2N7XAi8NOnxhqvuaKWBURbBwIHCf2zXyvDbL/YVPhDFngNlVdovCoKxQ5rPQCH1+9XvM4v ZM91 X-Google-Smtp-Source: AGHT+IGET3HBupLGA8wKf6yZO06DVgDVTJqiQn19B3j+FF2ee2xZZW/VpOK+unanJUvfXCv0cCJzVA== X-Received: by 2002:a17:902:c951:b0:215:bc30:c952 with SMTP id d9443c01a7336-21a83f4298fmr17529315ad.6.1736303245534; Tue, 07 Jan 2025 18:27:25 -0800 (PST) Original-Received: from smtpclient.apple ([2601:646:8f81:6120:715c:1de9:341d:f41d]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-219dc96e933sm317782195ad.59.2025.01.07.18.27.24 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Jan 2025 18:27:24 -0800 (PST) In-Reply-To: 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:298750 Archived-At: > On Jan 7, 2025, at 11:25=E2=80=AFAM, Stefan Monnier = wrote: >=20 >> Indeed, symbols are more traditional. >>=20 >> However, the problem arose only because >> 'treesit_traverse_validate_predicate' accepts a symbol >> for both a function and a thing, that caused ambiguity. >>=20 >> So there are two variants to resolve this ambiguity: >>=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. > - 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. 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. Since we don=E2=80=99t have docstrings for symbol = properties (right?). Also it=E2=80=99d be nice to document this in the = manual, maybe in the manual section for treesit-thing-settings. The = docstring probably don=E2=80=99t need this niche detail. Yuan=