core: for elpa dir, replace branch name by a variable set in .lock

New variable configuration-layer-elpa-subdirectory set in .lock file.
Now users creating a branch based on develop or master won't reinstall
all the packages in a new elpa directory.
This commit is contained in:
syl20bnr 2017-11-01 23:23:26 -04:00
parent 8a5771559e
commit a363f85d33
2 changed files with 6 additions and 1 deletions

1
.lock
View File

@ -2,6 +2,7 @@
(setq configuration-layer-stable-elpa-name "spacelpa") (setq configuration-layer-stable-elpa-name "spacelpa")
(setq configuration-layer-stable-elpa-version "0.300") (setq configuration-layer-stable-elpa-version "0.300")
(setq configuration-layer-elpa-subdirectory "develop")
(setq configuration-layer-elpa-archives (setq configuration-layer-elpa-archives
`(("melpa" . "melpa.org/packages/") `(("melpa" . "melpa.org/packages/")

View File

@ -58,6 +58,10 @@ the .lock file at the root of the repository.")
(defvar configuration-layer-stable-elpa-name "spacelpa" (defvar configuration-layer-stable-elpa-name "spacelpa"
"Name of the stable ELPA repository. Should be defined in the lock file.") "Name of the stable ELPA repository. Should be defined in the lock file.")
(defvar configuration-layer-elpa-subdirectory ""
"Sub-directory name where to install ELPA packages. Should be defined in
the lock file.")
(defconst configuration-layer-stable-elpa-directory (defconst configuration-layer-stable-elpa-directory
(expand-file-name (expand-file-name
(concat spacemacs-cache-directory "stable-elpa/" emacs-version "/")) (concat spacemacs-cache-directory "stable-elpa/" emacs-version "/"))
@ -88,7 +92,7 @@ This function also appends the name of the current branch of Spacemacs.
If `dotspacemacs-elpa-subdirectory' is nil, then ROOT is used. Otherwise the If `dotspacemacs-elpa-subdirectory' is nil, then ROOT is used. Otherwise the
subdirectory of ROOT is used." subdirectory of ROOT is used."
(expand-file-name (expand-file-name
(spacemacs//git-get-current-branch) configuration-layer-elpa-subdirectory
(if (not dotspacemacs-elpa-subdirectory) (if (not dotspacemacs-elpa-subdirectory)
root root
(let ((subdir (if (eq 'emacs-version dotspacemacs-elpa-subdirectory) (let ((subdir (if (eq 'emacs-version dotspacemacs-elpa-subdirectory)