GNU bug report logs -
#69120
Spurious "function is not known to be defined" if defined in `use-package` body
Previous Next
Full log
View this message in rfc822 format
> From: Konstantin Kharlamov <Hi-Angel <at> yandex.ru>
> 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.
This bug report was last modified 1 year and 125 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.