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

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

bug#69290: declare-function doesn't work when combined with --eval and -


From: Eli Zaretskii
Subject: bug#69290: declare-function doesn't work when combined with --eval and -batch
Date: Tue, 20 Feb 2024 22:20:24 +0200

> From: Konstantin Kharlamov <Hi-Angel@yandex.ru>
> Cc: 69290@debbugs.gnu.org
> Date: Tue, 20 Feb 2024 23:13:27 +0300
> 
> > Does --eval '(declare-function hello nil)' tell anything to the
> > byte-compiler?
> 
> Well, I can guess by the way you're asking that the answer is "no", but
> I have no idea why so. It should.

How can it?  The declare-function form is evaluated by the startup
code, and only after that the byte-compiler is invoked to compile
test.el.  At least this is my analysis of what happens here.

> It is the same as if you pop up Emacs, evaluate a (defun hello())
> and then call `byte-compile-file` over the `test.el`. There won't be
> a warning, despite that `(defun hello ())` was never byte-compiled
> (AFAIK Emacs does note byte-compile evaluated code).

For the declare-function form to take effect, the byte-compiler needs
to evaluate the form.  By contrast, defun is evaluated by the Lisp
interpreter and the result is stored in the global state.





reply via email to

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