Add function `dotspacemacs/install`

This commit is contained in:
syl20bnr 2014-11-21 22:33:54 -05:00
parent cb5b079970
commit 8cb1230e7e
2 changed files with 18 additions and 0 deletions

View File

@ -32,6 +32,20 @@ NOT USED FOR NOW :-)"
"Return the absolute path to the spacemacs dotfile."
(concat user-home-directory ".spacemacs"))
(defun dotspacemacs/install ()
"Install `.spacemacs.template' in home directory. Ask for confirmation
before installing the file if the destination already exists."
(interactive)
(let* ((dotfile "~/.spacemacs")
(install (if (file-exists-p dotfile)
(y-or-n-p (format "%s already exists. Do you want to overwite it ? "
dotfile))
t)))
(when install
(copy-file (concat spacemacs-template-directory
".spacemacs.template") dotfile t)
(message "%s has been installed." dotfile))))
(defun dotspacemacs/load ()
"Load ~/.spacemacs. If it is not found then copy .spacemacs.template to
~/.spacemacs"

View File

@ -9,6 +9,10 @@
"Spacemacs core directory.")
(add-to-list 'load-path spacemacs-core-directory)
(defconst spacemacs-template-directory
(expand-file-name (concat spacemacs-core-directory "templates/"))
"Spacemacs templates directory.")
;; additional paths
(defconst user-home-directory
(expand-file-name (concat user-emacs-directory "../"))