Add my/package-ensure-installed

Does the job of install.el but is available within an Emacs
session. install.el simply calls my/package-ensure-installed
This commit is contained in:
Evie Litherland-Smith 2024-08-16 09:16:11 +01:00
parent ed1c1a3e0a
commit 1dec1f8f4d
2 changed files with 10 additions and 3 deletions

View file

@ -19,6 +19,15 @@ Configure package archives and initialise.
:config
(add-to-list 'package-archives '("melpa-stable" . "https://stable.melpa.org/packages/"))
(package-initialize))
(defun my/package-ensure-installed ()
"Ensure packages in `package-selected-packages' are installed."
(interactive)
(require 'package)
(package-refresh-contents)
(package-install-selected-packages t)
(package-autoremove)
(package-upgrade-all nil))
#+end_src
** Defaults
Set some useful defaults. Some of these should be moved to relevant

View file

@ -3,8 +3,6 @@
;;; Code:
;; Configure packages archives with priority
(load-file (locate-user-emacs-file "init.el"))
(package-refresh-contents)
(package-install-selected-packages t)
(package-autoremove)
(my/package-ensure-installed)
(provide 'install)
;;; install.el ends here