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

From: Ship Mints <[email-masked]>
Date: Thu, 30 Jan 2025 10:37:39 -0500

If it is of interest, I wrote the below to visualize the compilation queue.
It appears when something is enqueued for compilation, and disappears when
the queue is empty.

(when (native-comp-available-p)
  (defvar my:comp--async-running-func)
  (if (version< emacs-version "30")
      (progn
        (declare-function comp--async-runnings nil)
        (require 'comp)
        (setq my:comp--async-running-func #'comp-async-runnings))
    (require 'comp-run)
    (setq my:comp--async-running-func #'comp--async-runnings))
  (defun my/native-comp-mode-line-lighter ()
    "mode-line lighter for `my/native-comp-mode-line-mode'."
    (when comp-files-queue
      (propertize
       (format " [◴%s:%d/%d]" comp-native-version-dir (length
comp-files-queue) (funcall my:comp--async-running-func))
       'face (list :height 0.75))))

  (define-minor-mode my/native-comp-mode-line-mode
    "Display the native compilation queue depth during compiles."
    :global t
    :group 'mode-line
    :lighter (:eval (my/native-comp-mode-line-lighter)))
  (when my:mode-line-native-comp
    (my/native-comp-mode-line-mode)))

On Thu, Jan 30, 2025 at 10:30 AM Andrea Corallo <[email-masked]> wrote:

> Eli Zaretskii <[email-masked]> writes:
>
> >> Cc: [email-masked], [email-masked]
> >> Date: Fri, 24 Jan 2025 17:35:50 -0500
> >> From:  Spencer Baugh via "Bug reports for GNU Emacs,
> >>  the Swiss army knife of text editors" <[email-masked]>
> >>
> >> > Sounds good to me, thanks.  We'll take patches implementing this.
> >>
> >> I'm happy to implement this, I'm just a bit lost about where to start.
> >> I tried the obvious "iterate over *.el files in the package directory,
> >> calling native-compile", but that failed on various files in various
> >> packages.
> >
> > Why not simply wait till all the async subprocesses compiling to
> > native code finish and exit?  Bonus points for displaying some kind of
> > status or progress messages while waiting, so the user is informed why
> > the wait.
> >
> > Andrea, is there a better way you can suggest?
>
> Not ATM, I agree having some way to visualize/report the status of the
> compilation queue would be nice.
>
>
>
>