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?
Asked
Active
Viewed 2,089 times
12

Ryan
- 4,039
- 1
- 27
- 49
3 Answers
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.

Malabarba
- 23,148
- 6
- 79
- 164
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.

Kyle Meyer
- 7,024
- 27
- 22
-
+1 Cask + Pallet are great (but I don't recommend using them on Windows). – rsenna Dec 02 '14 at 18:50
-
-
@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 02 '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 02 '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 02 '15 at 15:26
1
How about auto-package-update?
Old versions can be deleted by this customization:
(setq auto-package-update-delete-old-versions t)

zhanxw
- 111
- 2
No operations specified
. – Chillar Anand Sep 16 '15 at 06:00