From: Eli Zaretskii <eliz@gnu.org>
To: Konstantin Kharlamov <Hi-Angel@yandex.ru>,
Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 69120@debbugs.gnu.org
Subject: bug#69120: Spurious "function is not known to be defined" if defined in `use-package` body
Date: Thu, 15 Feb 2024 08:51:28 +0200 [thread overview]
Message-ID: <86v86qw77z.fsf@gnu.org> (raw)
In-Reply-To: <4380470ad6bbde9eb8b72135a039da5d218df8e9.camel@yandex.ru> (message from Konstantin Kharlamov on Thu, 15 Feb 2024 07:00:40 +0300)
> From: Konstantin Kharlamov <Hi-Angel@yandex.ru>
> Cc: 69120@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.
next prev parent reply other threads:[~2024-02-15 6:51 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-14 11:16 bug#69120: Spurious "function is not known to be defined" if defined in `use-package` body Konstantin Kharlamov
2024-02-14 15:23 ` Eli Zaretskii
2024-02-14 15:28 ` Konstantin Kharlamov
2024-02-14 16:07 ` Eli Zaretskii
2024-02-14 16:10 ` Konstantin Kharlamov
2024-02-14 16:38 ` Eli Zaretskii
2024-02-14 16:58 ` Konstantin Kharlamov
2024-02-15 3:57 ` Konstantin Kharlamov
2024-02-15 4:00 ` Konstantin Kharlamov
2024-02-15 6:51 ` Eli Zaretskii [this message]
2024-02-15 15:21 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86v86qw77z.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=69120@debbugs.gnu.org \
--cc=Hi-Angel@yandex.ru \
--cc=monnier@iro.umontreal.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).