From 1bcb630f3f734b9d5d325ddfcd5dcc6a7a2b578c Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Wed, 23 Oct 2024 02:35:41 +0200 Subject: emacs: Add ‘mm-package-sync’ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .config/emacs/init.el | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to '.config/emacs/init.el') diff --git a/.config/emacs/init.el b/.config/emacs/init.el index 07f6149..645aad6 100644 --- a/.config/emacs/init.el +++ b/.config/emacs/init.el @@ -108,9 +108,22 @@ buffer suppressed." package-archive-priorities '(("gnu" . 3) ("nongnu" . 2) ("melpa" . 1))) -(package-initialize) (setopt use-package-always-defer t) +(package-initialize) + +(defun mm-package-sync () + "Remove unused packages and install missing ones." + (interactive) + (let ((window-configuration (current-window-configuration))) + (package-autoremove) + (package-install-selected-packages) + (package-upgrade-all) + (package-vc-install-selected-packages) + (package-vc-upgrade-all) + (set-window-configuration window-configuration)) + (message "Done syncing packages.")) + ;;; Generic Emacs Configuration -- cgit v1.2.3