Subject: Re: bug#59728: 30.0.50; package-vc does not handle package-quickstart

From: Philip Kaludercic <[email-masked]>
Date: Wed, 30 Nov 2022 19:53:01 +0000

Matt Armstrong <[email-masked]> writes:

> X-debbugs-cc: Philip Kaludercic <[email-masked]>, Stefan Monnier <[email-masked]>
>
> package.el provides `package-quickstart':
>
>     package-quickstart is a variable defined in ‘package.el’.
>
>     Its value is t
>     Original value was nil
>
>     Precompute activation actions to speed up startup.
>     This requires the use of ‘package-quickstart-refresh’ every time the
>     activations need to be changed, such as when ‘package-load-list’ is modified.
>
> This places a package-quickstart.elc file in `user-emacs-directory' that
> is loaded at startup, instead of loading the individual
> `user-emacs-directory'/elpa/*-autoloads.el files.
>
> In practice package.el takes care of calling
> `package-quickstart-refresh' as needed.  As a user making normal use of
> package.el I don't believe I have ever needed to call
> `package-quickstart-refresh' manually.
>
> I am playing with package-vc.el and immediately noticed that functions
> like `package-vc-install-from-checkout' and `package-vc-rebuild' do not
> call `package-quickstart-refresh'.
>
> The effect is that package-vc leaves a "stale" package-quickstart.elc in
> the `user-emacs-directory', and the user must run
> `package-quickstart-refresh' manually.
>
> Ideally the various `package-vc-*' functions take care of running the
> function when necessary.

The central function here is `package-vc--unpack-1' so the following
patch should take care of that:

diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
index a4520ab800..5f7674190b 100644
--- a/lisp/emacs-lisp/package-vc.el
+++ b/lisp/emacs-lisp/package-vc.el
@@ -433,7 +433,8 @@ package-vc--unpack-1
                               (car load-path))))
                   (current-buffer))
            (buffer-string))
-         nil (expand-file-name auto-name pkg-dir))))
+         nil (expand-file-name auto-name pkg-dir)))
+      (package-quickstart-refresh))
 
     ;; Generate package file
     (package-vc--generate-description-file pkg-desc pkg-file)

However I am uncertain if this is too aggressive?  I don't have the time
to test it properly right now, but could try this (or some variation
thereof) and tell me if it addresses the issue?