Subject: 24.1; Enable 'package-menu-execute being non-interactive

From: Yves Baumes <[email-masked]>
Date: Mon, 04 Feb 2013 00:49:08 +0100

Hi,

I was trying to make a little program to upgrade automatically my
packages archives. Basically something looking like that:

(progn
  (list-packages)
  (with-current-buffer "*Packages*"
    (package-menu-mark-upgrades)
    (package-menu-execute)
    (kill-buffer)))

The 'package-menu-execute implementation relies on the user to,
interactively, answer yes-or-no to a question asking him to confirm
he wants to upgrade the packages needing an upgrade.

Well, from my point of view the implementation must be silent when
called non interactively. And proceed with the packages upgrades.

Here is a modification that I made that suit my needs:

(defun package-menu-execute ()
...
    (when install-list
      (if (or
           (not (called-interactively-p 'any))
           (yes-or-no-p
...
    ;; Delete packages, prompting if necessary.
    (when delete-list
      (if (or
           (not (called-interactively-p 'any))
           (yes-or-no-p
...

Then, first, I am a newbie in Emacs Lisp modifications. Secondly, the
changelog suggests that package.el has not been modified for a while
ago. Since I could not believe I would be the first needing that
modification in five years, I guess that I maybe wrong somewhere, and
that there must be an easier way to perform what I am trying to do. Then
my question is basically what is a correct behavior according to you and
is my "solution" acceptable?

Regards
Yves