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.devel Subject: Re: master 09b5f00613: ; Fix calls to treesit functions Date: Mon, 19 Dec 2022 00:35:56 -0800 Message-ID: References: <167138365421.15060.2886694741391315956@vcs2.savannah.gnu.org> <20221218171414.77B8EC0060F@vcs2.savannah.gnu.org> <831qowf54k.fsf@gnu.org> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\)) 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="6077"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org, Stefan Monnier , Eli Zaretskii To: Theodor Thornhill Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Dec 19 09:36:59 2022 Return-path: Envelope-to: ged-emacs-devel@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 1p7Bdq-0001Jb-W4 for ged-emacs-devel@m.gmane-mx.org; Mon, 19 Dec 2022 09:36:59 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p7Bd1-0000yH-D0; Mon, 19 Dec 2022 03:36: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 1p7Bcz-0000xN-1Q for emacs-devel@gnu.org; Mon, 19 Dec 2022 03:36:05 -0500 Original-Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p7Bcw-00063L-AF; Mon, 19 Dec 2022 03:36:04 -0500 Original-Received: by mail-pl1-x632.google.com with SMTP id d7so8309403pll.9; Mon, 19 Dec 2022 00:35:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=kuBpbAJgGpr3cPgwoCIYWQYmpMFKwTIKovYtjIUjjPc=; b=kLPvh8/mH8WC0U3UDXksMA28JU8v3PxOp3tTgWeZQr9woWp18Jml+rBePgg2wCHmRZ tlWabeQpHXOSHDQcezOaMwfY2vwl8/0jTUSZOXxC+gJC9ziOrTRvhGasiU8meRJ0Wssm vI5bFtQEVs9nwqpqRTwnNz2oXPd24HLWHs84v1q0k/g9eFFdnrO4jcWPMwgIQ/5sKlQQ ZO+aWy+EjJd8g2xpZHJ/BOGxGzarVimrZ22dbAAwyYPqUYtyXejjnp5SUSdp401Ity96 IImwzSe7Gj5Wwhq/QES/z0AGVJ8Fsks2AbwoYuv3d1HaUk/4XMhlYp1ulBZR2B9R/3Ai D8nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=kuBpbAJgGpr3cPgwoCIYWQYmpMFKwTIKovYtjIUjjPc=; b=3qIpAL0etpQR5/QRAhNeKSJ4yJ/ou+KB5CG5EPwASABc3EgyeZ0dPWGvljdztdAXSb UfHlC0WNtLsCeBhKxJ9vRtFgsn4A0Mr0fBqVIEylaF3Nrbxh3Md+TyPb4SgFlljkoDW+ j3hJYmunatAPjNB7GdDuT0VaN9Wsje6CO1Hr/Ca71STX31VK7DaBNagPL1T68BShCuFt /OLq4SLSvWxRoewuRPq1SBmbycBqcvS9IBHssj1rJ4VtUPNIcwFcWxiaO3rdyHebyBsG zm9zvjvTxdHdVrPUvUr2BOY09S5lqxHaYXqX5CJVYO2y7sQZWWPb98R7v3D5LfHFGkJD s+yQ== X-Gm-Message-State: ANoB5pk+ZM/y/hEg4349aWLgoHh7VEmD1JPgIhrcEwZfKOV2+Jy2KX12 GXtzUHTM03but/KuzFLplBE= X-Google-Smtp-Source: AA0mqf5w7eHYC5yhzwLxbFAYAjhrdrzvL5mMkOINht8dtcOAzXzJXbt2xBP+uGrzYtN6VxDO2qwQpg== X-Received: by 2002:a05:6a21:168c:b0:ad:e904:f247 with SMTP id np12-20020a056a21168c00b000ade904f247mr26993751pzb.29.1671438958553; Mon, 19 Dec 2022 00:35:58 -0800 (PST) Original-Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id c197-20020a621cce000000b00573a9d13e9esm5991330pfc.36.2022.12.19.00.35.57 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Dec 2022 00:35:58 -0800 (PST) In-Reply-To: X-Mailer: Apple Mail (2.3696.120.41.1.1) Received-SPF: pass client-ip=2607:f8b0:4864:20::632; envelope-from=casouri@gmail.com; helo=mail-pl1-x632.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:301633 Archived-At: > On Dec 18, 2022, at 10:26 PM, Theodor Thornhill = wrote: >=20 >=20 >=20 > On 19 December 2022 04:37:03 CET, Stefan Monnier = wrote: >>>> How 'bout always defining `treesit-parser-list` (and making it = return >>>> `nil` if Emacs was compiled without Tree-sitter support)? >>> Is it indeed guaranteed that the first function to be called by any >>> application that wants to optionally use tree-sitter will be >>> treesit-parser-list? Av >>=20 >> Good question. Tho I don't think we need a guarantee. >> We just need it to be frequent enough. >>=20 >>> What if they want to start with some other function? >>=20 >> There's always `treesit-available-p`. >>=20 >>=20 >> Stefan > 1> >>=20 >=20 > How about treesit-ensure, that checks treesit-available-p and whether = it's enabled for the current mode? The treesit-parser-list is also kind = of working just by accident, as it isn't its job to ensure availability. Depends on how you view it. If all you need to know is whether there is = a parser and everything you do is language-agnostic, then checking = treesit-parser-list is the right thing to do.=20 OTOH treesit-ensure feels vague to me, what exactly does it represent? = Treesit-available-p + treesit-parser-list? If it represents =E2=80=9Cthis = major mode is a tree-sitter mode=E2=80=9D, it still doesn=E2=80=99t say = much IMO. I think it makes more sense to check for specific features, = eg, "is there a parser=E2=80=9D. Yuan=