2017-12-18 04:25:04 +00:00
|
|
|
;; -*- nameless-current-name: "configuration-layer" -*-
|
2015-01-27 03:51:47 +00:00
|
|
|
;;; core-configuration-layer.el --- Spacemacs Core File
|
2015-01-14 04:12:56 +00:00
|
|
|
;;
|
2018-01-04 07:00:25 +00:00
|
|
|
;; Copyright (c) 2012-2018 Sylvain Benner & Contributors
|
2015-01-14 04:12:56 +00:00
|
|
|
;;
|
|
|
|
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
|
|
|
|
;; URL: https://github.com/syl20bnr/spacemacs
|
|
|
|
;;
|
|
|
|
;; This file is not part of GNU Emacs.
|
|
|
|
;;
|
|
|
|
;;; License: GPLv3
|
2015-08-06 03:39:39 +00:00
|
|
|
|
2015-08-29 07:09:13 +00:00
|
|
|
(require 'cl-lib)
|
2017-10-30 04:57:48 +00:00
|
|
|
(require 'epg)
|
2015-07-26 04:41:41 +00:00
|
|
|
(require 'eieio)
|
2016-03-06 04:21:55 +00:00
|
|
|
(require 'subr-x)
|
2015-01-05 05:20:38 +00:00
|
|
|
(require 'package)
|
2015-09-29 06:05:36 +00:00
|
|
|
(require 'warnings)
|
2016-02-22 07:29:43 +00:00
|
|
|
(require 'help-mode)
|
2015-08-06 03:39:39 +00:00
|
|
|
(require 'ht)
|
2015-01-27 03:51:47 +00:00
|
|
|
(require 'core-dotspacemacs)
|
|
|
|
(require 'core-funcs)
|
2018-06-10 06:32:29 +00:00
|
|
|
(require 'core-progress-bar)
|
2015-01-27 03:51:47 +00:00
|
|
|
(require 'core-spacemacs-buffer)
|
2015-01-05 05:20:38 +00:00
|
|
|
|
2015-12-21 05:56:04 +00:00
|
|
|
(defvar configuration-layer--refresh-package-timeout dotspacemacs-elpa-timeout
|
2015-12-03 04:25:00 +00:00
|
|
|
"Timeout in seconds to reach a package archive page.")
|
2015-07-26 04:41:41 +00:00
|
|
|
|
2018-05-06 15:41:53 +00:00
|
|
|
(defvar configuration-layer--last-dotspacemacs-configuration-layers-file
|
|
|
|
(concat spacemacs-cache-directory "last-configuration-layers"))
|
|
|
|
|
2014-12-25 20:24:26 +00:00
|
|
|
(defconst configuration-layer-template-directory
|
|
|
|
(expand-file-name (concat spacemacs-core-directory "templates/"))
|
|
|
|
"Configuration layer templates directory.")
|
|
|
|
|
2015-09-08 01:16:15 +00:00
|
|
|
(defconst configuration-layer-directory
|
2016-06-23 04:19:12 +00:00
|
|
|
(expand-file-name (concat spacemacs-start-directory "layers/"))
|
2017-08-28 15:33:55 +00:00
|
|
|
"Spacemacs layers directory.")
|
2014-10-24 03:11:36 +00:00
|
|
|
|
2015-06-05 23:50:03 +00:00
|
|
|
(defconst configuration-layer-private-layer-directory
|
|
|
|
(let ((dotspacemacs-layer-dir
|
|
|
|
(when dotspacemacs-directory
|
|
|
|
(expand-file-name
|
|
|
|
(concat dotspacemacs-directory "layers/")))))
|
|
|
|
(if (and dotspacemacs-directory
|
|
|
|
(file-exists-p dotspacemacs-layer-dir))
|
|
|
|
dotspacemacs-layer-dir
|
2018-06-25 06:16:27 +00:00
|
|
|
spacemacs-private-directory))
|
2015-06-05 23:50:03 +00:00
|
|
|
"Spacemacs default directory for private layers.")
|
|
|
|
|
2017-10-29 04:28:22 +00:00
|
|
|
(defconst configuration-layer-lock-file
|
|
|
|
(concat spacemacs-start-directory ".lock")
|
|
|
|
"Absolute path to the lock file.")
|
|
|
|
|
2017-11-02 03:13:47 +00:00
|
|
|
(defvar configuration-layer-stable-elpa-version spacemacs-version
|
2019-08-21 23:52:40 +00:00
|
|
|
"Version of ELPA stable repository. This value is aimed to be defined in
|
2017-11-02 03:13:47 +00:00
|
|
|
the .lock file at the root of the repository.")
|
|
|
|
|
|
|
|
(defvar configuration-layer-stable-elpa-name "spacelpa"
|
|
|
|
"Name of the stable ELPA repository. Should be defined in the lock file.")
|
2017-10-30 04:57:48 +00:00
|
|
|
|
2017-11-02 03:23:26 +00:00
|
|
|
(defvar configuration-layer-elpa-subdirectory ""
|
|
|
|
"Sub-directory name where to install ELPA packages. Should be defined in
|
|
|
|
the lock file.")
|
|
|
|
|
2017-11-02 03:13:47 +00:00
|
|
|
(defconst configuration-layer-stable-elpa-directory
|
|
|
|
(expand-file-name
|
|
|
|
(concat spacemacs-cache-directory "stable-elpa/" emacs-version "/"))
|
|
|
|
"Remote location of the tarball for the ELPA stable directory")
|
2017-10-29 04:28:22 +00:00
|
|
|
|
2019-08-21 23:52:40 +00:00
|
|
|
(defconst configuration-layer-stable-elpa-archive nil
|
|
|
|
"Absolute path to stable ELPA directory. This value is aimed to be defined in
|
|
|
|
the .lock file at the root of the repository.")
|
|
|
|
|
2017-10-29 04:28:22 +00:00
|
|
|
(defconst configuration-layer--stable-elpa-tarball-directory
|
|
|
|
"https://github.com/syl20bnr/spacelpa/archive/"
|
|
|
|
"Remote location of the tarball for the ELPA stable directory")
|
|
|
|
|
2017-10-30 04:57:48 +00:00
|
|
|
(defconst configuration-layer--stable-elpa-sig-directory
|
|
|
|
"https://github.com/syl20bnr/spacelpa/releases/download/"
|
|
|
|
"Remote location of the signature file for the ELPA stable directory")
|
|
|
|
|
2017-11-02 03:13:47 +00:00
|
|
|
(defconst configuration-layer--stable-elpa-gpg-keyring
|
|
|
|
(expand-file-name (concat spacemacs-core-directory "gnupg/spacemacs.pub"))
|
|
|
|
"Absolute path to public GPG key used to signed the ELPA stable repository
|
|
|
|
tarballs.")
|
2017-10-29 04:28:22 +00:00
|
|
|
|
|
|
|
(defconst configuration-layer--stable-elpa-version-file
|
2017-11-02 03:13:47 +00:00
|
|
|
(concat configuration-layer-stable-elpa-directory "version")
|
2017-10-29 04:28:22 +00:00
|
|
|
"Absolute path to the file containing the current stable elpa repository
|
|
|
|
version")
|
|
|
|
|
2016-08-13 12:21:01 +00:00
|
|
|
(defun configuration-layer/elpa-directory (root)
|
|
|
|
"Evaluate the correct package subdirectory of ROOT. This is
|
|
|
|
done according to the value of `dotspacemacs-elpa-subdirectory'.
|
2017-10-29 04:28:22 +00:00
|
|
|
This function also appends the name of the current branch of Spacemacs.
|
|
|
|
If `dotspacemacs-elpa-subdirectory' is nil, then ROOT is used. Otherwise the
|
|
|
|
subdirectory of ROOT is used."
|
2018-01-22 16:23:59 +00:00
|
|
|
(file-name-as-directory
|
|
|
|
(expand-file-name
|
|
|
|
configuration-layer-elpa-subdirectory
|
|
|
|
(if (not dotspacemacs-elpa-subdirectory)
|
|
|
|
root
|
|
|
|
(let ((subdir (if (eq 'emacs-version dotspacemacs-elpa-subdirectory)
|
|
|
|
(format "%d%s%d"
|
|
|
|
emacs-major-version
|
|
|
|
version-separator
|
|
|
|
emacs-minor-version)
|
|
|
|
(eval dotspacemacs-elpa-subdirectory))))
|
|
|
|
(expand-file-name subdir root))))))
|
2015-10-14 08:52:45 +00:00
|
|
|
|
2017-01-17 05:20:59 +00:00
|
|
|
(defun configuration-layer/get-elpa-package-install-directory (pkg)
|
|
|
|
"Return the install directory of elpa PKG. Return nil if it is not found."
|
|
|
|
(let ((elpa-dir package-user-dir))
|
|
|
|
(when (file-exists-p elpa-dir)
|
|
|
|
(let* ((pkg-match (concat "\\`" (symbol-name pkg) "-[0-9]+"))
|
|
|
|
(dir (car (directory-files elpa-dir 'full pkg-match))))
|
|
|
|
(when dir (file-name-as-directory dir))))))
|
|
|
|
|
2017-07-01 14:54:37 +00:00
|
|
|
(defvar configuration-layer-pre-load-hook nil
|
|
|
|
"Hook executed at the beginning of configuration loading.")
|
2017-02-02 03:59:03 +00:00
|
|
|
|
2017-07-01 14:54:37 +00:00
|
|
|
(defvar configuration-layer-post-load-hook nil
|
|
|
|
"Hook executed at the end of configuration loading.")
|
2017-02-02 03:59:03 +00:00
|
|
|
|
2017-10-31 04:35:18 +00:00
|
|
|
(defconst configuration-layer--elpa-root-directory
|
|
|
|
(concat spacemacs-start-directory "elpa/")
|
|
|
|
"Spacemacs ELPA root directory.")
|
|
|
|
|
|
|
|
(defconst configuration-layer--rollback-root-directory
|
2015-10-14 08:52:45 +00:00
|
|
|
(concat spacemacs-cache-directory ".rollback/")
|
2017-10-31 04:35:18 +00:00
|
|
|
"Spacemacs rollback root directory.")
|
|
|
|
|
|
|
|
(defvar configuration-layer-rollback-directory
|
|
|
|
configuration-layer--rollback-root-directory
|
|
|
|
"Spacemacs current rollback directory.")
|
2015-02-04 04:56:38 +00:00
|
|
|
|
|
|
|
(defconst configuration-layer-rollback-info "rollback-info"
|
|
|
|
"Spacemacs rollback information file.")
|
|
|
|
|
2015-08-06 03:39:39 +00:00
|
|
|
(defclass cfgl-layer ()
|
|
|
|
((name :initarg :name
|
|
|
|
:type symbol
|
|
|
|
:documentation "Name of the layer.")
|
|
|
|
(dir :initarg :dir
|
2016-07-17 19:00:43 +00:00
|
|
|
:initform nil
|
|
|
|
:type (satisfies (lambda (x) (or (null x) (stringp x))))
|
2015-08-06 03:39:39 +00:00
|
|
|
:documentation "Absolute path to the layer directory.")
|
2016-01-31 05:05:27 +00:00
|
|
|
(packages :initarg :packages
|
|
|
|
:initform nil
|
|
|
|
:type list
|
2016-03-06 04:21:55 +00:00
|
|
|
:documentation "List of package symbols declared in this layer.")
|
2016-06-21 00:48:25 +00:00
|
|
|
(selected-packages :initarg :selected-packages
|
|
|
|
:initform 'all
|
|
|
|
:type (satisfies (lambda (x) (or (and (symbolp x) (eq 'all x))
|
|
|
|
(listp x))))
|
|
|
|
:documentation "List of selected package symbols.")
|
2015-08-06 03:39:39 +00:00
|
|
|
(variables :initarg :variables
|
|
|
|
:initform nil
|
|
|
|
:type list
|
2015-09-03 03:01:26 +00:00
|
|
|
:documentation "A list of variable-value pairs.")
|
2016-01-31 05:05:27 +00:00
|
|
|
(lazy-install :initarg :lazy-install
|
|
|
|
:initform nil
|
|
|
|
:type boolean
|
|
|
|
:documentation
|
|
|
|
"If non-nil then the layer needs to be installed")
|
2015-09-03 03:01:26 +00:00
|
|
|
(disabled :initarg :disabled-for
|
|
|
|
:initform nil
|
|
|
|
:type list
|
2016-08-30 09:26:38 +00:00
|
|
|
:documentation "A list of layers where this layer is disabled.")
|
|
|
|
(enabled :initarg :enabled-for
|
|
|
|
:initform 'unspecified
|
|
|
|
:type (satisfies (lambda (x) (or (listp x) (eq 'unspecified x))))
|
2017-06-23 07:27:05 +00:00
|
|
|
:documentation
|
2017-09-26 02:55:08 +00:00
|
|
|
(concat "A list of layers where this layer is enabled. "
|
|
|
|
"(Takes precedence over `:disabled-for'.)"))
|
|
|
|
;; Note:
|
|
|
|
;; 'can-shadow' is a commutative relation:
|
|
|
|
;; if Y 'can-shadow' X then X 'can-shadow' Y
|
|
|
|
;; but the 'shadow' operation is not commutative, the order of the operands
|
|
|
|
;; is determined by the order of the layers in the dotfile
|
|
|
|
;; (variable: dotspacemacs-configuration-layers)
|
2017-09-22 03:47:20 +00:00
|
|
|
(can-shadow :initarg :can-shadow
|
2017-09-26 02:55:08 +00:00
|
|
|
:initform 'unspecified
|
|
|
|
:type (satisfies (lambda (x) (or (listp x) (eq 'unspecified x))))
|
2018-05-20 06:33:28 +00:00
|
|
|
:documentation "A list of layers this layer can shadow.")
|
|
|
|
(deps-loaded :initarg :deps-loaded
|
|
|
|
:initform nil
|
|
|
|
:type boolean
|
|
|
|
:documentation
|
2018-05-24 02:12:30 +00:00
|
|
|
"Boolean to track whether layers.el has been loaded."))
|
2015-08-06 03:39:39 +00:00
|
|
|
"A configuration layer.")
|
|
|
|
|
2017-01-22 18:37:12 +00:00
|
|
|
(defmethod cfgl-layer-owned-packages ((layer cfgl-layer) &optional props)
|
2016-03-06 04:21:55 +00:00
|
|
|
"Return the list of owned packages by LAYER.
|
2017-01-22 18:37:12 +00:00
|
|
|
If PROPS is non-nil then return packages as lists with their properties.
|
2016-03-06 04:21:55 +00:00
|
|
|
LAYER has to be installed for this method to work properly."
|
|
|
|
(delq nil (mapcar
|
|
|
|
(lambda (x)
|
2017-01-22 18:37:12 +00:00
|
|
|
(let* ((pkg-name (if (listp x) (car x) x))
|
|
|
|
(pkg (configuration-layer/get-package pkg-name)))
|
|
|
|
(when (eq (oref layer :name) (car (oref pkg :owners))) x)))
|
|
|
|
(cfgl-layer-get-packages layer props))))
|
2016-03-06 04:21:55 +00:00
|
|
|
|
2017-01-22 18:37:12 +00:00
|
|
|
(defmethod cfgl-layer-owned-packages ((layer nil) &optional props)
|
2016-03-06 04:21:55 +00:00
|
|
|
"Accept nil as argument and return nil."
|
|
|
|
nil)
|
|
|
|
|
2017-09-26 02:55:08 +00:00
|
|
|
(defmethod cfgl-layer-get-shadowing-layers ((layer cfgl-layer))
|
|
|
|
"Return the list of used layers that shadow LAYER."
|
2017-09-22 03:47:20 +00:00
|
|
|
(let ((rank (cl-position (oref layer :name) configuration-layer--used-layers))
|
2017-09-26 02:55:08 +00:00
|
|
|
(shadow-candidates (oref layer :can-shadow))
|
2017-09-22 03:47:20 +00:00
|
|
|
shadowing-layers)
|
2017-09-26 02:55:08 +00:00
|
|
|
(when (and (numberp rank)
|
|
|
|
(not (eq 'unspecified shadow-candidates))
|
|
|
|
(listp shadow-candidates))
|
2017-09-22 03:47:20 +00:00
|
|
|
(mapcar
|
|
|
|
(lambda (other)
|
|
|
|
(let ((orank (cl-position other configuration-layer--used-layers)))
|
2017-09-26 02:55:08 +00:00
|
|
|
;; OTHER shadows LAYER if and only if OTHER's rank is bigger than
|
|
|
|
;; LAYER's rank.
|
2017-09-22 03:47:20 +00:00
|
|
|
(when (and (numberp orank) (< rank orank))
|
|
|
|
(add-to-list 'shadowing-layers other))))
|
2017-09-26 02:55:08 +00:00
|
|
|
;; since the 'can-shadow' relation is commutative it is safe to use this
|
|
|
|
;; list, i.e. if LAYER can shadow layers X and Y then X and Y can shadow
|
|
|
|
;; LAYER.
|
|
|
|
shadow-candidates))
|
2017-09-22 03:47:20 +00:00
|
|
|
shadowing-layers))
|
|
|
|
|
2017-01-22 18:37:12 +00:00
|
|
|
(defmethod cfgl-layer-get-packages ((layer cfgl-layer) &optional props)
|
|
|
|
"Return the list of packages for LAYER.
|
2017-09-26 02:55:08 +00:00
|
|
|
If PROPS is non-nil then return packages as lists along with their properties."
|
2017-01-22 18:37:12 +00:00
|
|
|
(let ((all (eq 'all (oref layer :selected-packages))))
|
2016-06-21 00:48:25 +00:00
|
|
|
(delq nil (mapcar
|
|
|
|
(lambda (x)
|
|
|
|
(let ((pkg-name (if (listp x) (car x) x)))
|
2017-01-22 18:37:12 +00:00
|
|
|
(when (or all (memq pkg-name
|
|
|
|
(oref layer :selected-packages)))
|
|
|
|
(if props x pkg-name))))
|
2016-06-21 00:48:25 +00:00
|
|
|
(oref layer :packages)))))
|
|
|
|
|
2015-08-06 03:39:39 +00:00
|
|
|
(defclass cfgl-package ()
|
|
|
|
((name :initarg :name
|
|
|
|
:type symbol
|
|
|
|
:documentation "Name of the package.")
|
2016-07-09 15:36:27 +00:00
|
|
|
(min-version :initarg :min-version
|
|
|
|
:initform nil
|
|
|
|
:type list
|
|
|
|
:documentation "Minimum version to install as a version list.")
|
2016-06-11 01:37:32 +00:00
|
|
|
(owners :initarg :owners
|
|
|
|
:initform nil
|
|
|
|
:type list
|
|
|
|
:documentation "The layer defining the init function.")
|
2015-08-06 03:39:39 +00:00
|
|
|
(pre-layers :initarg :pre-layers
|
|
|
|
:initform '()
|
|
|
|
:type list
|
2016-02-21 05:01:39 +00:00
|
|
|
:documentation "List of layers with a pre-init function.")
|
2015-08-06 03:39:39 +00:00
|
|
|
(post-layers :initarg :post-layers
|
core: implement :depends for package declarations
This replaces the older pattern
:toggle (configuration-layer/package-usedp ..)
This implementation ensures that :disabled-for honors dependent packages, i.e.
if package a depends on package b, which is owned by layer c, and layer c is
disabled for layer d, then neither package a nor b will be configured for layer
d. Previously, this was only true for package a, but not b.
This commit also fixes:
- configuration-layer/describe-package now shows which post-init and pre-init
functions are disabled, if any
- Does not recreate all layer objects unconditionally when calling
configuration-layer/discover-layers. Previously, this led to all layers being
recreated after e.g. `SPC h SPC`, without any of the dotfile information.
Since this information is now necessary for
configuration-layer/describe-package, it’s important that we don’t clear the
indexed layers when invoking this function.
2017-06-21 10:27:59 +00:00
|
|
|
:initform '()
|
|
|
|
:type list
|
|
|
|
:documentation "List of layers with a post-init function.")
|
2015-08-06 03:39:39 +00:00
|
|
|
(location :initarg :location
|
|
|
|
:initform elpa
|
2015-08-14 19:31:22 +00:00
|
|
|
:type (satisfies (lambda (x)
|
2015-10-23 02:39:53 +00:00
|
|
|
(or (stringp x)
|
2016-04-03 16:02:28 +00:00
|
|
|
(memq x '(built-in local site elpa))
|
2015-08-14 19:31:22 +00:00
|
|
|
(and (listp x) (eq 'recipe (car x))))))
|
2015-08-06 03:39:39 +00:00
|
|
|
:documentation "Location of the package.")
|
2016-02-21 05:01:39 +00:00
|
|
|
(toggle :initarg :toggle
|
|
|
|
:initform t
|
|
|
|
:type (satisfies (lambda (x) (or (symbolp x) (listp x))))
|
|
|
|
:documentation
|
|
|
|
"Package is enabled/installed if toggle evaluates to non-nil.")
|
2015-08-06 03:39:39 +00:00
|
|
|
(step :initarg :step
|
|
|
|
:initform nil
|
2016-04-03 04:28:47 +00:00
|
|
|
:type (satisfies (lambda (x) (member x '(nil bootstrap pre))))
|
2015-08-06 03:39:39 +00:00
|
|
|
:documentation "Initialization step.")
|
2016-01-31 05:05:27 +00:00
|
|
|
(lazy-install :initarg :lazy-install
|
|
|
|
:initform nil
|
|
|
|
:type boolean
|
|
|
|
:documentation
|
|
|
|
"If non-nil then the package needs to be installed")
|
2015-11-19 05:53:57 +00:00
|
|
|
(protected :initarg :protected
|
|
|
|
:initform nil
|
|
|
|
:type boolean
|
|
|
|
:documentation
|
|
|
|
"If non-nil then this package cannot be excluded.")
|
2015-08-06 03:39:39 +00:00
|
|
|
(excluded :initarg :excluded
|
|
|
|
:initform nil
|
|
|
|
:type boolean
|
2015-09-03 03:01:26 +00:00
|
|
|
:documentation
|
core: implement :depends for package declarations
This replaces the older pattern
:toggle (configuration-layer/package-usedp ..)
This implementation ensures that :disabled-for honors dependent packages, i.e.
if package a depends on package b, which is owned by layer c, and layer c is
disabled for layer d, then neither package a nor b will be configured for layer
d. Previously, this was only true for package a, but not b.
This commit also fixes:
- configuration-layer/describe-package now shows which post-init and pre-init
functions are disabled, if any
- Does not recreate all layer objects unconditionally when calling
configuration-layer/discover-layers. Previously, this led to all layers being
recreated after e.g. `SPC h SPC`, without any of the dotfile information.
Since this information is now necessary for
configuration-layer/describe-package, it’s important that we don’t clear the
indexed layers when invoking this function.
2017-06-21 10:27:59 +00:00
|
|
|
"If non-nil this package is excluded from all layers.")
|
2017-07-03 07:52:54 +00:00
|
|
|
(requires :initarg :requires
|
|
|
|
:initform nil
|
|
|
|
:type list
|
|
|
|
:documentation
|
|
|
|
"Packages that must be enabled for this package to be enabled.")))
|
core: implement :depends for package declarations
This replaces the older pattern
:toggle (configuration-layer/package-usedp ..)
This implementation ensures that :disabled-for honors dependent packages, i.e.
if package a depends on package b, which is owned by layer c, and layer c is
disabled for layer d, then neither package a nor b will be configured for layer
d. Previously, this was only true for package a, but not b.
This commit also fixes:
- configuration-layer/describe-package now shows which post-init and pre-init
functions are disabled, if any
- Does not recreate all layer objects unconditionally when calling
configuration-layer/discover-layers. Previously, this led to all layers being
recreated after e.g. `SPC h SPC`, without any of the dotfile information.
Since this information is now necessary for
configuration-layer/describe-package, it’s important that we don’t clear the
indexed layers when invoking this function.
2017-06-21 10:27:59 +00:00
|
|
|
|
|
|
|
(defmethod cfgl-package-toggled-p ((pkg cfgl-package) &optional inhibit-messages)
|
2016-10-20 13:30:16 +00:00
|
|
|
"Evaluate the `toggle' slot of passed PKG.
|
|
|
|
If INHIBIT-MESSAGES is non nil then any message emitted by the toggle evaluation
|
|
|
|
is ignored."
|
2016-06-21 23:02:26 +00:00
|
|
|
(let ((message-log-max (unless inhibit-messages message-log-max))
|
|
|
|
(toggle (oref pkg :toggle)))
|
|
|
|
(eval toggle)))
|
2016-02-21 05:01:39 +00:00
|
|
|
|
2017-07-03 07:52:54 +00:00
|
|
|
(defmethod cfgl-package-reqs-satisfied-p ((pkg cfgl-package) &optional inhibit-messages)
|
|
|
|
"Check if requirements of a package are all enabled.
|
core: implement :depends for package declarations
This replaces the older pattern
:toggle (configuration-layer/package-usedp ..)
This implementation ensures that :disabled-for honors dependent packages, i.e.
if package a depends on package b, which is owned by layer c, and layer c is
disabled for layer d, then neither package a nor b will be configured for layer
d. Previously, this was only true for package a, but not b.
This commit also fixes:
- configuration-layer/describe-package now shows which post-init and pre-init
functions are disabled, if any
- Does not recreate all layer objects unconditionally when calling
configuration-layer/discover-layers. Previously, this led to all layers being
recreated after e.g. `SPC h SPC`, without any of the dotfile information.
Since this information is now necessary for
configuration-layer/describe-package, it’s important that we don’t clear the
indexed layers when invoking this function.
2017-06-21 10:27:59 +00:00
|
|
|
If INHIBIT-MESSAGES is non nil then any message emitted by the toggle evaluation
|
|
|
|
is ignored."
|
|
|
|
(not (memq nil (mapcar
|
|
|
|
(lambda (dep-pkg)
|
|
|
|
(let ((pkg-obj (configuration-layer/get-package dep-pkg)))
|
|
|
|
(when pkg-obj
|
|
|
|
(cfgl-package-enabled-p pkg-obj inhibit-messages))))
|
2017-07-03 07:52:54 +00:00
|
|
|
(oref pkg :requires)))))
|
core: implement :depends for package declarations
This replaces the older pattern
:toggle (configuration-layer/package-usedp ..)
This implementation ensures that :disabled-for honors dependent packages, i.e.
if package a depends on package b, which is owned by layer c, and layer c is
disabled for layer d, then neither package a nor b will be configured for layer
d. Previously, this was only true for package a, but not b.
This commit also fixes:
- configuration-layer/describe-package now shows which post-init and pre-init
functions are disabled, if any
- Does not recreate all layer objects unconditionally when calling
configuration-layer/discover-layers. Previously, this led to all layers being
recreated after e.g. `SPC h SPC`, without any of the dotfile information.
Since this information is now necessary for
configuration-layer/describe-package, it’s important that we don’t clear the
indexed layers when invoking this function.
2017-06-21 10:27:59 +00:00
|
|
|
|
|
|
|
(defmethod cfgl-package-enabled-p ((pkg cfgl-package) &optional inhibit-messages)
|
|
|
|
"Check if a package is enabled.
|
|
|
|
This checks the excluded property, evaluates the toggle, if any, and recursively
|
|
|
|
checks whether dependent packages are also enabled.
|
|
|
|
If INHIBIT-MESSAGES is non nil then any message emitted by the toggle evaluation
|
|
|
|
is ignored."
|
|
|
|
(and (or (oref pkg :protected) (not (oref pkg :excluded)))
|
2017-07-03 07:52:54 +00:00
|
|
|
(cfgl-package-reqs-satisfied-p pkg inhibit-messages)
|
core: implement :depends for package declarations
This replaces the older pattern
:toggle (configuration-layer/package-usedp ..)
This implementation ensures that :disabled-for honors dependent packages, i.e.
if package a depends on package b, which is owned by layer c, and layer c is
disabled for layer d, then neither package a nor b will be configured for layer
d. Previously, this was only true for package a, but not b.
This commit also fixes:
- configuration-layer/describe-package now shows which post-init and pre-init
functions are disabled, if any
- Does not recreate all layer objects unconditionally when calling
configuration-layer/discover-layers. Previously, this led to all layers being
recreated after e.g. `SPC h SPC`, without any of the dotfile information.
Since this information is now necessary for
configuration-layer/describe-package, it’s important that we don’t clear the
indexed layers when invoking this function.
2017-06-21 10:27:59 +00:00
|
|
|
(cfgl-package-toggled-p pkg inhibit-messages)))
|
|
|
|
|
2017-07-30 16:50:39 +00:00
|
|
|
(defmethod cfgl-package-used-p ((pkg cfgl-package))
|
|
|
|
"Return non-nil if PKG is a used package."
|
|
|
|
(and (not (null (oref pkg :owners)))
|
|
|
|
(not (oref pkg :excluded))
|
|
|
|
(cfgl-package-enabled-p pkg t)))
|
|
|
|
|
|
|
|
(defmethod cfgl-package-distant-p ((pkg cfgl-package))
|
|
|
|
"Return non-nil if PKG is a distant package (i.e. not built-in Emacs)."
|
|
|
|
(and (not (memq (oref pkg :location) '(built-in site local)))
|
|
|
|
(not (stringp (oref pkg :location)))))
|
|
|
|
|
2016-06-11 02:35:59 +00:00
|
|
|
(defmethod cfgl-package-get-safe-owner ((pkg cfgl-package))
|
|
|
|
"Safe method to return the name of the layer which owns PKG."
|
|
|
|
;; The owner of a package is the first *used* layer in `:owners' slot.
|
2016-07-17 19:00:43 +00:00
|
|
|
;; Note: for packages in `configuration-layer--used-packages' the owner is
|
|
|
|
;; always the car of the `:owners' slot.
|
2016-06-11 02:35:59 +00:00
|
|
|
(let ((layers (oref pkg :owners)))
|
|
|
|
(while (and (consp layers)
|
2017-07-02 13:48:06 +00:00
|
|
|
(not (configuration-layer/layer-used-p (car layers))))
|
2016-06-11 02:35:59 +00:00
|
|
|
(pop layers))
|
2017-07-02 13:48:06 +00:00
|
|
|
(when (configuration-layer/layer-used-p (car layers))
|
2016-06-11 02:35:59 +00:00
|
|
|
(car layers))))
|
|
|
|
|
2016-09-06 00:54:07 +00:00
|
|
|
(defmethod cfgl-package-set-property ((pkg cfgl-package) slot value)
|
|
|
|
"Set SLOT to the given VALUE for the package PKG.
|
|
|
|
If `configuration-layer--package-properties-read-onlyp' is non-nil then VALUE
|
|
|
|
is not set for the given SLOT."
|
|
|
|
(unless configuration-layer--package-properties-read-onlyp
|
|
|
|
(eval `(oset pkg ,slot value))))
|
|
|
|
|
2017-11-02 03:13:47 +00:00
|
|
|
(defvar configuration-layer-elpa-archives nil
|
2017-10-29 04:28:22 +00:00
|
|
|
"List of ELPA archives required by Spacemacs. This value is set by the lock
|
|
|
|
file.")
|
2015-12-03 04:25:00 +00:00
|
|
|
|
2016-07-17 19:00:43 +00:00
|
|
|
(defvar configuration-layer-exclude-all-layers nil
|
2016-04-22 03:27:10 +00:00
|
|
|
"If non nil then only the distribution layer is loaded.")
|
|
|
|
|
2016-07-17 19:00:43 +00:00
|
|
|
(defvar configuration-layer-force-distribution nil
|
2016-04-22 03:27:10 +00:00
|
|
|
"If set, bypass the user's choice `dotspacemacs-distribution'.")
|
|
|
|
|
2015-12-03 04:49:00 +00:00
|
|
|
(defvar configuration-layer--package-archives-refreshed nil
|
|
|
|
"Non nil if package archives have already been refreshed.")
|
|
|
|
|
2016-07-17 19:00:43 +00:00
|
|
|
(defvar configuration-layer--load-packages-files nil
|
|
|
|
"If non-nil force loading `packages.el' files when creating layer objects.")
|
|
|
|
|
|
|
|
(defvar configuration-layer--used-layers '()
|
|
|
|
"A non-sorted list of used layer names.")
|
|
|
|
|
2019-09-30 06:00:48 +00:00
|
|
|
(defvar configuration-layer--layers-dependencies '()
|
|
|
|
"List of layers declared in `layers.el' files.")
|
|
|
|
|
2016-07-17 19:00:43 +00:00
|
|
|
(defvar configuration-layer--indexed-layers (make-hash-table :size 1024)
|
|
|
|
"Hash map to index `cfgl-layer' objects by their names.")
|
2015-08-06 03:39:39 +00:00
|
|
|
|
2016-07-17 19:00:43 +00:00
|
|
|
(defvar configuration-layer--used-packages '()
|
|
|
|
"An alphabetically sorted list of used package names.")
|
|
|
|
|
|
|
|
(defvar configuration-layer--indexed-packages (make-hash-table :size 2048)
|
|
|
|
"Hash map to index `cfgl-package' objects by their names.")
|
2015-08-06 03:39:39 +00:00
|
|
|
|
2016-07-09 18:14:55 +00:00
|
|
|
(defvar configuration-layer--check-new-version-error-packages nil
|
2015-08-29 07:09:13 +00:00
|
|
|
"A list of all packages that were skipped during last update attempt.")
|
|
|
|
|
2015-11-04 13:21:36 +00:00
|
|
|
(defvar configuration-layer--protected-packages nil
|
|
|
|
"A list of packages that will be protected from removal as orphans.")
|
|
|
|
|
2016-02-22 07:29:43 +00:00
|
|
|
(defvar configuration-layer--lazy-mode-alist nil
|
|
|
|
"Association list where the key is a mode and the value a regexp.")
|
|
|
|
|
2017-10-30 02:01:39 +00:00
|
|
|
(defvar configuration-layer--inhibit-errors nil
|
|
|
|
"If non-nil then error messages emitted by the layer system are ignored.")
|
|
|
|
|
2016-06-11 02:47:45 +00:00
|
|
|
(defvar configuration-layer--inhibit-warnings nil
|
2017-10-30 02:01:39 +00:00
|
|
|
"If non-nil then warning messages emitted by the layer system are ignored.")
|
2016-06-11 02:47:45 +00:00
|
|
|
|
2016-09-06 00:54:07 +00:00
|
|
|
(defvar configuration-layer--package-properties-read-onlyp nil
|
2018-08-01 18:51:57 +00:00
|
|
|
"If non-nil then package properties are read only and cannot be overridden by
|
2016-09-06 00:54:07 +00:00
|
|
|
`configuration-layer/make-package'.")
|
|
|
|
|
2016-08-20 00:04:33 +00:00
|
|
|
(defvar configuration-layer--declared-layers-usedp nil
|
|
|
|
"If non-nil then declared layers are considered to be used.")
|
|
|
|
|
2015-03-16 05:28:21 +00:00
|
|
|
(defvar configuration-layer-error-count nil
|
|
|
|
"Non nil indicates the number of errors occurred during the
|
|
|
|
installation of initialization.")
|
|
|
|
|
2015-06-06 02:47:23 +00:00
|
|
|
(defvar configuration-layer-categories '()
|
|
|
|
"List of strings corresponding to category names. A category is a
|
2015-09-11 00:21:27 +00:00
|
|
|
directory with a name starting with `+'.")
|
2014-11-11 03:26:11 +00:00
|
|
|
|
2015-12-16 15:10:26 +00:00
|
|
|
(defvar update-packages-alist '()
|
|
|
|
"Used to collect information about rollback packages in the
|
|
|
|
cache folder.")
|
|
|
|
|
2017-10-29 04:28:22 +00:00
|
|
|
(defun configuration-layer/load-lock-file ()
|
|
|
|
"Load the .lock file"
|
2018-06-10 06:46:16 +00:00
|
|
|
(configuration-layer/load-file configuration-layer-lock-file))
|
2017-10-29 04:28:22 +00:00
|
|
|
|
2015-12-03 04:25:00 +00:00
|
|
|
(defun configuration-layer/initialize ()
|
|
|
|
"Initialize `package.el'."
|
2017-11-12 14:33:58 +00:00
|
|
|
(unless dotspacemacs-use-spacelpa
|
2019-08-23 04:51:21 +00:00
|
|
|
(configuration-layer//stable-elpa-disable-repository))
|
2015-12-21 05:56:04 +00:00
|
|
|
(setq configuration-layer--refresh-package-timeout dotspacemacs-elpa-timeout)
|
2015-12-03 04:25:00 +00:00
|
|
|
(unless package--initialized
|
2016-08-13 12:21:01 +00:00
|
|
|
(setq configuration-layer-rollback-directory
|
2017-10-29 04:28:22 +00:00
|
|
|
(configuration-layer/elpa-directory
|
2017-10-31 04:35:18 +00:00
|
|
|
configuration-layer--rollback-root-directory))
|
2016-08-13 12:21:01 +00:00
|
|
|
(setq package-user-dir
|
2017-10-31 04:35:18 +00:00
|
|
|
(configuration-layer/elpa-directory
|
|
|
|
configuration-layer--elpa-root-directory))
|
2015-12-03 04:25:00 +00:00
|
|
|
(setq package-archives (configuration-layer//resolve-package-archives
|
2017-11-02 03:13:47 +00:00
|
|
|
configuration-layer-elpa-archives))
|
2015-12-03 04:25:00 +00:00
|
|
|
;; optimization, no need to activate all the packages so early
|
|
|
|
(setq package-enable-at-startup nil)
|
2018-01-21 17:15:51 +00:00
|
|
|
(package-initialize 'noactivate)
|
|
|
|
;; hack to be sure to enable insalled org from Org ELPA repository
|
|
|
|
(when (package-installed-p 'org-plus-contrib)
|
2018-06-10 06:49:51 +00:00
|
|
|
(spacemacs-buffer/message "Initializing Org early...")
|
2018-01-21 17:15:51 +00:00
|
|
|
(configuration-layer//activate-package 'org-plus-contrib))))
|
2015-12-03 04:25:00 +00:00
|
|
|
|
2017-01-24 04:09:21 +00:00
|
|
|
(defun configuration-layer//configure-quelpa ()
|
|
|
|
"Configure `quelpa' package."
|
2016-04-03 06:51:01 +00:00
|
|
|
(setq quelpa-verbose init-file-debug
|
|
|
|
quelpa-dir (concat spacemacs-cache-directory "quelpa/")
|
|
|
|
quelpa-build-dir (expand-file-name "build" quelpa-dir)
|
|
|
|
quelpa-persistent-cache-file (expand-file-name "cache" quelpa-dir)
|
|
|
|
quelpa-update-melpa-p nil)
|
2017-01-24 04:09:21 +00:00
|
|
|
(require 'quelpa))
|
2016-04-03 06:51:01 +00:00
|
|
|
|
2017-07-02 13:48:06 +00:00
|
|
|
(defun configuration-layer//package-archive-absolute-path-p (archive)
|
2017-01-22 22:55:59 +00:00
|
|
|
"Return t if ARCHIVE has an absolute path defined."
|
|
|
|
(let ((path (cdr archive)))
|
|
|
|
(or (string-match-p "http" path)
|
|
|
|
(string-prefix-p "~" path)
|
2017-12-05 09:40:14 +00:00
|
|
|
(eq (string-match-p "^[a-zA-Z]:" path) 0)
|
2017-01-22 22:55:59 +00:00
|
|
|
(string-prefix-p "/" path))))
|
|
|
|
|
2017-07-02 13:48:06 +00:00
|
|
|
(defun configuration-layer//package-archive-local-path-p (archive)
|
2017-01-22 22:55:59 +00:00
|
|
|
"Return t if ARCHIVE has a local path."
|
|
|
|
(let ((path (cdr archive)))
|
|
|
|
(or (string-prefix-p "~" path)
|
|
|
|
(string-prefix-p "/" path)
|
2017-12-05 09:40:14 +00:00
|
|
|
(eq (string-match-p "^[a-zA-Z]:" path) 0)
|
2017-01-22 22:55:59 +00:00
|
|
|
(string-prefix-p "\." path))))
|
|
|
|
|
2015-12-03 04:25:00 +00:00
|
|
|
(defun configuration-layer//resolve-package-archives (archives)
|
|
|
|
"Resolve HTTP handlers for each archive in ARCHIVES and return a list
|
|
|
|
of all reachable ones.
|
2017-10-30 04:57:48 +00:00
|
|
|
If the url of an archive already contains the protocol then this url is
|
2015-12-03 04:25:00 +00:00
|
|
|
left untouched.
|
|
|
|
The returned list has a `package-archives' compliant format."
|
|
|
|
(mapcar
|
|
|
|
(lambda (x)
|
2017-01-22 22:55:59 +00:00
|
|
|
(let ((aname (car x))
|
|
|
|
(apath (cdr x)))
|
|
|
|
(cons aname
|
2017-07-02 13:48:06 +00:00
|
|
|
(if (configuration-layer//package-archive-absolute-path-p x)
|
2017-01-22 22:55:59 +00:00
|
|
|
apath
|
|
|
|
(concat
|
|
|
|
(if (and dotspacemacs-elpa-https
|
2018-01-22 18:21:03 +00:00
|
|
|
(not spacemacs-insecure))
|
2017-01-22 22:55:59 +00:00
|
|
|
"https://"
|
|
|
|
"http://")
|
|
|
|
apath)))))
|
2015-12-03 04:25:00 +00:00
|
|
|
archives))
|
|
|
|
|
2015-12-03 04:49:00 +00:00
|
|
|
(defun configuration-layer/retrieve-package-archives (&optional quiet force)
|
2015-12-03 04:25:00 +00:00
|
|
|
"Retrieve all archives declared in current `package-archives'.
|
2015-12-03 04:49:00 +00:00
|
|
|
|
2015-12-03 04:25:00 +00:00
|
|
|
This function first performs a simple GET request with a timeout in order to
|
|
|
|
fix very long refresh time when an archive is not reachable.
|
2015-12-03 04:49:00 +00:00
|
|
|
|
2015-12-03 04:25:00 +00:00
|
|
|
Note that this simple GET is a heuristic to determine the availability
|
|
|
|
likelihood of an archive, so it can gives false positive if the archive
|
2015-12-03 04:49:00 +00:00
|
|
|
page is served but the archive is not.
|
|
|
|
|
|
|
|
If QUIET is non nil then the function does not print message in the Spacemacs
|
|
|
|
home buffer.
|
|
|
|
|
|
|
|
If FORCE is non nil then refresh the archives even if they have been already
|
|
|
|
refreshed during the current session."
|
|
|
|
(unless (and configuration-layer--package-archives-refreshed
|
|
|
|
(not force))
|
|
|
|
(setq configuration-layer--package-archives-refreshed t)
|
|
|
|
(let ((count (length package-archives))
|
|
|
|
(i 1))
|
|
|
|
(dolist (archive package-archives)
|
2017-01-22 22:55:59 +00:00
|
|
|
(let ((aname (car archive))
|
|
|
|
(apath (cdr archive)))
|
|
|
|
(unless quiet
|
|
|
|
(spacemacs-buffer/replace-last-line
|
|
|
|
(format "--> refreshing package archive: %s... [%s/%s]"
|
|
|
|
aname i count) t))
|
|
|
|
(spacemacs//redisplay)
|
|
|
|
(setq i (1+ i))
|
|
|
|
(unless
|
2017-07-02 13:48:06 +00:00
|
|
|
(and (not (configuration-layer//package-archive-local-path-p
|
2017-01-22 22:55:59 +00:00
|
|
|
archive))
|
|
|
|
(eq 'error
|
|
|
|
(with-timeout
|
|
|
|
(dotspacemacs-elpa-timeout
|
|
|
|
(progn
|
|
|
|
(display-warning
|
|
|
|
'spacemacs
|
|
|
|
(format
|
|
|
|
"\nError connection time out for %s repository!"
|
|
|
|
aname) :warning)
|
|
|
|
'error))
|
|
|
|
(condition-case err
|
|
|
|
(url-retrieve-synchronously apath)
|
|
|
|
('error
|
|
|
|
(display-warning
|
|
|
|
'spacemacs
|
|
|
|
(format
|
|
|
|
"\nError while contacting %s repository!"
|
|
|
|
aname) :warning)
|
|
|
|
'error)))))
|
|
|
|
(let ((package-archives (list archive)))
|
|
|
|
(package-refresh-contents)))))
|
2015-12-03 04:49:00 +00:00
|
|
|
(package-read-all-archive-contents)
|
|
|
|
(unless quiet (spacemacs-buffer/append "\n")))))
|
2015-12-03 04:25:00 +00:00
|
|
|
|
2017-07-01 14:54:37 +00:00
|
|
|
(defun configuration-layer/load ()
|
2018-05-06 15:41:53 +00:00
|
|
|
"Load layers declared in dotfile if necessary."
|
2017-07-01 14:54:37 +00:00
|
|
|
(run-hooks 'configuration-layer-pre-load-hook)
|
2018-05-06 15:41:53 +00:00
|
|
|
(setq changed-since-last-dump-p nil)
|
|
|
|
;; check if layer list has changed since last dump
|
2018-05-06 15:49:53 +00:00
|
|
|
(when (file-exists-p
|
|
|
|
configuration-layer--last-dotspacemacs-configuration-layers-file)
|
2018-06-10 06:46:16 +00:00
|
|
|
(configuration-layer/load-file
|
|
|
|
configuration-layer--last-dotspacemacs-configuration-layers-file))
|
2018-05-06 03:01:37 +00:00
|
|
|
(let ((layers dotspacemacs-configuration-layers))
|
|
|
|
(dotspacemacs|call-func dotspacemacs/layers "Calling dotfile layers...")
|
2018-05-06 15:54:56 +00:00
|
|
|
;; `dotspacemacs--configuration-layers-saved' is used to detect if the layer
|
|
|
|
;; list has been changed outside of function `dotspacemacs/layers'
|
|
|
|
(setq dotspacemacs--configuration-layers-saved
|
|
|
|
dotspacemacs-configuration-layers)
|
2018-05-06 15:49:53 +00:00
|
|
|
(setq changed-since-last-dump-p
|
|
|
|
(not (equal layers dotspacemacs-configuration-layers)))
|
2018-05-06 15:41:53 +00:00
|
|
|
;; save layers list to file
|
|
|
|
(spacemacs/dump-vars-to-file
|
|
|
|
'(dotspacemacs-configuration-layers)
|
|
|
|
configuration-layer--last-dotspacemacs-configuration-layers-file))
|
|
|
|
(cond
|
2018-05-07 04:34:26 +00:00
|
|
|
(changed-since-last-dump-p
|
2018-05-06 16:01:32 +00:00
|
|
|
;; dump
|
|
|
|
(configuration-layer//load)
|
2018-05-08 04:46:32 +00:00
|
|
|
(when (spacemacs/emacs-with-pdumper-set-p)
|
2018-05-07 04:34:26 +00:00
|
|
|
(configuration-layer/message "Layer list has changed since last dump.")
|
2018-05-06 16:01:32 +00:00
|
|
|
(configuration-layer//dump-emacs)))
|
2018-05-07 04:34:26 +00:00
|
|
|
(spacemacs-force-dump
|
|
|
|
;; force dump
|
|
|
|
(configuration-layer//load)
|
2018-06-16 15:05:05 +00:00
|
|
|
(when (spacemacs/emacs-with-pdumper-set-p)
|
|
|
|
(configuration-layer/message (concat "--force-dump passed on the command line, "
|
|
|
|
"forcing a redump."))
|
|
|
|
(configuration-layer//dump-emacs)))
|
2018-05-07 04:34:26 +00:00
|
|
|
((spacemacs-is-dumping-p)
|
|
|
|
;; dumping
|
2019-07-27 02:44:11 +00:00
|
|
|
(configuration-layer//load))
|
2018-05-08 04:46:32 +00:00
|
|
|
((and (spacemacs/emacs-with-pdumper-set-p)
|
2018-05-06 15:41:53 +00:00
|
|
|
(spacemacs-run-from-dump-p))
|
2018-05-06 16:01:32 +00:00
|
|
|
;; dumped
|
2018-05-06 15:49:53 +00:00
|
|
|
(configuration-layer/message
|
|
|
|
"Running from a dumped file. Skipping the loading process!"))
|
2018-05-06 16:01:32 +00:00
|
|
|
(t
|
2018-05-07 04:34:26 +00:00
|
|
|
;; standard loading
|
2018-05-06 16:01:32 +00:00
|
|
|
(configuration-layer//load)
|
2018-05-08 04:46:32 +00:00
|
|
|
(when (spacemacs/emacs-with-pdumper-set-p)
|
2018-05-06 16:01:32 +00:00
|
|
|
(configuration-layer/message
|
|
|
|
(concat "Layer list has not changed since last time. "
|
|
|
|
"Skipping dumping process!")))))
|
2017-07-01 14:54:37 +00:00
|
|
|
(run-hooks 'configuration-layer-post-load-hook))
|
2016-03-25 04:24:52 +00:00
|
|
|
|
2018-05-06 16:01:32 +00:00
|
|
|
(defun configuration-layer//dump-emacs ()
|
|
|
|
"Dump emacs."
|
|
|
|
(configuration-layer/message
|
|
|
|
(concat "Dumping Emacs asynchronously, "
|
|
|
|
"you should not quit this Emacs "
|
|
|
|
"session until the dump is finished."))
|
|
|
|
(spacemacs/dump-emacs))
|
|
|
|
|
|
|
|
(defun configuration-layer//load ()
|
2018-05-06 15:41:53 +00:00
|
|
|
"Actually load the layers.
|
|
|
|
CHANGEDP non-nil means that layers list has changed since last dump
|
|
|
|
To prevent package from being installed or uninstalled set the variable
|
|
|
|
`spacemacs-sync-packages' to nil."
|
|
|
|
;; declare used layers then packages as soon as possible to resolve
|
|
|
|
;; usage and ownership
|
|
|
|
(configuration-layer/discover-layers 'refresh-index)
|
|
|
|
(configuration-layer//declare-used-layers dotspacemacs-configuration-layers)
|
|
|
|
(configuration-layer//declare-used-packages configuration-layer--used-layers)
|
|
|
|
;; then load the functions and finally configure the layers
|
|
|
|
(configuration-layer//load-layers-files configuration-layer--used-layers
|
|
|
|
'("funcs.el"))
|
|
|
|
(configuration-layer//configure-layers configuration-layer--used-layers)
|
|
|
|
;; load layers lazy settings
|
|
|
|
(configuration-layer/load-auto-layer-file)
|
|
|
|
;; install and/or uninstall packages
|
|
|
|
(when spacemacs-sync-packages
|
|
|
|
(let ((packages
|
|
|
|
(append
|
|
|
|
;; install used packages
|
|
|
|
(configuration-layer//filter-distant-packages
|
|
|
|
configuration-layer--used-packages t
|
|
|
|
'(not (oref pkg :lazy-install)))
|
|
|
|
;; also install all other packages if requested
|
|
|
|
(when (eq 'all dotspacemacs-install-packages)
|
|
|
|
(let (all-other-packages)
|
|
|
|
(dolist (layer (configuration-layer/get-layers-list))
|
|
|
|
(let ((configuration-layer--declared-layers-usedp nil)
|
|
|
|
(configuration-layer--load-packages-files t))
|
|
|
|
(configuration-layer/declare-layer layer)
|
|
|
|
(let* ((obj (configuration-layer/get-layer layer))
|
|
|
|
(pkgs (when obj (oref obj :packages))))
|
|
|
|
(configuration-layer/make-packages-from-layers
|
|
|
|
(list layer))
|
|
|
|
(dolist (pkg pkgs)
|
|
|
|
(let ((pkg-name (if (listp pkg) (car pkg) pkg)))
|
|
|
|
(add-to-list 'all-other-packages pkg-name))))))
|
|
|
|
(configuration-layer//filter-distant-packages
|
|
|
|
all-other-packages nil))))))
|
|
|
|
(configuration-layer//install-packages packages)
|
|
|
|
(when (and (or (eq 'used dotspacemacs-install-packages)
|
|
|
|
(eq 'used-only dotspacemacs-install-packages))
|
|
|
|
(not configuration-layer-force-distribution)
|
|
|
|
(not configuration-layer-exclude-all-layers))
|
|
|
|
(configuration-layer/delete-orphan-packages packages))))
|
|
|
|
;; configure used packages
|
|
|
|
(configuration-layer//configure-packages configuration-layer--used-packages)
|
2018-05-28 15:17:44 +00:00
|
|
|
;; evaluate layer variables a second time to override default values set in
|
|
|
|
;; packages configuration above
|
|
|
|
(configuration-layer//set-layers-variables configuration-layer--used-layers)
|
2018-05-06 15:41:53 +00:00
|
|
|
(configuration-layer//load-layers-files configuration-layer--used-layers
|
|
|
|
'("keybindings.el"))
|
2018-06-16 18:46:17 +00:00
|
|
|
(when (spacemacs-is-dumping-p)
|
2019-07-26 20:32:27 +00:00
|
|
|
;; dump stuff in layers
|
|
|
|
(dolist (layer-name configuration-layer--used-layers)
|
|
|
|
(let ((layer-dump-func (intern (format "%S/pre-dump" layer-name))))
|
|
|
|
(when (fboundp layer-dump-func)
|
|
|
|
(configuration-layer/message "Pre-dumping layer %S..." layer-name)
|
|
|
|
(funcall layer-dump-func))))
|
2018-06-16 18:46:17 +00:00
|
|
|
(dotspacemacs|call-func dotspacemacs/user-load
|
|
|
|
"Calling dotfile user-load...")))
|
2018-05-06 15:41:53 +00:00
|
|
|
|
2016-03-25 04:24:52 +00:00
|
|
|
(defun configuration-layer/load-auto-layer-file ()
|
|
|
|
"Load `auto-layer.el' file"
|
|
|
|
(let ((file (concat configuration-layer-directory "auto-layer.el")))
|
|
|
|
(when (file-exists-p file)
|
|
|
|
(spacemacs-buffer/message "Loading auto-layer file...")
|
2018-06-10 06:46:16 +00:00
|
|
|
(configuration-layer/load-file file))))
|
2015-03-02 03:12:09 +00:00
|
|
|
|
2015-05-18 15:43:27 +00:00
|
|
|
(defun configuration-layer/create-layer ()
|
|
|
|
"Ask the user for a configuration layer name and the layer
|
|
|
|
directory to use. Create a layer with this name in the selected
|
|
|
|
layer directory."
|
|
|
|
(interactive)
|
|
|
|
(let* ((current-layer-paths (mapcar (lambda (dir) (expand-file-name dir))
|
|
|
|
(cl-pushnew
|
2015-06-05 23:50:03 +00:00
|
|
|
configuration-layer-private-layer-directory
|
2015-05-18 15:43:27 +00:00
|
|
|
dotspacemacs-configuration-layer-path)))
|
|
|
|
(other-choice "Another directory...")
|
|
|
|
(helm-lp-source
|
|
|
|
`((name . "Configuration Layer Paths")
|
|
|
|
(candidates . ,(append current-layer-paths
|
|
|
|
(list other-choice)))
|
|
|
|
(action . (lambda (c) c))))
|
2017-07-02 13:48:06 +00:00
|
|
|
(layer-path-sel (if (configuration-layer/layer-used-p 'ivy)
|
2016-01-07 17:21:25 +00:00
|
|
|
(ivy-read "Configuration layer path: "
|
|
|
|
(append current-layer-paths
|
|
|
|
(list other-choice)))
|
|
|
|
(helm :sources helm-lp-source
|
|
|
|
:prompt "Configuration layer path: ")))
|
2015-05-18 15:43:27 +00:00
|
|
|
(layer-path (cond
|
|
|
|
((string-equal layer-path-sel other-choice)
|
2015-08-06 03:39:39 +00:00
|
|
|
(read-directory-name (concat "Other configuration "
|
|
|
|
"layer path: ") "~/" ))
|
2015-05-18 15:43:27 +00:00
|
|
|
((member layer-path-sel current-layer-paths)
|
|
|
|
layer-path-sel)
|
|
|
|
(t
|
|
|
|
(error "Please select an option from the list"))))
|
|
|
|
(name (read-from-minibuffer "Configuration layer name: " ))
|
|
|
|
(layer-dir (concat layer-path "/" name)))
|
2014-11-22 05:08:44 +00:00
|
|
|
(cond
|
|
|
|
((string-equal "" name)
|
2018-05-06 15:49:53 +00:00
|
|
|
(configuration-layer/message
|
|
|
|
"Cannot create a configuration layer without a name."))
|
2014-11-22 05:08:44 +00:00
|
|
|
((file-exists-p layer-dir)
|
2018-05-06 15:49:53 +00:00
|
|
|
(configuration-layer/message
|
|
|
|
(concat "Cannot create configuration layer \"%s\", "
|
|
|
|
"this layer already exists.") name))
|
2014-11-22 05:08:44 +00:00
|
|
|
(t
|
2015-05-18 15:43:27 +00:00
|
|
|
(make-directory layer-dir t)
|
2015-11-16 13:13:06 +00:00
|
|
|
(configuration-layer//copy-template name "packages.el" layer-dir)
|
2016-01-08 09:22:37 +00:00
|
|
|
(when (y-or-n-p "Create readme?")
|
|
|
|
(configuration-layer//copy-template name "README.org" layer-dir))
|
2018-05-06 15:49:53 +00:00
|
|
|
(configuration-layer/message
|
|
|
|
"Configuration layer \"%s\" successfully created." name)))))
|
2014-11-22 05:08:44 +00:00
|
|
|
|
2016-07-17 19:00:43 +00:00
|
|
|
(defun configuration-layer//select-packages (layer-specs packages)
|
|
|
|
"Return the selected packages of LAYER-SPECS from given PACKAGES list."
|
|
|
|
(let* ((value (when (listp layer-specs)
|
2018-06-07 10:13:06 +00:00
|
|
|
(spacemacs/mplist-get-values layer-specs :packages)))
|
2016-06-21 00:48:25 +00:00
|
|
|
(selected-packages (if (and (not (null (car value)))
|
|
|
|
(listp (car value)))
|
|
|
|
(car value)
|
|
|
|
value)))
|
|
|
|
(cond
|
|
|
|
;; select packages
|
|
|
|
((and selected-packages
|
|
|
|
(not (memq (car selected-packages) '(all not))))
|
|
|
|
selected-packages)
|
|
|
|
;; unselect packages
|
|
|
|
((and selected-packages
|
|
|
|
(eq 'not (car selected-packages)))
|
|
|
|
(delq nil (mapcar (lambda (x)
|
|
|
|
(let ((pkg-name (if (listp x) (car x) x)))
|
|
|
|
(unless (memq pkg-name selected-packages)
|
|
|
|
pkg-name)))
|
|
|
|
packages)))
|
|
|
|
;; no package selections or all package selected
|
|
|
|
(t 'all))))
|
|
|
|
|
2016-07-17 19:00:43 +00:00
|
|
|
(defun configuration-layer/make-layer (layer-specs &optional obj usedp dir)
|
|
|
|
"Return a `cfgl-layer' object based on LAYER-SPECS.
|
2017-07-01 21:48:31 +00:00
|
|
|
If OBJ is non nil then copy LAYER-SPECS properties into OBJ, otherwise create
|
|
|
|
a new object.
|
|
|
|
DIR is the directory where the layer is, if it is nil then search in the indexed
|
|
|
|
layers for the path.
|
|
|
|
If USEDP or `configuration-layer--load-packages-files' is non-nil then the
|
|
|
|
`packages.el' file of the layer is loaded."
|
2016-07-17 19:00:43 +00:00
|
|
|
(let* ((layer-name (if (listp layer-specs) (car layer-specs) layer-specs))
|
|
|
|
(obj (if obj obj (cfgl-layer (symbol-name layer-name)
|
|
|
|
:name layer-name)))
|
2018-05-20 06:32:57 +00:00
|
|
|
(packages (oref obj :packages))
|
2016-07-17 19:00:43 +00:00
|
|
|
(dir (or dir (oref obj :dir))))
|
|
|
|
(if (or (null dir)
|
|
|
|
(and dir (not (file-exists-p dir))))
|
|
|
|
(configuration-layer//warning
|
|
|
|
"Cannot make layer %S without a valid directory!"
|
|
|
|
layer-name)
|
|
|
|
(let* ((dir (file-name-as-directory dir))
|
|
|
|
(disabled (when (listp layer-specs)
|
2018-06-07 10:13:06 +00:00
|
|
|
(spacemacs/mplist-get-values layer-specs :disabled-for)))
|
2016-08-30 09:26:38 +00:00
|
|
|
(enabled (if (and (listp layer-specs)
|
|
|
|
(memq :enabled-for layer-specs))
|
2018-06-07 10:13:06 +00:00
|
|
|
(spacemacs/mplist-get-values layer-specs :enabled-for)
|
2016-08-30 09:26:38 +00:00
|
|
|
'unspecified))
|
2016-07-17 19:00:43 +00:00
|
|
|
(variables (when (listp layer-specs)
|
2018-06-07 10:13:06 +00:00
|
|
|
(spacemacs/mplist-get-values layer-specs :variables)))
|
2017-09-26 02:55:08 +00:00
|
|
|
(shadow
|
2017-09-22 03:47:20 +00:00
|
|
|
(if (and (listp layer-specs)
|
|
|
|
(memq :can-shadow layer-specs))
|
2018-06-07 10:13:06 +00:00
|
|
|
(spacemacs/mplist-get-values layer-specs :can-shadow)
|
2017-09-22 03:47:20 +00:00
|
|
|
'unspecified))
|
2016-07-17 19:00:43 +00:00
|
|
|
(packages-file (concat dir "packages.el"))
|
2018-05-20 06:32:57 +00:00
|
|
|
(packages (when (and (null packages)
|
|
|
|
(or usedp configuration-layer--load-packages-files)
|
|
|
|
(file-exists-p packages-file))
|
2018-06-10 06:46:16 +00:00
|
|
|
(configuration-layer/load-file packages-file)
|
2018-05-20 06:32:57 +00:00
|
|
|
(symbol-value (intern (format "%S-packages"
|
|
|
|
layer-name)))))
|
2016-07-17 19:00:43 +00:00
|
|
|
(selected-packages (if packages
|
|
|
|
(configuration-layer//select-packages
|
|
|
|
layer-specs packages)
|
|
|
|
;; default value
|
|
|
|
'all)))
|
|
|
|
(oset obj :dir dir)
|
|
|
|
(when usedp
|
|
|
|
(oset obj :disabled-for disabled)
|
2016-08-30 09:26:38 +00:00
|
|
|
(oset obj :enabled-for enabled)
|
2017-09-22 03:47:20 +00:00
|
|
|
(oset obj :variables variables)
|
2017-09-26 02:55:08 +00:00
|
|
|
(unless (eq 'unspecified shadow)
|
|
|
|
(oset obj :can-shadow shadow)))
|
2016-07-17 19:00:43 +00:00
|
|
|
(when packages
|
|
|
|
(oset obj :packages packages)
|
|
|
|
(oset obj :selected-packages selected-packages))
|
|
|
|
obj))))
|
2015-08-26 02:27:31 +00:00
|
|
|
|
2017-07-01 21:48:31 +00:00
|
|
|
(defun configuration-layer/make-package (pkg-specs layer-name &optional obj)
|
|
|
|
"Return a `cfgl-package' object based on PKG-SPECS.
|
|
|
|
LAYER-NAME is the layer name where the PKG-SPECS is listed.
|
|
|
|
If OBJ is non nil then copy PKG-SPECS properties into OBJ, otherwise create
|
|
|
|
a new object."
|
|
|
|
(let* ((pkg-name (if (listp pkg-specs) (car pkg-specs) pkg-specs))
|
2016-09-05 15:54:29 +00:00
|
|
|
(pkg-name-str (symbol-name pkg-name))
|
|
|
|
(layer (unless (eq 'dotfile layer-name)
|
|
|
|
(configuration-layer/get-layer layer-name)))
|
2017-07-01 21:48:31 +00:00
|
|
|
(min-version (when (listp pkg-specs)
|
|
|
|
(plist-get (cdr pkg-specs) :min-version)))
|
|
|
|
(step (when (listp pkg-specs)
|
|
|
|
(plist-get (cdr pkg-specs) :step)))
|
|
|
|
(toggle (when (listp pkg-specs)
|
|
|
|
(plist-get (cdr pkg-specs) :toggle)))
|
2017-07-03 07:52:54 +00:00
|
|
|
(requires (when (listp pkg-specs)
|
|
|
|
(plist-get (cdr pkg-specs) :requires)))
|
|
|
|
(requires (if (listp requires) requires (list requires)))
|
2017-07-01 21:48:31 +00:00
|
|
|
(excluded (when (listp pkg-specs)
|
|
|
|
(plist-get (cdr pkg-specs) :excluded)))
|
|
|
|
(location (when (listp pkg-specs)
|
|
|
|
(plist-get (cdr pkg-specs) :location)))
|
|
|
|
(protected (when (listp pkg-specs)
|
|
|
|
(plist-get (cdr pkg-specs) :protected)))
|
2016-09-05 15:54:29 +00:00
|
|
|
(init-func (intern (format "%S/init-%S"
|
|
|
|
layer-name pkg-name)))
|
|
|
|
(pre-init-func (intern (format "%S/pre-init-%S"
|
|
|
|
layer-name pkg-name)))
|
|
|
|
(post-init-func (intern (format "%S/post-init-%S"
|
|
|
|
layer-name pkg-name)))
|
2015-11-19 05:53:57 +00:00
|
|
|
(copyp (not (null obj)))
|
2016-09-05 16:40:44 +00:00
|
|
|
(obj (if obj obj (cfgl-package pkg-name-str :name pkg-name)))
|
|
|
|
(ownerp (or (and (eq 'dotfile layer-name)
|
|
|
|
(null (oref obj :owners)))
|
|
|
|
(fboundp init-func))))
|
2016-09-06 00:54:07 +00:00
|
|
|
(when min-version
|
2017-07-01 21:48:31 +00:00
|
|
|
(cfgl-package-set-property obj :min-version
|
|
|
|
(version-to-list min-version)))
|
|
|
|
(when step
|
|
|
|
(cfgl-package-set-property obj :step step))
|
core: implement :depends for package declarations
This replaces the older pattern
:toggle (configuration-layer/package-usedp ..)
This implementation ensures that :disabled-for honors dependent packages, i.e.
if package a depends on package b, which is owned by layer c, and layer c is
disabled for layer d, then neither package a nor b will be configured for layer
d. Previously, this was only true for package a, but not b.
This commit also fixes:
- configuration-layer/describe-package now shows which post-init and pre-init
functions are disabled, if any
- Does not recreate all layer objects unconditionally when calling
configuration-layer/discover-layers. Previously, this led to all layers being
recreated after e.g. `SPC h SPC`, without any of the dotfile information.
Since this information is now necessary for
configuration-layer/describe-package, it’s important that we don’t clear the
indexed layers when invoking this function.
2017-06-21 10:27:59 +00:00
|
|
|
(when toggle
|
|
|
|
(cfgl-package-set-property obj :toggle toggle))
|
2017-07-03 07:52:54 +00:00
|
|
|
(when (and ownerp requires)
|
|
|
|
(cfgl-package-set-property obj :requires requires))
|
2016-10-10 05:09:05 +00:00
|
|
|
(cfgl-package-set-property obj :excluded
|
2017-07-02 13:48:06 +00:00
|
|
|
(and (configuration-layer/layer-used-p layer-name)
|
2016-10-10 05:09:05 +00:00
|
|
|
(or excluded (oref obj :excluded))))
|
2016-09-05 15:54:29 +00:00
|
|
|
(when location
|
|
|
|
(if (and (listp location)
|
|
|
|
(eq (car location) 'recipe)
|
|
|
|
(eq (plist-get (cdr location) :fetcher) 'local))
|
|
|
|
(cond
|
|
|
|
(layer (let ((path (expand-file-name
|
2017-04-21 18:23:46 +00:00
|
|
|
(format "%s%s"
|
2016-09-05 15:54:29 +00:00
|
|
|
(configuration-layer/get-layer-local-dir
|
|
|
|
layer-name)
|
2017-04-21 18:23:46 +00:00
|
|
|
pkg-name-str))))
|
2016-09-06 00:54:07 +00:00
|
|
|
(cfgl-package-set-property
|
|
|
|
obj :location `(recipe :fetcher file :path ,path))))
|
2017-07-01 21:48:31 +00:00
|
|
|
((eq 'dotfile layer-name) nil))
|
2016-09-06 00:54:07 +00:00
|
|
|
(cfgl-package-set-property obj :location location)))
|
2015-11-19 05:53:57 +00:00
|
|
|
;; cannot override protected packages
|
|
|
|
(unless copyp
|
2016-04-03 04:28:47 +00:00
|
|
|
;; a bootstrap package is protected
|
2016-09-06 00:54:07 +00:00
|
|
|
(cfgl-package-set-property
|
|
|
|
obj :protected (or protected (eq 'bootstrap step)))
|
2015-11-19 05:53:57 +00:00
|
|
|
(when protected
|
2016-09-05 15:54:29 +00:00
|
|
|
(push pkg-name configuration-layer--protected-packages)))
|
|
|
|
(when ownerp
|
2018-08-01 18:51:57 +00:00
|
|
|
;; warn about multiple owners
|
2016-09-05 15:54:29 +00:00
|
|
|
(when (and (oref obj :owners)
|
|
|
|
(not (memq layer-name (oref obj :owners))))
|
|
|
|
(configuration-layer//warning
|
|
|
|
(format (concat "More than one init function found for "
|
|
|
|
"package %S. Previous owner was %S, "
|
|
|
|
"replacing it with layer %S.")
|
|
|
|
pkg-name (car (oref obj :owners)) layer-name)))
|
|
|
|
;; last owner wins over the previous one
|
2016-09-05 19:01:35 +00:00
|
|
|
(object-add-to-list obj :owners layer-name))
|
2017-01-22 05:34:08 +00:00
|
|
|
;; check consistency between package and defined init functions
|
2016-09-05 15:54:29 +00:00
|
|
|
(unless (or ownerp
|
2016-09-05 19:01:35 +00:00
|
|
|
(eq 'dotfile layer-name)
|
2017-01-22 05:34:08 +00:00
|
|
|
(eq 'system layer-name)
|
2016-09-05 15:54:29 +00:00
|
|
|
(fboundp pre-init-func)
|
|
|
|
(fboundp post-init-func)
|
|
|
|
(oref obj :excluded))
|
|
|
|
(configuration-layer//warning
|
|
|
|
(format (concat "package %s not initialized in layer %s, "
|
|
|
|
"you may consider removing this package from "
|
|
|
|
"the package list or use the :toggle keyword "
|
|
|
|
"instead of a `when' form.")
|
|
|
|
pkg-name layer-name)))
|
|
|
|
;; check if toggle can be applied
|
|
|
|
(when (and (not ownerp)
|
|
|
|
(and (not (eq 'unspecified toggle))
|
|
|
|
toggle))
|
|
|
|
(configuration-layer//warning
|
|
|
|
(format (concat "Ignoring :toggle for package %s because "
|
|
|
|
"layer %S does not own it.")
|
|
|
|
pkg-name layer-name)))
|
2017-07-03 07:52:54 +00:00
|
|
|
;; check if requires can be applied
|
|
|
|
(when (and (not ownerp) requires)
|
core: implement :depends for package declarations
This replaces the older pattern
:toggle (configuration-layer/package-usedp ..)
This implementation ensures that :disabled-for honors dependent packages, i.e.
if package a depends on package b, which is owned by layer c, and layer c is
disabled for layer d, then neither package a nor b will be configured for layer
d. Previously, this was only true for package a, but not b.
This commit also fixes:
- configuration-layer/describe-package now shows which post-init and pre-init
functions are disabled, if any
- Does not recreate all layer objects unconditionally when calling
configuration-layer/discover-layers. Previously, this led to all layers being
recreated after e.g. `SPC h SPC`, without any of the dotfile information.
Since this information is now necessary for
configuration-layer/describe-package, it’s important that we don’t clear the
indexed layers when invoking this function.
2017-06-21 10:27:59 +00:00
|
|
|
(configuration-layer//warning
|
2017-07-03 07:52:54 +00:00
|
|
|
(format (concat "Ignoring :requires for package %s because "
|
core: implement :depends for package declarations
This replaces the older pattern
:toggle (configuration-layer/package-usedp ..)
This implementation ensures that :disabled-for honors dependent packages, i.e.
if package a depends on package b, which is owned by layer c, and layer c is
disabled for layer d, then neither package a nor b will be configured for layer
d. Previously, this was only true for package a, but not b.
This commit also fixes:
- configuration-layer/describe-package now shows which post-init and pre-init
functions are disabled, if any
- Does not recreate all layer objects unconditionally when calling
configuration-layer/discover-layers. Previously, this led to all layers being
recreated after e.g. `SPC h SPC`, without any of the dotfile information.
Since this information is now necessary for
configuration-layer/describe-package, it’s important that we don’t clear the
indexed layers when invoking this function.
2017-06-21 10:27:59 +00:00
|
|
|
"layer %S does not own it.")
|
|
|
|
pkg-name layer-name)))
|
2016-09-05 15:54:29 +00:00
|
|
|
(when (fboundp pre-init-func)
|
2016-09-05 19:01:35 +00:00
|
|
|
(object-add-to-list obj :pre-layers layer-name))
|
2016-09-05 15:54:29 +00:00
|
|
|
(when (fboundp post-init-func)
|
2016-09-05 19:01:35 +00:00
|
|
|
(object-add-to-list obj :post-layers layer-name))
|
2015-08-06 03:39:39 +00:00
|
|
|
obj))
|
|
|
|
|
2016-02-22 07:29:43 +00:00
|
|
|
(define-button-type 'help-dotfile-variable
|
|
|
|
:supertype 'help-xref
|
|
|
|
'help-function
|
|
|
|
(lambda (variable)
|
|
|
|
(with-current-buffer (find-file-noselect dotspacemacs-filepath)
|
|
|
|
(pop-to-buffer (current-buffer))
|
|
|
|
(goto-char (point-min))
|
|
|
|
;; try to exclude comments
|
|
|
|
(if (re-search-forward (format "^[a-z\s\\(\\-]*%s" variable)
|
|
|
|
nil 'noerror)
|
|
|
|
(beginning-of-line)
|
2018-05-06 15:49:53 +00:00
|
|
|
(configuration-layer/message "Unable to find location in file"))))
|
2016-02-22 07:29:43 +00:00
|
|
|
'help-echo
|
|
|
|
(purecopy (concat "mouse-2, RET: "
|
|
|
|
"visit the Spacemacs dotfile where variable is defined.")))
|
|
|
|
|
core: implement :depends for package declarations
This replaces the older pattern
:toggle (configuration-layer/package-usedp ..)
This implementation ensures that :disabled-for honors dependent packages, i.e.
if package a depends on package b, which is owned by layer c, and layer c is
disabled for layer d, then neither package a nor b will be configured for layer
d. Previously, this was only true for package a, but not b.
This commit also fixes:
- configuration-layer/describe-package now shows which post-init and pre-init
functions are disabled, if any
- Does not recreate all layer objects unconditionally when calling
configuration-layer/discover-layers. Previously, this led to all layers being
recreated after e.g. `SPC h SPC`, without any of the dotfile information.
Since this information is now necessary for
configuration-layer/describe-package, it’s important that we don’t clear the
indexed layers when invoking this function.
2017-06-21 10:27:59 +00:00
|
|
|
(define-button-type 'help-describe-package
|
|
|
|
:supertype 'help-xref
|
|
|
|
'help-function 'configuration-layer/describe-package
|
|
|
|
'help-echo
|
|
|
|
(purecopy (concat "mouse-2, RET: show a description of this package.")))
|
|
|
|
|
2016-02-22 07:29:43 +00:00
|
|
|
(defun configuration-layer/describe-package (pkg-symbol
|
2017-07-03 07:52:54 +00:00
|
|
|
&optional layer-list pkg-list)
|
2016-02-22 07:29:43 +00:00
|
|
|
"Describe a package in the context of the configuration layer system."
|
2016-06-01 02:33:04 +00:00
|
|
|
(interactive
|
|
|
|
(list (intern
|
2016-07-17 19:00:43 +00:00
|
|
|
(completing-read "Package: " configuration-layer--used-packages))))
|
|
|
|
(let* ((pkg (configuration-layer/get-package pkg-symbol))
|
2016-06-11 01:37:32 +00:00
|
|
|
(owners (oref pkg :owners))
|
|
|
|
(owner (car owners)))
|
2016-02-22 07:29:43 +00:00
|
|
|
(with-help-window (help-buffer)
|
|
|
|
;; declaration location
|
|
|
|
(princ pkg-symbol)
|
|
|
|
(princ " is a package declared and configured ")
|
|
|
|
(cond
|
|
|
|
((eq 'dotfile owner)
|
|
|
|
(princ "by the variable `dotspacemacs-additional-packages' ")
|
|
|
|
(with-current-buffer standard-output
|
|
|
|
(save-excursion
|
|
|
|
(re-search-backward "`\\([^`']+\\)'" nil t)
|
|
|
|
(help-xref-button 1 'help-variable
|
|
|
|
'dotspacemacs-additional-packages
|
|
|
|
dotspacemacs-filepath)))
|
|
|
|
(princ "in your `dotfile'.\n")
|
|
|
|
(with-current-buffer standard-output
|
|
|
|
(save-excursion
|
|
|
|
(re-search-backward "`\\([^`']+\\)'" nil t)
|
|
|
|
(help-xref-button
|
|
|
|
1 'help-dotfile-variable 'dotspacemacs-additional-packages))))
|
|
|
|
((not (null owner))
|
2016-07-17 19:00:43 +00:00
|
|
|
(let* ((layer (configuration-layer/get-layer owner))
|
2016-02-22 07:29:43 +00:00
|
|
|
(path (concat (oref layer dir) "packages.el")))
|
|
|
|
(princ "by the layer `")
|
|
|
|
(princ owner)
|
|
|
|
(princ "'.\n")
|
|
|
|
(with-current-buffer standard-output
|
|
|
|
(save-excursion
|
|
|
|
(re-search-backward "`\\([^`']+\\)'" nil t)
|
|
|
|
(help-xref-button
|
|
|
|
1 'help-function-def
|
|
|
|
(intern (format "%S/init-%S" owner pkg-symbol)) path)))))
|
|
|
|
(t
|
|
|
|
(princ "in an unknown place in the lisp parenthesis universe.\n")))
|
|
|
|
;; exclusion/protection
|
|
|
|
(if (oref pkg :protected)
|
|
|
|
(princ "\nThis package is protected and cannot be excluded.\n")
|
|
|
|
(when (oref pkg :excluded)
|
2016-05-31 11:46:45 +00:00
|
|
|
(princ "\nThis package is excluded and cannot be installed.\n")))
|
2016-02-22 07:29:43 +00:00
|
|
|
;; toggle
|
|
|
|
(unless (or (oref pkg :excluded) (eq t (oref pkg :toggle)))
|
|
|
|
(princ "\nA toggle is defined for this package, it is currently ")
|
core: implement :depends for package declarations
This replaces the older pattern
:toggle (configuration-layer/package-usedp ..)
This implementation ensures that :disabled-for honors dependent packages, i.e.
if package a depends on package b, which is owned by layer c, and layer c is
disabled for layer d, then neither package a nor b will be configured for layer
d. Previously, this was only true for package a, but not b.
This commit also fixes:
- configuration-layer/describe-package now shows which post-init and pre-init
functions are disabled, if any
- Does not recreate all layer objects unconditionally when calling
configuration-layer/discover-layers. Previously, this led to all layers being
recreated after e.g. `SPC h SPC`, without any of the dotfile information.
Since this information is now necessary for
configuration-layer/describe-package, it’s important that we don’t clear the
indexed layers when invoking this function.
2017-06-21 10:27:59 +00:00
|
|
|
(princ (if (cfgl-package-toggled-p pkg t) "on" "off"))
|
2016-05-31 11:46:45 +00:00
|
|
|
(princ " because the following expression evaluates to ")
|
core: implement :depends for package declarations
This replaces the older pattern
:toggle (configuration-layer/package-usedp ..)
This implementation ensures that :disabled-for honors dependent packages, i.e.
if package a depends on package b, which is owned by layer c, and layer c is
disabled for layer d, then neither package a nor b will be configured for layer
d. Previously, this was only true for package a, but not b.
This commit also fixes:
- configuration-layer/describe-package now shows which post-init and pre-init
functions are disabled, if any
- Does not recreate all layer objects unconditionally when calling
configuration-layer/discover-layers. Previously, this led to all layers being
recreated after e.g. `SPC h SPC`, without any of the dotfile information.
Since this information is now necessary for
configuration-layer/describe-package, it’s important that we don’t clear the
indexed layers when invoking this function.
2017-06-21 10:27:59 +00:00
|
|
|
(princ (if (cfgl-package-toggled-p pkg t) "t:\n" "nil:\n"))
|
2016-02-22 07:29:43 +00:00
|
|
|
(princ (oref pkg :toggle))
|
|
|
|
(princ "\n"))
|
2017-07-03 07:52:54 +00:00
|
|
|
(when (oref pkg :requires)
|
|
|
|
(princ "\nThis package requires the following packages: ")
|
|
|
|
(dolist (dep-pkg (oref pkg :requires))
|
core: implement :depends for package declarations
This replaces the older pattern
:toggle (configuration-layer/package-usedp ..)
This implementation ensures that :disabled-for honors dependent packages, i.e.
if package a depends on package b, which is owned by layer c, and layer c is
disabled for layer d, then neither package a nor b will be configured for layer
d. Previously, this was only true for package a, but not b.
This commit also fixes:
- configuration-layer/describe-package now shows which post-init and pre-init
functions are disabled, if any
- Does not recreate all layer objects unconditionally when calling
configuration-layer/discover-layers. Previously, this led to all layers being
recreated after e.g. `SPC h SPC`, without any of the dotfile information.
Since this information is now necessary for
configuration-layer/describe-package, it’s important that we don’t clear the
indexed layers when invoking this function.
2017-06-21 10:27:59 +00:00
|
|
|
(princ (concat "`" (symbol-name dep-pkg) "' "))
|
|
|
|
(with-current-buffer standard-output
|
|
|
|
(save-excursion
|
|
|
|
(re-search-backward "`\\([^`']+\\)'" nil t)
|
|
|
|
(help-xref-button 1 'help-describe-package dep-pkg))))
|
|
|
|
(princ "\nThese dependencies are currently ")
|
2017-07-03 07:52:54 +00:00
|
|
|
(princ (if (cfgl-package-reqs-satisfied-p pkg t) "" "not "))
|
core: implement :depends for package declarations
This replaces the older pattern
:toggle (configuration-layer/package-usedp ..)
This implementation ensures that :disabled-for honors dependent packages, i.e.
if package a depends on package b, which is owned by layer c, and layer c is
disabled for layer d, then neither package a nor b will be configured for layer
d. Previously, this was only true for package a, but not b.
This commit also fixes:
- configuration-layer/describe-package now shows which post-init and pre-init
functions are disabled, if any
- Does not recreate all layer objects unconditionally when calling
configuration-layer/discover-layers. Previously, this led to all layers being
recreated after e.g. `SPC h SPC`, without any of the dotfile information.
Since this information is now necessary for
configuration-layer/describe-package, it’s important that we don’t clear the
indexed layers when invoking this function.
2017-06-21 10:27:59 +00:00
|
|
|
(princ "satisfied.\n"))
|
2016-02-22 07:29:43 +00:00
|
|
|
(unless (oref pkg :excluded)
|
|
|
|
;; usage and installation
|
2017-07-02 13:48:06 +00:00
|
|
|
(if (not (configuration-layer/package-used-p pkg-symbol))
|
2016-02-22 07:29:43 +00:00
|
|
|
(princ "\nYou are not using this package.\n")
|
|
|
|
(princ "\nYou are using this package")
|
2016-05-31 11:46:45 +00:00
|
|
|
(if (or (memq (oref pkg :location) '(built-in local site))
|
|
|
|
(stringp (oref pkg :location)))
|
2016-02-22 07:29:43 +00:00
|
|
|
(princ ".\n")
|
|
|
|
(if (not (package-installed-p pkg-symbol))
|
|
|
|
(princ " but it is not yet installed.\n")
|
|
|
|
(princ ", it is currently installed ")
|
|
|
|
(if (featurep pkg-symbol)
|
|
|
|
(princ "and loaded.\n")
|
|
|
|
(princ "but it has not been loaded yet.\n")))))
|
2017-07-02 13:48:06 +00:00
|
|
|
(when (configuration-layer/package-lazy-install-p pkg-symbol)
|
2016-02-22 07:29:43 +00:00
|
|
|
(princ
|
|
|
|
"\nThis package can be lazily installed using `auto-mode-alist'.\n")
|
|
|
|
(with-current-buffer standard-output
|
|
|
|
(save-excursion
|
|
|
|
(re-search-backward "`\\([^`']+\\)'" nil t)
|
|
|
|
(help-xref-button 1 'help-variable 'auto-mode-alist)))
|
|
|
|
(when (assq pkg-symbol configuration-layer--lazy-mode-alist)
|
|
|
|
(princ (concat "Actually it will be installed when one of the "
|
|
|
|
"following files is opened: \n"))
|
|
|
|
(princ (cdr (assq pkg-symbol
|
|
|
|
configuration-layer--lazy-mode-alist)))
|
|
|
|
(princ "\n")))
|
|
|
|
;; source location
|
|
|
|
(let ((location (oref pkg :location)))
|
|
|
|
(cond
|
|
|
|
((eq 'built-in location)
|
|
|
|
(princ "\nThis is a built-in package distributed with Emacs.\n"))
|
|
|
|
((eq 'local location)
|
2016-07-17 19:00:43 +00:00
|
|
|
(let* ((layer (configuration-layer/get-layer owner))
|
2016-02-22 07:29:43 +00:00
|
|
|
(path (format "%slocal/%S" (oref layer dir) pkg-symbol)))
|
|
|
|
(princ (concat "\nThis is a local package whose source files "
|
|
|
|
"can be found in layer `"))
|
|
|
|
(princ owner)
|
|
|
|
(princ "'.\n")
|
|
|
|
(with-current-buffer standard-output
|
|
|
|
(save-excursion
|
|
|
|
(re-search-backward "`\\([^`']+\\)'" nil t)
|
|
|
|
(help-xref-button 1 'help-package-def path)))))
|
|
|
|
((eq 'site location)
|
|
|
|
;; TODO find a way to find the location on disk and detect if it is
|
|
|
|
;; really installed
|
|
|
|
(princ "\nWhen used it must be installed by a third party.\n"))
|
|
|
|
((eq 'elpa location)
|
|
|
|
;; TODO find a way to find the ELPA repository
|
|
|
|
(princ "\nWhen used it is downloaded from an ELPA repository.\n"))
|
|
|
|
((and (listp location) (eq 'recipe (car location)))
|
|
|
|
(princ (concat "\nWhen used it is downloaded using `quelpa' "
|
|
|
|
"with the following recipe:\n"))
|
|
|
|
(with-current-buffer standard-output
|
|
|
|
(save-excursion
|
|
|
|
(re-search-backward "`\\([^`']+\\)'" nil t)
|
|
|
|
(help-xref-button
|
|
|
|
1 'help-url "https://github.com/quelpa/quelpa")))
|
|
|
|
(princ location)
|
|
|
|
(princ "\n"))))
|
|
|
|
;; pre/post init functions
|
|
|
|
(when (or (oref pkg pre-layers) (oref pkg post-layers))
|
|
|
|
(princ (concat "\nAdditional configuration for this package "
|
|
|
|
"can be found in the following "))
|
|
|
|
(if (null layer-list)
|
|
|
|
(princ "used layers:\n")
|
|
|
|
(princ "layers:\n"))
|
|
|
|
(when (oref pkg pre-layers)
|
|
|
|
(princ "(pre-init) ")
|
|
|
|
(dolist (layer-sym (sort (oref pkg pre-layers) 'string<))
|
2016-07-17 19:00:43 +00:00
|
|
|
(let* ((layer (configuration-layer/get-layer layer-sym))
|
2016-02-22 07:29:43 +00:00
|
|
|
(path (concat (oref layer dir) "packages.el")))
|
|
|
|
(princ (concat "`" (symbol-name layer-sym) "'"))
|
|
|
|
(with-current-buffer standard-output
|
|
|
|
(save-excursion
|
|
|
|
(re-search-backward "`\\([^`']+\\)'" nil t)
|
|
|
|
(help-xref-button
|
|
|
|
1 'help-function-def
|
|
|
|
(intern (format "%S/pre-init-%S" layer-sym pkg-symbol))
|
core: implement :depends for package declarations
This replaces the older pattern
:toggle (configuration-layer/package-usedp ..)
This implementation ensures that :disabled-for honors dependent packages, i.e.
if package a depends on package b, which is owned by layer c, and layer c is
disabled for layer d, then neither package a nor b will be configured for layer
d. Previously, this was only true for package a, but not b.
This commit also fixes:
- configuration-layer/describe-package now shows which post-init and pre-init
functions are disabled, if any
- Does not recreate all layer objects unconditionally when calling
configuration-layer/discover-layers. Previously, this led to all layers being
recreated after e.g. `SPC h SPC`, without any of the dotfile information.
Since this information is now necessary for
configuration-layer/describe-package, it’s important that we don’t clear the
indexed layers when invoking this function.
2017-06-21 10:27:59 +00:00
|
|
|
path)))
|
|
|
|
(unless (configuration-layer//package-enabled-p pkg layer-sym)
|
|
|
|
(princ " (disabled)")))
|
2016-02-22 07:29:43 +00:00
|
|
|
(princ " "))
|
|
|
|
(princ "\n"))
|
|
|
|
(when (oref pkg post-layers)
|
|
|
|
(princ "(post-init) ")
|
|
|
|
(dolist (layer-sym (sort (oref pkg post-layers) 'string<))
|
2016-07-17 19:00:43 +00:00
|
|
|
(let* ((layer (configuration-layer/get-layer layer-sym))
|
2016-02-22 07:29:43 +00:00
|
|
|
(path (concat (oref layer dir) "packages.el")))
|
|
|
|
(princ (concat "`" (symbol-name layer-sym) "'"))
|
|
|
|
(with-current-buffer standard-output
|
|
|
|
(save-excursion
|
|
|
|
(re-search-backward "`\\([^`']+\\)'" nil t)
|
|
|
|
(help-xref-button
|
|
|
|
1 'help-function-def
|
|
|
|
(intern (format "%S/post-init-%S" layer-sym pkg-symbol))
|
core: implement :depends for package declarations
This replaces the older pattern
:toggle (configuration-layer/package-usedp ..)
This implementation ensures that :disabled-for honors dependent packages, i.e.
if package a depends on package b, which is owned by layer c, and layer c is
disabled for layer d, then neither package a nor b will be configured for layer
d. Previously, this was only true for package a, but not b.
This commit also fixes:
- configuration-layer/describe-package now shows which post-init and pre-init
functions are disabled, if any
- Does not recreate all layer objects unconditionally when calling
configuration-layer/discover-layers. Previously, this led to all layers being
recreated after e.g. `SPC h SPC`, without any of the dotfile information.
Since this information is now necessary for
configuration-layer/describe-package, it’s important that we don’t clear the
indexed layers when invoking this function.
2017-06-21 10:27:59 +00:00
|
|
|
path)))
|
|
|
|
(unless (configuration-layer//package-enabled-p pkg layer-sym)
|
|
|
|
(princ " (disabled)")))
|
2016-02-22 07:29:43 +00:00
|
|
|
(princ " "))
|
|
|
|
(princ "\n"))))
|
|
|
|
(princ (concat "\nClick [here] to display an Emacs description "
|
|
|
|
"for this package.\n"))
|
|
|
|
(with-current-buffer standard-output
|
|
|
|
(save-excursion
|
|
|
|
(re-search-backward "\\(\\[.+\\]\\)" nil t)
|
|
|
|
(help-xref-button 1 'help-package pkg-symbol))))))
|
|
|
|
|
2016-06-11 02:47:45 +00:00
|
|
|
(defun configuration-layer//warning (msg &rest args)
|
|
|
|
"Display MSG as a warning message in buffer `*Messages*'.
|
2016-06-11 03:41:33 +00:00
|
|
|
If `configuration-layer--inhibit-warnings' is non nil then this function is a
|
2016-06-11 02:47:45 +00:00
|
|
|
no-op."
|
2016-06-11 03:41:33 +00:00
|
|
|
(unless configuration-layer--inhibit-warnings
|
2016-06-13 01:09:22 +00:00
|
|
|
(apply 'spacemacs-buffer/warning msg args)))
|
2016-06-11 02:47:45 +00:00
|
|
|
|
2017-10-30 02:01:39 +00:00
|
|
|
(defun configuration-layer//error (msg &rest args)
|
|
|
|
"Display MSG as a warning message in buffer `*Messages*'.
|
|
|
|
If `configuration-layer--inhibit-errors' is non nil then this function is a
|
|
|
|
no-op."
|
|
|
|
(unless configuration-layer--inhibit-errors
|
|
|
|
(configuration-layer//increment-error-count)
|
|
|
|
(apply 'spacemacs-buffer/error msg args)))
|
|
|
|
|
2016-07-17 19:00:43 +00:00
|
|
|
(defun configuration-layer//add-layer (layer &optional usedp)
|
|
|
|
"Add a LAYER object to the system.
|
|
|
|
USEDP non-nil means that PKG is a used layer."
|
|
|
|
(let ((layer-name (oref layer :name)))
|
|
|
|
(puthash layer-name layer configuration-layer--indexed-layers)
|
|
|
|
(when usedp
|
|
|
|
(add-to-list 'configuration-layer--used-layers layer-name))))
|
|
|
|
|
|
|
|
(defun configuration-layer/remove-layers (layer-names)
|
|
|
|
"Remove layers with LAYER-NAMES from used layers."
|
|
|
|
(mapc 'configuration-layer/remove-layer layer-names))
|
|
|
|
|
|
|
|
(defun configuration-layer/remove-layer (layer-name)
|
|
|
|
"Remove an used layer with name LAYER-NAME."
|
|
|
|
(setq configuration-layer--used-layers
|
|
|
|
(delq layer-name configuration-layer--used-layers)))
|
|
|
|
|
|
|
|
(defun configuration-layer/get-layer (layer-name)
|
|
|
|
"Return a layer object with name LAYER-NAME.
|
|
|
|
Return nil if layer object is not found."
|
|
|
|
(when (ht-contains? configuration-layer--indexed-layers layer-name)
|
|
|
|
(ht-get configuration-layer--indexed-layers layer-name)))
|
|
|
|
|
|
|
|
(defun configuration-layer/get-layers-list ()
|
|
|
|
"Return a list of all discovered layer symbols."
|
|
|
|
(ht-keys configuration-layer--indexed-layers))
|
|
|
|
|
|
|
|
(defun configuration-layer/get-layer-local-dir (layer)
|
|
|
|
"Return the value of SLOT for the given LAYER."
|
|
|
|
(let ((obj (ht-get configuration-layer--indexed-layers layer)))
|
|
|
|
(when obj (concat (oref obj :dir) "local/"))))
|
|
|
|
|
|
|
|
(defun configuration-layer/get-layer-path (layer)
|
|
|
|
"Return the path for LAYER symbol."
|
|
|
|
(let ((obj (ht-get configuration-layer--indexed-layers layer)))
|
|
|
|
(when obj (oref obj :dir))))
|
|
|
|
|
|
|
|
(defun configuration-layer//add-package (pkg &optional usedp)
|
|
|
|
"Add a PKG object to the system.
|
|
|
|
USEDP non-nil means that PKG is a used package."
|
|
|
|
(let ((pkg-name (oref pkg :name)))
|
|
|
|
(puthash pkg-name pkg configuration-layer--indexed-packages)
|
|
|
|
(when usedp
|
|
|
|
(add-to-list 'configuration-layer--used-packages pkg-name))))
|
|
|
|
|
|
|
|
(defun configuration-layer/get-packages-list ()
|
|
|
|
"Return a list of all package symbols."
|
|
|
|
(ht-keys configuration-layer--indexed-packages))
|
|
|
|
|
|
|
|
(defun configuration-layer/get-package (pkg-name)
|
|
|
|
"Return a package object with name PKG-NAME.
|
|
|
|
Return nil if package object is not found."
|
|
|
|
(when (ht-contains? configuration-layer--indexed-packages pkg-name)
|
|
|
|
(ht-get configuration-layer--indexed-packages pkg-name)))
|
|
|
|
|
|
|
|
(defun configuration-layer//sort-packages (packages)
|
|
|
|
"Return a sorted list of PACKAGES objects."
|
|
|
|
(sort packages (lambda (x y) (string< (symbol-name x) (symbol-name y)))))
|
|
|
|
|
2017-01-16 04:09:57 +00:00
|
|
|
(defun configuration-layer/make-all-packages (&optional skip-layer-discovery)
|
|
|
|
"Create objects for _all_ packages supported by Spacemacs.
|
|
|
|
If SKIP-LAYER-DISCOVERY is non-nil then do not check for new layers."
|
2017-01-16 02:40:07 +00:00
|
|
|
(let ((all-layers (configuration-layer/get-layers-list))
|
|
|
|
(configuration-layer--load-packages-files t)
|
|
|
|
(configuration-layer--package-properties-read-onlyp t)
|
|
|
|
(configuration-layer--inhibit-warnings t))
|
2017-01-16 04:09:57 +00:00
|
|
|
(unless skip-layer-discovery
|
|
|
|
(configuration-layer/discover-layers))
|
2017-01-16 02:40:07 +00:00
|
|
|
(configuration-layer/declare-layers all-layers)
|
|
|
|
(configuration-layer/make-packages-from-layers all-layers)))
|
2016-07-17 19:00:43 +00:00
|
|
|
|
2016-09-05 16:40:44 +00:00
|
|
|
(defun configuration-layer/make-packages-from-layers
|
|
|
|
(layer-names &optional usedp)
|
2016-07-17 19:00:43 +00:00
|
|
|
"Read the package lists of layers with name LAYER-NAMES and create packages.
|
2017-07-30 16:50:39 +00:00
|
|
|
USEDP if non-nil indicates that made packages are used packages."
|
2016-07-17 19:00:43 +00:00
|
|
|
(dolist (layer-name layer-names)
|
2017-09-22 03:47:20 +00:00
|
|
|
(let* ((layer (configuration-layer/get-layer layer-name))
|
2017-09-26 02:55:08 +00:00
|
|
|
(shadowed-by (cfgl-layer-get-shadowing-layers layer)))
|
2017-09-22 03:47:20 +00:00
|
|
|
(if shadowed-by
|
|
|
|
(spacemacs-buffer/message
|
|
|
|
"Ignoring layer '%s' because it is shadowed by layer(s) '%s'."
|
|
|
|
layer-name shadowed-by)
|
|
|
|
(dolist (pkg (cfgl-layer-get-packages layer 'with-props))
|
|
|
|
(let* ((pkg-name (if (listp pkg) (car pkg) pkg))
|
|
|
|
(obj (configuration-layer/get-package pkg-name)))
|
|
|
|
(setq obj (configuration-layer/make-package pkg layer-name obj))
|
|
|
|
(configuration-layer//add-package
|
|
|
|
obj (and (cfgl-package-get-safe-owner obj) usedp))))))))
|
2016-09-05 16:40:44 +00:00
|
|
|
|
|
|
|
(defun configuration-layer/make-packages-from-dotfile (&optional usedp)
|
2018-08-01 18:51:57 +00:00
|
|
|
"Read the additional packages declared in the dotfile and create packages.
|
2016-09-05 16:40:44 +00:00
|
|
|
USEDP if non-nil indicates that made packages are used packages."
|
2017-01-26 04:30:25 +00:00
|
|
|
(dolist (pkg (append dotspacemacs-additional-packages
|
2017-02-02 03:59:03 +00:00
|
|
|
dotspacemacs--additional-theme-packages))
|
2016-09-05 16:40:44 +00:00
|
|
|
(let* ((pkg-name (if (listp pkg) (car pkg) pkg))
|
|
|
|
(obj (configuration-layer/get-package pkg-name)))
|
|
|
|
(if obj
|
|
|
|
(setq obj (configuration-layer/make-package pkg 'dotfile obj))
|
|
|
|
(setq obj (configuration-layer/make-package pkg 'dotfile)))
|
|
|
|
(configuration-layer//add-package obj usedp)))
|
|
|
|
(dolist (xpkg dotspacemacs-excluded-packages)
|
|
|
|
(let ((obj (configuration-layer/get-package xpkg)))
|
|
|
|
(unless obj
|
|
|
|
(setq obj (configuration-layer/make-package xpkg 'dotfile)))
|
|
|
|
(configuration-layer//add-package obj usedp)
|
2016-09-06 00:54:07 +00:00
|
|
|
(cfgl-package-set-property obj :excluded t))))
|
2015-08-06 03:39:39 +00:00
|
|
|
|
2016-01-31 05:05:27 +00:00
|
|
|
(defun configuration-layer/lazy-install (layer-name &rest props)
|
|
|
|
"Configure auto-installation of layer with name LAYER-NAME."
|
|
|
|
(declare (indent 1))
|
2016-03-27 19:55:24 +00:00
|
|
|
(when (configuration-layer//lazy-install-p layer-name)
|
2018-06-07 10:13:06 +00:00
|
|
|
(let ((extensions (spacemacs/mplist-get-values props :extensions))
|
2017-01-22 18:41:04 +00:00
|
|
|
(interpreter (plist-get props :interpreter)))
|
2017-07-02 13:48:06 +00:00
|
|
|
(when (configuration-layer/layer-used-p layer-name)
|
2016-07-17 19:00:43 +00:00
|
|
|
(let* ((layer (configuration-layer/get-layer layer-name))
|
2017-01-22 18:37:12 +00:00
|
|
|
(package-names (when layer (cfgl-layer-owned-packages layer))))
|
2016-06-11 01:37:32 +00:00
|
|
|
;; set lazy install flag for a layer if and only if its owned
|
|
|
|
;; distant packages are all not already installed
|
2017-01-22 18:37:12 +00:00
|
|
|
(let ((lazy
|
|
|
|
(or (eq 'all dotspacemacs-enable-lazy-installation)
|
|
|
|
(cl-reduce
|
|
|
|
(lambda (x y) (and x y))
|
|
|
|
(mapcar
|
|
|
|
(lambda (p)
|
|
|
|
(let ((pkg (configuration-layer/get-package p)))
|
|
|
|
(or (not (eq layer-name (car (oref pkg :owners))))
|
|
|
|
(null (package-installed-p
|
|
|
|
(oref pkg :name))))))
|
|
|
|
package-names)
|
|
|
|
:initial-value t))))
|
2016-03-27 19:55:24 +00:00
|
|
|
(oset layer :lazy-install lazy)
|
2017-01-22 18:37:12 +00:00
|
|
|
(dolist (pkg-name package-names)
|
|
|
|
(let ((pkg (configuration-layer/get-package pkg-name)))
|
|
|
|
(cfgl-package-set-property pkg :lazy-install lazy))))))
|
|
|
|
;; configure `auto-mode-alist'
|
2016-03-27 19:55:24 +00:00
|
|
|
(dolist (x extensions)
|
|
|
|
(let ((ext (car x))
|
|
|
|
(mode (cadr x)))
|
|
|
|
(add-to-list 'configuration-layer--lazy-mode-alist (cons mode ext))
|
|
|
|
(add-to-list
|
|
|
|
'auto-mode-alist
|
|
|
|
`(,ext . (lambda ()
|
|
|
|
(configuration-layer//auto-mode
|
2017-01-22 18:41:04 +00:00
|
|
|
',layer-name ',mode))))
|
|
|
|
))
|
|
|
|
;; configure `interpreter-mode-alist'
|
|
|
|
(when interpreter
|
|
|
|
(let ((regex (car interpreter))
|
|
|
|
(mode (cadr interpreter)))
|
|
|
|
(add-to-list
|
|
|
|
'interpreter-mode-alist
|
|
|
|
`(,regex . (lambda () (configuration-layer//auto-mode
|
|
|
|
',layer-name ',mode)))))))))
|
2016-01-31 05:05:27 +00:00
|
|
|
|
|
|
|
(defun configuration-layer//auto-mode (layer-name mode)
|
|
|
|
"Auto mode support of lazily installed layers."
|
2016-07-17 19:00:43 +00:00
|
|
|
(let ((layer (configuration-layer/get-layer layer-name)))
|
2016-10-10 03:32:31 +00:00
|
|
|
(when (or (oref layer :lazy-install)
|
2017-07-02 13:48:06 +00:00
|
|
|
(not (configuration-layer/layer-used-p layer-name)))
|
2016-04-05 02:15:24 +00:00
|
|
|
(configuration-layer//lazy-install-packages layer-name mode)))
|
2016-03-26 04:49:12 +00:00
|
|
|
(when (fboundp mode) (funcall mode)))
|
2016-01-31 05:05:27 +00:00
|
|
|
|
2015-09-03 03:00:56 +00:00
|
|
|
(defun configuration-layer/filter-objects (objects ffunc)
|
|
|
|
"Return a filtered OBJECTS list where each element satisfies FFUNC."
|
2016-10-10 03:32:31 +00:00
|
|
|
(reverse (cl-reduce (lambda (acc x) (if (funcall ffunc x) (push x acc) acc))
|
|
|
|
objects
|
|
|
|
:initial-value nil)))
|
2015-08-08 04:01:36 +00:00
|
|
|
|
2017-07-30 16:50:39 +00:00
|
|
|
(defun configuration-layer//filter-distant-packages
|
|
|
|
(packages usedp &optional predicate)
|
2016-05-31 02:58:59 +00:00
|
|
|
"Return the distant packages (ie to be intalled).
|
2016-07-17 19:00:43 +00:00
|
|
|
If USEDP is non nil then returns only the used packages; if it is nil then
|
2017-07-30 16:50:39 +00:00
|
|
|
return both used and unused packages.
|
|
|
|
PREDICATE is an additional expression that eval to a boolean."
|
2015-09-03 03:00:56 +00:00
|
|
|
(configuration-layer/filter-objects
|
2016-10-10 03:32:31 +00:00
|
|
|
packages
|
|
|
|
(lambda (x)
|
|
|
|
(let ((pkg (configuration-layer/get-package x)))
|
2018-01-25 05:08:46 +00:00
|
|
|
(if pkg
|
|
|
|
(and (cfgl-package-distant-p pkg)
|
|
|
|
(or (null usedp)
|
|
|
|
(cfgl-package-used-p pkg))
|
|
|
|
(or (null predicate)
|
|
|
|
(eval predicate)))
|
|
|
|
(spacemacs-buffer/warning "Cannot find package for %s" x)
|
|
|
|
nil)))))
|
2015-08-26 02:52:26 +00:00
|
|
|
|
2014-12-25 19:45:27 +00:00
|
|
|
(defun configuration-layer//get-private-layer-dir (name)
|
2015-09-19 05:37:45 +00:00
|
|
|
"Return an absolute path to the private configuration layer string NAME."
|
|
|
|
(file-name-as-directory
|
|
|
|
(concat configuration-layer-private-layer-directory name)))
|
2014-11-22 05:08:44 +00:00
|
|
|
|
2015-09-19 05:37:45 +00:00
|
|
|
(defun configuration-layer//copy-template (name template &optional layer-dir)
|
|
|
|
"Copy and replace special values of TEMPLATE to layer string NAME.
|
|
|
|
If LAYER_DIR is nil, the private directory is used."
|
2016-01-08 09:22:37 +00:00
|
|
|
(cl-flet ((substitute (old new) (let ((case-fold-search nil))
|
|
|
|
(save-excursion
|
|
|
|
(goto-char (point-min))
|
|
|
|
(while (search-forward old nil t)
|
|
|
|
(replace-match new t))))))
|
|
|
|
(let ((src (concat configuration-layer-template-directory
|
|
|
|
(format "%s.template" template)))
|
|
|
|
(dest (if layer-dir
|
|
|
|
(concat layer-dir "/" (format "%s" template))
|
|
|
|
(concat (configuration-layer//get-private-layer-dir name)
|
|
|
|
(format "%s" template)))))
|
|
|
|
(copy-file src dest)
|
|
|
|
(find-file dest)
|
|
|
|
(substitute "%LAYER_NAME%" name)
|
|
|
|
(cond
|
|
|
|
(user-full-name
|
|
|
|
(substitute "%USER_FULL_NAME%" user-full-name)
|
|
|
|
(substitute "%USER_MAIL_ADDRESS%" user-mail-address))
|
|
|
|
(t
|
|
|
|
(substitute "%USER_FULL_NAME%" "Sylvain Benner & Contributors")
|
|
|
|
(substitute "%USER_MAIL_ADDRESS%" "sylvain.benner@gmail.com")))
|
|
|
|
(save-buffer))))
|
2014-11-22 05:08:44 +00:00
|
|
|
|
2015-06-06 02:47:23 +00:00
|
|
|
(defun configuration-layer//directory-type (path)
|
|
|
|
"Return the type of directory pointed by PATH.
|
|
|
|
Possible return values:
|
|
|
|
layer - the directory is a layer
|
|
|
|
category - the directory is a category
|
|
|
|
nil - the directory is a regular directory."
|
2015-05-17 12:27:43 +00:00
|
|
|
(when (file-directory-p path)
|
2015-06-06 02:47:23 +00:00
|
|
|
(if (string-match
|
2015-09-11 00:21:27 +00:00
|
|
|
"^+" (file-name-nondirectory
|
2015-06-06 02:47:23 +00:00
|
|
|
(directory-file-name
|
2015-09-08 01:16:15 +00:00
|
|
|
(concat configuration-layer-directory path))))
|
2015-06-06 02:47:23 +00:00
|
|
|
'category
|
|
|
|
(let ((files (directory-files path)))
|
|
|
|
;; most frequent files encoutered in a layer are tested first
|
|
|
|
(when (or (member "packages.el" files)
|
2016-05-29 01:20:23 +00:00
|
|
|
(member "layers.el" files)
|
2015-06-06 02:47:23 +00:00
|
|
|
(member "config.el" files)
|
|
|
|
(member "keybindings.el" files)
|
|
|
|
(member "funcs.el" files))
|
|
|
|
'layer)))))
|
|
|
|
|
|
|
|
(defun configuration-layer//get-category-from-path (dirpath)
|
|
|
|
"Return a category symbol from the given DIRPATH.
|
2015-09-11 00:21:27 +00:00
|
|
|
The directory name must start with `+'.
|
2015-06-06 02:47:23 +00:00
|
|
|
Returns nil if the directory is not a category."
|
|
|
|
(when (file-directory-p dirpath)
|
|
|
|
(let ((dirname (file-name-nondirectory
|
|
|
|
(directory-file-name
|
2015-09-08 01:16:15 +00:00
|
|
|
(concat configuration-layer-directory
|
2015-06-06 02:47:23 +00:00
|
|
|
dirpath)))))
|
2015-09-11 00:21:27 +00:00
|
|
|
(when (string-match "^+" dirname)
|
2015-06-06 02:47:23 +00:00
|
|
|
(intern (substring dirname 1))))))
|
2014-11-11 03:26:11 +00:00
|
|
|
|
core: implement :depends for package declarations
This replaces the older pattern
:toggle (configuration-layer/package-usedp ..)
This implementation ensures that :disabled-for honors dependent packages, i.e.
if package a depends on package b, which is owned by layer c, and layer c is
disabled for layer d, then neither package a nor b will be configured for layer
d. Previously, this was only true for package a, but not b.
This commit also fixes:
- configuration-layer/describe-package now shows which post-init and pre-init
functions are disabled, if any
- Does not recreate all layer objects unconditionally when calling
configuration-layer/discover-layers. Previously, this led to all layers being
recreated after e.g. `SPC h SPC`, without any of the dotfile information.
Since this information is now necessary for
configuration-layer/describe-package, it’s important that we don’t clear the
indexed layers when invoking this function.
2017-06-21 10:27:59 +00:00
|
|
|
(defun configuration-layer/discover-layers (&optional refresh-index)
|
|
|
|
"Initialize `configuration-layer--indexed-layers' with layer directories.
|
|
|
|
If REFRESH-INDEX is non-nil, the layer index is cleared before
|
|
|
|
discovery."
|
2018-08-01 18:51:57 +00:00
|
|
|
;; load private layers at the end on purpose we assume that the user layers
|
2015-05-29 17:08:48 +00:00
|
|
|
;; must have the final word on configuration choices. Let
|
|
|
|
;; `dotspacemacs-directory' override the private directory if it exists.
|
core: implement :depends for package declarations
This replaces the older pattern
:toggle (configuration-layer/package-usedp ..)
This implementation ensures that :disabled-for honors dependent packages, i.e.
if package a depends on package b, which is owned by layer c, and layer c is
disabled for layer d, then neither package a nor b will be configured for layer
d. Previously, this was only true for package a, but not b.
This commit also fixes:
- configuration-layer/describe-package now shows which post-init and pre-init
functions are disabled, if any
- Does not recreate all layer objects unconditionally when calling
configuration-layer/discover-layers. Previously, this led to all layers being
recreated after e.g. `SPC h SPC`, without any of the dotfile information.
Since this information is now necessary for
configuration-layer/describe-package, it’s important that we don’t clear the
indexed layers when invoking this function.
2017-06-21 10:27:59 +00:00
|
|
|
(when refresh-index
|
|
|
|
(setq configuration-layer--indexed-layers (make-hash-table :size 1024)))
|
2017-10-30 01:43:43 +00:00
|
|
|
(spacemacs-buffer/set-mode-line "Indexing layers..." t)
|
2016-12-25 20:10:31 +00:00
|
|
|
(let ((search-paths (append
|
|
|
|
;; layers shipped with spacemacs
|
|
|
|
(list configuration-layer-directory)
|
|
|
|
;; layers in private folder ~/.emacs.d/private
|
2018-06-25 06:16:27 +00:00
|
|
|
(list spacemacs-private-directory)
|
2016-12-25 20:10:31 +00:00
|
|
|
;; layers in dotdirectory
|
2017-05-29 09:51:57 +00:00
|
|
|
;; this path may not exist, so check if it does
|
2016-12-25 20:10:31 +00:00
|
|
|
(when dotspacemacs-directory
|
2017-05-29 09:51:57 +00:00
|
|
|
(let ((dir (expand-file-name (concat dotspacemacs-directory
|
|
|
|
"layers/"))))
|
|
|
|
(when (file-exists-p dir) (list dir))))
|
2016-12-25 20:10:31 +00:00
|
|
|
;; additional layer directories provided by the user
|
|
|
|
dotspacemacs-configuration-layer-path))
|
2016-07-17 19:00:43 +00:00
|
|
|
(discovered '()))
|
2016-12-25 20:10:31 +00:00
|
|
|
;; filter out directories that don't exist
|
|
|
|
(setq search-paths (configuration-layer/filter-objects
|
|
|
|
search-paths
|
|
|
|
(lambda (x)
|
|
|
|
(let ((exists (file-exists-p x)))
|
|
|
|
(unless exists
|
|
|
|
(configuration-layer//warning
|
|
|
|
"Layer directory \"%s\" not found. Ignoring it."
|
|
|
|
x))
|
|
|
|
exists))))
|
2015-05-17 12:27:43 +00:00
|
|
|
;; depth-first search of subdirectories
|
|
|
|
(while search-paths
|
|
|
|
(let ((current-path (car search-paths)))
|
|
|
|
(setq search-paths (cdr search-paths))
|
|
|
|
(dolist (sub (directory-files current-path t nil 'nosort))
|
|
|
|
;; ignore ".", ".." and non-directories
|
|
|
|
(unless (or (string-equal ".." (substring sub -2))
|
|
|
|
(string-equal "." (substring sub -1))
|
|
|
|
(not (file-directory-p sub)))
|
2015-06-06 02:47:23 +00:00
|
|
|
(let ((type (configuration-layer//directory-type sub)))
|
|
|
|
(cond
|
|
|
|
((eq 'category type)
|
|
|
|
(let ((category (configuration-layer//get-category-from-path
|
|
|
|
sub)))
|
|
|
|
(spacemacs-buffer/message "-> Discovered category: %S"
|
|
|
|
category)
|
2018-06-01 06:59:57 +00:00
|
|
|
(add-to-list 'configuration-layer-categories category)
|
2015-06-06 02:47:23 +00:00
|
|
|
(setq search-paths (cons sub search-paths))))
|
|
|
|
((eq 'layer type)
|
2016-07-17 19:00:43 +00:00
|
|
|
(let* ((layer-name-str (file-name-nondirectory sub))
|
|
|
|
(layer-name (intern layer-name-str))
|
|
|
|
(indexed-layer (configuration-layer/get-layer
|
|
|
|
layer-name)))
|
|
|
|
(if indexed-layer
|
|
|
|
;; the same layer may have been discovered twice,
|
|
|
|
;; in which case we don't need a warning
|
2016-11-14 13:45:58 +00:00
|
|
|
(unless (string-equal (file-truename
|
|
|
|
(directory-file-name (oref indexed-layer :dir)))
|
|
|
|
(file-truename
|
|
|
|
(directory-file-name sub)))
|
2016-07-17 19:00:43 +00:00
|
|
|
(configuration-layer//warning
|
|
|
|
(concat
|
|
|
|
"Duplicated layer %s detected in directory \"%s\", "
|
|
|
|
"replacing old directory \"%s\" with new directory.")
|
|
|
|
layer-name-str sub (oref indexed-layer :dir))
|
|
|
|
(oset indexed-layer :dir sub))
|
|
|
|
(spacemacs-buffer/message
|
|
|
|
"-> Discovered configuration layer: %s" layer-name-str)
|
2017-01-16 03:09:34 +00:00
|
|
|
(let ((configuration-layer--load-packages-files nil))
|
|
|
|
(configuration-layer//add-layer
|
core: implement :depends for package declarations
This replaces the older pattern
:toggle (configuration-layer/package-usedp ..)
This implementation ensures that :disabled-for honors dependent packages, i.e.
if package a depends on package b, which is owned by layer c, and layer c is
disabled for layer d, then neither package a nor b will be configured for layer
d. Previously, this was only true for package a, but not b.
This commit also fixes:
- configuration-layer/describe-package now shows which post-init and pre-init
functions are disabled, if any
- Does not recreate all layer objects unconditionally when calling
configuration-layer/discover-layers. Previously, this led to all layers being
recreated after e.g. `SPC h SPC`, without any of the dotfile information.
Since this information is now necessary for
configuration-layer/describe-package, it’s important that we don’t clear the
indexed layers when invoking this function.
2017-06-21 10:27:59 +00:00
|
|
|
(configuration-layer/make-layer
|
|
|
|
layer-name
|
|
|
|
(configuration-layer/get-layer layer-name)
|
|
|
|
nil sub))))))
|
2015-06-06 02:47:23 +00:00
|
|
|
(t
|
|
|
|
;; layer not found, add it to search path
|
2016-07-17 19:00:43 +00:00
|
|
|
(setq search-paths (cons sub search-paths)))))))))))
|
|
|
|
|
2016-08-20 00:04:33 +00:00
|
|
|
(defun configuration-layer/declare-layers (layers-specs)
|
2016-07-17 19:00:43 +00:00
|
|
|
"Declare layers with LAYERS-SPECS."
|
2016-08-20 00:04:33 +00:00
|
|
|
(mapc 'configuration-layer/declare-layer layers-specs))
|
2016-07-17 19:00:43 +00:00
|
|
|
|
2016-08-20 00:04:33 +00:00
|
|
|
(defun configuration-layer/declare-layer (layer-specs)
|
|
|
|
"Declare a single layer with spec LAYER-SPECS.
|
|
|
|
Set the variable `configuration-layer--declared-layers-usedp' to control
|
2018-05-24 02:12:30 +00:00
|
|
|
whether the declared layer is an used one or not."
|
2016-07-17 19:00:43 +00:00
|
|
|
(let* ((layer-name (if (listp layer-specs) (car layer-specs) layer-specs))
|
2016-08-20 00:04:33 +00:00
|
|
|
(layer (configuration-layer/get-layer layer-name))
|
|
|
|
(usedp configuration-layer--declared-layers-usedp))
|
2016-07-17 19:00:43 +00:00
|
|
|
(if layer
|
|
|
|
(let ((obj (configuration-layer/make-layer
|
|
|
|
layer-specs
|
|
|
|
(configuration-layer/get-layer layer-name)
|
|
|
|
usedp)))
|
|
|
|
(configuration-layer//add-layer obj usedp)
|
|
|
|
(configuration-layer//set-layer-variables obj)
|
2018-05-20 06:33:28 +00:00
|
|
|
(when (and (not (oref layer :deps-loaded))
|
|
|
|
(or usedp configuration-layer--load-packages-files))
|
|
|
|
(oset layer :deps-loaded t)
|
2016-07-17 19:00:43 +00:00
|
|
|
(configuration-layer//load-layer-files layer-name '("layers.el"))))
|
2017-09-22 03:47:20 +00:00
|
|
|
(configuration-layer//warning "Unknown declared layer %s." layer-name))))
|
2014-12-20 20:08:02 +00:00
|
|
|
|
2019-09-30 06:00:48 +00:00
|
|
|
(defun configuration-layer/declare-layer-dependencies (layer-names)
|
|
|
|
"Function to be used in `layers.el' files to declare dependencies."
|
|
|
|
(dolist (x layer-names)
|
|
|
|
(add-to-list 'configuration-layer--layers-dependencies x)
|
|
|
|
(configuration-layer//load-layer-files x '("layers.el"))))
|
|
|
|
|
2016-08-20 00:04:33 +00:00
|
|
|
(defun configuration-layer//declare-used-layers (layers-specs)
|
|
|
|
"Declare used layers from LAYERS-SPECS list."
|
2016-07-17 19:00:43 +00:00
|
|
|
(setq configuration-layer--used-layers nil)
|
2016-08-20 00:04:33 +00:00
|
|
|
(let ((configuration-layer--declared-layers-usedp t))
|
|
|
|
(unless configuration-layer-exclude-all-layers
|
|
|
|
(dolist (layer-specs layers-specs)
|
|
|
|
(let* ((layer-name (if (listp layer-specs)
|
|
|
|
(car layer-specs)
|
|
|
|
layer-specs))
|
|
|
|
(layer (configuration-layer/get-layer layer-name)))
|
|
|
|
(if layer
|
|
|
|
(let ((layer-path (oref layer :dir)))
|
|
|
|
(unless (string-match-p "+distributions" layer-path)
|
|
|
|
(configuration-layer/declare-layer layer-specs)))
|
|
|
|
(configuration-layer//warning
|
|
|
|
"Unknown layer %s declared in dotfile." layer-name))))
|
|
|
|
(setq configuration-layer--used-layers
|
|
|
|
(reverse configuration-layer--used-layers)))
|
2019-09-30 06:00:48 +00:00
|
|
|
;; declare additional layer required by used layers
|
|
|
|
;; this layers will be at the beginning of `configuration-layer--used-layers'
|
|
|
|
(dolist (layer-name configuration-layer--layers-dependencies)
|
|
|
|
(configuration-layer/declare-layer layer-name))
|
2016-08-20 00:04:33 +00:00
|
|
|
;; distribution and bootstrap layers are always first
|
|
|
|
(let ((distribution (if configuration-layer-force-distribution
|
|
|
|
configuration-layer-force-distribution
|
|
|
|
dotspacemacs-distribution)))
|
|
|
|
(unless (eq 'spacemacs-bootstrap distribution)
|
|
|
|
(configuration-layer/declare-layer distribution)))
|
|
|
|
(configuration-layer/declare-layer 'spacemacs-bootstrap)))
|
2016-01-13 05:06:38 +00:00
|
|
|
|
2017-09-26 02:55:08 +00:00
|
|
|
(defun configuration-layer/declare-shadow-relation (layer-name &rest onames)
|
|
|
|
"Declare 'can-shadow' relationship between LAYER_NAME and OTHER-NAMES layers.
|
|
|
|
LAYER-NAME is the name symbol of an existing layer.
|
|
|
|
ONAMES is a list of other layer name symbols."
|
|
|
|
(dolist (o onames)
|
|
|
|
(configuration-layer//declare-shadow-relation layer-name o)))
|
|
|
|
|
|
|
|
(defun configuration-layer//declare-shadow-relation (lname rname)
|
|
|
|
"Declare 'can-shadow' relationship between LAYER_NAME and OTHER-NAMES layers.
|
|
|
|
LNAME is the name symbol of an existing layer.
|
|
|
|
RNAME is the name symbol of another existing layer."
|
|
|
|
(let ((llayer (configuration-layer/get-layer lname))
|
|
|
|
(rlayer (configuration-layer/get-layer rname)))
|
|
|
|
(if (and llayer rlayer)
|
|
|
|
(let ((lshadow (oref llayer :can-shadow))
|
|
|
|
(rshadow (oref rlayer :can-shadow)))
|
|
|
|
;; lhs of the relation
|
|
|
|
(cond
|
|
|
|
((eq 'unspecified lshadow)
|
|
|
|
(when rshadow
|
|
|
|
(oset llayer :can-shadow `(,rname))))
|
|
|
|
((and lshadow (listp lshadow))
|
|
|
|
(when rshadow
|
|
|
|
(cl-pushnew rname (oref llayer :can-shadow))))
|
|
|
|
((null lshadow)
|
|
|
|
(spacemacs-buffer/message
|
|
|
|
(concat "Ignore shadow relation between layers %s and %s because "
|
|
|
|
":can-shadow of layer %s has been set to nil by the user.")
|
|
|
|
lname rname lname)))
|
|
|
|
;; rhs of the relation
|
|
|
|
(cond
|
|
|
|
((eq 'unspecified rshadow)
|
|
|
|
(when lshadow
|
|
|
|
(oset rlayer :can-shadow `(,lname))))
|
|
|
|
((and rshadow (listp rshadow))
|
|
|
|
(when lshadow
|
|
|
|
(cl-pushnew lname (oref rlayer :can-shadow))))
|
|
|
|
((null rshadow)
|
|
|
|
(spacemacs-buffer/message
|
|
|
|
(concat "Ignore shadow relation between layers %s and %s because "
|
|
|
|
":can-shadow of layer %s has been set to nil by the user.")
|
|
|
|
rname lname rname))))
|
|
|
|
(when (null llayer)
|
|
|
|
(configuration-layer//warning
|
|
|
|
"Unknown layer %s to declare lshadow relationship."
|
|
|
|
lname))
|
|
|
|
(when (null rlayer)
|
|
|
|
(configuration-layer//warning
|
|
|
|
"Unknown layer %s to declare lshadow relationship."
|
|
|
|
rname)))))
|
2017-09-22 03:47:20 +00:00
|
|
|
|
2018-05-28 15:17:44 +00:00
|
|
|
(defun configuration-layer//set-layers-variables (layer-names)
|
|
|
|
"Set the configuration variables for the passed LAYER-NAMES."
|
2018-06-10 06:45:34 +00:00
|
|
|
(mapc 'configuration-layer//set-layer-variables
|
|
|
|
(mapcar (lambda (lname)
|
|
|
|
(configuration-layer/get-layer lname))
|
|
|
|
layer-names)))
|
2015-08-26 06:41:54 +00:00
|
|
|
|
|
|
|
(defun configuration-layer//set-layer-variables (layer)
|
|
|
|
"Set the configuration variables for the passed LAYER."
|
|
|
|
(let ((variables (oref layer :variables)))
|
|
|
|
(while variables
|
|
|
|
(let ((var (pop variables)))
|
|
|
|
(if (consp variables)
|
2016-02-01 04:15:04 +00:00
|
|
|
(condition-case-unless-debug err
|
2015-08-26 06:41:54 +00:00
|
|
|
(set-default var (eval (pop variables)))
|
|
|
|
('error
|
2017-10-30 02:01:39 +00:00
|
|
|
(configuration-layer//error
|
|
|
|
(concat "\nAn error occurred while setting layer "
|
|
|
|
"variable %s "
|
|
|
|
"(error: %s). Be sure to quote the value "
|
|
|
|
"if needed.\n") var err)))
|
2016-06-11 02:47:45 +00:00
|
|
|
(configuration-layer//warning "Missing value for variable %s !"
|
2017-10-30 02:01:39 +00:00
|
|
|
var))))))
|
2015-06-01 04:29:38 +00:00
|
|
|
|
2017-07-02 13:48:06 +00:00
|
|
|
(defun configuration-layer/layer-used-p (layer-name)
|
2017-09-22 03:47:20 +00:00
|
|
|
"Return non-nil if LAYER-NAME is the name of a used and non-shadowed layer."
|
2017-07-02 07:35:01 +00:00
|
|
|
(or (eq 'dotfile layer-name)
|
|
|
|
(let ((obj (configuration-layer/get-layer layer-name)))
|
2017-09-26 02:55:08 +00:00
|
|
|
(when obj (and (not (cfgl-layer-get-shadowing-layers obj))
|
2017-09-22 03:47:20 +00:00
|
|
|
(memq layer-name configuration-layer--used-layers))))))
|
2017-07-02 13:48:06 +00:00
|
|
|
(defalias 'configuration-layer/layer-usedp
|
|
|
|
'configuration-layer/layer-used-p)
|
2015-08-06 03:39:39 +00:00
|
|
|
|
2017-07-02 13:48:06 +00:00
|
|
|
(defun configuration-layer/package-used-p (name)
|
2015-08-06 03:39:39 +00:00
|
|
|
"Return non-nil if NAME is the name of a used package."
|
2016-07-17 19:00:43 +00:00
|
|
|
(let ((obj (configuration-layer/get-package name)))
|
|
|
|
(and obj (cfgl-package-get-safe-owner obj)
|
2017-07-02 07:35:01 +00:00
|
|
|
(not (oref obj :excluded))
|
|
|
|
(not (memq nil (mapcar
|
2017-07-02 13:48:06 +00:00
|
|
|
'configuration-layer/package-used-p
|
2017-07-03 07:52:54 +00:00
|
|
|
(oref obj :requires)))))))
|
2017-07-02 13:48:06 +00:00
|
|
|
(defalias 'configuration-layer/package-usedp
|
|
|
|
'configuration-layer/package-used-p)
|
2014-11-30 05:52:22 +00:00
|
|
|
|
2017-07-03 07:52:54 +00:00
|
|
|
(defun configuration-layer//package-reqs-used-p (pkg)
|
|
|
|
"Returns non-nil if all requirements of PKG are used."
|
2017-06-23 16:29:15 +00:00
|
|
|
(not (memq nil (mapcar
|
2017-07-02 13:48:06 +00:00
|
|
|
'configuration-layer/package-used-p
|
2017-07-03 07:52:54 +00:00
|
|
|
(oref pkg :requires)))))
|
2017-06-23 16:29:15 +00:00
|
|
|
|
2017-07-02 13:48:06 +00:00
|
|
|
(defun configuration-layer/package-lazy-install-p (name)
|
2016-01-31 05:05:27 +00:00
|
|
|
"Return non-nil if NAME is the name of a package to be lazily installed."
|
2016-07-17 19:00:43 +00:00
|
|
|
(let ((obj (configuration-layer/get-package name)))
|
2016-01-31 05:05:27 +00:00
|
|
|
(when obj (oref obj :lazy-install))))
|
|
|
|
|
2016-07-17 19:00:43 +00:00
|
|
|
(defun configuration-layer//configure-layers (layer-names)
|
|
|
|
"Configure layers with LAYER-NAMES."
|
2015-08-26 06:41:54 +00:00
|
|
|
(let ((warning-minimum-level :error))
|
2016-07-17 19:00:43 +00:00
|
|
|
(dolist (layer-name layer-names)
|
|
|
|
(configuration-layer//load-layer-files layer-name '("config.el")))))
|
2015-08-26 02:27:31 +00:00
|
|
|
|
2016-08-20 00:04:33 +00:00
|
|
|
(defun configuration-layer//declare-used-packages (layers)
|
|
|
|
"Declare used packages contained in LAYERS."
|
2016-07-17 19:00:43 +00:00
|
|
|
(setq configuration-layer--used-packages nil)
|
2016-05-29 01:20:23 +00:00
|
|
|
(let* ((warning-minimum-level :error))
|
2016-09-05 16:40:44 +00:00
|
|
|
(configuration-layer/make-packages-from-layers layers t)
|
|
|
|
(configuration-layer/make-packages-from-dotfile t)
|
2017-07-02 07:35:01 +00:00
|
|
|
(setq configuration-layer--used-packages
|
|
|
|
(configuration-layer/filter-objects
|
|
|
|
configuration-layer--used-packages
|
2017-07-02 13:48:06 +00:00
|
|
|
'configuration-layer/package-used-p))
|
2016-07-17 19:00:43 +00:00
|
|
|
(setq configuration-layer--used-packages
|
|
|
|
(configuration-layer//sort-packages
|
|
|
|
configuration-layer--used-packages))))
|
|
|
|
|
|
|
|
(defun configuration-layer//load-layers-files (layer-names files)
|
|
|
|
"Load the files of list FILES for all passed LAYER-NAMES."
|
|
|
|
(dolist (layer-name layer-names)
|
|
|
|
(configuration-layer//load-layer-files layer-name files)))
|
|
|
|
|
|
|
|
(defun configuration-layer//load-layer-files (layer-name files)
|
|
|
|
"Load the files of list FILES for the layer with the given LAYER-NAME."
|
|
|
|
(let ((obj (configuration-layer/get-layer layer-name)))
|
|
|
|
(when obj
|
|
|
|
(dolist (file files)
|
|
|
|
(let ((file (concat (oref obj :dir) file)))
|
2018-06-10 06:46:16 +00:00
|
|
|
(if (file-exists-p file)
|
|
|
|
(configuration-layer/load-file file)))))))
|
2014-09-03 06:25:27 +00:00
|
|
|
|
2016-04-03 16:02:28 +00:00
|
|
|
(defun configuration-layer/configured-packages-stats (packages)
|
|
|
|
"Return a statistics alist regarding the number of configured PACKAGES."
|
|
|
|
`((total ,(length packages))
|
|
|
|
(elpa ,(length (configuration-layer/filter-objects
|
2016-07-17 19:00:43 +00:00
|
|
|
packages
|
|
|
|
(lambda (x)
|
|
|
|
(let ((pkg (configuration-layer/get-package x)))
|
|
|
|
(eq 'elpa (oref pkg :location)))))))
|
2016-04-03 16:02:28 +00:00
|
|
|
(recipe ,(length (configuration-layer/filter-objects
|
|
|
|
packages
|
|
|
|
(lambda (x)
|
2016-07-17 19:00:43 +00:00
|
|
|
(let* ((pkg (configuration-layer/get-package x))
|
|
|
|
(location (oref pkg :location)))
|
2016-04-03 16:02:28 +00:00
|
|
|
(and (listp location)
|
|
|
|
(eq 'recipe (car location))))))))
|
|
|
|
(local ,(length (configuration-layer/filter-objects
|
2016-07-17 19:00:43 +00:00
|
|
|
packages
|
|
|
|
(lambda (x)
|
|
|
|
(let ((pkg (configuration-layer/get-package x)))
|
|
|
|
(memq (oref pkg :location) '(local site)))))))
|
2016-04-03 16:02:28 +00:00
|
|
|
(built-in ,(length (configuration-layer/filter-objects
|
2016-07-17 19:00:43 +00:00
|
|
|
packages
|
|
|
|
(lambda (x)
|
|
|
|
(let ((pkg (configuration-layer/get-package x)))
|
|
|
|
(eq 'built-in (oref pkg :location)))))))))
|
2015-08-09 02:57:12 +00:00
|
|
|
|
2016-01-31 05:05:27 +00:00
|
|
|
(defun configuration-layer//install-package (pkg)
|
|
|
|
"Unconditionally install the package PKG."
|
2016-06-11 01:37:32 +00:00
|
|
|
(let* ((layer (when pkg (car (oref pkg :owners))))
|
2016-07-09 15:36:27 +00:00
|
|
|
(location (when pkg (oref pkg :location)))
|
|
|
|
(min-version (when pkg (oref pkg :min-version))))
|
2016-01-31 05:05:27 +00:00
|
|
|
(spacemacs-buffer/replace-last-line
|
|
|
|
(format "--> installing %s: %s%s... [%s/%s]"
|
|
|
|
(if layer "package" "dependency")
|
|
|
|
pkg-name (if layer (format "@%S" layer) "")
|
2016-05-31 02:58:59 +00:00
|
|
|
installed-count not-inst-count) t)
|
2016-04-03 06:51:01 +00:00
|
|
|
(spacemacs//redisplay)
|
2016-07-09 15:36:27 +00:00
|
|
|
(unless (package-installed-p pkg-name min-version)
|
2016-02-24 15:32:45 +00:00
|
|
|
(condition-case-unless-debug err
|
2016-01-31 05:05:27 +00:00
|
|
|
(cond
|
|
|
|
((or (null pkg) (eq 'elpa location))
|
|
|
|
(configuration-layer//install-from-elpa pkg-name)
|
2016-09-06 00:54:07 +00:00
|
|
|
(when pkg (cfgl-package-set-property pkg :lazy-install nil)))
|
2016-01-31 05:05:27 +00:00
|
|
|
((and (listp location) (eq 'recipe (car location)))
|
|
|
|
(configuration-layer//install-from-recipe pkg)
|
2016-09-06 00:54:07 +00:00
|
|
|
(cfgl-package-set-property pkg :lazy-install nil))
|
2016-06-11 02:47:45 +00:00
|
|
|
(t (configuration-layer//warning "Cannot install package %S."
|
2016-01-31 05:05:27 +00:00
|
|
|
pkg-name)))
|
|
|
|
('error
|
2017-10-30 02:01:39 +00:00
|
|
|
(configuration-layer//error
|
|
|
|
(concat "\nAn error occurred while installing %s "
|
|
|
|
"(error: %s)\n") pkg-name err)
|
2016-04-03 06:51:01 +00:00
|
|
|
(spacemacs//redisplay))))))
|
2016-01-31 05:05:27 +00:00
|
|
|
|
2016-03-25 04:24:52 +00:00
|
|
|
(defun configuration-layer//lazy-install-p (layer-name)
|
|
|
|
"Return non nil if the layer with LAYER-NAME should be lazy installed."
|
2016-03-28 16:10:12 +00:00
|
|
|
(or (eq 'all dotspacemacs-enable-lazy-installation)
|
|
|
|
(and (memq dotspacemacs-enable-lazy-installation '(unused t))
|
2017-07-02 13:48:06 +00:00
|
|
|
(not (configuration-layer/layer-used-p layer-name)))))
|
2016-03-25 04:24:52 +00:00
|
|
|
|
|
|
|
(defun configuration-layer//lazy-install-packages (layer-name mode)
|
2016-03-26 04:49:12 +00:00
|
|
|
"Install layer with LAYER-NAME to support MODE."
|
2016-03-27 19:56:15 +00:00
|
|
|
(when (or (not dotspacemacs-ask-for-lazy-installation)
|
2017-07-24 13:46:39 +00:00
|
|
|
(and
|
|
|
|
(not noninteractive)
|
|
|
|
(yes-or-no-p (format
|
|
|
|
(concat "Support for %s requires installation of "
|
|
|
|
"layer %s, do you want to install it?")
|
|
|
|
mode layer-name))))
|
2016-03-25 04:24:52 +00:00
|
|
|
(when (dotspacemacs/add-layer layer-name)
|
2017-07-01 14:54:37 +00:00
|
|
|
(let (spacemacs-sync-packages)
|
|
|
|
(configuration-layer/load)))
|
2016-07-17 19:00:43 +00:00
|
|
|
(let* ((layer (configuration-layer/get-layer layer-name))
|
2016-03-27 16:23:24 +00:00
|
|
|
(inst-pkgs
|
2016-07-17 19:00:43 +00:00
|
|
|
(delq nil
|
|
|
|
(mapcar
|
|
|
|
(lambda (x)
|
2016-10-10 03:32:31 +00:00
|
|
|
(let* ((pkg-name (if (listp x) (car x) x))
|
|
|
|
(pkg (configuration-layer/get-package pkg-name)))
|
|
|
|
(cfgl-package-set-property pkg :lazy-install nil)
|
2017-08-16 07:28:30 +00:00
|
|
|
(when (cfgl-package-distant-p pkg)
|
2016-10-10 03:32:31 +00:00
|
|
|
pkg-name)))
|
|
|
|
(oref layer :packages)))))
|
2016-03-27 16:23:24 +00:00
|
|
|
(let ((last-buffer (current-buffer))
|
2016-10-10 03:32:31 +00:00
|
|
|
(sorted-pkg (configuration-layer//sort-packages inst-pkgs)))
|
2016-03-26 07:36:54 +00:00
|
|
|
(spacemacs-buffer/goto-buffer)
|
|
|
|
(goto-char (point-max))
|
2016-10-10 03:32:31 +00:00
|
|
|
(configuration-layer//install-packages sorted-pkg)
|
|
|
|
(configuration-layer//configure-packages sorted-pkg)
|
2016-04-03 04:28:47 +00:00
|
|
|
(configuration-layer//load-layer-files layer '("keybindings.el"))
|
2016-10-10 03:32:31 +00:00
|
|
|
(oset layer :lazy-install nil)
|
2016-03-27 16:23:24 +00:00
|
|
|
(switch-to-buffer last-buffer)))))
|
2016-01-31 05:05:27 +00:00
|
|
|
|
2015-08-09 02:57:12 +00:00
|
|
|
(defun configuration-layer//install-packages (packages)
|
2016-01-31 05:05:27 +00:00
|
|
|
"Install PACKAGES which are not lazy installed."
|
2014-09-03 06:25:27 +00:00
|
|
|
(interactive)
|
2016-06-05 04:04:53 +00:00
|
|
|
;; Force the display of warning buffers at the bottom
|
2016-06-04 04:00:52 +00:00
|
|
|
(let ((display-buffer-alist
|
|
|
|
'(("\\(\\*Compile-Log\\*\\)\\|\\(\\*Warnings\\*\\)"
|
|
|
|
(display-buffer-in-side-window)
|
|
|
|
(inhibit-same-window . t)
|
|
|
|
(side . bottom)
|
|
|
|
(window-height . 0.2)))))
|
2016-06-05 04:04:53 +00:00
|
|
|
;; ensure we have quelpa available first
|
2017-01-24 04:09:21 +00:00
|
|
|
(configuration-layer//configure-quelpa)
|
2016-07-17 19:00:43 +00:00
|
|
|
(let* ((upkg-names (configuration-layer//get-uninstalled-packages packages))
|
|
|
|
(not-inst-count (length upkg-names))
|
2016-06-04 04:00:52 +00:00
|
|
|
installed-count)
|
|
|
|
;; installation
|
2016-07-17 19:00:43 +00:00
|
|
|
(when upkg-names
|
2017-10-30 01:43:43 +00:00
|
|
|
(spacemacs-buffer/set-mode-line "Installing packages..." t)
|
2017-01-22 05:37:10 +00:00
|
|
|
(let ((delayed-warnings-backup delayed-warnings-list))
|
|
|
|
(spacemacs-buffer/append
|
|
|
|
(format "Found %s new package(s) to install...\n"
|
|
|
|
not-inst-count))
|
|
|
|
(configuration-layer/retrieve-package-archives)
|
|
|
|
(setq installed-count 0)
|
|
|
|
(spacemacs//redisplay)
|
2018-01-22 16:33:13 +00:00
|
|
|
;; bootstrap and pre step packages first
|
2017-01-22 05:37:10 +00:00
|
|
|
(dolist (pkg-name upkg-names)
|
2018-01-22 16:33:13 +00:00
|
|
|
(let ((pkg (configuration-layer/get-package pkg-name)))
|
|
|
|
(when (and pkg (memq (oref pkg :step) '(bootstrap pre)))
|
|
|
|
(setq installed-count (1+ installed-count))
|
|
|
|
(configuration-layer//install-package pkg))))
|
|
|
|
;; then all other packages
|
|
|
|
(dolist (pkg-name upkg-names)
|
|
|
|
(let ((pkg (configuration-layer/get-package pkg-name)))
|
|
|
|
(unless (and pkg (memq (oref pkg :step) '(bootstrap pre)))
|
|
|
|
(setq installed-count (1+ installed-count))
|
|
|
|
(configuration-layer//install-package pkg))))
|
2017-01-22 05:37:10 +00:00
|
|
|
(spacemacs-buffer/append "\n")
|
|
|
|
(unless init-file-debug
|
|
|
|
;; get rid of all delayed warnings when byte-compiling packages
|
|
|
|
;; unless --debug-init was passed on the command line
|
|
|
|
(setq delayed-warnings-list delayed-warnings-backup)))))))
|
2015-08-13 03:56:24 +00:00
|
|
|
|
2015-08-15 04:08:21 +00:00
|
|
|
(defun configuration-layer//install-from-elpa (pkg-name)
|
2015-08-13 03:56:24 +00:00
|
|
|
"Install PKG from ELPA."
|
|
|
|
(if (not (assq pkg-name package-archive-contents))
|
|
|
|
(spacemacs-buffer/append
|
|
|
|
(format (concat "\nPackage %s is unavailable. "
|
|
|
|
"Is the package name misspelled?\n")
|
|
|
|
pkg-name))
|
2016-07-09 15:36:27 +00:00
|
|
|
(let ((pkg-desc (assq pkg-name package-archive-contents)))
|
|
|
|
(dolist
|
|
|
|
(dep (configuration-layer//get-package-deps-from-archive
|
|
|
|
pkg-name))
|
2016-07-09 15:51:36 +00:00
|
|
|
(if (package-installed-p (car dep) (cadr dep))
|
2016-07-09 15:36:27 +00:00
|
|
|
(configuration-layer//activate-package (car dep))
|
2016-07-09 15:51:36 +00:00
|
|
|
(configuration-layer//install-from-elpa (car dep))))
|
2016-07-09 15:36:27 +00:00
|
|
|
(if pkg-desc
|
|
|
|
(package-install (cadr pkg-desc))
|
|
|
|
(package-install pkg-name)))))
|
2015-08-13 03:56:24 +00:00
|
|
|
|
|
|
|
(defun configuration-layer//install-from-recipe (pkg)
|
|
|
|
"Install PKG from a recipe."
|
2015-08-19 17:08:57 +00:00
|
|
|
(let* ((pkg-name (oref pkg :name))
|
2016-06-11 01:37:32 +00:00
|
|
|
(layer (car (oref pkg :owners)))
|
2015-08-14 19:31:22 +00:00
|
|
|
(recipe (cons pkg-name (cdr (oref pkg :location)))))
|
2015-08-13 03:56:24 +00:00
|
|
|
(if recipe
|
|
|
|
(quelpa recipe)
|
2016-06-11 02:47:45 +00:00
|
|
|
(configuration-layer//warning
|
2015-08-13 03:56:24 +00:00
|
|
|
(concat "Cannot find any recipe for package %S! Be sure "
|
|
|
|
"to add a recipe for it in alist %S.")
|
|
|
|
pkg-name recipes-var))))
|
2014-09-03 06:25:27 +00:00
|
|
|
|
2015-09-18 03:05:32 +00:00
|
|
|
(defun configuration-layer//filter-packages-with-deps
|
|
|
|
(pkg-names filter &optional use-archive)
|
2016-01-31 05:05:27 +00:00
|
|
|
"Return a filtered PKG-NAMES list where each elements satisfies FILTER."
|
2015-08-09 03:16:56 +00:00
|
|
|
(when pkg-names
|
2015-02-03 07:05:29 +00:00
|
|
|
(let (result)
|
2015-08-09 03:16:56 +00:00
|
|
|
(dolist (pkg-name pkg-names)
|
2015-02-03 07:05:29 +00:00
|
|
|
;; recursively check dependencies
|
|
|
|
(let* ((deps
|
2015-09-18 03:05:32 +00:00
|
|
|
(if use-archive
|
|
|
|
(configuration-layer//get-package-deps-from-archive
|
|
|
|
pkg-name)
|
|
|
|
(configuration-layer//get-package-deps-from-alist pkg-name)))
|
2015-04-08 03:51:08 +00:00
|
|
|
(install-deps
|
|
|
|
(when deps (configuration-layer//filter-packages-with-deps
|
|
|
|
(mapcar 'car deps) filter))))
|
|
|
|
(when install-deps
|
|
|
|
(setq result (append install-deps result))))
|
2015-08-09 03:16:56 +00:00
|
|
|
(when (funcall filter pkg-name)
|
|
|
|
(add-to-list 'result pkg-name t)))
|
2015-02-03 07:05:29 +00:00
|
|
|
(delete-dups result))))
|
2015-02-03 05:58:17 +00:00
|
|
|
|
2015-08-09 03:16:56 +00:00
|
|
|
(defun configuration-layer//get-uninstalled-packages (pkg-names)
|
|
|
|
"Return a filtered list of PKG-NAMES to install."
|
2015-04-08 03:51:08 +00:00
|
|
|
(configuration-layer//filter-packages-with-deps
|
2016-07-09 15:36:27 +00:00
|
|
|
pkg-names (lambda (x)
|
2016-07-17 19:00:43 +00:00
|
|
|
(let* ((pkg (configuration-layer/get-package x))
|
2016-07-09 15:36:27 +00:00
|
|
|
(min-version (when pkg (oref pkg :min-version))))
|
|
|
|
(not (package-installed-p x min-version))))))
|
2015-04-08 03:51:08 +00:00
|
|
|
|
2015-08-15 04:07:56 +00:00
|
|
|
(defun configuration-layer//package-has-recipe-p (pkg-name)
|
|
|
|
"Return non nil if PKG-NAME is the name of a package declared with a recipe."
|
2016-07-17 19:00:43 +00:00
|
|
|
(when (configuration-layer/get-package pkg-name)
|
|
|
|
(let* ((pkg (configuration-layer/get-package pkg-name))
|
2015-08-15 04:07:56 +00:00
|
|
|
(location (oref pkg :location)))
|
|
|
|
(and (listp location) (eq 'recipe (car location))))))
|
|
|
|
|
|
|
|
(defun configuration-layer//get-package-recipe (pkg-name)
|
|
|
|
"Return the recipe for PGK-NAME if it has one."
|
2016-07-17 19:00:43 +00:00
|
|
|
(let ((pkg (configuration-layer/get-package pkg-name)))
|
2015-08-15 04:07:56 +00:00
|
|
|
(when pkg
|
|
|
|
(let ((location (oref pkg :location)))
|
|
|
|
(when (and (listp location) (eq 'recipe (car location)))
|
2016-10-01 01:40:56 +00:00
|
|
|
(cons pkg-name (cdr location)))))))
|
2015-08-15 04:07:56 +00:00
|
|
|
|
|
|
|
(defun configuration-layer//new-version-available-p (pkg-name)
|
|
|
|
"Return non nil if there is a new version available for PKG-NAME."
|
|
|
|
(let ((recipe (configuration-layer//get-package-recipe pkg-name))
|
|
|
|
(cur-version (configuration-layer//get-package-version-string pkg-name))
|
2016-10-01 01:40:56 +00:00
|
|
|
(quelpa-upgrade-p t)
|
2015-08-15 04:07:56 +00:00
|
|
|
new-version)
|
|
|
|
(when cur-version
|
|
|
|
(setq new-version
|
|
|
|
(if recipe
|
2016-10-01 01:40:56 +00:00
|
|
|
(or (quelpa-checkout recipe (expand-file-name (symbol-name pkg-name) quelpa-build-dir)) cur-version)
|
2015-08-15 04:07:56 +00:00
|
|
|
(configuration-layer//get-latest-package-version-string
|
|
|
|
pkg-name)))
|
|
|
|
;; (message "%s: %s > %s ?" pkg-name cur-version new-version)
|
2015-08-29 07:09:13 +00:00
|
|
|
(if new-version
|
|
|
|
(version< cur-version new-version)
|
2016-07-09 18:14:55 +00:00
|
|
|
(cl-pushnew pkg-name
|
|
|
|
configuration-layer--check-new-version-error-packages
|
|
|
|
:test #'eq)
|
2015-08-29 07:09:13 +00:00
|
|
|
nil))))
|
2015-08-15 04:07:56 +00:00
|
|
|
|
2015-08-09 04:47:22 +00:00
|
|
|
(defun configuration-layer//get-packages-to-update (pkg-names)
|
|
|
|
"Return a filtered list of PKG-NAMES to update."
|
2015-04-08 03:51:08 +00:00
|
|
|
(configuration-layer//filter-packages-with-deps
|
2015-09-18 03:05:32 +00:00
|
|
|
pkg-names 'configuration-layer//new-version-available-p 'use-archive))
|
2015-04-08 03:51:08 +00:00
|
|
|
|
2015-08-09 02:57:12 +00:00
|
|
|
(defun configuration-layer//configure-packages (packages)
|
|
|
|
"Configure all passed PACKAGES honoring the steps order."
|
2018-06-10 06:32:29 +00:00
|
|
|
(spacemacs/init-progress-bar (length packages))
|
2016-04-03 04:28:47 +00:00
|
|
|
(spacemacs-buffer/message "+ Configuring bootstrap packages...")
|
|
|
|
(configuration-layer//configure-packages-2
|
|
|
|
(configuration-layer/filter-objects
|
2016-07-17 19:00:43 +00:00
|
|
|
packages (lambda (x)
|
|
|
|
(let ((pkg (configuration-layer/get-package x)))
|
|
|
|
(eq 'bootstrap (oref pkg :step))))))
|
2016-04-03 04:28:47 +00:00
|
|
|
(spacemacs-buffer/message "+ Configuring pre packages...")
|
2015-08-09 02:57:12 +00:00
|
|
|
(configuration-layer//configure-packages-2
|
2015-09-03 03:00:56 +00:00
|
|
|
(configuration-layer/filter-objects
|
2016-07-17 19:00:43 +00:00
|
|
|
packages (lambda (x)
|
|
|
|
(let ((pkg (configuration-layer/get-package x)))
|
|
|
|
(eq 'pre (oref pkg :step))))))
|
2016-04-03 04:28:47 +00:00
|
|
|
(spacemacs-buffer/message "+ Configuring packages...")
|
2015-08-09 02:57:12 +00:00
|
|
|
(configuration-layer//configure-packages-2
|
2015-09-03 03:00:56 +00:00
|
|
|
(configuration-layer/filter-objects
|
2016-07-17 19:00:43 +00:00
|
|
|
packages (lambda (x)
|
|
|
|
(let ((pkg (configuration-layer/get-package x)))
|
|
|
|
(null (oref pkg :step)))))))
|
2015-08-09 02:57:12 +00:00
|
|
|
|
|
|
|
(defun configuration-layer//configure-packages-2 (packages)
|
|
|
|
"Configure all passed PACKAGES."
|
2018-01-11 04:23:49 +00:00
|
|
|
(let (packages-to-configure)
|
|
|
|
(dolist (pkg-name packages)
|
|
|
|
(let ((pkg (configuration-layer/get-package pkg-name)))
|
2015-09-20 04:49:18 +00:00
|
|
|
(cond
|
2018-01-11 04:23:49 +00:00
|
|
|
((oref pkg :lazy-install)
|
|
|
|
(spacemacs-buffer/message
|
|
|
|
(format "%S ignored since it can be lazily installed." pkg-name)))
|
|
|
|
((and (oref pkg :excluded)
|
|
|
|
(not (oref pkg :protected)))
|
2015-09-20 04:49:18 +00:00
|
|
|
(spacemacs-buffer/message
|
2018-01-11 04:23:49 +00:00
|
|
|
(format "%S ignored since it has been excluded." pkg-name)))
|
|
|
|
((null (oref pkg :owners))
|
|
|
|
(spacemacs-buffer/message
|
|
|
|
(format "%S ignored since it has no owner layer." pkg-name)))
|
|
|
|
((not (configuration-layer//package-reqs-used-p pkg))
|
|
|
|
(spacemacs-buffer/message
|
|
|
|
(format (concat "%S is ignored since it has dependencies "
|
|
|
|
"that are not used.") pkg-name)))
|
|
|
|
((not (cfgl-package-enabled-p pkg))
|
|
|
|
(spacemacs-buffer/message (format "%S is disabled." pkg-name)))
|
2015-09-20 04:49:18 +00:00
|
|
|
(t
|
2018-01-11 04:23:49 +00:00
|
|
|
;; load-path
|
|
|
|
(let ((dir (configuration-layer/get-location-directory
|
|
|
|
pkg-name
|
|
|
|
(oref pkg :location)
|
|
|
|
(car (oref pkg :owners)))))
|
|
|
|
(when dir
|
|
|
|
(add-to-list 'load-path dir)))
|
|
|
|
;; configuration
|
|
|
|
(unless (memq (oref pkg :location) '(local site built-in))
|
|
|
|
(configuration-layer//activate-package pkg-name))
|
|
|
|
(cond
|
|
|
|
((eq 'dotfile (car (oref pkg :owners)))
|
|
|
|
(spacemacs-buffer/message
|
|
|
|
(format "%S is configured in the dotfile." pkg-name)))
|
|
|
|
(t
|
|
|
|
;; first loop executes pre-init functions, this allows to setup
|
|
|
|
;; use-package hooks without sorting issues.
|
|
|
|
;; For instance a package B adds a use-package hook on package A,
|
|
|
|
;; since we configure packages in alphabetical order, the package B
|
|
|
|
;; is configured after package A. But we need B to setup the
|
|
|
|
;; use-package hook for A before A is being actually configured.
|
|
|
|
;; The solution is to always put use-package hook declarations in
|
|
|
|
;; pre-init functions and first call all pre-init functions so we
|
|
|
|
;; effectively setup all the use-package hooks. Then we configure
|
|
|
|
;; the packages in alphabetical order as usual.
|
|
|
|
(push pkg packages-to-configure)
|
|
|
|
(configuration-layer//pre-configure-package pkg)))))))
|
2018-01-12 04:52:18 +00:00
|
|
|
(setq packages-to-configure (reverse packages-to-configure))
|
|
|
|
(mapc 'configuration-layer//configure-package packages-to-configure)
|
|
|
|
(mapc 'configuration-layer//post-configure-package packages-to-configure)))
|
2015-08-09 02:57:12 +00:00
|
|
|
|
2017-02-06 04:01:50 +00:00
|
|
|
(defun configuration-layer/get-location-directory (pkg-name location owner)
|
|
|
|
"Return the location on disk for PKG."
|
|
|
|
(cond
|
|
|
|
((stringp location)
|
|
|
|
(if (file-directory-p location)
|
|
|
|
(file-name-as-directory location)
|
|
|
|
(configuration-layer//warning
|
2018-11-17 15:27:38 +00:00
|
|
|
"Location path for package %S does not exist (value: %s)."
|
2017-02-06 04:01:50 +00:00
|
|
|
pkg-name location)
|
|
|
|
nil))
|
|
|
|
((eq 'local location)
|
|
|
|
(let ((dir (if (eq 'dotfile owner)
|
2018-06-25 06:16:27 +00:00
|
|
|
spacemacs-private-directory
|
2017-02-06 04:01:50 +00:00
|
|
|
(let* ((owner (configuration-layer/get-layer owner)))
|
|
|
|
(when owner (oref owner :dir))))))
|
|
|
|
(if dir
|
|
|
|
(file-name-as-directory (format "%slocal/%S/" dir pkg-name))
|
|
|
|
(configuration-layer//warning
|
|
|
|
"Cannot find path location path for package %S." pkg-name)
|
|
|
|
nil)))))
|
|
|
|
|
2016-08-30 09:26:38 +00:00
|
|
|
(defun configuration-layer//package-enabled-p (pkg layer)
|
|
|
|
"Returns true if PKG should be configured for LAYER.
|
|
|
|
LAYER must not be the owner of PKG."
|
|
|
|
(let* ((owner (configuration-layer/get-layer (car (oref pkg :owners))))
|
2017-07-01 08:33:43 +00:00
|
|
|
(disabled (when owner (oref owner :disabled-for)))
|
|
|
|
(enabled (when owner (oref owner :enabled-for))))
|
|
|
|
(and owner
|
|
|
|
(not (memq nil (mapcar
|
core: implement :depends for package declarations
This replaces the older pattern
:toggle (configuration-layer/package-usedp ..)
This implementation ensures that :disabled-for honors dependent packages, i.e.
if package a depends on package b, which is owned by layer c, and layer c is
disabled for layer d, then neither package a nor b will be configured for layer
d. Previously, this was only true for package a, but not b.
This commit also fixes:
- configuration-layer/describe-package now shows which post-init and pre-init
functions are disabled, if any
- Does not recreate all layer objects unconditionally when calling
configuration-layer/discover-layers. Previously, this led to all layers being
recreated after e.g. `SPC h SPC`, without any of the dotfile information.
Since this information is now necessary for
configuration-layer/describe-package, it’s important that we don’t clear the
indexed layers when invoking this function.
2017-06-21 10:27:59 +00:00
|
|
|
(lambda (dep-pkg)
|
|
|
|
(let ((pkg-obj (configuration-layer/get-package dep-pkg)))
|
|
|
|
(when pkg-obj
|
|
|
|
(configuration-layer//package-enabled-p pkg-obj layer))))
|
2017-07-03 07:52:54 +00:00
|
|
|
(oref pkg :requires))))
|
core: implement :depends for package declarations
This replaces the older pattern
:toggle (configuration-layer/package-usedp ..)
This implementation ensures that :disabled-for honors dependent packages, i.e.
if package a depends on package b, which is owned by layer c, and layer c is
disabled for layer d, then neither package a nor b will be configured for layer
d. Previously, this was only true for package a, but not b.
This commit also fixes:
- configuration-layer/describe-package now shows which post-init and pre-init
functions are disabled, if any
- Does not recreate all layer objects unconditionally when calling
configuration-layer/discover-layers. Previously, this led to all layers being
recreated after e.g. `SPC h SPC`, without any of the dotfile information.
Since this information is now necessary for
configuration-layer/describe-package, it’s important that we don’t clear the
indexed layers when invoking this function.
2017-06-21 10:27:59 +00:00
|
|
|
(if (not (eq 'unspecified enabled))
|
|
|
|
(memq layer enabled)
|
|
|
|
(not (memq layer disabled))))))
|
2016-08-30 09:26:38 +00:00
|
|
|
|
2018-01-11 04:23:49 +00:00
|
|
|
(defun configuration-layer//pre-configure-package (pkg)
|
|
|
|
"Pre-configure PKG object, i.e. call its pre-init functions."
|
2015-09-03 03:01:26 +00:00
|
|
|
(let* ((pkg-name (oref pkg :name))
|
2016-08-30 09:26:38 +00:00
|
|
|
(owner (car (oref pkg :owners))))
|
2016-08-20 00:04:33 +00:00
|
|
|
(mapc
|
|
|
|
(lambda (layer)
|
2017-07-02 13:48:06 +00:00
|
|
|
(when (configuration-layer/layer-used-p layer)
|
2016-08-30 09:26:38 +00:00
|
|
|
(if (not (configuration-layer//package-enabled-p pkg layer))
|
2016-08-20 00:04:33 +00:00
|
|
|
(spacemacs-buffer/message
|
2018-01-11 04:23:49 +00:00
|
|
|
(format "%S -> ignored pre-init (%S)..." pkg-name layer))
|
2016-08-20 00:04:33 +00:00
|
|
|
(spacemacs-buffer/message
|
2018-01-11 04:23:49 +00:00
|
|
|
(format "%S -> pre-init (%S)..." pkg-name layer))
|
2016-08-20 00:04:33 +00:00
|
|
|
(condition-case-unless-debug err
|
|
|
|
(funcall (intern (format "%S/pre-init-%S" layer pkg-name)))
|
|
|
|
('error
|
2017-10-30 02:01:39 +00:00
|
|
|
(configuration-layer//error
|
|
|
|
(concat "\nAn error occurred while pre-configuring %S "
|
|
|
|
"in layer %S (error: %s)\n")
|
|
|
|
pkg-name layer err))))))
|
2018-01-11 04:23:49 +00:00
|
|
|
(oref pkg :pre-layers))))
|
|
|
|
|
|
|
|
(defun configuration-layer//configure-package (pkg)
|
2018-01-12 04:52:18 +00:00
|
|
|
"Configure PKG object, i.e. call its post-init function."
|
2018-06-10 06:32:29 +00:00
|
|
|
(spacemacs/update-progress-bar)
|
2018-01-11 04:23:49 +00:00
|
|
|
(let* ((pkg-name (oref pkg :name))
|
|
|
|
(owner (car (oref pkg :owners))))
|
2015-08-09 02:57:12 +00:00
|
|
|
;; init
|
2018-01-11 04:23:49 +00:00
|
|
|
(spacemacs-buffer/message (format "%S -> init (%S)..." pkg-name owner))
|
2018-01-12 04:52:18 +00:00
|
|
|
(funcall (intern (format "%S/init-%S" owner pkg-name)))))
|
|
|
|
|
|
|
|
(defun configuration-layer//post-configure-package (pkg)
|
|
|
|
"Post-configure PKG object, i.e. call its post-init functions."
|
|
|
|
(let* ((pkg-name (oref pkg :name))
|
|
|
|
(owner (car (oref pkg :owners))))
|
2016-08-20 00:04:33 +00:00
|
|
|
(mapc
|
|
|
|
(lambda (layer)
|
2017-07-02 13:48:06 +00:00
|
|
|
(when (configuration-layer/layer-used-p layer)
|
2016-08-30 09:26:38 +00:00
|
|
|
(if (not (configuration-layer//package-enabled-p pkg layer))
|
2016-08-20 00:04:33 +00:00
|
|
|
(spacemacs-buffer/message
|
2018-01-11 04:23:49 +00:00
|
|
|
(format "%S -> ignored post-init (%S)..." pkg-name layer))
|
2016-08-20 00:04:33 +00:00
|
|
|
(spacemacs-buffer/message
|
2018-01-11 04:23:49 +00:00
|
|
|
(format "%S -> post-init (%S)..." pkg-name layer))
|
2016-08-20 00:04:33 +00:00
|
|
|
(condition-case-unless-debug err
|
|
|
|
(funcall (intern (format "%S/post-init-%S" layer pkg-name)))
|
|
|
|
('error
|
2017-10-30 02:01:39 +00:00
|
|
|
(configuration-layer//error
|
|
|
|
(concat "\nAn error occurred while post-configuring %S "
|
|
|
|
"in layer %S (error: %s)\n")
|
|
|
|
pkg-name layer err))))))
|
2017-06-23 16:29:15 +00:00
|
|
|
(oref pkg :post-layers))))
|
2015-08-09 02:57:12 +00:00
|
|
|
|
2015-11-10 22:34:27 +00:00
|
|
|
(defun configuration-layer//cleanup-rollback-directory ()
|
2015-11-10 21:40:26 +00:00
|
|
|
"Clean up the rollback directory."
|
|
|
|
(let* ((dirattrs (delq nil
|
|
|
|
(mapcar (lambda (d)
|
|
|
|
(unless (eq t d) d))
|
|
|
|
(directory-files-and-attributes
|
|
|
|
configuration-layer-rollback-directory
|
|
|
|
nil "\\`\\(\\.\\{0,2\\}[^.\n].*\\)\\'" t))))
|
|
|
|
(dirs (sort dirattrs
|
|
|
|
(lambda (d e)
|
|
|
|
(time-less-p (nth 6 d) (nth 6 e))))))
|
2015-11-11 05:14:46 +00:00
|
|
|
(dotimes (c (- (length dirs) dotspacemacs-max-rollback-slots))
|
2015-11-10 21:40:26 +00:00
|
|
|
(delete-directory (concat configuration-layer-rollback-directory
|
|
|
|
"/" (car (pop dirs)))
|
|
|
|
t t))))
|
2015-11-08 19:20:43 +00:00
|
|
|
|
2017-07-30 16:54:42 +00:00
|
|
|
(defun configuration-layer/update-packages (&optional no-confirmation)
|
2015-08-09 04:47:22 +00:00
|
|
|
"Update packages.
|
|
|
|
|
2017-07-30 16:54:42 +00:00
|
|
|
If called with a prefix argument or NO-CONFIRMATION is non-nil then assume yes
|
|
|
|
to update."
|
2015-06-28 02:33:48 +00:00
|
|
|
(interactive "P")
|
2015-04-12 04:24:03 +00:00
|
|
|
(spacemacs-buffer/insert-page-break)
|
2016-01-11 05:29:12 +00:00
|
|
|
(spacemacs-buffer/append "\nUpdating package archives, please wait...\n")
|
2015-12-03 04:49:00 +00:00
|
|
|
(configuration-layer/retrieve-package-archives nil 'force)
|
2016-07-09 18:14:55 +00:00
|
|
|
(setq configuration-layer--check-new-version-error-packages nil)
|
2017-07-30 16:50:39 +00:00
|
|
|
(let* ((distant-packages (configuration-layer//filter-distant-packages
|
|
|
|
configuration-layer--used-packages t))
|
|
|
|
(update-packages
|
2017-08-13 17:17:59 +00:00
|
|
|
(configuration-layer//get-packages-to-update distant-packages))
|
2016-07-09 18:14:55 +00:00
|
|
|
(skipped-count (length
|
|
|
|
configuration-layer--check-new-version-error-packages))
|
2015-02-04 04:56:38 +00:00
|
|
|
(date (format-time-string "%y-%m-%d_%H.%M.%S"))
|
|
|
|
(rollback-dir (expand-file-name
|
|
|
|
(concat configuration-layer-rollback-directory
|
|
|
|
(file-name-as-directory date))))
|
|
|
|
(upgrade-count (length update-packages))
|
|
|
|
(upgraded-count 0)
|
|
|
|
(update-packages-alist))
|
2016-07-09 18:14:55 +00:00
|
|
|
(when configuration-layer--check-new-version-error-packages
|
2017-10-30 02:01:39 +00:00
|
|
|
(spacemacs-buffer/warning
|
|
|
|
(concat "--> Warning: cannot update %s package(s), possibly due"
|
|
|
|
" to a temporary network problem: %s\n")
|
|
|
|
skipped-count
|
|
|
|
(mapconcat #'symbol-name
|
|
|
|
configuration-layer--check-new-version-error-packages
|
|
|
|
" ")))
|
2015-08-09 04:47:22 +00:00
|
|
|
;; (message "packages to udpate: %s" update-packages)
|
2016-01-11 05:29:12 +00:00
|
|
|
(when (> upgrade-count 0)
|
|
|
|
(spacemacs-buffer/append
|
|
|
|
(format (concat "--> Found %s package(s) to update"
|
|
|
|
(if (> skipped-count 0)
|
|
|
|
(format " (skipped %s):\n" skipped-count)
|
|
|
|
":\n"))
|
|
|
|
upgrade-count) t)
|
|
|
|
(mapc (lambda (x)
|
2016-07-09 18:55:45 +00:00
|
|
|
(spacemacs-buffer/append
|
|
|
|
(format (if (memq (intern x) dotspacemacs-frozen-packages)
|
|
|
|
"%s (won't be updated because package is frozen)\n"
|
|
|
|
"%s\n") x) t))
|
2016-01-11 15:59:52 +00:00
|
|
|
(sort (mapcar 'symbol-name update-packages) 'string<))
|
2017-07-30 16:54:42 +00:00
|
|
|
(if (and (not no-confirmation)
|
2016-01-11 05:29:12 +00:00
|
|
|
(not (yes-or-no-p
|
2018-10-18 12:34:04 +00:00
|
|
|
(format "Do you want to update %s package(s)? "
|
2016-01-11 05:29:12 +00:00
|
|
|
upgrade-count))))
|
|
|
|
(spacemacs-buffer/append "Packages update has been cancelled.\n" t)
|
|
|
|
;; backup the package directory and construct an alist
|
|
|
|
;; variable to be cached for easy update and rollback
|
|
|
|
(spacemacs-buffer/append
|
|
|
|
"--> performing backup of package(s) to update...\n" t)
|
|
|
|
(spacemacs//redisplay)
|
|
|
|
(dolist (pkg update-packages)
|
2016-07-09 18:55:45 +00:00
|
|
|
(unless (memq pkg dotspacemacs-frozen-packages)
|
|
|
|
(let* ((src-dir (configuration-layer//get-package-directory pkg))
|
|
|
|
(dest-dir (expand-file-name
|
|
|
|
(concat rollback-dir
|
|
|
|
(file-name-as-directory
|
|
|
|
(file-name-nondirectory src-dir))))))
|
|
|
|
(copy-directory src-dir dest-dir 'keeptime 'create 'copy-content)
|
|
|
|
(push (cons pkg (file-name-nondirectory src-dir))
|
|
|
|
update-packages-alist))))
|
2016-01-11 05:29:12 +00:00
|
|
|
(spacemacs/dump-vars-to-file
|
|
|
|
'(update-packages-alist)
|
|
|
|
(expand-file-name (concat rollback-dir
|
|
|
|
configuration-layer-rollback-info)))
|
|
|
|
(dolist (pkg update-packages)
|
2016-07-09 18:55:45 +00:00
|
|
|
(unless (memq pkg dotspacemacs-frozen-packages)
|
|
|
|
(setq upgraded-count (1+ upgraded-count))
|
|
|
|
(spacemacs-buffer/replace-last-line
|
|
|
|
(format "--> preparing update of package %s... [%s/%s]"
|
|
|
|
pkg upgraded-count upgrade-count) t)
|
|
|
|
(spacemacs//redisplay)
|
|
|
|
(configuration-layer//package-delete pkg)))
|
2016-01-11 05:29:12 +00:00
|
|
|
(spacemacs-buffer/append
|
|
|
|
(format "\n--> %s package(s) to be updated.\n" upgraded-count))
|
|
|
|
(spacemacs-buffer/append
|
2016-11-16 21:09:17 +00:00
|
|
|
(format
|
|
|
|
(concat "\nEmacs has to be restarted to actually install the "
|
|
|
|
"new version of the packages%s.\n")
|
|
|
|
(if (member "restart-emacs" update-packages) "" " (SPC q r)")))
|
2016-01-11 05:29:12 +00:00
|
|
|
(configuration-layer//cleanup-rollback-directory)
|
|
|
|
(spacemacs//redisplay)))
|
|
|
|
(when (eq upgrade-count 0)
|
2015-04-12 04:24:03 +00:00
|
|
|
(spacemacs-buffer/append "--> All packages are up to date.\n")
|
2015-02-16 02:25:12 +00:00
|
|
|
(spacemacs//redisplay))))
|
2014-12-28 18:46:15 +00:00
|
|
|
|
2015-02-04 04:56:38 +00:00
|
|
|
(defun configuration-layer//ido-candidate-rollback-slot ()
|
|
|
|
"Return a list of candidates to select a rollback slot."
|
|
|
|
(let ((rolldir configuration-layer-rollback-directory))
|
|
|
|
(when (file-exists-p rolldir)
|
|
|
|
(reverse
|
|
|
|
(delq nil (mapcar
|
|
|
|
(lambda (x)
|
2016-01-21 09:46:00 +00:00
|
|
|
(when (and (file-directory-p (concat rolldir x))
|
|
|
|
(not (or (string= "." x) (string= ".." x))))
|
2015-02-11 02:56:44 +00:00
|
|
|
(let ((p (length (directory-files (file-name-as-directory
|
|
|
|
(concat rolldir x))))))
|
|
|
|
;; -3 for . .. and rollback-info
|
|
|
|
(format "%s (%s packages)" x (- p 3)))))
|
2015-02-04 04:56:38 +00:00
|
|
|
(directory-files rolldir)))))))
|
|
|
|
|
|
|
|
(defun configuration-layer/rollback (slot)
|
|
|
|
"Rollback all the packages in the given SLOT.
|
|
|
|
If called interactively and SLOT is nil then an ido buffers appears
|
|
|
|
to select one."
|
|
|
|
(interactive
|
|
|
|
(list
|
|
|
|
(if (boundp 'slot) slot
|
|
|
|
(let ((candidates (configuration-layer//ido-candidate-rollback-slot)))
|
|
|
|
(when candidates
|
2015-02-11 02:56:44 +00:00
|
|
|
(ido-completing-read "Rollback slots (most recent are first): "
|
2015-02-04 04:56:38 +00:00
|
|
|
candidates))))))
|
2015-04-12 04:24:03 +00:00
|
|
|
(spacemacs-buffer/insert-page-break)
|
2015-02-11 02:56:44 +00:00
|
|
|
(if (not slot)
|
2018-05-06 15:49:53 +00:00
|
|
|
(configuration-layer/message "No rollback slot available.")
|
2015-02-11 02:56:44 +00:00
|
|
|
(string-match "^\\(.+?\\)\s.*$" slot)
|
|
|
|
(let* ((slot-dir (match-string 1 slot))
|
|
|
|
(rollback-dir (file-name-as-directory
|
|
|
|
(concat configuration-layer-rollback-directory
|
|
|
|
(file-name-as-directory slot-dir))))
|
|
|
|
(info-file (expand-file-name
|
|
|
|
(concat rollback-dir
|
|
|
|
configuration-layer-rollback-info))))
|
2015-04-12 04:24:03 +00:00
|
|
|
(spacemacs-buffer/append
|
2015-02-11 02:56:44 +00:00
|
|
|
(format "\nRollbacking ELPA packages from slot %s...\n" slot-dir))
|
2018-06-10 06:46:16 +00:00
|
|
|
(configuration-layer/load-file info-file)
|
2015-02-11 02:56:44 +00:00
|
|
|
(let ((rollback-count (length update-packages-alist))
|
|
|
|
(rollbacked-count 0))
|
2015-04-12 04:24:03 +00:00
|
|
|
(spacemacs-buffer/append
|
2015-02-11 02:56:44 +00:00
|
|
|
(format "Found %s package(s) to rollback...\n" rollback-count))
|
2015-02-16 02:25:12 +00:00
|
|
|
(spacemacs//redisplay)
|
2015-02-11 02:56:44 +00:00
|
|
|
(dolist (apkg update-packages-alist)
|
|
|
|
(let* ((pkg (car apkg))
|
|
|
|
(pkg-dir-name (cdr apkg))
|
2015-04-08 03:51:08 +00:00
|
|
|
(installed-ver
|
|
|
|
(configuration-layer//get-package-version-string pkg))
|
2016-03-08 12:53:11 +00:00
|
|
|
(elpa-dir (file-name-as-directory package-user-dir))
|
2015-02-11 02:56:44 +00:00
|
|
|
(src-dir (expand-file-name
|
|
|
|
(concat rollback-dir (file-name-as-directory
|
|
|
|
pkg-dir-name))))
|
|
|
|
(dest-dir (expand-file-name
|
|
|
|
(concat elpa-dir (file-name-as-directory
|
|
|
|
pkg-dir-name)))))
|
2016-07-09 18:55:45 +00:00
|
|
|
(unless (memq pkg dotspacemacs-frozen-packages)
|
|
|
|
(setq rollbacked-count (1+ rollbacked-count))
|
|
|
|
(if (string-equal (format "%S-%s" pkg installed-ver) pkg-dir-name)
|
|
|
|
(spacemacs-buffer/replace-last-line
|
|
|
|
(format "--> package %s already rolled back! [%s/%s]"
|
|
|
|
pkg rollbacked-count rollback-count) t)
|
|
|
|
;; rollback the package
|
2015-04-12 04:24:03 +00:00
|
|
|
(spacemacs-buffer/replace-last-line
|
2016-07-09 18:55:45 +00:00
|
|
|
(format "--> rolling back package %s... [%s/%s]"
|
2015-04-08 03:51:08 +00:00
|
|
|
pkg rollbacked-count rollback-count) t)
|
2016-07-09 18:55:45 +00:00
|
|
|
(configuration-layer//package-delete pkg)
|
|
|
|
(copy-directory src-dir dest-dir
|
|
|
|
'keeptime 'create 'copy-content)))
|
2015-04-08 03:51:08 +00:00
|
|
|
(spacemacs//redisplay)))
|
2015-04-12 04:24:03 +00:00
|
|
|
(spacemacs-buffer/append
|
2015-12-09 09:55:32 +00:00
|
|
|
(format "\n--> %s packages rolled back.\n" rollbacked-count))
|
2015-04-12 04:24:03 +00:00
|
|
|
(spacemacs-buffer/append
|
2015-02-11 02:56:44 +00:00
|
|
|
"\nEmacs has to be restarted for the changes to take effect.\n")))))
|
2015-02-04 04:56:38 +00:00
|
|
|
|
2015-01-10 05:58:27 +00:00
|
|
|
(defun configuration-layer//activate-package (pkg)
|
|
|
|
"Activate PKG."
|
2016-06-21 01:50:30 +00:00
|
|
|
(unless (memq pkg package-activated-list)
|
|
|
|
(package-activate pkg)))
|
2015-01-10 05:58:27 +00:00
|
|
|
|
2017-01-17 05:23:04 +00:00
|
|
|
(defun configuration-layer//get-packages-upstream-dependencies-from-alist ()
|
2018-08-01 18:51:57 +00:00
|
|
|
"Returns upstream dependencies hash map for all packages in `package-alist'.
|
2017-01-17 05:23:04 +00:00
|
|
|
The keys are package names and the values are lists of package names that
|
|
|
|
depends on it."
|
|
|
|
(let ((result (make-hash-table :size 1024)))
|
2014-10-21 05:41:33 +00:00
|
|
|
(dolist (pkg package-alist)
|
|
|
|
(let* ((pkg-sym (car pkg))
|
2015-09-18 03:05:32 +00:00
|
|
|
(deps (configuration-layer//get-package-deps-from-alist pkg-sym)))
|
2014-10-21 05:41:33 +00:00
|
|
|
(dolist (dep deps)
|
|
|
|
(let* ((dep-sym (car dep))
|
|
|
|
(value (ht-get result dep-sym)))
|
|
|
|
(puthash dep-sym
|
|
|
|
(if value (add-to-list 'value pkg-sym) (list pkg-sym))
|
|
|
|
result)))))
|
|
|
|
result))
|
|
|
|
|
2017-01-17 05:23:04 +00:00
|
|
|
(defun configuration-layer//get-implicit-packages-from-alist (packages)
|
2015-08-09 04:21:18 +00:00
|
|
|
"Returns packages in `packages-alist' which are not found in PACKAGES."
|
|
|
|
(let (imp-pkgs)
|
2014-10-21 05:41:33 +00:00
|
|
|
(dolist (pkg package-alist)
|
|
|
|
(let ((pkg-sym (car pkg)))
|
2016-07-17 19:00:43 +00:00
|
|
|
(unless (memq pkg-sym packages)
|
2015-08-08 04:01:36 +00:00
|
|
|
(add-to-list 'imp-pkgs pkg-sym))))
|
2014-10-21 05:41:33 +00:00
|
|
|
imp-pkgs))
|
|
|
|
|
2015-08-26 02:52:26 +00:00
|
|
|
(defun configuration-layer//get-orphan-packages
|
|
|
|
(dist-pkgs implicit-pkgs dependencies)
|
2015-08-09 04:21:18 +00:00
|
|
|
"Return orphan packages."
|
|
|
|
(let (result)
|
2014-10-21 05:41:33 +00:00
|
|
|
(dolist (imp-pkg implicit-pkgs)
|
2015-08-26 02:52:26 +00:00
|
|
|
(when (configuration-layer//is-package-orphan
|
|
|
|
imp-pkg dist-pkgs dependencies)
|
2015-08-09 04:21:18 +00:00
|
|
|
(add-to-list 'result imp-pkg)))
|
2014-11-11 05:09:52 +00:00
|
|
|
result))
|
|
|
|
|
2015-08-26 02:52:26 +00:00
|
|
|
(defun configuration-layer//is-package-orphan (pkg-name dist-pkgs dependencies)
|
2015-08-09 04:21:18 +00:00
|
|
|
"Returns not nil if PKG-NAME is the name of an orphan package."
|
2016-07-17 19:00:43 +00:00
|
|
|
(unless (or (memq pkg-name dist-pkgs)
|
2015-11-04 13:21:36 +00:00
|
|
|
(memq pkg-name configuration-layer--protected-packages))
|
2015-08-09 04:21:18 +00:00
|
|
|
(if (ht-contains? dependencies pkg-name)
|
|
|
|
(let ((parents (ht-get dependencies pkg-name)))
|
2015-12-16 14:45:08 +00:00
|
|
|
(cl-reduce (lambda (x y) (and x y))
|
|
|
|
(mapcar (lambda (p) (configuration-layer//is-package-orphan
|
|
|
|
p dist-pkgs dependencies))
|
|
|
|
parents)
|
|
|
|
:initial-value t))
|
2016-07-17 19:00:43 +00:00
|
|
|
(not (memq pkg-name dist-pkgs)))))
|
2014-10-21 05:41:33 +00:00
|
|
|
|
2015-08-09 04:27:21 +00:00
|
|
|
(defun configuration-layer//get-package-directory (pkg-name)
|
|
|
|
"Return the directory path for package with name PKG-NAME."
|
|
|
|
(let ((pkg-desc (assq pkg-name package-alist)))
|
2016-06-21 01:50:30 +00:00
|
|
|
(package-desc-dir (cadr pkg-desc))))
|
2015-02-04 05:28:58 +00:00
|
|
|
|
2015-09-18 03:05:32 +00:00
|
|
|
(defun configuration-layer//get-package-deps-from-alist (pkg-name)
|
2015-08-09 04:27:21 +00:00
|
|
|
"Return the dependencies alist for package with name PKG-NAME."
|
|
|
|
(let ((pkg-desc (assq pkg-name package-alist)))
|
2016-06-21 01:50:30 +00:00
|
|
|
(when pkg-desc (package-desc-reqs (cadr pkg-desc)))))
|
2014-10-25 02:39:03 +00:00
|
|
|
|
2015-08-09 03:16:56 +00:00
|
|
|
(defun configuration-layer//get-package-deps-from-archive (pkg-name)
|
|
|
|
"Return the dependencies alist for a PKG-NAME from the archive data."
|
|
|
|
(let* ((pkg-arch (assq pkg-name package-archive-contents))
|
2016-06-21 01:50:30 +00:00
|
|
|
(reqs (when pkg-arch (package-desc-reqs (cadr pkg-arch)))))
|
2015-01-10 06:55:36 +00:00
|
|
|
;; recursively get the requirements of reqs
|
|
|
|
(dolist (req reqs)
|
2015-08-09 03:16:56 +00:00
|
|
|
(let* ((pkg-name2 (car req))
|
|
|
|
(reqs2 (configuration-layer//get-package-deps-from-archive
|
|
|
|
pkg-name2)))
|
2015-01-10 06:55:36 +00:00
|
|
|
(when reqs2 (setq reqs (append reqs2 reqs)))))
|
|
|
|
reqs))
|
2015-01-10 05:58:27 +00:00
|
|
|
|
2015-08-09 04:27:21 +00:00
|
|
|
(defun configuration-layer//get-package-version-string (pkg-name)
|
|
|
|
"Return the version string for package with name PKG-NAME."
|
|
|
|
(let ((pkg-desc (assq pkg-name package-alist)))
|
2015-02-04 05:28:58 +00:00
|
|
|
(when pkg-desc
|
2016-06-21 01:50:30 +00:00
|
|
|
(package-version-join (package-desc-version (cadr pkg-desc))))))
|
2014-12-28 18:46:15 +00:00
|
|
|
|
2015-08-09 04:27:21 +00:00
|
|
|
(defun configuration-layer//get-package-version (pkg-name)
|
|
|
|
"Return the version list for package with name PKG-NAME."
|
2016-06-11 02:47:45 +00:00
|
|
|
(let ((version-string (configuration-layer//get-package-version-string
|
|
|
|
pkg-name)))
|
2015-02-09 04:03:52 +00:00
|
|
|
(unless (string-empty-p version-string)
|
|
|
|
(version-to-list version-string))))
|
|
|
|
|
2015-08-09 04:27:21 +00:00
|
|
|
(defun configuration-layer//get-latest-package-version-string (pkg-name)
|
|
|
|
"Return the version string for package with name PKG-NAME."
|
|
|
|
(let ((pkg-arch (assq pkg-name package-archive-contents)))
|
2015-02-04 05:28:58 +00:00
|
|
|
(when pkg-arch
|
2016-06-21 01:50:30 +00:00
|
|
|
(package-version-join (package-desc-version (cadr pkg-arch))))))
|
2014-10-25 02:39:03 +00:00
|
|
|
|
2015-08-09 04:27:21 +00:00
|
|
|
(defun configuration-layer//get-latest-package-version (pkg-name)
|
|
|
|
"Return the versio list for package with name PKG-NAME."
|
2015-02-11 02:57:14 +00:00
|
|
|
(let ((version-string
|
2015-08-09 04:27:21 +00:00
|
|
|
(configuration-layer//get-latest-package-version-string pkg-name)))
|
2015-02-09 04:03:52 +00:00
|
|
|
(unless (string-empty-p version-string)
|
|
|
|
(version-to-list version-string))))
|
|
|
|
|
2015-08-09 04:21:18 +00:00
|
|
|
(defun configuration-layer//package-delete (pkg-name)
|
|
|
|
"Delete package with name PKG-NAME."
|
2014-10-25 02:39:03 +00:00
|
|
|
(cond
|
2015-08-14 15:28:14 +00:00
|
|
|
((version<= "25.0.50" emacs-version)
|
|
|
|
(let ((p (cadr (assq pkg-name package-alist))))
|
|
|
|
;; add force flag to ignore dependency checks in Emacs25
|
2015-09-14 12:52:20 +00:00
|
|
|
(when p (package-delete p t t))))
|
2015-08-09 04:21:18 +00:00
|
|
|
(t (let ((p (cadr (assq pkg-name package-alist))))
|
2015-02-11 02:57:14 +00:00
|
|
|
(when p (package-delete p))))))
|
2014-10-21 05:41:33 +00:00
|
|
|
|
2015-08-09 04:21:18 +00:00
|
|
|
(defun configuration-layer/delete-orphan-packages (packages)
|
|
|
|
"Delete PACKAGES if they are orphan."
|
2014-10-21 05:41:33 +00:00
|
|
|
(interactive)
|
2017-01-17 05:23:04 +00:00
|
|
|
(let* ((dependencies
|
|
|
|
(configuration-layer//get-packages-upstream-dependencies-from-alist))
|
|
|
|
(implicit-packages
|
|
|
|
(configuration-layer//get-implicit-packages-from-alist
|
|
|
|
packages))
|
2015-11-04 13:21:36 +00:00
|
|
|
(orphans (configuration-layer//get-orphan-packages
|
2016-07-17 19:00:43 +00:00
|
|
|
packages
|
2015-11-04 13:21:36 +00:00
|
|
|
implicit-packages
|
|
|
|
dependencies))
|
2015-12-16 15:10:26 +00:00
|
|
|
(orphans-count (length orphans))
|
|
|
|
deleted-count)
|
2014-11-15 04:54:08 +00:00
|
|
|
;; (message "dependencies: %s" dependencies)
|
|
|
|
;; (message "implicit: %s" implicit-packages)
|
|
|
|
;; (message "orphans: %s" orphans)
|
2014-10-21 19:43:08 +00:00
|
|
|
(if orphans
|
|
|
|
(progn
|
2017-10-30 01:43:43 +00:00
|
|
|
(spacemacs-buffer/set-mode-line "Uninstalling unused packages..." t)
|
2015-04-12 04:24:03 +00:00
|
|
|
(spacemacs-buffer/append
|
2014-10-21 19:43:08 +00:00
|
|
|
(format "Found %s orphan package(s) to delete...\n"
|
|
|
|
orphans-count))
|
|
|
|
(setq deleted-count 0)
|
|
|
|
(dolist (orphan orphans)
|
|
|
|
(setq deleted-count (1+ deleted-count))
|
2015-04-12 04:24:03 +00:00
|
|
|
(spacemacs-buffer/replace-last-line
|
2014-10-21 19:43:08 +00:00
|
|
|
(format "--> deleting %s... [%s/%s]"
|
|
|
|
orphan
|
|
|
|
deleted-count
|
|
|
|
orphans-count) t)
|
2016-09-04 16:29:52 +00:00
|
|
|
(configuration-layer//package-delete orphan)
|
2015-02-16 02:25:12 +00:00
|
|
|
(spacemacs//redisplay))
|
2015-04-12 04:24:03 +00:00
|
|
|
(spacemacs-buffer/append "\n"))
|
|
|
|
(spacemacs-buffer/message "No orphan package to delete."))))
|
2014-10-24 03:07:40 +00:00
|
|
|
|
2016-03-06 04:21:55 +00:00
|
|
|
(defun configuration-layer//gather-auto-mode-extensions (mode)
|
|
|
|
"Return a regular expression matching all the extensions associate to MODE."
|
|
|
|
(let (gather-extensions)
|
|
|
|
(dolist (x auto-mode-alist)
|
|
|
|
(let ((ext (car x))
|
|
|
|
(auto-mode (cdr x)))
|
|
|
|
(when (and (stringp ext)
|
|
|
|
(symbolp auto-mode)
|
|
|
|
(eq auto-mode mode))
|
|
|
|
(push (car x) gather-extensions))))
|
|
|
|
(when gather-extensions
|
|
|
|
(concat "\\("
|
|
|
|
(string-join gather-extensions "\\|")
|
|
|
|
"\\)"))))
|
|
|
|
|
2016-07-17 19:00:43 +00:00
|
|
|
(defun configuration-layer//lazy-install-extensions-for-layer (layer-name)
|
2016-03-06 04:21:55 +00:00
|
|
|
"Return an alist of owned modes and extensions for the passed layer."
|
2016-07-17 19:00:43 +00:00
|
|
|
(let* ((layer (configuration-layer/get-layer layer-name))
|
2017-01-22 18:37:12 +00:00
|
|
|
(package-names (cfgl-layer-owned-packages layer))
|
2016-03-06 04:21:55 +00:00
|
|
|
result)
|
2017-01-22 18:37:12 +00:00
|
|
|
(dolist (pkg-name package-names)
|
|
|
|
(dolist (mode (list pkg-name (intern (format "%S-mode" pkg-name))))
|
|
|
|
(let ((ext (configuration-layer//gather-auto-mode-extensions mode)))
|
|
|
|
(when ext (push (cons mode ext) result)))))
|
2016-03-06 04:21:55 +00:00
|
|
|
result))
|
|
|
|
|
2016-03-25 04:24:52 +00:00
|
|
|
(defun configuration-layer//insert-lazy-install-form (layer-name mode ext)
|
2016-03-06 04:21:55 +00:00
|
|
|
"Insert a configuration form for lazy installation of MODE."
|
|
|
|
(let ((str (concat "(configuration-layer/lazy-install '"
|
2016-03-25 04:24:52 +00:00
|
|
|
(symbol-name layer-name)
|
2016-03-06 04:21:55 +00:00
|
|
|
" :extensions '("
|
|
|
|
(let ((print-quoted t)) (prin1-to-string ext))
|
2016-03-25 04:24:52 +00:00
|
|
|
" "
|
|
|
|
(symbol-name mode)
|
2016-03-06 04:21:55 +00:00
|
|
|
"))\n")))
|
|
|
|
(insert str)))
|
|
|
|
|
|
|
|
(defun configuration-layer/insert-lazy-install-configuration ()
|
|
|
|
"Prompt for a layer and insert the forms to configure lazy installation."
|
|
|
|
(interactive)
|
2016-03-25 04:24:52 +00:00
|
|
|
(let ((layer-name
|
|
|
|
(intern (completing-read
|
|
|
|
"Choose a used layer"
|
2018-11-26 02:19:50 +00:00
|
|
|
(sort (copy-list configuration-layer--used-layers) #'string<)))))
|
2016-03-06 04:21:55 +00:00
|
|
|
(let ((mode-exts (configuration-layer//lazy-install-extensions-for-layer
|
2016-03-25 04:24:52 +00:00
|
|
|
layer-name)))
|
2016-03-06 04:21:55 +00:00
|
|
|
(dolist (x mode-exts)
|
2016-03-25 04:24:52 +00:00
|
|
|
(configuration-layer//insert-lazy-install-form
|
|
|
|
layer-name (car x) (cdr x))))))
|
2016-03-06 04:21:55 +00:00
|
|
|
|
2016-08-25 13:10:45 +00:00
|
|
|
(defvar configuration-layer--spacemacs-startup-time nil
|
|
|
|
"Spacemacs full startup duration.")
|
|
|
|
|
2016-04-03 16:02:28 +00:00
|
|
|
(defun configuration-layer/display-summary (start-time)
|
|
|
|
"Display a summary of loading time."
|
2016-08-25 13:10:45 +00:00
|
|
|
(unless configuration-layer--spacemacs-startup-time
|
|
|
|
(setq configuration-layer--spacemacs-startup-time
|
|
|
|
(float-time (time-subtract (current-time) emacs-start-time))))
|
|
|
|
(let ((stats (configuration-layer/configured-packages-stats
|
2016-07-17 19:00:43 +00:00
|
|
|
configuration-layer--used-packages)))
|
2016-08-25 13:10:45 +00:00
|
|
|
(spacemacs-buffer/insert-page-break)
|
2016-08-25 14:02:30 +00:00
|
|
|
(with-current-buffer (get-buffer-create spacemacs-buffer-name)
|
|
|
|
(let ((buffer-read-only nil))
|
2018-06-16 19:21:58 +00:00
|
|
|
(spacemacs-buffer/append
|
|
|
|
(format "\n%s packages loaded in %.3fs (e:%s r:%s l:%s b:%s)"
|
|
|
|
(cadr (assq 'total stats))
|
|
|
|
configuration-layer--spacemacs-startup-time
|
|
|
|
(cadr (assq 'elpa stats))
|
|
|
|
(cadr (assq 'recipe stats))
|
|
|
|
(cadr (assq 'local stats))
|
|
|
|
(cadr (assq 'built-in stats))))
|
|
|
|
(spacemacs-buffer//center-line)
|
|
|
|
(spacemacs-buffer/append (format "\n(%.3fs spent in your user-config)"
|
|
|
|
dotspacemacs--user-config-elapsed-time))
|
|
|
|
(spacemacs-buffer//center-line)
|
|
|
|
(insert "\n")))))
|
2016-04-03 16:02:28 +00:00
|
|
|
|
2017-01-18 05:24:14 +00:00
|
|
|
(defun configuration-layer//get-indexed-elpa-package-names ()
|
2017-01-17 05:24:32 +00:00
|
|
|
"Return a list of all ELPA packages in indexed packages and dependencies."
|
|
|
|
(let (result)
|
2017-07-30 16:50:39 +00:00
|
|
|
(dolist (pkg-sym (configuration-layer//filter-distant-packages
|
2017-01-17 05:24:32 +00:00
|
|
|
(ht-keys configuration-layer--indexed-packages) nil))
|
|
|
|
(when (assq pkg-sym package-archive-contents)
|
|
|
|
(let* ((deps (mapcar 'car
|
|
|
|
(configuration-layer//get-package-deps-from-archive
|
|
|
|
pkg-sym)))
|
|
|
|
(elpa-deps (configuration-layer/filter-objects
|
|
|
|
deps (lambda (x)
|
|
|
|
(assq x package-archive-contents)))))
|
|
|
|
(dolist (pkg (cons pkg-sym elpa-deps))
|
|
|
|
;; avoid duplicates
|
|
|
|
(add-to-list 'result pkg)))))
|
|
|
|
result))
|
|
|
|
|
|
|
|
(defun configuration-layer//create-archive-contents-item (pkg-name)
|
|
|
|
"Return an item with an ELPA archive-contents compliant format."
|
|
|
|
(let ((obj (cadr (assq pkg-name package-archive-contents))))
|
|
|
|
(cons pkg-name `[,(package-desc-version obj)
|
|
|
|
,(package-desc-reqs obj)
|
|
|
|
,(package-desc-summary obj)
|
|
|
|
,(package-desc-kind obj)
|
|
|
|
,(package-desc-extras obj)])))
|
|
|
|
|
2017-10-29 04:28:22 +00:00
|
|
|
(defun configuration-layer//patch-package-descriptor (desc)
|
|
|
|
"Return a patched DESC.
|
|
|
|
The URL of the descriptor is patched to be the passed URL"
|
|
|
|
)
|
|
|
|
|
2017-01-18 05:24:14 +00:00
|
|
|
(defun configuration-layer//download-elpa-file
|
2017-10-30 19:04:01 +00:00
|
|
|
(pkg-name filename archive-url output-dir
|
2017-01-18 05:24:14 +00:00
|
|
|
&optional signaturep readmep)
|
|
|
|
"Download FILENAME from distant ELPA repository to OUTPUT-DIR.
|
|
|
|
|
|
|
|
Original code from dochang at https://github.com/dochang/elpa-clone"
|
|
|
|
(let ((source (concat archive-url filename))
|
|
|
|
(target (expand-file-name filename output-dir)))
|
|
|
|
(unless (file-exists-p target)
|
|
|
|
(let* ((readme-filename (format "%S-readme.txt" pkg-name))
|
|
|
|
(source-readme (concat archive-url readme-filename)))
|
|
|
|
(when (and readmep (url-http-file-exists-p source-readme))
|
|
|
|
(url-copy-file source-readme
|
|
|
|
(expand-file-name readme-filename output-dir)
|
|
|
|
'ok-if-already-exists)))
|
|
|
|
(when signaturep
|
|
|
|
(let* ((sig-filename (concat filename ".sig"))
|
|
|
|
(source-sig (concat archive-url sig-filename))
|
|
|
|
(target-sig (expand-file-name sig-filename output-dir)))
|
|
|
|
(url-copy-file source-sig target-sig 'ok-if-already-exists)))
|
|
|
|
(url-copy-file source target))))
|
|
|
|
|
|
|
|
(defun configuration-layer//sync-elpa-packages-files (packages output-dir)
|
|
|
|
"Synchronize PACKAGES files from remote ELPA directory to OUTPUT-DIR"
|
2018-05-06 15:49:53 +00:00
|
|
|
(configuration-layer/message
|
|
|
|
"Synchronizing files in ELPA repository at %s..." output-dir)
|
2017-01-18 05:24:14 +00:00
|
|
|
(let (filenames
|
|
|
|
(output-filenames (directory-files
|
|
|
|
output-dir nil "\\.\\(el\\|tar\\)$"))
|
|
|
|
(pkg-count (length packages))
|
|
|
|
(i 1))
|
|
|
|
(dolist (pkg-name packages)
|
|
|
|
(let* ((obj (cadr (assq pkg-name package-archive-contents)))
|
|
|
|
(filename (concat (package-desc-full-name obj)
|
|
|
|
(package-desc-suffix obj)))
|
|
|
|
(archive-url (cdr (assq (package-desc-archive obj)
|
|
|
|
package-archives))))
|
|
|
|
(push filename filenames)
|
|
|
|
(if (member filename output-filenames)
|
2018-05-06 15:49:53 +00:00
|
|
|
(configuration-layer/message
|
|
|
|
"[%s/%s] Skip %s..." i pkg-count filename)
|
|
|
|
(configuration-layer/message
|
|
|
|
"[%s/%s] Download %s..." i pkg-count filename)
|
2017-01-18 05:24:14 +00:00
|
|
|
(configuration-layer//download-elpa-file
|
|
|
|
pkg-name filename archive-url output-dir))
|
|
|
|
(setq i (1+ i))))
|
|
|
|
(dolist (ofilename output-filenames)
|
|
|
|
(unless (member ofilename filenames)
|
2018-05-06 15:49:53 +00:00
|
|
|
(configuration-layer/message "Remove outdated %s..." ofilename)
|
2017-01-18 05:24:14 +00:00
|
|
|
(delete-file (concat output-dir ofilename))))))
|
|
|
|
|
|
|
|
(defun configuration-layer/create-elpa-repository (name output-dir)
|
|
|
|
"Create an ELPA repository containing all packages supported by Spacemacs."
|
2017-01-17 05:24:32 +00:00
|
|
|
(configuration-layer/make-all-packages 'no-discover)
|
2017-01-22 05:40:02 +00:00
|
|
|
(let (package-archive-contents
|
|
|
|
(package-archives '(("melpa" . "https://melpa.org/packages/")
|
2018-01-22 18:21:03 +00:00
|
|
|
("org" . "https://orgmode.org/elpa/")
|
2017-01-22 05:40:02 +00:00
|
|
|
("gnu" . "https://elpa.gnu.org/packages/"))))
|
|
|
|
(package-refresh-contents)
|
|
|
|
(package-read-all-archive-contents)
|
|
|
|
(let* ((packages (configuration-layer//get-indexed-elpa-package-names))
|
|
|
|
(archive-contents
|
|
|
|
(mapcar 'configuration-layer//create-archive-contents-item
|
|
|
|
packages))
|
2017-10-29 04:28:22 +00:00
|
|
|
(path (file-name-as-directory (concat output-dir "/" name))))
|
2017-01-22 05:40:02 +00:00
|
|
|
(unless (file-exists-p path) (make-directory path 'create-parents))
|
|
|
|
(configuration-layer//sync-elpa-packages-files packages path)
|
|
|
|
(push 1 archive-contents)
|
|
|
|
(with-current-buffer (find-file-noselect
|
|
|
|
(concat path "archive-contents"))
|
|
|
|
(erase-buffer)
|
|
|
|
(prin1 archive-contents (current-buffer))
|
|
|
|
(save-buffer)))))
|
2017-01-17 05:24:32 +00:00
|
|
|
|
2017-10-29 04:28:22 +00:00
|
|
|
(defun configuration-layer/stable-elpa-version ()
|
|
|
|
"Set and return the current version of the ELPA repository.
|
|
|
|
Returns nil if the version is unknown."
|
2019-08-23 04:51:21 +00:00
|
|
|
(interactive)
|
2017-10-29 04:28:22 +00:00
|
|
|
(when (file-exists-p configuration-layer--stable-elpa-version-file)
|
|
|
|
(with-current-buffer (find-file-noselect
|
|
|
|
configuration-layer--stable-elpa-version-file)
|
2019-08-23 04:51:21 +00:00
|
|
|
(when (called-interactively-p)
|
|
|
|
(message "Stable ELPA repository version is: %s" (buffer-string)))
|
2017-10-29 04:28:22 +00:00
|
|
|
(buffer-string))))
|
|
|
|
|
|
|
|
(defun configuration-layer//stable-elpa-tarball-distant-file ()
|
|
|
|
"Return the distant file path of the downloaded tarball of ELPA stable
|
|
|
|
repository."
|
|
|
|
(format "%sv%s.tar.gz"
|
|
|
|
configuration-layer--stable-elpa-tarball-directory
|
2017-11-02 03:13:47 +00:00
|
|
|
configuration-layer-stable-elpa-version))
|
2017-10-29 04:28:22 +00:00
|
|
|
|
2017-10-30 04:57:48 +00:00
|
|
|
(defun configuration-layer//stable-elpa-tarball-distant-sign-file ()
|
|
|
|
"Return the absolute path to the signature file."
|
|
|
|
(format "%s/v%s/v%s.tar.gz.sig"
|
|
|
|
configuration-layer--stable-elpa-sig-directory
|
2017-11-02 03:13:47 +00:00
|
|
|
configuration-layer-stable-elpa-version
|
|
|
|
configuration-layer-stable-elpa-version))
|
2017-10-30 04:57:48 +00:00
|
|
|
|
2017-10-29 04:28:22 +00:00
|
|
|
(defun configuration-layer//stable-elpa-directory ()
|
|
|
|
"Return the local absolute path of the ELPA stable repository."
|
2019-08-21 23:52:40 +00:00
|
|
|
configuration-layer-stable-elpa-archive)
|
2017-10-29 04:28:22 +00:00
|
|
|
|
|
|
|
(defun configuration-layer//stable-elpa-tarball-local-file ()
|
|
|
|
"Return the local absolute path for the file of the downloaded tarball of
|
|
|
|
ELPA stable repository."
|
|
|
|
(format "%s.tar.gz" (configuration-layer//stable-elpa-directory)))
|
|
|
|
|
2017-10-30 04:57:48 +00:00
|
|
|
(defun configuration-layer//stable-elpa-tarball-local-sign-file ()
|
|
|
|
"Return the absolute path to the signature file."
|
|
|
|
(format "%s.sig" (configuration-layer//stable-elpa-directory)))
|
|
|
|
|
2019-08-22 02:30:24 +00:00
|
|
|
(defun configuration-layer//executable-not-found-error (exec &optional msg)
|
|
|
|
"Display a generic error message about not found EXECutable file.
|
|
|
|
|
|
|
|
MSG is an additional message append to the generic error."
|
|
|
|
(when (null msg) (setq msg ""))
|
|
|
|
(configuration-layer//error
|
|
|
|
(format
|
|
|
|
(concat
|
|
|
|
"Cannot find %s executable in your PATH.\n"
|
|
|
|
"Verify your spacemacs environment variables with [SPC f e e].%s\n"
|
|
|
|
"Spacelpa installation has been skipped!") exec msg)))
|
|
|
|
|
2019-08-23 04:51:21 +00:00
|
|
|
(defun configuration-layer//stable-elpa-update-version-file ()
|
|
|
|
"Write a file containing the version number of the stable ELPA repository."
|
|
|
|
(with-current-buffer (find-file-noselect
|
|
|
|
configuration-layer--stable-elpa-version-file)
|
|
|
|
(erase-buffer)
|
|
|
|
(beginning-of-buffer)
|
|
|
|
(insert (format "%s" configuration-layer-stable-elpa-version))
|
|
|
|
(save-buffer)))
|
|
|
|
|
|
|
|
(defun configuration-layer//stable-elpa-delete-temporary-files ()
|
|
|
|
"Delete stable ELPA repository temporary files."
|
|
|
|
(let ((tarball (configuration-layer//stable-elpa-tarball-local-file))
|
|
|
|
(tarball-sig (configuration-layer//stable-elpa-tarball-local-sign-file)))
|
|
|
|
(when (file-exists-p tarball)
|
|
|
|
(delete-file tarball))
|
|
|
|
(when (file-exists-p tarball-sig)
|
|
|
|
(delete-file tarball-sig))))
|
|
|
|
|
|
|
|
(defun configuration-layer//stable-elpa-ask-to-continue (reason)
|
|
|
|
"Prompt the users to continue when Spacemacs cannot verify the archive."
|
|
|
|
(y-or-n-p
|
|
|
|
(format (concat "Spacemacs cannot verify the authenticity of "
|
|
|
|
"the stable ELPA archive (%s)!\n"
|
|
|
|
"The reason is: %s\n"
|
|
|
|
"\n"
|
|
|
|
"Do you still want to install the stable ELPA repository ?")
|
|
|
|
configuration-layer-stable-elpa-name
|
|
|
|
reason)))
|
|
|
|
|
|
|
|
(defun configuration-layer//stable-elpa-verify-archive ()
|
|
|
|
"Verify the downloaded stable ELPA repository archive.
|
|
|
|
|
|
|
|
Returns non nil if the verification succeeded.
|
|
|
|
|
|
|
|
If Spacemacs cannot verify the archive a prompt ask the user if they want to
|
|
|
|
continue with the stable ELPA repository installation."
|
2019-08-25 02:39:41 +00:00
|
|
|
(let (context
|
|
|
|
good-signatures
|
|
|
|
verification-err
|
|
|
|
fatal-err
|
|
|
|
(archive (configuration-layer//stable-elpa-tarball-local-file))
|
|
|
|
(sig-file (configuration-layer//stable-elpa-tarball-local-sign-file))
|
|
|
|
large-file-warning-threshold)
|
|
|
|
(when (or (not (file-exists-p archive))
|
|
|
|
(not (file-exists-p sig-file)))
|
|
|
|
(setq fatal-err (concat "Cannot find downloaded stable ELPA repository "
|
|
|
|
"archive or its signature file.")))
|
|
|
|
(unless fatal-err
|
|
|
|
(with-current-buffer (find-file-noselect archive)
|
|
|
|
(spacemacs-buffer/set-mode-line
|
|
|
|
(format "Verifying %s archive..."
|
|
|
|
configuration-layer-stable-elpa-name) t)
|
2019-08-23 04:51:21 +00:00
|
|
|
(condition-case error
|
2019-08-25 02:39:41 +00:00
|
|
|
(setq context (epg-make-context 'OpenPGP))
|
2019-08-23 16:12:51 +00:00
|
|
|
(error (setq verification-err
|
2019-08-25 02:39:41 +00:00
|
|
|
(format "GnuPGP doesn't seem to be available. %s"
|
2019-08-23 16:12:51 +00:00
|
|
|
(cdr error)))))
|
|
|
|
(unless verification-err
|
|
|
|
(condition-case error
|
2019-08-25 02:39:41 +00:00
|
|
|
(epg-import-keys-from-file
|
|
|
|
context configuration-layer--stable-elpa-gpg-keyring)
|
2019-08-23 16:12:51 +00:00
|
|
|
(error (setq verification-err
|
2019-08-25 02:39:41 +00:00
|
|
|
(format "Cannot import public key. %s"
|
2019-08-23 16:12:51 +00:00
|
|
|
(cdr error)))))
|
2019-08-25 02:39:41 +00:00
|
|
|
(unless verification-err
|
|
|
|
(condition-case error
|
|
|
|
(epg-verify-file context sig-file archive)
|
|
|
|
(error (setq verification-err
|
|
|
|
(format "Error during verification phase. %s"
|
|
|
|
(cdr error)))))
|
|
|
|
;; The .sig file may contain multiple signatures. Success if one
|
|
|
|
;; of the signatures is good.
|
|
|
|
(dolist (sig (epg-context-result-for context 'verify))
|
|
|
|
(when (eq (epg-signature-status sig) 'good)
|
|
|
|
(push sig good-signatures)))
|
|
|
|
(when (null good-signatures)
|
|
|
|
(unless verification-err
|
|
|
|
;; `epg-verify-string' does not signal error when everything
|
|
|
|
;; went fine but the verification in itself failed.
|
|
|
|
;; This is a strong indicator that the archive may be
|
|
|
|
;; compromised.
|
|
|
|
(setq verification-err
|
|
|
|
(concat "Verification failed! It is strongly advised to "
|
|
|
|
"NOT install the stable ELPA repository and "
|
|
|
|
"report it on GitHub.")))
|
|
|
|
(when init-file-debug
|
|
|
|
(package--display-verify-error context sig-file)))))))
|
|
|
|
(cond
|
|
|
|
((not (null fatal-err))
|
|
|
|
(configuration-layer//error fatal-err)
|
|
|
|
nil)
|
|
|
|
((not (null verification-err))
|
|
|
|
(configuration-layer//stable-elpa-ask-to-continue verification-err))
|
|
|
|
(t t))))
|
2019-08-23 04:51:21 +00:00
|
|
|
|
2017-10-29 04:28:22 +00:00
|
|
|
(defun configuration-layer//stable-elpa-untar-archive ()
|
2017-10-30 04:57:48 +00:00
|
|
|
"Untar the downloaded archive of stable ELPA, returns non-nil if succeeded."
|
2017-10-29 04:28:22 +00:00
|
|
|
(require 'tar-mode)
|
2019-08-23 04:51:21 +00:00
|
|
|
(let ((archive (configuration-layer//stable-elpa-tarball-local-file))
|
2017-10-30 04:57:48 +00:00
|
|
|
(sig-file (configuration-layer//stable-elpa-tarball-local-sign-file))
|
|
|
|
large-file-warning-threshold)
|
|
|
|
(with-current-buffer (find-file-noselect archive)
|
2017-10-29 04:28:22 +00:00
|
|
|
(spacemacs-buffer/set-mode-line
|
2019-08-23 04:51:21 +00:00
|
|
|
(format "Extracting %s archive..."
|
|
|
|
configuration-layer-stable-elpa-name) t)
|
|
|
|
(if (not (executable-find "tar"))
|
|
|
|
(configuration-layer//executable-not-found-error "tar")
|
|
|
|
(call-process "tar" nil nil nil "-xzf" archive)))))
|
|
|
|
|
|
|
|
(defun configuration-layer//stable-elpa-download-tarball ()
|
|
|
|
"Download the tarball of the stable ELPA repository if it used.
|
|
|
|
|
|
|
|
Returns non nil if the tarball has been downloaded.
|
|
|
|
|
|
|
|
Returns nil if the tarball does not need to be downloaded or if an error
|
|
|
|
happened during the download."
|
|
|
|
(let (result)
|
|
|
|
(when (and (assoc configuration-layer-stable-elpa-name
|
|
|
|
configuration-layer-elpa-archives)
|
|
|
|
(not (string-equal (configuration-layer/stable-elpa-version)
|
|
|
|
configuration-layer-stable-elpa-version)))
|
|
|
|
(let ((url (configuration-layer//stable-elpa-tarball-distant-file))
|
|
|
|
(local (configuration-layer//stable-elpa-tarball-local-file))
|
|
|
|
(url-sig (configuration-layer//stable-elpa-tarball-distant-sign-file))
|
|
|
|
(local-sig (configuration-layer//stable-elpa-tarball-local-sign-file)))
|
|
|
|
(spacemacs-buffer/set-mode-line
|
|
|
|
(format (concat "Downloading stable ELPA repository: %s... "
|
|
|
|
"(please wait)")
|
|
|
|
configuration-layer-stable-elpa-name) t)
|
|
|
|
;; download tarball and detached signature
|
|
|
|
(make-directory configuration-layer-stable-elpa-directory t)
|
|
|
|
(condition-case-unless-debug err
|
|
|
|
(progn
|
|
|
|
(url-copy-file url local 'ok-if-already-exists)
|
|
|
|
(when dotspacemacs-verify-spacelpa-archives
|
|
|
|
(url-copy-file url-sig local-sig 'ok-if-already-exists))
|
|
|
|
(setq result t))
|
|
|
|
(error nil))))
|
|
|
|
result))
|
|
|
|
|
|
|
|
(defun configuration-layer//stable-elpa-disable-repository ()
|
|
|
|
"Remove stable ELPA repostiory from `package.el' archive.."
|
|
|
|
(setq configuration-layer-elpa-archives
|
|
|
|
(cl-delete configuration-layer-stable-elpa-name
|
|
|
|
configuration-layer-elpa-archives
|
|
|
|
:test 'equal :key 'car))
|
|
|
|
(setq package-archive-priorities
|
|
|
|
(cl-delete configuration-layer-stable-elpa-name
|
|
|
|
package-archive-priorities
|
|
|
|
:test 'equal :key 'car)))
|
|
|
|
|
|
|
|
(defun configuration-layer/stable-elpa-init ()
|
|
|
|
"Initialize the stable ELPA repository.
|
|
|
|
|
|
|
|
This function downloads the repository tarball. Then it verifies its signature
|
|
|
|
if required. The last step is to uncompress the tarball and clean the temporary
|
|
|
|
files."
|
|
|
|
(unwind-protect
|
|
|
|
(if (and (configuration-layer//stable-elpa-download-tarball)
|
|
|
|
(or (not dotspacemacs-verify-spacelpa-archives)
|
|
|
|
(configuration-layer//stable-elpa-verify-archive)))
|
|
|
|
(progn
|
|
|
|
(configuration-layer//stable-elpa-untar-archive)
|
|
|
|
(configuration-layer//stable-elpa-update-version-file))
|
|
|
|
(configuration-layer//stable-elpa-disable-repository))
|
|
|
|
(configuration-layer//stable-elpa-delete-temporary-files)))
|
2017-10-29 04:28:22 +00:00
|
|
|
|
|
|
|
;; (configuration-layer/create-elpa-repository
|
|
|
|
;; "spacelpa"
|
|
|
|
;; spacemacs-cache-directory)
|
|
|
|
|
2017-01-23 04:23:39 +00:00
|
|
|
(defun configuration-layer//package-install-org (func &rest args)
|
|
|
|
"Advice around `package-install' to patch package name and dependencies at
|
|
|
|
install time in order to replace all `org' package installation by
|
|
|
|
`org-plus-contrib'. We avoid installing unecessarily both `org' and
|
|
|
|
`org-plus-contrib' at the same time (i.e. we always install `org-plus-contrib')"
|
|
|
|
(let* ((pkg (car args))
|
|
|
|
(patched
|
|
|
|
(cond
|
|
|
|
;; patch symbol name
|
|
|
|
((and (symbolp pkg) (eq 'org pkg))
|
|
|
|
(setcar args 'org-plus-contrib)
|
|
|
|
t)
|
|
|
|
;; patch name in package-desc object
|
|
|
|
((and (package-desc-p pkg)
|
|
|
|
(eq 'org (package-desc-name pkg)))
|
|
|
|
(setf (package-desc-name pkg) 'org-plus-contrib)
|
|
|
|
t)
|
|
|
|
;; patch dependencies in package-desc object
|
|
|
|
((and (package-desc-p pkg)
|
|
|
|
(assq 'org (package-desc-reqs pkg)))
|
|
|
|
(setf (car (assq 'org (package-desc-reqs pkg))) 'org-plus-contrib)
|
|
|
|
t))))
|
|
|
|
(let ((name (if (package-desc-p pkg)
|
|
|
|
(package-desc-name pkg)
|
|
|
|
pkg)))
|
|
|
|
;; check manually if `org-plus-contrib' is already installed since
|
|
|
|
;; package.el may install `org-plus-contrib' more than once.
|
|
|
|
;; Maybe we could hook somewhere else (at transaction computation time?)
|
|
|
|
(if (or patched (eq 'org-plus-contrib name))
|
|
|
|
(unless (package-installed-p name)
|
|
|
|
(apply func args))
|
|
|
|
(apply func args)))))
|
|
|
|
(advice-add 'package-install :around #'configuration-layer//package-install-org)
|
|
|
|
|
2016-01-12 04:58:47 +00:00
|
|
|
(defun configuration-layer//increment-error-count ()
|
|
|
|
"Increment the error counter."
|
2015-03-16 05:28:21 +00:00
|
|
|
(if configuration-layer-error-count
|
2016-06-11 02:47:45 +00:00
|
|
|
(setq configuration-layer-error-count
|
|
|
|
(1+ configuration-layer-error-count))
|
2015-03-16 05:28:21 +00:00
|
|
|
(setq configuration-layer-error-count 1)))
|
|
|
|
|
2018-05-06 15:49:53 +00:00
|
|
|
(defun configuration-layer/message (msg &rest args)
|
|
|
|
"Display MSG in *Messages* prepended with '(Spacemacs)'.
|
|
|
|
ARGS: format string arguments."
|
|
|
|
(message "(Spacemacs) %s" (apply 'format msg args)))
|
|
|
|
|
2018-06-10 06:46:16 +00:00
|
|
|
(defun configuration-layer/load-file (file)
|
|
|
|
"Load file silently except if in debug mode."
|
|
|
|
(load file nil (not init-file-debug)))
|
|
|
|
|
2015-01-27 03:51:47 +00:00
|
|
|
(provide 'core-configuration-layer)
|
2015-08-06 03:39:39 +00:00
|
|
|
|
|
|
|
;;; core-configuration-layer.el ends here
|