This commit is contained in:
Rongsong Shen 2018-12-11 22:02:24 +08:00
parent 7f09c707cf
commit 17b262f5f8

View File

@ -1,8 +1,39 @@
(setq emacs-config-name
(let ((config-name (getenv "EMACS_CONFIG")))
(if config-name
config-name
".emacs.d")))
(defun install-emacs-startkit (name directory)
(let ((startkit-info
'((doom-emacs .
(lambda (dir)
(concat "git clone git@github.com:shen390s/doom-emacs.git "
dir " && cd " dir " && "
" cp init.example.el init.el && "
" make install ")))
(frontmacs .
(lambda (dir)
(concat "mkdir -p " dir " && cd " dir " && "
"wget https://github.com/shen390s/frontmacs/blob/master/scripts/init-frontmacs.el && "
"echo \"(load (expand-file-name \"init-frontmacs.el\" user-emacs-directory))\" >>init.el")))
(graphane .
(lambda (dir)
(concat "git clone git@github.com:shen390s/dotfiles-emacs.git " dir)))
(ohai-emacs .
(lambda (dir)
(concat "git clone git@github.com:shen390s/ohai-emacs.git " dir)))
(prelude .
(lambda (dir)
(concat "git clone git@github.com:shen390s/prelude.git " dir)))
(spacemacs .
(lambda (dir)
(concat "git clone https://github.com/syl20bnr/spacemacs.git " dir))))))
(let ((installer (funcall (cdr (assoc (intern name) startkit-info)) directory)))
(let ((output (shell-command-to-string installer)))
(message "%s" output)))))
(setq emacs-start-kit
(let ((start-kit (getenv "EMACS_STARTKIT")))
(if start-kit
start-kit
"spacemacs")))
(setq emacs-config-name emacs-start-kit)
(setq emacs-config-directory
(let ((config-dir (getenv "EMACS_CONFIG_DIR")))
@ -13,6 +44,12 @@
(setq user-emacs-directory emacs-config-directory)
(setq emacs-init-file
(expand-file-name "init.el" user-emacs-directory))
(if (not (file-exists-p emacs-init-file))
(install-emacs-startkit emacs-start-kit emacs-config-directory))
(let ((init-file (expand-file-name "init.el" user-emacs-directory)))
(when (file-exists-p init-file)
(load-file init-file)))