From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Konstantin Kharlamov Newsgroups: gmane.emacs.bugs Subject: bug#69290: declare-function doesn't work when combined with --eval and -batch Date: Tue, 20 Feb 2024 22:56:01 +0300 Message-ID: <2f376e6d58b58f3fa8afa5376018a37b1ba3fab4.camel@yandex.ru> References: <868r3eoqw0.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="24255"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Evolution 3.50.3 Cc: 69290@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Feb 20 20:57:00 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 1rcWEe-0006BR-Bu for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 20 Feb 2024 20:57:00 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rcWEM-0007M6-IN; Tue, 20 Feb 2024 14:56: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 1rcWEK-0007Lx-Vl for bug-gnu-emacs@gnu.org; Tue, 20 Feb 2024 14:56: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 1rcWEK-0003ih-NZ for bug-gnu-emacs@gnu.org; Tue, 20 Feb 2024 14:56:40 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rcWEg-00030D-9l for bug-gnu-emacs@gnu.org; Tue, 20 Feb 2024 14:57:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Konstantin Kharlamov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 20 Feb 2024 19:57: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.170845899111501 (code B ref 69290); Tue, 20 Feb 2024 19:57:02 +0000 Original-Received: (at 69290) by debbugs.gnu.org; 20 Feb 2024 19:56:31 +0000 Original-Received: from localhost ([127.0.0.1]:46719 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rcWEA-0002zR-SY for submit@debbugs.gnu.org; Tue, 20 Feb 2024 14:56:31 -0500 Original-Received: from forward502b.mail.yandex.net ([178.154.239.146]:41806) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rcWE7-0002zF-JK for 69290@debbugs.gnu.org; Tue, 20 Feb 2024 14:56:29 -0500 Original-Received: from mail-nwsmtp-smtp-production-main-91.myt.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-91.myt.yp-c.yandex.net [IPv6:2a02:6b8:c12:3019:0:640:a0d4:0]) by forward502b.mail.yandex.net (Yandex) with ESMTPS id F3A3F5EF95; Tue, 20 Feb 2024 22:56:02 +0300 (MSK) Original-Received: by mail-nwsmtp-smtp-production-main-91.myt.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id 2uX0jCFTtOs0-kzb8Iqzx; Tue, 20 Feb 2024 22:56:02 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1708458962; bh=RSGJcm5jSWHQVuoD2sdxsyB5C+pmzDJZ5G+eCAhk4Ko=; h=References:Date:In-Reply-To:Cc:To:From:Subject:Message-ID; b=RfIetAWHnNB+pBrqwXs/EZMpv+2+uI22CUBXgvUoHEN+/Xv0/XkrouI/iOpveLrc/ 04VogtjKhBVBZYMO1GG2ZBZioHZO+aDaL3ROEoRyjjS+haWzrOMA9ztyh6J2ubukHE vC+epRj+6nxUQRIBOKXp5YGa/kII4z1lvbnrGGuk= Authentication-Results: mail-nwsmtp-smtp-production-main-91.myt.yp-c.yandex.net; dkim=pass header.i=@yandex.ru In-Reply-To: <868r3eoqw0.fsf@gnu.org> 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:280354 Archived-At: On Tue, 2024-02-20 at 21:51 +0200, Eli Zaretskii wrote: > > From: Konstantin Kharlamov > > Date: Tue, 20 Feb 2024 21:59:31 +0300 > >=20 > > Stumbled upon that while trying to improve CI in Evil mode. > > Enabling byte-compilation > > causes warnings about `undo-redo` undeclared on older Emacs'es, so > > tried to work > > around that with `declare-function`. Turns out it doesn't work. >=20 > Of course it does.=C2=A0 If used correctly, that is.=C2=A0 We do that in > gazillion places in our sources. >=20 > > =C2=A0=C2=A0=C2=A0 =CE=BB cat test.el > > =C2=A0=C2=A0=C2=A0 ;;; -*- lexical-binding: t -*- > > =C2=A0=C2=A0=C2=A0 (hello) > > =C2=A0=C2=A0=C2=A0 =CE=BB emacs -batch --eval '(declare-function hello = nil)' -f batch- > > byte-compile test.el > >=20 > > =C2=A0=C2=A0=C2=A0 In end of data: > > =C2=A0=C2=A0=C2=A0 test.el:2:2: Warning: the function =E2=80=98hello=E2= =80=99 is not known to be > > defined. > >=20 > > ## Expected > >=20 > > There's no warning >=20 > What does the doc string of declare-function tell you about its usage > and effect? It says `Tell the byte-compiler that function FN is defined, in FILE`, and then FILE may be nil. In the context of the problem it seems the only thing that's relevant. There's a lot more text, but the rest of it just explains behavior of different parameters. Is there anything I'm missing?