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: Thu, 15 Feb 2024 06:57:41 +0300 Message-ID: <5d0c0baa89e8fc0fe6fe9d4fdfbca72cf67d123e.camel@yandex.ru> References: <7f4f61be9fbdb5d07b9420d9b75a7ed9d1522744.camel@yandex.ru> <86eddfxe7d.fsf@gnu.org> <7aa4ac2b4eb557533d5b77b03b3ce2a74a674f21.camel@yandex.ru> <868r3nxc4u.fsf@gnu.org> <379435a543c0fb73d4f0ede0fd8c82b4134ec41d.camel@yandex.ru> <867cj7xaqe.fsf@gnu.org> <66ec2134f5cde69d417646dba07ec724f15af36d.camel@yandex.ru> 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="2380"; 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 Thu Feb 15 04:59:48 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 1raSua-0000TX-2f for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 15 Feb 2024 04:59:48 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1raStd-0001tT-R5; Wed, 14 Feb 2024 22:58:49 -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 1raStZ-0001sl-0B for bug-gnu-emacs@gnu.org; Wed, 14 Feb 2024 22:58:45 -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 1raStY-0000SJ-Do for bug-gnu-emacs@gnu.org; Wed, 14 Feb 2024 22:58:44 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1raStq-0007BM-8R for bug-gnu-emacs@gnu.org; Wed, 14 Feb 2024 22:59: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: Thu, 15 Feb 2024 03:59: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.170796948727539 (code B ref 69120); Thu, 15 Feb 2024 03:59:02 +0000 Original-Received: (at 69120) by debbugs.gnu.org; 15 Feb 2024 03:58:07 +0000 Original-Received: from localhost ([127.0.0.1]:53712 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1raSsx-0007A6-71 for submit@debbugs.gnu.org; Wed, 14 Feb 2024 22:58:07 -0500 Original-Received: from forward502b.mail.yandex.net ([178.154.239.146]:58782) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1raSst-00079i-Sc for 69120@debbugs.gnu.org; Wed, 14 Feb 2024 22:58:05 -0500 Original-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) Original-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 In-Reply-To: <66ec2134f5cde69d417646dba07ec724f15af36d.camel@yandex.ru> 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:280036 Archived-At: 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