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: Stefan Monnier
Subject: 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
User-agent: Gnus/5.13 (Gnus v5.13)

>> >    ;;; -*- 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






reply via email to

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