GNU bug report logs - #69120
Spurious "function is not known to be defined" if defined in `use-package` body

Previous Next

Package: emacs;

Reported by: Konstantin Kharlamov <Hi-Angel <at> yandex.ru>

Date: Wed, 14 Feb 2024 11:17:02 UTC

Severity: normal

Full log


View this message in rfc822 format

From: Konstantin Kharlamov <Hi-Angel <at> yandex.ru>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 69120 <at> 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 06:57:41 +0300
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))
   




This bug report was last modified 1 year and 126 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.