Subject: bug#55305: 28.0.50: With async nativecomp, package manager fails to load hyperbole-autoloads.el before compilation

From: Eli Zaretskii <[email-masked]>
Date: Thu, 12 May 2022 10:22:47 +0300

> From: Robert Weiner <[email-masked]>
> Date: Thu, 12 May 2022 02:21:37 -0400
> Cc: [email-masked]
> 
>  Does this last fact mean there's an assumption in Hyperbole that the
>  package is always activated before its *.el files are compiled?  If
>  so, perhaps this is why it fails during native-compilation, where the
>  package is not activated prior to the compilation?
> 
> Said another way, there is an assumption that the hyperbole-autoloads.el file is loaded prior to any
> compilation, yes.  This is similar to assumptions that loaddefs.el are loaded prior to their reference in other
> Emacs Lisp files.

loaddefs.el is preloaded into Emacs when it is built, so the analogy
doesn't work in practice.

I think you should look at bundled packages like Calc.  Calc has
calc-loaddefs.el, but I just now forced Emacs 28.1 to native-compile
Calc and didn't see any problems.  And I see that calc.el does say
explicitly

  ;;;; (Autoloads here)
  (load "calc-loaddefs.el" nil t)

> The point of the autoloads file is to include definitions that must exist in the Lisp
> environment prior to their reference in any Lisp files, whether this is during package use or package
> build-time.

That is true, but AFAIU packages that have their own separate
autoloads file should proactively do something to make sure those
autoloads are loaded before they are needed.

And this is not related to native-compilation in any way: the same
will happen if one tries to byte-compile Hyperbole files without first
loading its autoloads.  Right?