From 2ee6c2c9770cef654ebfbcd618633f668c56ba88 Mon Sep 17 00:00:00 2001 From: Eivind Fonn Date: Sun, 2 Jul 2017 09:35:01 +0200 Subject: [PATCH] Fix: Better checking of used packages --- core/core-configuration-layer.el | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/core/core-configuration-layer.el b/core/core-configuration-layer.el index 2ead3c7da..2b186ed2f 100644 --- a/core/core-configuration-layer.el +++ b/core/core-configuration-layer.el @@ -1338,23 +1338,23 @@ wether the declared layer is an used one or not." (defun configuration-layer/layer-usedp (layer-name) "Return non-nil if LAYER-NAME is the name of a used layer." - (let ((obj (configuration-layer/get-layer layer-name))) - (when obj (memq layer-name configuration-layer--used-layers)))) + (or (eq 'dotfile layer-name) + (let ((obj (configuration-layer/get-layer layer-name))) + (when obj (memq layer-name configuration-layer--used-layers))))) (defun configuration-layer/package-usedp (name) "Return non-nil if NAME is the name of a used package." (let ((obj (configuration-layer/get-package name))) (and obj (cfgl-package-get-safe-owner obj) - (not (oref obj :excluded))))) + (not (oref obj :excluded)) + (not (memq nil (mapcar + 'configuration-layer/package-usedp + (oref obj :depends))))))) (defun configuration-layer//package-deps-used-p (pkg) "Returns non-nil if all dependencies of PKG are used." (not (memq nil (mapcar - (lambda (dep-pkg) - (let ((pkg-obj (configuration-layer/get-package dep-pkg))) - (and pkg-obj - (cfgl-package-get-safe-owner pkg-obj) - (not (oref pkg-obj :excluded))))) + 'configuration-layer/package-usedp (oref pkg :depends))))) (defun configuration-layer/package-lazy-installp (name) @@ -1374,6 +1374,10 @@ wether the declared layer is an used one or not." (let* ((warning-minimum-level :error)) (configuration-layer/make-packages-from-layers layers t) (configuration-layer/make-packages-from-dotfile t) + (setq configuration-layer--used-packages + (configuration-layer/filter-objects + configuration-layer--used-packages + 'configuration-layer/package-usedp)) (setq configuration-layer--used-packages (configuration-layer//sort-packages configuration-layer--used-packages))))