Extract installation of core packages to function

This commit is contained in:
Henrik Lissner 2020-05-25 15:52:39 -04:00
parent 235b69bd20
commit 944d7ec83f
No known key found for this signature in database
GPG Key ID: 5F6C0EA160557395

View File

@ -151,20 +151,21 @@ uses a straight or package.el command directly).")
(eval-region (search-forward "(require 'straight)")
(point-max))))))
(defun doom--ensure-core-packages ()
(doom-log "Installing core packages")
(dolist (package doom-packages)
(let ((name (car package)))
(when-let (recipe (plist-get (cdr package) :recipe))
(straight-override-recipe (cons name recipe)))
(straight-use-package name))))
(defun doom-initialize-core-packages (&optional force-p)
"Ensure `straight' is installed and was compiled with this version of Emacs."
(when (or force-p (null (bound-and-true-p straight-recipe-repositories)))
(doom-log "Initializing straight")
(let ((doom-disabled-packages nil)
(doom-packages (doom-package-list nil 'core-only)))
(let ((doom-packages (doom-package-list nil 'core-only)))
(doom--ensure-straight)
(doom-log "Installing core packages")
(dolist (package doom-packages)
(cl-destructuring-bind (name &key recipe &allow-other-keys)
package
(when recipe
(straight-override-recipe (cons name recipe)))
(straight-use-package name))))))
(doom--ensure-core-packages))))
(defun doom-initialize-packages (&optional force-p)
"Process all packages, essential and otherwise, if they haven't already been.