From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#69290: declare-function doesn't work when combined with --eval and -batch Date: Tue, 20 Feb 2024 22:20:24 +0200 Message-ID: <865xyiopkn.fsf@gnu.org> References: <868r3eoqw0.fsf@gnu.org> <2f376e6d58b58f3fa8afa5376018a37b1ba3fab4.camel@yandex.ru> <867ciyoqc4.fsf@gnu.org> <7c6965eaa2f67eaba8128228033dc0b0d0efb42b.camel@yandex.ru> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2850"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 69290@debbugs.gnu.org To: Konstantin Kharlamov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Feb 20 21:21:59 2024 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 1rcWco-0000XC-QT for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 20 Feb 2024 21:21:58 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rcWcY-0005O1-Mx; Tue, 20 Feb 2024 15:21:42 -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 1rcWcX-0005Nd-17 for bug-gnu-emacs@gnu.org; Tue, 20 Feb 2024 15:21:41 -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 1rcWcW-0008Fy-PX for bug-gnu-emacs@gnu.org; Tue, 20 Feb 2024 15:21:40 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rcWcs-0003da-9Y for bug-gnu-emacs@gnu.org; Tue, 20 Feb 2024 15:22:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 20 Feb 2024 20:22:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69290 X-GNU-PR-Package: emacs Original-Received: via spool by 69290-submit@debbugs.gnu.org id=B69290.170846046613872 (code B ref 69290); Tue, 20 Feb 2024 20:22:02 +0000 Original-Received: (at 69290) by debbugs.gnu.org; 20 Feb 2024 20:21:06 +0000 Original-Received: from localhost ([127.0.0.1]:46749 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rcWby-0003bf-3T for submit@debbugs.gnu.org; Tue, 20 Feb 2024 15:21:06 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:40200) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rcWbt-0003b1-Hs for 69290@debbugs.gnu.org; Tue, 20 Feb 2024 15:21:05 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rcWbS-00089c-0A; Tue, 20 Feb 2024 15:20:34 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=GblWj+gFtsM29r29jh098ws3o3xbY/LabJ2L/c+JhRw=; b=TXcycOtFS18N wU4o3FohXh6jLOqRYsrAN8N1UbPsWYxAs3MPBm0QKbdp0gtdtW5teAG4haOq7bqzykQkuwj380ZmX /zCdrL7e22y7WyqmIgd6dXIJ9fvkQEne0vrw7tfXt46rObBnuw3nXvpaCp3rHTF+O3rhEO+qKuEyo +2wGBG7iSpnnrzi65aJnJNgNT+CsuXZoc8iUqrYbOTdDIGkLRmWirq8U/BmHah82weo8AAGaF3F0Q ALy4huWhrMCGUjSmltbufz2Tz7w5nMe8pXbuy/K5Fj2fUGlFFQnqcnSzQ/Ecp+FH251KtFHoHe3hT tagQUAYMPbMK9FTQzMD1Zg==; In-Reply-To: <7c6965eaa2f67eaba8128228033dc0b0d0efb42b.camel@yandex.ru> (message from Konstantin Kharlamov on Tue, 20 Feb 2024 23:13:27 +0300) 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:280357 Archived-At: > From: Konstantin Kharlamov > Cc: 69290@debbugs.gnu.org > Date: Tue, 20 Feb 2024 23:13:27 +0300 > > > Does --eval '(declare-function hello nil)' tell anything to the > > byte-compiler? > > Well, I can guess by the way you're asking that the answer is "no", but > I have no idea why so. It should. How can it? The declare-function form is evaluated by the startup code, and only after that the byte-compiler is invoked to compile test.el. At least this is my analysis of what happens here. > It is the same as if you pop up Emacs, evaluate a (defun hello()) > and then call `byte-compile-file` over the `test.el`. There won't be > a warning, despite that `(defun hello ())` was never byte-compiled > (AFAIK Emacs does note byte-compile evaluated code). For the declare-function form to take effect, the byte-compiler needs to evaluate the form. By contrast, defun is evaluated by the Lisp interpreter and the result is stored in the global state.