12

I'm a bit compulsive about updating packages for all of my systems, so I find myself running list-packages -> U -> x -> y -> y pretty much daily to update my packages and delete old versions once the update is complete. How can I automate this process so that at the very least I have to run only one function to update, compile, and delete my packages? Or is there some reason I might not want to do that?

17

The following is now part of the Paradox package. Just invoke paradox-upgrade-packages.


This should do it.

(defun endless/upgrade ()
  "Upgrade all packages, no questions asked."
  (interactive)
  (save-window-excursion
    (list-packages)
    (package-menu-mark-upgrades)
    (package-menu-execute 'no-query)))

Just check which function is called by each of the steps you enumerated, and throw them inside an interactive function. Normally, the (y or n) prompts would be an issue, but package-menu-execute conveniently takes a NO-QUERY argument.

  • If all packages are up to date, it will return No operations specified. – ChillarAnand Sep 16 '15 at 6:00
3

You can automate this with Cask. This works for package development, but also for user configuration. The documentation provides details for setting this up.

Also, Pallet is useful for keeping your Cask file up-to-date with changes you make in the *Packages* buffer.

  • +1 Cask + Pallet are great (but I don't recommend using them on Windows). – rsenna Dec 2 '14 at 18:50
  • Hmm, that's a problem, because I am on Windows most of the time. – Ryan Dec 2 '14 at 19:03
  • @rsenna Thanks for the information. I don't run any Windows systems, so I wasn't aware they didn't play nicely. – Kyle Meyer Dec 2 '14 at 21:36
  • In fact you can use Cask + Pallet on Windows, with some work. I was able achieve that by using Cygwin, but I remember it was far from easy... – rsenna Dec 2 '14 at 22:03
  • Cask will work fine in Windows once you install Python. I'm not sure about Pallet since I haven't tested though. But from looking at the repo it shouldn't depend on anything other than Cask + Emacs. – Jonathan Leech-Pepin Jan 2 '15 at 15:26
0

How about auto-package-update?

Old versions can be deleted by this customization:

(setq auto-package-update-delete-old-versions t)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.