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#75198: 31.0.50; [treesitter] peculiar error Date: Sat, 4 Jan 2025 11:22:54 -0800 Message-ID: References: <87y0zxmgeu.fsf@akurth.de> <87h66l6opc.fsf@mail.linkov.net> <5123F6E2-519E-42DE-9437-E65D1749D9D4@gmail.com> <87pll2mq7c.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="24895"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 75198@debbugs.gnu.org To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jan 04 20:24: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 1tU9l4-0006IQ-Fr for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 04 Jan 2025 20:24:26 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tU9kl-00070f-AQ; Sat, 04 Jan 2025 14:24:07 -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 1tU9kg-00070Q-LH for bug-gnu-emacs@gnu.org; Sat, 04 Jan 2025 14:24: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 1tU9kf-0001so-R7 for bug-gnu-emacs@gnu.org; Sat, 04 Jan 2025 14:24:02 -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=XXLA9zPwPSZ39RZiV8reySsjhSxWP0E/H+N+csvD9iU=; b=VXokfQWK/RPs+R7XCfhb0DPV1itqRkv+6MGbEuCHYGJpuZyvHsfKolyttiER7il8HSRzFKSmXWCwM+IUNOJyK4ncK3AVJbC9pwUqbtovQyLgdrl3Saqbo/BPxaLBb2T/E9NK5nMIM1KOnqA/YJtS5MD+zzmbymc8ZNysMCKlzmgK10jXO4UxSNZdE4ew4xdm/EHlQt79mFGCgHghrmIzEtE0jDD9wwwBs27e3m7Yt4g+F8KbnnMTlDl5/SaG2Ec7BqcyhQ/iYOHGZc1eqDQoJQZRgwg+DU3bji7aKCTOE/9gnbx7qUNbEKY43z0FHTAXrMXfBLNO2fBdTElp4eeX6g==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tU9kf-0000D6-L3 for bug-gnu-emacs@gnu.org; Sat, 04 Jan 2025 14:24:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 04 Jan 2025 19:24:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 75198 X-GNU-PR-Package: emacs Original-Received: via spool by 75198-submit@debbugs.gnu.org id=B75198.1736018590721 (code B ref 75198); Sat, 04 Jan 2025 19:24:01 +0000 Original-Received: (at 75198) by debbugs.gnu.org; 4 Jan 2025 19:23:10 +0000 Original-Received: from localhost ([127.0.0.1]:57428 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tU9jq-0000BZ-AO for submit@debbugs.gnu.org; Sat, 04 Jan 2025 14:23:10 -0500 Original-Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]:56607) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1tU9jn-0000BO-Tz for 75198@debbugs.gnu.org; Sat, 04 Jan 2025 14:23:08 -0500 Original-Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-2166360285dso187271395ad.1 for <75198@debbugs.gnu.org>; Sat, 04 Jan 2025 11:23:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736018587; x=1736623387; 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=XXLA9zPwPSZ39RZiV8reySsjhSxWP0E/H+N+csvD9iU=; b=bnJ/H/UhJvUNQ9zdwf4yupQGpyzvzVzB7ZWpe0Jd+TLX7SljnJmrHnuxps547IsJTm ZYB3zm6++WEQXRZedKs8bTF3AB0ffK+qln5NLMMTxwV47kOxAVq5PqKfrzR/b963azMt fBTbLJlltqgLRULX2y1oi/lxC564bwtb8F5LVjtea1dZjx0Jd/D0qD0y/fmZJkqxpMWl dHUQaHRLVfnsgBr7DpXkEb4/1nx9v7CdsRta0VZEw+QezCoRvgQpASkgl21YWxIflB4O FrWxHdZkoWHWzI5bw2aszVbMUs6v1d6mRw7yq7WlPDdm20KqcaUOkHX+8GQ5eeG8+Z+Z bDAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736018587; x=1736623387; 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=XXLA9zPwPSZ39RZiV8reySsjhSxWP0E/H+N+csvD9iU=; b=jUaLJMS36zcO4ITVtAOc2HTcnOGGqyj4YupdbVVujsW1fkIA9J0A2k4X26HpHT4zYo a6BIqThUXbJMn4jYZclmSLM/z2S2efKj9KsMXtnG1h7uUWarL53p7/pwSIhfDwDnpFw+ sg+/NQlZYcv+go0QRshd0Ukaw2b1bquFcIJIVgWzH72+d6L7WyDPOcvhaV1/An6I/kaN w3Oz1WkaSC67f+WewRUjDLSF8EZp7XleGVU8P6xjc9lGMppce3P2o+q0mEOauO9eHBeP wLQjyOax0xe+DqJDLSJkbIWu9F+kbphya7sQLXCeiMdPz8XI/BqkDhyhwNg8LeOQVAO4 9P2Q== X-Gm-Message-State: AOJu0YwU+2XfuMl4/qDacFc2jAyTXLqCzjPjuRP362/tgYq0faHNoGJc n2Kg8hW4KsJojbmAqo4kShlztTkd5jQtvt+JdyGsspzxiZ5QcWhZHBU4/w== X-Gm-Gg: ASbGncvhry7arItYRDLELC8I82FzI5p0A6WjkKLB14XduWZ6Yg64XMM4+s+PCbXAUwB Ata0Po3ztgyuHHHoRrlHJfOcQ3QziYqW4Cyiui9D2mm/XsQ2/P5P0A4IZN7QOeqpGMXI8UEYvkD un/6c5wsVsjbQyf8VnfTqtgVTp2sVco6qKdOFH87o900tLCPwRdMgNmI2fLyv/u2d1n6mEm41LN hBd8iIj3T+PzDldHSDbk+9Lg6ucHXgwYeajxJjV62+0hZ1DvcqQtPLpSi9J3hO+1Kp54hI3q36M IRY1 X-Google-Smtp-Source: AGHT+IHDywUw9NzyNjUe84Fu/K4waZqR0C2ffQlQlrWAce1uMtsojVG4IQe5E5NCVDcu4qMvso2nYA== X-Received: by 2002:a05:6a20:7fa3:b0:1e1:ae4a:1d48 with SMTP id adf61e73a8af0-1e5e083eae4mr94905451637.40.1736018586479; Sat, 04 Jan 2025 11:23:06 -0800 (PST) Original-Received: from smtpclient.apple ([2601:646:8f81:6120:c496:8cdf:4c5d:3617]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72aad831148sm28337884b3a.53.2025.01.04.11.23.05 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 04 Jan 2025 11:23:05 -0800 (PST) In-Reply-To: <87pll2mq7c.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:298456 Archived-At: > On Jan 4, 2025, at 9:43=E2=80=AFAM, Juri Linkov = wrote: >=20 >>> The problem is that 'treesit-parent-until' raises an error by = default. >>> So needed to copy its implementation where treesit-node-match-p >>> sets the argument IGNORE-MISSING to t. >>>=20 >>> Or maybe better to add new arg IGNORE-MISSING to = treesit-parent-until. >>=20 >> Hmm, I=E2=80=99m not sure. If we go this route, we=E2=80=99d need to = add IGNORE-MISSING for >> every single function that uses treesit-node-match-p. >=20 > Agreed, adding a new arg to all such functions is not the right thing. >=20 > Then maybe better to define the preferred behavior > by a new dynamically bound variable, e.g. > (let ((treesit-raise-error t)) (treesit-parent-until ... pred)) >=20 >> It=E2=80=99s better for these functions to check whether the = definition of the >> thing they=E2=80=99re going to use exists or not, before calling >> treesit-node-match-p; alternatively, if they know they don=E2=80=99t = care, >> they can pass t to IGNORE-MISSING. >=20 > Not sure how much this will degrade the performance of > every function that uses treesit-node-match-p. It should be negligible, plus if a function wants to use a thing, it=E2=80= =99s TRT to first check if the thing exists, right? Otherwise they can = just pass IGNORE-MISSING. There might be cases where the function can=E2=80=99t know whether they = can ignore missing. In that case they can expose the IGNORE-MISSING = parameter in their signature. Treesit-raise-error-p could make sense, but it=E2=80=99s a rather = significant commitment and I don=E2=80=99t see any strong argument for = it as for now.=20 Yuan=