I just do this manually: run list-packages
hit U
to mark available upgrades, then review to decide if there are any I don't want to pick up. Then x
to upgrade. I do this pretty regularly, and often check what's new at the same time. I've got a couple tweaks to simplify this (see below).
I suspect upgrading could be automated, but you do want to consider the case where an update breaks something and you need to back it out and then prevent your automated updater from just installing it again.
Some package menu tweaks:
(defun package-menu-find-marks ()
"Find packages marked for action in *Packages*."
(interactive)
(occur "^[A-Z]"))
;; Only in Emacs 25.1+
(defun package-menu-filter-by-status (status)
"Filter the *Packages* buffer by status."
(interactive
(list (completing-read
"Status: " '("new" "installed" "dependency" "obsolete"))))
(package-menu-filter (concat "status:" status)))
(define-key package-menu-mode-map "s" #'package-menu-filter-by-status)
(define-key package-menu-mode-map "a" #'package-menu-find-marks)
With this I can use s new
to just see what packages are newly available. And after hitting U
to mark upgrades I can hit a
for an occur buffer list of the ones that were marked, in case I want to dig in to details of what changed etc.
UPDATED: Emacs 28 added new package menu commands to filter the package list in various ways, replacing the need for the custom commands above. Use /-?
to see the available package-menu-filter-*
bindings.
a
worked for finding out marked packages. However,s installed
or any of the other remaining three statuses returns an empty list. – Jaagrit Sapana Apr 02 '17 at 14:05package-menu-filter
command is new in 25.1, so that command won't work for you. – glucas Apr 03 '17 at 00:20/
command. See here – kotchwane Apr 08 '22 at 16:00