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 :config
(add-to-list 'package-archives '("melpa-stable" . "https://stable.melpa.org/packages/")) (add-to-list 'package-archives '("melpa-stable" . "https://stable.melpa.org/packages/"))
(package-initialize)) (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 #+end_src
** Defaults ** Defaults
Set some useful defaults. Some of these should be moved to relevant Set some useful defaults. Some of these should be moved to relevant

View file

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