diff options
| author | Kévin Le Gouguec <kevin.legouguec@gmail.com> | 2024-03-24 20:26:15 +0100 |
|---|---|---|
| committer | Kévin Le Gouguec <kevin.legouguec@gmail.com> | 2024-03-24 20:26:15 +0100 |
| commit | dbbdd1e282137a04ce2271eb00f46869db8b9be4 (patch) | |
| tree | c2ecf9b5e65eee8035cea820605374d487e39979 /.local/bin | |
| parent | 89d55ba2eb0ad172dc6aae81ce5d1cb340a632d2 (diff) | |
| download | dotfiles-dbbdd1e282137a04ce2271eb00f46869db8b9be4.tar.xz | |
Add script to "update" ELPA packages
I update somewhat infrequently, and more often than not some packages
will fail to compile for obscure reasons.
At this stage, I've done the "generate minimal .emacs with selected
packages, install from scratch" dance that I figure I might as well
automate it.
Diffstat (limited to '.local/bin')
| -rwxr-xr-x | .local/bin/emacs-update-packages | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/.local/bin/emacs-update-packages b/.local/bin/emacs-update-packages new file mode 100755 index 0000000..8ad22d2 --- /dev/null +++ b/.local/bin/emacs-update-packages @@ -0,0 +1,44 @@ +#!/bin/bash + +set -euo pipefail +set -x + +backup-elpa () +{ + ( + cd ~/.emacs.d + + # Make a timestamped snapshot for archival. + tar czf elpa.$(date +%F).tgz elpa + + # Move directory out of Emacs's sight. We could remove it + # altogether since we have the archived snapshot; keep it + # around for the very minor convenience gain. + mv -T elpa elpa.bkp + ) +} + +gen-dotemacs () +{ + # --batch will not read my configuration. Fall back to print-like + # functions, redirecting to 'external-debugging-output, + # redirecting stderr to stdout, and kill-emacs. + emacs 2>&1 \ + --eval '(pp `(use-package package + :custom + (package-archives '\''(,@package-archives)) + (package-selected-packages '\''(,@package-selected-packages)))) + '\''external-debugging-output' \ + --funcall kill-emacs +} + + +gen-dotemacs > .emacs.upgrade + +backup-elpa +mv .emacs .emacs.bkp + +cp .emacs.upgrade .emacs +emacs --funcall package-install-selected-packages + +mv .emacs.bkp .emacs |
