Subject: bug#75812: 29.2.50; Support native-compiling package-install from batch Emacs

From: Stefan Kangas <[email-masked]>
Date: Fri, 24 Jan 2025 16:03:35 -0600

severity 75812 wishlist
tags 75812 + confirmed
thanks

Spencer Baugh <[email-masked]> writes:

> Currently, setting package-native-compile to t will make package-install
> asynchronously native-compile the package.  This works great for
> interactive usage.
>
> However, this is unsuitable for a batch Emacs running package-install.
> "emacs -batch --eval (package-install something)" will exit once the
> package is installed, but before the asynchronous native compilation
> completes; the native compilation will just be abandoned.  So,
> currently, there's no straightforward way to native compile a package
> from a batch Emacs.
>
> Running package-install from a batch Emacs is useful as a way to update
> or pre-install packages in scripts, without requiring user interaction.
> This is widely used by package managers like Nix or dpkg to install
> Emacs packages as OS packages.  In my specific case, it's used to
> install and byte-compile common packages into site-lisp.  In all these
> cases, it would be nice to be able to native-compile the package at
> installation time and include the .eln files in the package directory.
>
> A straightforward solution would be for package-install-file to support
> synchronously native-compiling the installed package, such that after
> package-install finishes running, the native compilation is complete.
> Perhaps with a new value of package-native-compile?

Sounds good to me, thanks.  We'll take patches implementing this.