Subject: Re: bug#59088: 29.0.50; void-function package-vc-update when first run package-update-all.

From: Philip Kaludercic <[email-masked]>
Date: Thu, 15 Dec 2022 10:15:03 +0000

Feng Shu <[email-masked]> writes:

> Debugger entered--Lisp error: (void-function package-vc-update)
>   package-vc-update(#s(package-desc :name pyim :version (5 2 8) :summary "A Chinese input method support quanpin, shuangpin,..." :reqs ((emacs (25 1)) (async (1 6)) (xr (1 13))) :kind vc :archive nil :dir "/home/feng/.emacs.d/elpa-29/pyim" :extras ((:url . "https://github.com/tumashu/pyim") (:keywords "convenience" "chinese" "pinyin" "input-method") (:maintainer "Feng Shu" . "[email-masked]") (:authors ("Ye Wenbin" . "[email-masked]") ("Feng Shu" . "[email-masked]")) (:commit . "8c4f7d40c05dc06b3c96c2955e5d72ec268f2b61")) :signed nil))
>   package-update(pyim)
>   mapc(package-update (pyim))
>   package-update-all(t)
>   funcall-interactively(package-update-all t)
>   call-interactively(package-update-all record nil)
>   command-execute(package-update-all record)
>   execute-extended-command(nil "package-update-all" nil)
>   funcall-interactively(execute-extended-command nil "package-update-all" nil)
>   call-interactively(execute-extended-command nil nil)
>   command-execute(execute-extended-command)

The function has been autoloaded, so this shouldn't occur any more:

  commit 17889dd828dabc8d4a015c3df889799818178afb
  Author: Philip Kaludercic <[email-masked]>
  Date:   Thu Nov 17 17:39:46 2022 +0100

      * lisp/emacs-lisp/package-vc.el: Autoload package-vc-update{,-all}

  diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
  --- a/lisp/emacs-lisp/package-vc.el
  +++ b/lisp/emacs-lisp/package-vc.el
  @@ -573,35 +574,36 @@

  +;;;###autoload
   (defun package-vc-update (pkg-desc)
     "Attempt to update the package PKG-DESC."
     (interactive (list (package-vc--read-package-desc "Update source package: " t)))
     ;; HACK: To run `package-vc--unpack-1' after checking out the new
     ;; revision, we insert a hook into `vc-post-command-functions', and
     ;; remove it right after it ran.  To avoid running the hook multiple
     ;; times or even for the wrong repository (as `vc-pull' is often
     ;; asynchronous), we extract the relevant arguments using a pseudo
     ;; filter for `vc-filter-command-function', executed only for the
     ;; side effect, and store them in the lexical scope.  When the hook
     ;; is run, we check if the arguments are the same (`eq') as the ones
     ;; previously extracted, and only in that case will be call
     ;; `package-vc--unpack-1'.  Ugh...
     ;;
     ;; If there is a better way to do this, it should be done.
     (cl-assert (package-vc-p pkg-desc))
     (letrec ((pkg-dir (package-desc-dir pkg-desc))
              (vc-flags)
              (vc-filter-command-function
               (lambda (command file-or-list flags)
                 (setq vc-flags flags)
                 (list command file-or-list flags)))
              (post-upgrade
               (lambda (_command _file-or-list flags)
                 (when (and (file-equal-p pkg-dir default-directory)
                            (eq flags vc-flags))
                   (unwind-protect
                       (with-demoted-errors "Failed to activate: %S"
                         (package-vc--unpack-1 pkg-desc pkg-dir))
                     (remove-hook 'vc-post-command-functions post-upgrade))))))
       (add-hook 'vc-post-command-functions post-upgrade)
       (with-demoted-errors "Failed to fetch: %S"
         (let ((default-directory pkg-dir))
           (vc-pull)))))