@@ -390,7 +390,10 @@ file. It can be overridden by users inside `dotspacemacs/user-init'.")
390390 " Hash map to index `cfgl-layer' objects by their names." )
391391
392392(defvar configuration-layer--used-packages '()
393- " An alphabetically sorted list of used package names." )
393+ " A list of used package names." )
394+
395+ (defvar configuration-layer--used-packages-sorted '()
396+ " Like `configuration-layer--used-packages' , but sorted alphabetically." )
394397
395398(defvar configuration-layer--indexed-packages (make-hash-table )
396399 " Hash map to index `cfgl-package' objects by their names." )
@@ -641,7 +644,7 @@ To prevent package from being installed or uninstalled set the variable
641644 (not (eq 'template spacemacs-load-dotspacemacs)))
642645 (configuration-layer/delete-orphan-packages packages))))
643646 ; ; configure used packages
644- (configuration-layer//configure-packages configuration-layer--used-packages)
647+ (configuration-layer//configure-packages configuration-layer--used-packages-sorted )
645648 ; ; evaluate layer variables a second time to override default values set in
646649 ; ; packages configuration above
647650 (configuration-layer//set-layers-variables configuration-layer--used-layers)
@@ -922,7 +925,7 @@ a new object."
922925 " Describe a package in the context of the configuration layer system."
923926 (interactive
924927 (list (intern
925- (completing-read " Package: " configuration-layer--used-packages))))
928+ (completing-read " Package: " configuration-layer--used-packages-sorted ))))
926929 (help-setup-xref (list #'configuration-layer/describe-package
927930 pkg-symbol layer-list pkg-list)
928931 (called-interactively-p 'interactive ))
@@ -1655,9 +1658,14 @@ RNAME is the name symbol of another existing layer."
16551658 (configuration-layer/make-packages-from-layers layers t )
16561659 (configuration-layer/make-packages-from-dotfile t )
16571660 (setq configuration-layer--used-packages
1658- (sort (cl-delete-if-not #'configuration-layer/package-used-p
1659- configuration-layer--used-packages)
1660- #'string< ))))
1661+ (cl-delete-if-not #'configuration-layer/package-used-p
1662+ ; ; Reverse such that we get the order in which
1663+ ; ; packages are declared in each layer of
1664+ ; ; `configuration-layer--used-layers' and
1665+ ; ; `dotspacemacs-additional-packages' .
1666+ (nreverse configuration-layer--used-packages))
1667+ configuration-layer--used-packages-sorted
1668+ (sort (cl-copy-list configuration-layer--used-packages) #'string< ))))
16611669
16621670(defun configuration-layer//load-layers-files (layer-names files )
16631671 " Load the files of list FILES for all passed LAYER-NAMES."
@@ -1754,10 +1762,10 @@ RNAME is the name symbol of another existing layer."
17541762 pkg-name)))
17551763 (oref layer packages)))))
17561764 (let ((last-buffer (current-buffer ))
1757- (sorted-pkg (sort inst-pkgs #'string< )))
1765+ (sorted-pkg (sort ( cl-copy-list inst-pkgs) #'string< )))
17581766 (spacemacs-buffer/goto-buffer)
17591767 (goto-char (point-max ))
1760- (configuration-layer//install-packages sorted-pkg )
1768+ (configuration-layer//install-packages inst-pkgs )
17611769 (configuration-layer//configure-packages sorted-pkg)
17621770 (configuration-layer//load-layer-files layer '(" keybindings" ))
17631771 (oset layer lazy-install nil )
@@ -2134,7 +2142,7 @@ to update."
21342142 (configuration-layer/retrieve-package-archives nil 'force )
21352143 (setq configuration-layer--check-new-version-error-packages nil )
21362144 (let* ((distant-packages (configuration-layer//filter-distant-packages
2137- configuration-layer--used-packages t ))
2145+ configuration-layer--used-packages-sorted t ))
21382146 (update-packages
21392147 (configuration-layer//get-packages-to-update distant-packages))
21402148 (skipped-count (length
0 commit comments