Received: (at 69120) by debbugs.gnu.org; 15 Feb 2024 06:51:57 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Feb 15 01:51:57 2024 Received: from localhost ([127.0.0.1]:53869 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1raVbB-0003ZT-73 for submit <at> debbugs.gnu.org; Thu, 15 Feb 2024 01:51:57 -0500 Received: from eggs.gnu.org ([209.51.188.92]:50186) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1raVb9-0003ZB-3P for 69120 <at> debbugs.gnu.org; Thu, 15 Feb 2024 01:51:55 -0500 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 <eliz@HIDDEN>) id 1raVal-0005mk-8d; Thu, 15 Feb 2024 01:51:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=sZQuX39XPmihSnghQvL7WDr4z8YvxJjju3OeRMOZi0c=; b=oTAJ5U3Px9XP+A+Jj3Dh y9ufxQnfnHXf4q8ns1YTbpXZtIXzmsx5lgpFD3GQiBg0WIcZVO4ZNaacSOmFtdKVpB5B+GwOukQJl jr8yCIxNhwYCv69M/W5LcIb9wFC1H1/lqORkisTVuv/m87Mb2mr70EEzFhoedU/l+x5pRHUYVWkDx VIYQETvc9H06uk6vJ6rcxMoET8B9WDQVKr/0nItRMXA1uydnDD7pxTy9e4PIl2kUIIduP3Kl2LWW+ K0TVTWQ1LwVrrsfC8NESJ1lqaJIGj2tFWg+PSwkR/fptn5CvgTz0dUBHfjgL+eAkZLUooz0hkg9YK 7i1zAhbw5OYDYg==; Date: Thu, 15 Feb 2024 08:51:28 +0200 Message-Id: <86v86qw77z.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> To: Konstantin Kharlamov <Hi-Angel@HIDDEN>, Stefan Monnier <monnier@HIDDEN> In-Reply-To: <4380470ad6bbde9eb8b72135a039da5d218df8e9.camel@HIDDEN> (message from Konstantin Kharlamov on Thu, 15 Feb 2024 07:00:40 +0300) Subject: Re: bug#69120: Spurious "function is not known to be defined" if defined in `use-package` body References: <7f4f61be9fbdb5d07b9420d9b75a7ed9d1522744.camel@HIDDEN> <86eddfxe7d.fsf@HIDDEN> <7aa4ac2b4eb557533d5b77b03b3ce2a74a674f21.camel@HIDDEN> <868r3nxc4u.fsf@HIDDEN> <379435a543c0fb73d4f0ede0fd8c82b4134ec41d.camel@HIDDEN> <867cj7xaqe.fsf@HIDDEN> <66ec2134f5cde69d417646dba07ec724f15af36d.camel@HIDDEN> <5d0c0baa89e8fc0fe6fe9d4fdfbca72cf67d123e.camel@HIDDEN> <4380470ad6bbde9eb8b72135a039da5d218df8e9.camel@HIDDEN> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: 69120 Cc: 69120 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -5.2 (-----) > From: Konstantin Kharlamov <Hi-Angel@HIDDEN> > Cc: 69120 <at> debbugs.gnu.org > Date: Thu, 15 Feb 2024 07:00:40 +0300 > > On Thu, 2024-02-15 at 06:57 +0300, Konstantin Kharlamov wrote: > > On Wed, 2024-02-14 at 19:58 +0300, Konstantin Kharlamov wrote: > > > Mhm… Well, that does reduce the testcase to this code: > > > > > > ;;; -*- lexical-binding: t -*- > > > (progn > > > (defun hello() > > > (print "hello")) > > > (hello)) > > > > > > So the function is defined in the same visibility scope as where > > > it's > > > used, right > > > before its use, but byte-compiler apparently doesn't see that. > > > > Turns out this false-positive is even more common than I thought. > > > > As upstream Emacs deprecated `defadvice`, I'm porting `lsp-mode` > > plugin > > to an `advice-add`. They use it as a debugging facility, and there's > > an > > "advicing" call inside a `(defun …)`, and the function is defined > > inside the same `(defun …)` as well. And it also triggers the same > > warning. In terms of minimal testcase: > > > > ;;; -*- lexical-binding: t -*- > > (defun foo () > > (defun hello() > > (print "hello")) > > (hello)) > > An interesting fact: inserting a `(declare-function hello nil)` after a > `defun` suppresses the warning. So I guess `defun` should work somehow > similarly to `declare-function`. Perhaps Stefan (CC'ed) will have some comments or advice.
bug-gnu-emacs@HIDDEN
:bug#69120
; Package emacs
.
Full text available.Received: (at 69120) by debbugs.gnu.org; 15 Feb 2024 04:01:03 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Wed Feb 14 23:01:03 2024 Received: from localhost ([127.0.0.1]:53723 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1raSvm-0007H9-VH for submit <at> debbugs.gnu.org; Wed, 14 Feb 2024 23:01:03 -0500 Received: from forward501a.mail.yandex.net ([178.154.239.81]:53238) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <Hi-Angel@HIDDEN>) id 1raSvl-0007Gb-Mi for 69120 <at> debbugs.gnu.org; Wed, 14 Feb 2024 23:01:02 -0500 Received: from mail-nwsmtp-smtp-production-main-55.vla.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-55.vla.yp-c.yandex.net [IPv6:2a02:6b8:c0d:230c:0:640:f8e:0]) by forward501a.mail.yandex.net (Yandex) with ESMTPS id 91D1661DFE; Thu, 15 Feb 2024 07:00:41 +0300 (MSK) Received: by mail-nwsmtp-smtp-production-main-55.vla.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id e0gwD348VCg0-8dChsj3x; Thu, 15 Feb 2024 07:00:41 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1707969641; bh=osE4XrpZCjTiXtxVbNgDLW/z9PuvnkmXRS5RKBagglc=; h=References:Date:In-Reply-To:Cc:To:From:Subject:Message-ID; b=izkINAWwU9bz+aVxJnF6cIFnaQFaju2XSOtxuiMYm9fvycq9AjOtLIJpphI/CwSoO AqxfVokbs94NQFZ7e0DjsHzgY+3nBuD8bQy/0ZzzC5aP+C5UpWZqwLdMBozqu0Xkbn c6kuqRCOeoRxqlR7VBOz0BePUtPCa+FGkw2uX7pc= Authentication-Results: mail-nwsmtp-smtp-production-main-55.vla.yp-c.yandex.net; dkim=pass header.i=@yandex.ru Message-ID: <4380470ad6bbde9eb8b72135a039da5d218df8e9.camel@HIDDEN> Subject: Re: bug#69120: Spurious "function is not known to be defined" if defined in `use-package` body From: Konstantin Kharlamov <Hi-Angel@HIDDEN> To: Eli Zaretskii <eliz@HIDDEN> Date: Thu, 15 Feb 2024 07:00:40 +0300 In-Reply-To: <5d0c0baa89e8fc0fe6fe9d4fdfbca72cf67d123e.camel@HIDDEN> References: <7f4f61be9fbdb5d07b9420d9b75a7ed9d1522744.camel@HIDDEN> <86eddfxe7d.fsf@HIDDEN> <7aa4ac2b4eb557533d5b77b03b3ce2a74a674f21.camel@HIDDEN> <868r3nxc4u.fsf@HIDDEN> <379435a543c0fb73d4f0ede0fd8c82b4134ec41d.camel@HIDDEN> <867cj7xaqe.fsf@HIDDEN> <66ec2134f5cde69d417646dba07ec724f15af36d.camel@HIDDEN> <5d0c0baa89e8fc0fe6fe9d4fdfbca72cf67d123e.camel@HIDDEN> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.50.3 MIME-Version: 1.0 X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 69120 Cc: 69120 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -2.9 (--) On Thu, 2024-02-15 at 06:57 +0300, Konstantin Kharlamov wrote: > On Wed, 2024-02-14 at 19:58 +0300, Konstantin Kharlamov wrote: > > Mhm=E2=80=A6 Well, that does reduce the testcase to this code: > >=20 > > =C2=A0=C2=A0=C2=A0 ;;; -*- lexical-binding: t -*- > > =C2=A0=C2=A0=C2=A0 (progn > > =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)) > >=20 > > So the function is defined in the same visibility scope as where > > it's > > used, right > > before its use, but byte-compiler apparently doesn't see that. >=20 > Turns out this false-positive is even more common than I thought. >=20 > As upstream Emacs deprecated `defadvice`, I'm porting `lsp-mode` > plugin > to an `advice-add`. They use it as a debugging facility, and there's > an > "advicing" call inside a `(defun =E2=80=A6)`, and the function is defined > inside the same `(defun =E2=80=A6)` as well. And it also triggers the sam= e > warning. In terms of minimal testcase: >=20 > =C2=A0=C2=A0 ;;; -*- lexical-binding: t -*- > =C2=A0=C2=A0 (defun foo () > =C2=A0=C2=A0=C2=A0=C2=A0 (defun hello() > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (print "hello")) > =C2=A0=C2=A0=C2=A0=C2=A0 (hello)) An interesting fact: inserting a `(declare-function hello nil)` after a `defun` suppresses the warning. So I guess `defun` should work somehow similarly to `declare-function`.
bug-gnu-emacs@HIDDEN
:bug#69120
; Package emacs
.
Full text available.Received: (at 69120) by debbugs.gnu.org; 15 Feb 2024 03:58:07 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Wed Feb 14 22:58:07 2024 Received: from localhost ([127.0.0.1]:53712 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1raSsx-0007A6-71 for submit <at> debbugs.gnu.org; Wed, 14 Feb 2024 22:58:07 -0500 Received: from forward502b.mail.yandex.net ([178.154.239.146]:58782) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <Hi-Angel@HIDDEN>) id 1raSst-00079i-Sc for 69120 <at> debbugs.gnu.org; Wed, 14 Feb 2024 22:58:05 -0500 Received: from mail-nwsmtp-smtp-production-main-92.myt.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-92.myt.yp-c.yandex.net [IPv6:2a02:6b8:c12:4220:0:640:1015:0]) by forward502b.mail.yandex.net (Yandex) with ESMTPS id CE9C75EA34; Thu, 15 Feb 2024 06:57:42 +0300 (MSK) Received: by mail-nwsmtp-smtp-production-main-92.myt.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id fvfAWeHGgmI0-I4VCNzR5; Thu, 15 Feb 2024 06:57:42 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1707969462; bh=8IThte0sl8pLOOtcp+ykPP7iTss8ytZCDJ2ZxSmAb0w=; h=References:Date:In-Reply-To:Cc:To:From:Subject:Message-ID; b=vVwJaa3sQ5zr2tmcEd4VzwOjbTyzYOL1BLiTyLI2s7OCx+Hd7hOQyxeHrdOmEWqWH OMuxKIAu7Vr9SRiyfnpk1UUaJDItTzQQalcBvNQZOfVeAR7rsPZsacTksEmlWbB8/5 YbFQfiuqrILv4PwslgtdB4PEETnLXMjF+pOEmJG0= Authentication-Results: mail-nwsmtp-smtp-production-main-92.myt.yp-c.yandex.net; dkim=pass header.i=@yandex.ru Message-ID: <5d0c0baa89e8fc0fe6fe9d4fdfbca72cf67d123e.camel@HIDDEN> Subject: Re: bug#69120: Spurious "function is not known to be defined" if defined in `use-package` body From: Konstantin Kharlamov <Hi-Angel@HIDDEN> To: Eli Zaretskii <eliz@HIDDEN> Date: Thu, 15 Feb 2024 06:57:41 +0300 In-Reply-To: <66ec2134f5cde69d417646dba07ec724f15af36d.camel@HIDDEN> References: <7f4f61be9fbdb5d07b9420d9b75a7ed9d1522744.camel@HIDDEN> <86eddfxe7d.fsf@HIDDEN> <7aa4ac2b4eb557533d5b77b03b3ce2a74a674f21.camel@HIDDEN> <868r3nxc4u.fsf@HIDDEN> <379435a543c0fb73d4f0ede0fd8c82b4134ec41d.camel@HIDDEN> <867cj7xaqe.fsf@HIDDEN> <66ec2134f5cde69d417646dba07ec724f15af36d.camel@HIDDEN> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.50.3 MIME-Version: 1.0 X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 69120 Cc: 69120 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -2.9 (--) On Wed, 2024-02-14 at 19:58 +0300, Konstantin Kharlamov wrote: > Mhm=E2=80=A6 Well, that does reduce the testcase to this code: >=20 > =C2=A0=C2=A0=C2=A0 ;;; -*- lexical-binding: t -*- > =C2=A0=C2=A0=C2=A0 (progn > =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)) >=20 > So the function is defined in the same visibility scope as where it's > used, right > before its use, but byte-compiler apparently doesn't see that. Turns out this false-positive is even more common than I thought. As upstream Emacs deprecated `defadvice`, I'm porting `lsp-mode` plugin to an `advice-add`. They use it as a debugging facility, and there's an "advicing" call inside a `(defun =E2=80=A6)`, and the function is defined inside the same `(defun =E2=80=A6)` as well. And it also triggers the same warning. In terms of minimal testcase: ;;; -*- lexical-binding: t -*- (defun foo () (defun hello() (print "hello")) (hello)) =20
bug-gnu-emacs@HIDDEN
:bug#69120
; Package emacs
.
Full text available.Received: (at 69120) by debbugs.gnu.org; 14 Feb 2024 16:59:14 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Wed Feb 14 11:59:14 2024 Received: from localhost ([127.0.0.1]:52948 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1raIbJ-0005a0-Cc for submit <at> debbugs.gnu.org; Wed, 14 Feb 2024 11:59:13 -0500 Received: from forward501b.mail.yandex.net ([178.154.239.145]:33304) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <Hi-Angel@HIDDEN>) id 1raIb4-0005ZL-8z for 69120 <at> debbugs.gnu.org; Wed, 14 Feb 2024 11:59:12 -0500 Received: from mail-nwsmtp-smtp-production-main-87.sas.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-87.sas.yp-c.yandex.net [IPv6:2a02:6b8:c08:6286:0:640:583f:0]) by forward501b.mail.yandex.net (Yandex) with ESMTPS id 64A2961CBC; Wed, 14 Feb 2024 19:58:37 +0300 (MSK) Received: by mail-nwsmtp-smtp-production-main-87.sas.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id awrxadGWm8c0-Xdth8OS8; Wed, 14 Feb 2024 19:58:36 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1707929916; bh=ry7dRElQu5BDHU6t3OmFZ2Yditr54abjUG+YDQEK/SA=; h=References:Date:In-Reply-To:Cc:To:From:Subject:Message-ID; b=sBbYGEFQT0h190TqRLcV3lkJ7YycUJgUiD1U+TFWLX1lPi0BtnurSYDgEKO8XObz1 6iz3hL8SG5H+e7uc6pUVX+1kk3qRxDGOwoxOgRcw8EMZOCLE0G1IIRVs2l/xKGWB4y AXSSEE0TDu9NMrnC8qj4G6WjivTMO5EEU4lbBywc= Authentication-Results: mail-nwsmtp-smtp-production-main-87.sas.yp-c.yandex.net; dkim=pass header.i=@yandex.ru Message-ID: <66ec2134f5cde69d417646dba07ec724f15af36d.camel@HIDDEN> Subject: Re: bug#69120: Spurious "function is not known to be defined" if defined in `use-package` body From: Konstantin Kharlamov <Hi-Angel@HIDDEN> To: Eli Zaretskii <eliz@HIDDEN> Date: Wed, 14 Feb 2024 19:58:36 +0300 In-Reply-To: <867cj7xaqe.fsf@HIDDEN> References: <7f4f61be9fbdb5d07b9420d9b75a7ed9d1522744.camel@HIDDEN> <86eddfxe7d.fsf@HIDDEN> <7aa4ac2b4eb557533d5b77b03b3ce2a74a674f21.camel@HIDDEN> <868r3nxc4u.fsf@HIDDEN> <379435a543c0fb73d4f0ede0fd8c82b4134ec41d.camel@HIDDEN> <867cj7xaqe.fsf@HIDDEN> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.50.3 MIME-Version: 1.0 X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 69120 Cc: 69120 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -2.9 (--) On Wed, 2024-02-14 at 18:38 +0200, Eli Zaretskii wrote: > > From: Konstantin Kharlamov <Hi-Angel@HIDDEN> > > Cc: 69120 <at> debbugs.gnu.org > > Date: Wed, 14 Feb 2024 19:10:54 +0300 > > > > On Wed, 2024-02-14 at 18:07 +0200, Eli Zaretskii wrote: > > > > From: Konstantin Kharlamov <Hi-Angel@HIDDEN> > > > > Cc: 69120 <at> debbugs.gnu.org > > > > Date: Wed, 14 Feb 2024 18:28:15 +0300 > > > > > > > > > > =C2=A0=C2=A0=C2=A0 test.el:6:4: Warning: the function =E2=80=98= hello=E2=80=99 is not known > > > > > > to > > > > > > be > > > > > > defined. > > > > > > > > > > What do you get if you macro-expand your code? > > > > > > > > Wrapping the above code to a `(macroexpand =E2=80=A6)` gives a: > > > > > > > > =C2=A0=C2=A0 "hello" > > > > =C2=A0=C2=A0 nil > > > > > > You need to quote the form you pass to macroexpand, to get the > > > expansion, I think. > > > > Oh indeed you're right! > > > > It gives me the following: > > > > (progn (defvar use-package--warning196 #'(lambda (keyword err) (let > > ((msg (format "%s/%s: %s" 'prog-mode keyword (error-message-string > > err)))) (display-warning 'use-package msg :error)))) (condition- > > case-unless-debug err (progn (condition-case-unless-debug err > > (progn (defun hello nil (print "hello")) (hello)) (error (funcall > > use-package--warning196 :init err))) (if (not (require 'prog-mode > > nil t)) (display-warning 'use-package (format "Cannot load %s" > > 'prog-mode) :error))) (error (funcall use-package--warning196 > > :catch err)))) > > And that doesn't explain the warning? Mhm=E2=80=A6 Well, that does reduce the testcase to this code: ;;; -*- lexical-binding: t -*- (progn (defun hello() (print "hello")) (hello)) So the function is defined in the same visibility scope as where it's used,= right before its use, but byte-compiler apparently doesn't see that.
bug-gnu-emacs@HIDDEN
:bug#69120
; Package emacs
.
Full text available.Received: (at 69120) by debbugs.gnu.org; 14 Feb 2024 16:38:36 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Wed Feb 14 11:38:36 2024 Received: from localhost ([127.0.0.1]:52913 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1raIHM-000508-9T for submit <at> debbugs.gnu.org; Wed, 14 Feb 2024 11:38:36 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43088) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1raIHK-0004zw-I1 for 69120 <at> debbugs.gnu.org; Wed, 14 Feb 2024 11:38:35 -0500 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 <eliz@HIDDEN>) id 1raIGw-0002wx-GP; Wed, 14 Feb 2024 11:38:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=pO7IdemnYap7zQfRJjv6shEmyzL8U4xSTxwJC7i115s=; b=OpyNQxLIlv/IQmWuENWT /lxqt/36ea4jAK6xZI/8d4e8LQRXQLPe6PpTSrAUBN/fxiEZqDAFRz0bj+copfLqBmDo9SNg8ie59 qbhrOrsL+GKN2E8KQw9RpxEwTR6Amg+xaGj7vyMWcd1nDWs48qc7XJi8U3qXjQvqfqvawQUG7fMUr E/8KTeLpT4IwoHuSTDCS0kMVhlFahApOZZViqTGkJa/XlFYt93cB7qPU/AH1IAB0YTkQG8DTFqCUt oP2u36fbb7xMj80DPRb0u6RksFFExTIZvUwndQDfMQ4NdCGU+AK3h9lU84UzBMoRn6ZKXgy6LUZXd D3xeH+yt0jWAXg==; Date: Wed, 14 Feb 2024 18:38:01 +0200 Message-Id: <867cj7xaqe.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> To: Konstantin Kharlamov <Hi-Angel@HIDDEN> In-Reply-To: <379435a543c0fb73d4f0ede0fd8c82b4134ec41d.camel@HIDDEN> (message from Konstantin Kharlamov on Wed, 14 Feb 2024 19:10:54 +0300) Subject: Re: bug#69120: Spurious "function is not known to be defined" if defined in `use-package` body References: <7f4f61be9fbdb5d07b9420d9b75a7ed9d1522744.camel@HIDDEN> <86eddfxe7d.fsf@HIDDEN> <7aa4ac2b4eb557533d5b77b03b3ce2a74a674f21.camel@HIDDEN> <868r3nxc4u.fsf@HIDDEN> <379435a543c0fb73d4f0ede0fd8c82b4134ec41d.camel@HIDDEN> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: 69120 Cc: 69120 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -5.2 (-----) > From: Konstantin Kharlamov <Hi-Angel@HIDDEN> > Cc: 69120 <at> debbugs.gnu.org > Date: Wed, 14 Feb 2024 19:10:54 +0300 > > On Wed, 2024-02-14 at 18:07 +0200, Eli Zaretskii wrote: > > > From: Konstantin Kharlamov <Hi-Angel@HIDDEN> > > > Cc: 69120 <at> debbugs.gnu.org > > > Date: Wed, 14 Feb 2024 18:28:15 +0300 > > > > > > > > test.el:6:4: Warning: the function ‘hello’ is not known to > > > > > be > > > > > defined. > > > > > > > > What do you get if you macro-expand your code? > > > > > > Wrapping the above code to a `(macroexpand …)` gives a: > > > > > > "hello" > > > nil > > > > You need to quote the form you pass to macroexpand, to get the > > expansion, I think. > > Oh indeed you're right! > > It gives me the following: > > (progn (defvar use-package--warning196 #'(lambda (keyword err) (let ((msg (format "%s/%s: %s" 'prog-mode keyword (error-message-string err)))) (display-warning 'use-package msg :error)))) (condition-case-unless-debug err (progn (condition-case-unless-debug err (progn (defun hello nil (print "hello")) (hello)) (error (funcall use-package--warning196 :init err))) (if (not (require 'prog-mode nil t)) (display-warning 'use-package (format "Cannot load %s" 'prog-mode) :error))) (error (funcall use-package--warning196 :catch err)))) And that doesn't explain the warning?
bug-gnu-emacs@HIDDEN
:bug#69120
; Package emacs
.
Full text available.Received: (at 69120) by debbugs.gnu.org; 14 Feb 2024 16:11:21 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Wed Feb 14 11:11:21 2024 Received: from localhost ([127.0.0.1]:52883 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1raHqy-0004Kh-I0 for submit <at> debbugs.gnu.org; Wed, 14 Feb 2024 11:11:20 -0500 Received: from forward500a.mail.yandex.net ([178.154.239.80]:49966) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <Hi-Angel@HIDDEN>) id 1raHqu-0004KU-Vz for 69120 <at> debbugs.gnu.org; Wed, 14 Feb 2024 11:11:19 -0500 Received: from mail-nwsmtp-smtp-production-main-22.iva.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-22.iva.yp-c.yandex.net [IPv6:2a02:6b8:c0c:2cad:0:640:fa29:0]) by forward500a.mail.yandex.net (Yandex) with ESMTPS id 26285616A9; Wed, 14 Feb 2024 19:10:56 +0300 (MSK) Received: by mail-nwsmtp-smtp-production-main-22.iva.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id sAr5lFBj3uQ0-ZzMNMnTB; Wed, 14 Feb 2024 19:10:55 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1707927055; bh=gKH9QmSL7xhnrDflPYiZfl5YQJRm2ELwNFLa+B5/PVM=; h=References:Date:In-Reply-To:Cc:To:From:Subject:Message-ID; b=bHr8Bty9C44Vv08mjTjqbf1+UGbeZN85YgaqaXewMZEXV0wyACsNnWs2srATDRVfb qqTJVJy1xVxQ8cnx+A+sqDjG/eBgr2En/zKHBfXlPJWIVv0+6aN+fejVX75h48b32G ZOumI5iG4LB1v93fsXs/VfGXbEQk0Fsg+u2eiuog= Authentication-Results: mail-nwsmtp-smtp-production-main-22.iva.yp-c.yandex.net; dkim=pass header.i=@yandex.ru Message-ID: <379435a543c0fb73d4f0ede0fd8c82b4134ec41d.camel@HIDDEN> Subject: Re: bug#69120: Spurious "function is not known to be defined" if defined in `use-package` body From: Konstantin Kharlamov <Hi-Angel@HIDDEN> To: Eli Zaretskii <eliz@HIDDEN> Date: Wed, 14 Feb 2024 19:10:54 +0300 In-Reply-To: <868r3nxc4u.fsf@HIDDEN> References: <7f4f61be9fbdb5d07b9420d9b75a7ed9d1522744.camel@HIDDEN> <86eddfxe7d.fsf@HIDDEN> <7aa4ac2b4eb557533d5b77b03b3ce2a74a674f21.camel@HIDDEN> <868r3nxc4u.fsf@HIDDEN> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.50.3 MIME-Version: 1.0 X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 69120 Cc: 69120 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -2.9 (--) On Wed, 2024-02-14 at 18:07 +0200, Eli Zaretskii wrote: > > From: Konstantin Kharlamov <Hi-Angel@HIDDEN> > > Cc: 69120 <at> debbugs.gnu.org > > Date: Wed, 14 Feb 2024 18:28:15 +0300 > > > > > > =C2=A0=C2=A0=C2=A0 test.el:6:4: Warning: the function =E2=80=98hell= o=E2=80=99 is not known to > > > > be > > > > defined. > > > > > > What do you get if you macro-expand your code? > > > > Wrapping the above code to a `(macroexpand =E2=80=A6)` gives a: > > > > =C2=A0=C2=A0 "hello" > > =C2=A0=C2=A0 nil > > You need to quote the form you pass to macroexpand, to get the > expansion, I think. Oh indeed you're right! It gives me the following: (progn (defvar use-package--warning196 #'(lambda (keyword err) (let ((msg (= format "%s/%s: %s" 'prog-mode keyword (error-message-string err)))) (displa= y-warning 'use-package msg :error)))) (condition-case-unless-debug err (pro= gn (condition-case-unless-debug err (progn (defun hello nil (print "hello")= ) (hello)) (error (funcall use-package--warning196 :init err))) (if (not (r= equire 'prog-mode nil t)) (display-warning 'use-package (format "Cannot loa= d %s" 'prog-mode) :error))) (error (funcall use-package--warning196 :catch = err))))
bug-gnu-emacs@HIDDEN
:bug#69120
; Package emacs
.
Full text available.Received: (at 69120) by debbugs.gnu.org; 14 Feb 2024 16:08:30 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Wed Feb 14 11:08:30 2024 Received: from localhost ([127.0.0.1]:52875 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1raHoD-0004GO-BL for submit <at> debbugs.gnu.org; Wed, 14 Feb 2024 11:08:30 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39126) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1raHnw-0004Ex-Ke for 69120 <at> debbugs.gnu.org; Wed, 14 Feb 2024 11:08:27 -0500 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 <eliz@HIDDEN>) id 1raHnY-00043h-I3; Wed, 14 Feb 2024 11:07:48 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=XNpRXW4G6fPZm0AhWIctsQs4U71oXVlmGNywJDhOU5k=; b=RDT5Z9qtX/+Xhs2n7EcR 4aCS7jVeJlQQ7VknQSZzUpE73RhFMDaP27aKAiXpBuKeUB+lWBlYmzaLEZa8nUpA+ukHKnyaB7w58 khEfgN9skS6i9XMg/gZgYL1u/FpJBJVJLl1YegngCC9Qpx2a9OCCDmdv7GOQfoKcX+zO0REG8brjL 68kAiD0YnXLLro/K8oQiH3igGy83EUYctPwcgUyNFrDTlqjQMegZWeDI5R6QI3kiG9HKmQE2qLm44 531AKEbADAb3Ihbn/+QGFLT8dJCurfFXnQVeiI99EP8Z7bVLPulnUbkOVHvvQRCM4p8ZPTs6XWNpE 1XPTY8atq0+Kng==; Date: Wed, 14 Feb 2024 18:07:45 +0200 Message-Id: <868r3nxc4u.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> To: Konstantin Kharlamov <Hi-Angel@HIDDEN> In-Reply-To: <7aa4ac2b4eb557533d5b77b03b3ce2a74a674f21.camel@HIDDEN> (message from Konstantin Kharlamov on Wed, 14 Feb 2024 18:28:15 +0300) Subject: Re: bug#69120: Spurious "function is not known to be defined" if defined in `use-package` body References: <7f4f61be9fbdb5d07b9420d9b75a7ed9d1522744.camel@HIDDEN> <86eddfxe7d.fsf@HIDDEN> <7aa4ac2b4eb557533d5b77b03b3ce2a74a674f21.camel@HIDDEN> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 69120 Cc: 69120 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -5.2 (-----) > From: Konstantin Kharlamov <Hi-Angel@HIDDEN> > Cc: 69120 <at> debbugs.gnu.org > Date: Wed, 14 Feb 2024 18:28:15 +0300 > > > > test.el:6:4: Warning: the function ‘hello’ is not known to be > > > defined. > > > > What do you get if you macro-expand your code? > > Wrapping the above code to a `(macroexpand …)` gives a: > > "hello" > nil You need to quote the form you pass to macroexpand, to get the expansion, I think.
bug-gnu-emacs@HIDDEN
:bug#69120
; Package emacs
.
Full text available.Received: (at 69120) by debbugs.gnu.org; 14 Feb 2024 15:29:08 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Wed Feb 14 10:29:08 2024 Received: from localhost ([127.0.0.1]:52781 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1raHC7-00037o-V0 for submit <at> debbugs.gnu.org; Wed, 14 Feb 2024 10:29:08 -0500 Received: from forward500c.mail.yandex.net ([178.154.239.208]:50882) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <Hi-Angel@HIDDEN>) id 1raHC5-00037g-Qn for 69120 <at> debbugs.gnu.org; Wed, 14 Feb 2024 10:29:06 -0500 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) 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 Message-ID: <7aa4ac2b4eb557533d5b77b03b3ce2a74a674f21.camel@HIDDEN> Subject: Re: bug#69120: Spurious "function is not known to be defined" if defined in `use-package` body From: Konstantin Kharlamov <Hi-Angel@HIDDEN> To: Eli Zaretskii <eliz@HIDDEN> Date: Wed, 14 Feb 2024 18:28:15 +0300 In-Reply-To: <86eddfxe7d.fsf@HIDDEN> References: <7f4f61be9fbdb5d07b9420d9b75a7ed9d1522744.camel@HIDDEN> <86eddfxe7d.fsf@HIDDEN> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.50.3 MIME-Version: 1.0 X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 69120 Cc: 69120 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -2.9 (--) On Wed, 2024-02-14 at 17:23 +0200, Eli Zaretskii wrote: > > From: Konstantin Kharlamov <Hi-Angel@HIDDEN> > > 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
bug-gnu-emacs@HIDDEN
:bug#69120
; Package emacs
.
Full text available.Received: (at 69120) by debbugs.gnu.org; 14 Feb 2024 15:23:30 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Wed Feb 14 10:23:30 2024 Received: from localhost ([127.0.0.1]:52766 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1raH6g-0002zc-2w for submit <at> debbugs.gnu.org; Wed, 14 Feb 2024 10:23:30 -0500 Received: from eggs.gnu.org ([209.51.188.92]:48976) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1raH6d-0002zP-Oq for 69120 <at> debbugs.gnu.org; Wed, 14 Feb 2024 10:23:28 -0500 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 <eliz@HIDDEN>) id 1raH6G-0001sN-7K; Wed, 14 Feb 2024 10:23:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=SZ+KNHf/HJn3WFkfyDaG7wkdrf7sHZmYrJl8F15OhNQ=; b=mv7DpsJScgQAP7FVadeH yTnBxe2NUXfANPTcWL77wUQt9I5e+1TCf3uvwBz5iKNRDSOo3Lku+nBck/uxSQha5oBM4oaWAc+i3 /zNxuqTUcgUFyCuvR9qtMQUzT2mtMngbEmyt6YRvfja8egkABOdEz+CWkc0nD5hQI4rLBjzK9r+Nr g5VzpQoKpY6cuVjrlGH2pDzpY57J5sJBQiXe0rKtfo9e5e6639nfTbiUrXMdha6u7HLpmxo9XCNKF 7N1VJQingFZT03m1WlM8KT40uZkrsoXt/N3W6jmfv6Jf+9a3BT8Kd9BhczUJpzuR/HrJpeu/wz5KU WLa+dC3CNMNR0Q==; Date: Wed, 14 Feb 2024 17:23:02 +0200 Message-Id: <86eddfxe7d.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> To: Konstantin Kharlamov <Hi-Angel@HIDDEN> In-Reply-To: <7f4f61be9fbdb5d07b9420d9b75a7ed9d1522744.camel@HIDDEN> (message from Konstantin Kharlamov on Wed, 14 Feb 2024 14:16:09 +0300) Subject: Re: bug#69120: Spurious "function is not known to be defined" if defined in `use-package` body References: <7f4f61be9fbdb5d07b9420d9b75a7ed9d1522744.camel@HIDDEN> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: 69120 Cc: 69120 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -5.2 (-----) > From: Konstantin Kharlamov <Hi-Angel@HIDDEN> > Date: Wed, 14 Feb 2024 14:16:09 +0300 > > 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. > > It turns out, byte-compiler does not consider such functions to be > defined and prints a warning about it. > > # Steps to reproduce (in terms of terminal commands) > > λ cat test.el > ;;; -*- lexical-binding: t -*- > (use-package prog-mode > :init > (defun hello() > (print "hello")) > (hello)) > λ emacs -batch -f batch-byte-compile test.el > > In end of data: > test.el:6:4: Warning: the function ‘hello’ is not known to be defined. > > ## Expected > > File gets compiled with no warnings > > ## Actual > > There's a warning > > test.el:6:4: Warning: the function ‘hello’ is not known to be defined. What do you get if you macro-expand your code?
bug-gnu-emacs@HIDDEN
:bug#69120
; Package emacs
.
Full text available.Received: (at submit) by debbugs.gnu.org; 14 Feb 2024 11:16:41 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Wed Feb 14 06:16:41 2024 Received: from localhost ([127.0.0.1]:50590 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1raDFp-00078S-C2 for submit <at> debbugs.gnu.org; Wed, 14 Feb 2024 06:16:41 -0500 Received: from lists.gnu.org ([209.51.188.17]:43378) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <Hi-Angel@HIDDEN>) id 1raDFm-00078J-Gh for submit <at> debbugs.gnu.org; Wed, 14 Feb 2024 06:16:39 -0500 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 <Hi-Angel@HIDDEN>) id 1raDFT-0005lS-By for bug-gnu-emacs@HIDDEN; Wed, 14 Feb 2024 06:16:19 -0500 Received: from forward102c.mail.yandex.net ([2a02:6b8:c03:500:1:45:d181:d102]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <Hi-Angel@HIDDEN>) id 1raDFP-0007Os-2R for bug-gnu-emacs@HIDDEN; Wed, 14 Feb 2024 06:16:18 -0500 Received: from mail-nwsmtp-smtp-production-main-46.myt.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-46.myt.yp-c.yandex.net [IPv6:2a02:6b8:c12:3285:0:640:fd1e:0]) by forward102c.mail.yandex.net (Yandex) with ESMTPS id C560760C5B for <bug-gnu-emacs@HIDDEN>; Wed, 14 Feb 2024 14:16:09 +0300 (MSK) Received: by mail-nwsmtp-smtp-production-main-46.myt.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id 9GmBXX8BX8c0-MdkM5kXI; Wed, 14 Feb 2024 14:16:09 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1707909369; bh=On5TOpDpMW7Qa65n9Si+qmDumxSaJuR0pLcLgJRo13o=; h=Date:To:From:Subject:Message-ID; b=OMo3NYSeaUCtUziQy6PKs9ccLYhZItshMrP2YlAtLBP6U+T1buim4QdTDOB7ulhdi G6NX7Bw918lyjp3UxPq4dyoF73Q+MiPfk4qf0aXpyf7spz5/Sn7fuWMvCRISlE0tcH rIzvghYhmalqbiqmYb963tQbbFoGn/bXrEMfZd8Y= Authentication-Results: mail-nwsmtp-smtp-production-main-46.myt.yp-c.yandex.net; dkim=pass header.i=@yandex.ru Message-ID: <7f4f61be9fbdb5d07b9420d9b75a7ed9d1522744.camel@HIDDEN> Subject: Spurious "function is not known to be defined" if defined in `use-package` body From: Konstantin Kharlamov <Hi-Angel@HIDDEN> To: bug-gnu-emacs@HIDDEN Date: Wed, 14 Feb 2024 14:16:09 +0300 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.50.3 MIME-Version: 1.0 Received-SPF: pass client-ip=2a02:6b8:c03:500:1:45:d181:d102; envelope-from=Hi-Angel@HIDDEN; helo=forward102c.mail.yandex.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.5 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -4.5 (----) 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. It turns out, byte-compiler does not consider such functions to be defined and prints a warning about it. # Steps to reproduce (in terms of terminal commands) =CE=BB cat test.el ;;; -*- lexical-binding: t -*- (use-package prog-mode :init (defun hello() (print "hello")) (hello)) =CE=BB emacs -batch -f batch-byte-compile test.el In end of data: test.el:6:4: Warning: the function =E2=80=98hello=E2=80=99 is not known= to be defined. ## Expected File gets compiled with no warnings ## Actual There's a warning test.el:6:4: Warning: the function =E2=80=98hello=E2=80=99 is not known= to be defined. # Additional information Emacs version: commit d4d5830f8a0 built two weeks ago from master.
Konstantin Kharlamov <Hi-Angel@HIDDEN>
:bug-gnu-emacs@HIDDEN
.
Full text available.bug-gnu-emacs@HIDDEN
:bug#69120
; Package emacs
.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.