From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.devel Subject: Re: Use (eval-when-compile 'treesit) to save us from writing declare-function forms Date: Wed, 11 Dec 2024 03:57:42 +0200 Message-ID: <1af97645-16bc-47d6-bcba-2dbe2a1fa583@gutov.dev> References: <2C0B7D3A-6131-4427-BF04-9211981B57DD@gmail.com> <867c8g3o6v.fsf@gnu.org> <0D278D91-4D67-4E0E-869F-6AF0A46678F7@gmail.com> <86h67jz36z.fsf@gnu.org> <502D58B8-9432-4A8F-B50D-ECA392B7E7C5@gmail.com> <86ser2y5e1.fsf@gnu.org> <86ser0j5hw.fsf@gnu.org> <292D0D0F-AB88-49AB-86DD-A9B736DB00F7@gmail.com> <1771C735-A03F-4FE5-8FCE-22F9647F4C36@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12989"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird Cc: Eli Zaretskii , emacs-devel@gnu.org To: Stefan Monnier , Yuan Fu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Dec 11 02:58:49 2024 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 1tLC00-0003B6-Or for ged-emacs-devel@m.gmane-mx.org; Wed, 11 Dec 2024 02:58:49 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tLBz7-0004R4-H3; Tue, 10 Dec 2024 20:57:53 -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 1tLBz5-0004Qd-4P for emacs-devel@gnu.org; Tue, 10 Dec 2024 20:57:51 -0500 Original-Received: from fout-a6-smtp.messagingengine.com ([103.168.172.149]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tLBz3-00009A-Eo; Tue, 10 Dec 2024 20:57:50 -0500 Original-Received: from phl-compute-06.internal (phl-compute-06.phl.internal [10.202.2.46]) by mailfout.phl.internal (Postfix) with ESMTP id 5D2101383E5C; Tue, 10 Dec 2024 20:57:46 -0500 (EST) Original-Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-06.internal (MEProxy); Tue, 10 Dec 2024 20:57:46 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm3; t=1733882266; x=1733968666; bh=/yPmBmPJFMg9DTaWvPyX8Tetts90aAmOhtgPf42Hklw=; b= OVHKuE7R7sWV4XuOVu8DEZ1EjlLoX95UqqyG44VOQsRQXxbpyWGONufC3r+sJsUq NfJyRFD0DMjsE1+thcp3HWkYQVlS2RMny25f69qF+n4K5K54JpNfDyS0mzn3I0xN EVVStnbQkn9jeo/DxIANcbifHV4+OBiNNGsE13Jw2DXiIyVvuU3uHMGbinE0aM6B 78VTAdH0AE5zh0WujG4PVv5YMyAcx19ovrR4NNS9yHqLk5B0CZkHgNIgPoZyozUu CPN5EQdKDR/1PuX7MDRmmaVe854CrcEYEZ+mMY6Ox7H4dqnbtkuVW2SqULEzd1rI +tmgqeggcGVxVaqs2aUoew== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1733882266; x= 1733968666; bh=/yPmBmPJFMg9DTaWvPyX8Tetts90aAmOhtgPf42Hklw=; b=g nt9n1F9pAbuInjzfXB96aA/0Vf173cp/ecSf6+icGf/R00t+jP+upKK5iH7bHWeL 04D3aAzjSlHxNYEFsZi/uVO8SN8cyWsKTNPRpgFjWy9ZUIyVQPAzHjLkQMW+oEJy wveov3wrV7FcuXTP5uJUpRxRs1W72mtGVH6znFVWXGN3QiPnT5G7WHsxfBNR0Fvy FfxGWv+GuRM+82MBCCroJTofljf5VMRkdq3sAct5cDh/jyiXMEoVwZNFEimrz6+R CsyiKMsvfhtcP4arVegdiiWE0AdcBmkJA9/jdSgQvwYkU8hFd+Hp1PrPrzaUctUv 2trv7ZxArg3rfXnA9WNmg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrjeelgdeflecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdpuffr tefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnth hsucdlqddutddtmdenucfjughrpefkffggfgfuvfevfhfhjggtgfesthekredttddvjeen ucfhrhhomhepffhmihhtrhihucfiuhhtohhvuceoughmihhtrhihsehguhhtohhvrdguvg hvqeenucggtffrrghtthgvrhhnpeegleefteekgffhvdfhtdegveevveetteegteevgeet tdehhfdukeetheffueekkeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmh grihhlfhhrohhmpegumhhithhrhiesghhuthhovhdruggvvhdpnhgspghrtghpthhtohep gedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepmhhonhhnihgvrhesihhrohdruh hmohhnthhrvggrlhdrtggrpdhrtghpthhtoheptggrshhouhhrihesghhmrghilhdrtgho mhdprhgtphhtthhopegvlhhiiiesghhnuhdrohhrghdprhgtphhtthhopegvmhgrtghsqd guvghvvghlsehgnhhurdhorhhg X-ME-Proxy: Feedback-ID: i07de48aa:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 10 Dec 2024 20:57:44 -0500 (EST) Content-Language: en-US In-Reply-To: Received-SPF: pass client-ip=103.168.172.149; envelope-from=dmitry@gutov.dev; helo=fout-a6-smtp.messagingengine.com X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 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, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_SBL_A=0.1 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:326315 Archived-At: On 09/12/2024 04:40, Stefan Monnier wrote: >> I thought eval-when-compile is more of a “include if compiling” macro, should’ve checked 🙂 >> >> We can also go with Dmitry’s idea, and just define all the functions in >> treesit.el if Emacs is not built with tree-sitter. We can detect that with >> treesit-available-p. > I haven't really thought about it, so I don't have a strong opinion. > AFAICT your proposal should work fine even if you remove the > `eval-when-compile` wrappers to which I objected. 🙂 It seems to me that, having taken than route, we would recommend every (require 'treesit) to be accompanied by (treesit-declare-c-functions) ...or the familiar declare-function list, of course. And the same would also be true for transitive dependencies (so, both c-ts-common and c-ts-mode, even though otherwise the latter could drop the (require 'treesit) form).