diff --git a/core/autoload/packages.el b/core/autoload/packages.el index 2eb01150d..804ed62c4 100644 --- a/core/autoload/packages.el +++ b/core/autoload/packages.el @@ -88,11 +88,12 @@ list of the package." (list name old-version new-version))))) ;;;###autoload -(defun doom-package-prop (name prop) +(defun doom-package-prop (name prop &optional eval) "Return PROPerty in NAME's plist." (cl-check-type name symbol) (cl-check-type prop keyword) - (plist-get (cdr (assq name doom-packages)) prop)) + (let ((value (plist-get (cdr (assq name doom-packages)) prop))) + (if eval (eval value) value))) ;;;###autoload (defun doom-package-different-backend-p (name) @@ -164,9 +165,9 @@ files." if (and (or (not backend) (eq (doom-package-backend sym t) backend)) (or (eq ignored 'any) - (if ignored - (plist-get plist :ignore) - (not (plist-get plist :ignore)))) + (let* ((form (plist-get plist :ignore)) + (value (eval form))) + (if ignored value (not value)))) (or (eq disabled 'any) (if disabled (plist-get plist :disable) @@ -236,9 +237,9 @@ Used by `doom-packages-update'." (let (quelpa-pkgs elpa-pkgs) ;; Separate quelpa from elpa packages (dolist (pkg (mapcar #'car package-alist)) - (when (and (or (not (doom-package-prop pkg :freeze)) + (when (and (or (not (doom-package-prop pkg :freeze 'eval)) include-frozen-p) - (not (doom-package-prop pkg :ignore)) + (not (doom-package-prop pkg :ignore 'eval)) (not (doom-package-different-backend-p pkg))) (push pkg (if (eq (doom-package-backend pkg) 'quelpa) diff --git a/core/core-packages.el b/core/core-packages.el index cf4fc37fe..762277b02 100644 --- a/core/core-packages.el +++ b/core/core-packages.el @@ -171,7 +171,7 @@ them." ;; Module package macros ;; -(defmacro package! (name &rest plist) +(cl-defmacro package! (name &rest plist &key recipe pin disable _ignore _freeze) "Declares a package and how to install it (if applicable). This macro is declarative and does not load nor install packages. It is used to @@ -200,30 +200,27 @@ Returns t if package is successfully registered, and nil if it was disabled elsewhere." (declare (indent defun)) (doom--assert-stage-p 'packages #'package!) - (let* ((old-plist (cdr (assq name doom-packages))) - (pkg-recipe (or (plist-get plist :recipe) - (and old-plist (plist-get old-plist :recipe)))) - (pkg-pin (or (plist-get plist :pin) - (and old-plist (plist-get old-plist :pin)))) - (pkg-disable (or (plist-get plist :disable) - (and old-plist (plist-get old-plist :disable))))) - (when pkg-recipe - (when (= 0 (% (length pkg-recipe) 2)) - (setq plist (plist-put plist :recipe (cons name pkg-recipe)))) - (when pkg-pin - (setq plist (plist-put plist :pin nil)))) - (dolist (prop '(:ignore :freeze)) - (when-let* ((val (plist-get plist prop))) - (setq plist (plist-put plist prop (eval val))))) - (when (file-in-directory-p (or (bound-and-true-p byte-compile-current-file) - load-file-name) - doom-private-dir) + (let ((plist (append plist (cdr (assq name doom-packages))))) + (when recipe + (when (cl-evenp (length recipe)) + (setq plist (plist-put plist :recipe (cons name recipe)))) + (setq pin nil + plist (plist-put plist :pin nil))) + (when (file-in-directory-p (FILE!) doom-private-dir) (setq plist (plist-put plist :private t))) - `(progn - ,(if pkg-disable `(add-to-list 'doom-disabled-packages ',name nil #'eq)) - ,(if pkg-pin `(setf (alist-get ',name package-pinned-packages) ,pkg-pin)) - (setf (alist-get ',name doom-packages) ',plist) - (not (memq ',name doom-disabled-packages))))) + (let (newplist) + (while plist + (unless (null (cadr plist)) + (push (cadr plist) newplist) + (push (car plist) newplist)) + (pop plist) + (pop plist)) + (setq plist newplist)) + (macroexp-progn + (append (if disable `((add-to-list 'doom-disabled-packages ',name nil #'eq))) + (if pin `((setf (alist-get ',name package-pinned-packages) ,pin))) + `((setf (alist-get ',name doom-packages) ',plist) + (not (memq ',name doom-disabled-packages))))))) (defmacro packages! (&rest packages) "A convenience macro like `package!', but allows you to declare multiple