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: Sun, 15 May 2022 19:22:02 +0300

[Resending for Andrea, whose address was incorrect.]

> Cc: [email-masked], Andrea Corallo <[email-masked]>, [email-masked]
> Date: Sun, 15 May 2022 11:59:05 -0400
> From:  Stefan Monnier via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <[email-masked]>
> 
> I suspect we should add a call to `package-activate-all` somewhere
> in the above code (and probably preserve `package-directory-list` and
> `package-user-dir` as well).

I don't see why comp.el should call package-related functions (or
indeed know anything about packages and distinguish between packages
and other Lisp files).  It makes no sense to me.  Compilation should
not consider user customizations or be dependent on them.

I could support some general infrastructure to detect whether a given
file has separate autoloads, and perhaps load them when compiling, but
that's all.  And even this should be discussed, because I don't think
I like the idea of a compilation always loading the autoloads, it's in
many/most cases an overkill IMNSHO.

> I just tried to re-trigger the problem after applying the patch below
> [which also make this part of the code obey our 80-column convention,
> while at it] and it appears to be fixed (e.g. `hui-em-but.el` was
> successfully compiled).
> Andrea, any comment?

I'm firmly against this, sorry.  Let's look for more elegant ways;
this one is too blunt, and most Lisp files don't need it.  Moreover,
activating the packages will make every compilation dependent on the
current user's customizations and installed packages, which is the
antithesis of batch-mode compilation: it isn't a coincidence that
"-batch" implies "-Q".