GNU bug report logs - #69290
declare-function doesn't work when combined with --eval and -batch

Previous Next

Package: emacs;

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

Date: Tue, 20 Feb 2024 19:01:01 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: 69290 <at> debbugs.gnu.org
Subject: bug#69290: declare-function doesn't work when combined with --eval and -batch
Date: Tue, 20 Feb 2024 23:13:27 +0300
On Tue, 2024-02-20 at 22:03 +0200, Eli Zaretskii wrote:
> > From: Konstantin Kharlamov <Hi-Angel <at> yandex.ru>
> > Cc: 69290 <at> debbugs.gnu.org
> > Date: Tue, 20 Feb 2024 22:56:01 +0300
> > 
> > On Tue, 2024-02-20 at 21:51 +0200, Eli Zaretskii wrote:
> > > >     λ emacs -batch --eval '(declare-function hello nil)' -f
> > > > batch-
> > > > byte-compile test.el
> > > > 
> > > >     In end of data:
> > > >     test.el:2:2: Warning: the function ‘hello’ is not known to
> > > > be
> > > > defined.
> > > > 
> > > > ## Expected
> > > > 
> > > > There's no warning
> > > 
> > > What does the doc string of declare-function tell you about its
> > > usage
> > > and effect?
> > 
> > It says `Tell the byte-compiler that function FN is defined, in
> > FILE`,
> > and then FILE may be nil. In the context of the problem it seems
> > the
> > only thing that's relevant. There's a lot more text, but the rest
> > of it
> > just explains behavior of different parameters. Is there anything
> > I'm
> > missing?
> 
> 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. 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).




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

Previous Next


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