                       (and (not (memq x spacemacs-used-theme-packages))
                            x)) orphans)))
 
-(defun configuration-layer/delete-orphan-packages ()
-  "Delete all the orphan packages."
+(defun configuration-layer/delete-orphan-packages (packages)
+  "Delete PACKAGES if they are orphan."
   (interactive)
-  (let* ((dependencies (configuration-layer//get-packages-dependencies))
-         (implicit-packages (configuration-layer//get-implicit-packages))
+  (let* ((dependencies (configuration-layer//get-all-packages-dependencies))
+         (implicit-packages (configuration-layer//get-implicit-packages
+                             packages))
          (orphans (configuration-layer//filter-used-themes
                    (configuration-layer//get-orphan-packages implicit-packages
                                                              dependencies)))

  (configuration-layer/init-layers)
  (configuration-layer/load-layers)
  (when dotspacemacs-delete-orphan-packages
    (configuration-layer/delete-orphan-packages)))

(defun configuration-layer/create-layer ()
  "Ask the user for a configuration layer name and the layer

    (unless (string-empty-p version-string)
      (version-to-list version-string))))

(defun configuration-layer//package-delete (pkg-name)
  "Delete package with name PKG-NAME."
  (cond
   ((version< emacs-version "24.3.50")
    (let ((v (configuration-layer//get-package-version-string pkg-name)))
      (when v (package-delete (symbol-name pkg-name) v))))
   (t (let ((p (cadr (assq pkg-name package-alist))))
        (when p (package-delete p))))))

(defun configuration-layer//filter-used-themes (orphans)
