From 252f26d55595879ac719dfd8d7981a52f8e9594a Mon Sep 17 00:00:00 2001 From: justbur Date: Fri, 5 Jun 2015 19:50:03 -0400 Subject: [PATCH] Make default private layer directory explicit --- core/core-configuration-layer.el | 17 ++++++++++++++--- core/core-dotspacemacs.el | 4 ++-- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/core/core-configuration-layer.el b/core/core-configuration-layer.el index 7388f7bb4..e4ca2b4e7 100644 --- a/core/core-configuration-layer.el +++ b/core/core-configuration-layer.el @@ -43,6 +43,17 @@ (expand-file-name (concat user-emacs-directory "private/")) "Spacemacs private layers base directory.") +(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 + configuration-layer-private-directory)) + "Spacemacs default directory for private layers.") + (defconst configuration-layer-rollback-directory (expand-file-name (concat spacemacs-cache-directory ".rollback/")) "Spacemacs rollback directory.") @@ -118,7 +129,7 @@ layer directory." (interactive) (let* ((current-layer-paths (mapcar (lambda (dir) (expand-file-name dir)) (cl-pushnew - configuration-layer-private-directory + configuration-layer-private-layer-directory dotspacemacs-configuration-layer-path))) (other-choice "Another directory...") (helm-lp-source @@ -152,7 +163,7 @@ layer directory." (defun configuration-layer//get-private-layer-dir (name) "Return an absolute path the the private configuration layer with name NAME." - (concat configuration-layer-private-directory name "/")) + (concat configuration-layer-private-layer-directory name "/")) (defun configuration-layer//copy-template (template &optional layer-dir) "Copy and replace special values of TEMPLATE to LAYER_DIR. If @@ -213,7 +224,7 @@ path." ;; `dotspacemacs-directory' override the private directory if it exists. (let ((search-paths (append (list configuration-layer-contrib-directory) dotspacemacs-configuration-layer-path - (list configuration-layer-private-directory) + (list configuration-layer-private-layer-directory) (list dotspacemacs-directory))) (discovered '()) (result (make-hash-table :size 256))) diff --git a/core/core-dotspacemacs.el b/core/core-dotspacemacs.el index c8a3a9bab..8101be44f 100644 --- a/core/core-dotspacemacs.el +++ b/core/core-dotspacemacs.el @@ -15,7 +15,7 @@ (defconst dotspacemacs-directory (let* ((env (getenv "SPACEMACSDIR")) - (env-dir (if env (expand-file-name (concat env "/")))) + (env-dir (when env (expand-file-name (concat env "/")))) (no-env-dir-default (expand-file-name (concat user-home-directory ".spacemacs.d/")))) @@ -33,7 +33,7 @@ directories exist, this variable will be nil.") (defconst dotspacemacs-filepath (let* ((default (concat user-home-directory ".spacemacs")) - (spacemacs-dir-init (if dotspacemacs-directory + (spacemacs-dir-init (when dotspacemacs-directory (concat dotspacemacs-directory "init.el")))) (if (and (not (file-exists-p default))