From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Use (eval-when-compile 'treesit) to save us from writing declare-function forms Date: Sat, 07 Dec 2024 08:47:24 -0500 Message-ID: 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> Mime-Version: 1.0 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="33389"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Yuan Fu , emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Dec 07 14:48:09 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 1tJvAG-0008Xc-5t for ged-emacs-devel@m.gmane-mx.org; Sat, 07 Dec 2024 14:48:08 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tJv9m-0005Ia-GS; Sat, 07 Dec 2024 08:47:38 -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 1tJv9k-0005I8-19 for emacs-devel@gnu.org; Sat, 07 Dec 2024 08:47:36 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tJv9i-0005mX-6S; Sat, 07 Dec 2024 08:47:35 -0500 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 70D0A10012E; Sat, 7 Dec 2024 08:47:30 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1733579245; bh=cu+T96Jymm2n71xehK3Fv9RZAnX11/GoCw31NDsJblI=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=hPHuvik0gpygB9VEs3z5a/vQBWu5N318+9M1PL1AsdP6ZirSDF8sX6oomd6guM653 w4OA36/hesiX+bXavPeFlqZz9Jtnn3Wh4TE3/TSQL/j+Xdd6duh9A1oICZv/QqJWmw SIXDID05ldrLPAHPcij7cvMPTOLn2zrlkB80O2hlj4IROHDq1jY2JL41y5hZleW1eA ggxJyjVFM5ceco+G72+icpU1pcZ0T4bPpW0iT+iLTMZoMPNUuSROW0ghc3tzvHWrnw XG9hNRa4289ykS3uW8PbScxVF7GtpO6qFxmUjO4AT3Q/tZsdN4MIZkLDBb1QcJIFUH sExa0+byqUNLA== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id A44991000C3; Sat, 7 Dec 2024 08:47:25 -0500 (EST) Original-Received: from pastel (104-195-225-43.cpe.teksavvy.com [104.195.225.43]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 75A251202E2; Sat, 7 Dec 2024 08:47:25 -0500 (EST) In-Reply-To: <86ser0j5hw.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 07 Dec 2024 09:51:07 +0200") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, 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:326166 Archived-At: >> Does that mean declare-function forms only affect the file it=E2=80=99s = in? >> Because if treesit.el has declare-function forms for all the treesit.c >> functions, and c-ts-mode.el requires treesit.el, why do we need to have >> declare-function forms in c-ts-mode.el? > Seems like that. Stefan, am I missing something here? Yes, `declare-function` *should* follow the same principles as `(defvar FOO)`, meaning that they are compiler directives not functions to execute. They affect warnings only in the current lexical scope, and requiring a file full of `(defvar FOO)` and `declare-function` will have no effect at all. [ Side note regarding this *should*: it currently doesn't work quite as well as `defvar` because its effect is always file-wide, whereas it should be limited to the current scope. ] Stefan