diff --git a/core/core-configuration-layer.el b/core/core-configuration-layer.el index 3b9b1b7aeb97..2152f3c6729f 100644 --- a/core/core-configuration-layer.el +++ b/core/core-configuration-layer.el @@ -186,7 +186,8 @@ LAYER has to be installed for this method to work properly." (defvar configuration-layer--elpa-archives '(("melpa" . "melpa.org/packages/") ("org" . "orgmode.org/elpa/") - ("gnu" . "elpa.gnu.org/packages/")) + ("gnu" . "elpa.gnu.org/packages/") + ("melpa-stable" . "stable.melpa.org/packages/")) "List of ELPA archives required by Spacemacs.") (defvar configuration-layer-no-layer nil @@ -486,6 +487,7 @@ If TOGGLEP is nil then `:toggle' parameter is ignored." (let* ((name-sym (if (listp pkg) (car pkg) pkg)) (name-str (symbol-name name-sym)) (location (when (listp pkg) (plist-get (cdr pkg) :location))) + (archive (when (listp pkg) (plist-get (cdr pkg) :archive))) (min-version (when (listp pkg) (plist-get (cdr pkg) :min-version))) (step (when (listp pkg) (plist-get (cdr pkg) :step))) (excluded (when (listp pkg) (plist-get (cdr pkg) :excluded))) @@ -493,6 +495,8 @@ If TOGGLEP is nil then `:toggle' parameter is ignored." (protected (when (listp pkg) (plist-get (cdr pkg) :protected))) (copyp (not (null obj))) (obj (if obj obj (cfgl-package name-str :name name-sym)))) + (when archive + (configuration-layer/pin-package name-sym archive)) (when location (oset obj :location location)) (when min-version (oset obj :min-version (version-to-list min-version))) (when step (oset obj :step step)) @@ -1866,7 +1870,19 @@ FILE-TO-LOAD is an explicit file to load after the installation." (1+ configuration-layer-error-count)) (setq configuration-layer-error-count 1))) +(defun configuration-layer/pin-package (package archive) + "Pin PACKAGE to ARCHIVE. + +When PACKAGE is pinned to specific ARCHIVE, it is installed +exactly from that ARCHIVE. + +ARCHIVE must be one of the following symbols: melpa, org, gnu, +melpa-stable." + (let ((archive-name (symbol-name archive))) + (unless (assoc archive-name package-archives) + (error "Archive '%s' is not supported." archive)) + (push (cons package archive-name) package-pinned-packages))) + (provide 'core-configuration-layer) ;;; core-configuration-layer.el ends here -