bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#69120: Spurious "function is not known to be defined" if defined in


From: Konstantin Kharlamov
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
User-agent: Evolution 3.50.3

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))
   





reply via email to

[Prev in Thread] Current Thread [Next in Thread]