29

I'm using use-package to install and configure packages (most of these packages are in melpa). Is there a clean automated way of keeping all these packages up-to-date ?

If not, what is the best work flow in this case ?

Note: A very similar question here with an answer, but I wanted a clarification on "You'll still need to deal with installing updates". I could not comment on the answer for clarification as I do not have enough reputation.

22

I just do this manually: run list-packages hit Uto 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.

| improve this answer | |
  • Thanks, the questions is primarily answered. 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 2 '17 at 14:05
  • What version of Emacs are you using? – glucas Apr 2 '17 at 15:03
  • I'm using 24.5.1 – Jaagrit Sapana Apr 2 '17 at 22:58
  • Ah ok. I checked and the package-menu-filter command is new in 25.1, so that command won't work for you. – glucas Apr 3 '17 at 0:20
  • I do this every Monday morning – Ricky Nelson Mar 8 '19 at 0:52
12

You can use auto-package-update to automatically update packages.

Copied from my other post (https://emacs.stackexchange.com/a/31903/9972)

(use-package auto-package-update
   :ensure t
   :config
   (setq auto-package-update-delete-old-versions t
         auto-package-update-interval 4)
   (auto-package-update-maybe))

With that setup, packages will be updated every 4 days, and the old packages will be removed.

| improve this answer | |
2

There is a highly recommended package called paradox that extends package management commands. Read more from https://github.com/Malabarba/paradox

(use-package paradox
  :init
  (setq paradox-github-token t)
  (setq paradox-execute-asynchronously t)
  (setq paradox-automatically-star t))

This setup feeds package usage statistics back to system using a separately set github token and updates packages in the background when you manually run the command paradox-upgrade-packages bound to your keys of choice.

Read the inline documentation of the variable paradox-github-token on how to set it up.

| improve this answer | |
0

Try epm to keep update process clean.

cf. https://github.com/xuchunyang/epm

It can run update process within emacs batch process, without loading normal init.el settings.

| improve this answer | |
0

Just enter list-packages and pres SHIFT+U. It will mark all installed packages for an update.

| improve this answer | |
  • 1
    It's arguably not fully automatic. – JeanPierre Sep 29 '19 at 7:27
0

Emacs package update sometimes fails.

If package installation is automated using use-package, delete the .emacs.d/elpa directory and reinstall the package.

good luck

| improve this answer | |

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.