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


Message #35 received at 69120 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 69120 <at> debbugs.gnu.org, Konstantin Kharlamov <Hi-Angel <at> yandex.ru>
Subject: Re: bug#69120: Spurious "function is not known to be defined" if
 defined in `use-package` body
Date: Thu, 15 Feb 2024 10:21:03 -0500
>> >    ;;; -*- 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.

Both `defun` and `declare-function` work in unsatisfactory ways in this
respect.

Any `declare-function` anywhere in the file will silence all warnings
about this function in the whole file, which is too lax.

`defun` in contrast only silences the warnings if it's at the top-level,
which is too restrictive.

We should make them both work a bit more like `defvar`.


        Stefan





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.