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#69120: Spurious "function is not known to be defined" if defined in `use-package` body Date: Wed, 14 Feb 2024 18:28:15 +0300 Message-ID: <7aa4ac2b4eb557533d5b77b03b3ce2a74a674f21.camel@yandex.ru> References: <7f4f61be9fbdb5d07b9420d9b75a7ed9d1522744.camel@yandex.ru> <86eddfxe7d.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="30991"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Evolution 3.50.3 Cc: 69120@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Feb 14 16:30:05 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 1raHD2-0007ua-Cb for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 14 Feb 2024 16:30:04 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1raHCq-0002c9-Gh; Wed, 14 Feb 2024 10:29:52 -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 1raHCo-0002by-3e for bug-gnu-emacs@gnu.org; Wed, 14 Feb 2024 10:29:50 -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 1raHCi-000387-6m for bug-gnu-emacs@gnu.org; Wed, 14 Feb 2024 10:29:49 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1raHD0-00039H-94 for bug-gnu-emacs@gnu.org; Wed, 14 Feb 2024 10:30: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: Wed, 14 Feb 2024 15:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69120 X-GNU-PR-Package: emacs Original-Received: via spool by 69120-submit@debbugs.gnu.org id=B69120.170792454812021 (code B ref 69120); Wed, 14 Feb 2024 15:30:02 +0000 Original-Received: (at 69120) by debbugs.gnu.org; 14 Feb 2024 15:29:08 +0000 Original-Received: from localhost ([127.0.0.1]:52781 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1raHC7-00037o-V0 for submit@debbugs.gnu.org; Wed, 14 Feb 2024 10:29:08 -0500 Original-Received: from forward500c.mail.yandex.net ([178.154.239.208]:50882) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1raHC5-00037g-Qn for 69120@debbugs.gnu.org; Wed, 14 Feb 2024 10:29:06 -0500 Original-Received: from mail-nwsmtp-smtp-production-main-39.sas.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-39.sas.yp-c.yandex.net [IPv6:2a02:6b8:c08:1d83:0:640:2ab:0]) by forward500c.mail.yandex.net (Yandex) with ESMTPS id 77A6B6166F; Wed, 14 Feb 2024 18:28:16 +0300 (MSK) Original-Received: by mail-nwsmtp-smtp-production-main-39.sas.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id FSq8231Po0U0-JNsOg9y0; Wed, 14 Feb 2024 18:28:15 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1707924496; bh=lapPuj/0GhWTdz0nL64E36cWhEjn9pPus5PBo9yWJoQ=; h=References:Date:In-Reply-To:Cc:To:From:Subject:Message-ID; b=LgaMzoSZSw1HLsqtp2rvr8QyjJo80Z1Tyyg2ThITyg89tUYMh8ajBJyJxV83fJMy/ HwW8po6Yq67PmO6iNkERD2M1IkV1z4m/crwdK7hJ7bh7pvl/kozQ+6zuEObdQxovGg yFPcfhPoqXyUGbOxuCD5KQ7Kvm+DFPpmCoH9uUgk= Authentication-Results: mail-nwsmtp-smtp-production-main-39.sas.yp-c.yandex.net; dkim=pass header.i=@yandex.ru In-Reply-To: <86eddfxe7d.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:280010 Archived-At: On Wed, 2024-02-14 at 17:23 +0200, Eli Zaretskii wrote: > > From: Konstantin Kharlamov > > Date: Wed, 14 Feb 2024 14:16:09 +0300 > >=20 > > I have many functions that are only useful inside a specific mode. > > So I > > group them with `use-package`, by defining them inside `:init` or > > `:config` section, depending on the use. > >=20 > > It turns out, byte-compiler does not consider such functions to be > > defined and prints a warning about it. > >=20 > > # Steps to reproduce (in terms of terminal commands) > >=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 (use-package prog-mode > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 :init > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (defun hello() > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (print "hello")) > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (hello)) > > =C2=A0=C2=A0=C2=A0 =CE=BB emacs -batch -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:6:4: Warning: the function =E2=80=98hello=E2= =80=99 is not known to be > > defined. > >=20 > > ## Expected > >=20 > > File gets compiled with no warnings > >=20 > > ## Actual > >=20 > > There's a warning > >=20 > > =C2=A0=C2=A0=C2=A0 test.el:6:4: Warning: the function =E2=80=98hello=E2= =80=99 is not known to be > > defined. >=20 > What do you get if you macro-expand your code? Wrapping the above code to a `(macroexpand =E2=80=A6)` gives a: "hello" nil