Subject: Re: bug#16573: 24.3; Auctex (11.87.2) in Elpa issues hundreds of warnings on compile

From: Achim Gratz <[email-masked]>
Date: Wed, 29 Jan 2014 07:26:24 +0100

Stefan Monnier writes:
>> That's certainly not recommended for everyone and everything, but since
>> declare-function must used in situations were the function to be
>> declared is known to be already defined at runtime, the autoload will
>> never do anything anyway;
>
> It does do something:
> - it does something during byte-compilation.

That's the intended effect.  I haven't checked if it could in fact skip
the compile part of eval-and-compile; if so, that would be an obvious
improvement.

> - it does something during run-time if the function is "already loaded
>   when you call it" but not "already loaded when you load the file".

Which is not supposed to happen in these cases, otherwise you'd be able
to use a plain require.

> Both of those situations are quite common.  The reason why you don't
> suffer from it is not that the autoload doesn't do anything, but because
> the autoload is usually harmless.

That too.

>> Defining this nil and then not finding the one warning that must be
>> dealt with in the hundreds of spurious warnings is decidedly worse.
>
> Admittedly I haven't spent much time dealing with compatibility with
> older Emacsen lately, but in the past I've never found warnings useful
> for that work.  So I only ever used warnings to help debug & improve my
> code on my "main" Emacs version, and completely ignored warnings when
> porting to older Emacsen (relying on testing and bug-reports instead).

I can't speak for other eLisp libraries, but testing came late for Org
and test coverage isn't quite up where it would need to be for this to
work.  Besides, testing on older Emacsen gets rather difficult since
they don't compile on my system any more and I'd need to set up a
container or VM.

> Of course, it's probably got to do with taste, but if you're going to
> use `autoload', then I strongly suggest you name it
> `<foo>-declare-function', since when "adding a missing definition" you're
> better off defining it *exactly* like a recentish Emacs.

Moving it to Org namespace may be in the cards given that Org already
does that for most other compatibility macros.  If you know a way to
have it really just declare the function without byte-compiler magic let
me know.

Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

Samples for the Waldorf Blofeld:
http://Synth.Stromeko.net/Downloads.html#BlofeldSamplesExtra