Add function `dotspacemacs/install`
This commit is contained in:
parent
cb5b079970
commit
8cb1230e7e
|
@ -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"
|
||||
|
|
|
@ -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 "../"))
|
||||
|
|
Loading…
Reference in New Issue