88 lines
3.4 KiB
EmacsLisp
88 lines
3.4 KiB
EmacsLisp
(require 'cl-lib)
|
|
|
|
(setq installation-done-stat-file "/tmp/.emacs.install.ok")
|
|
(setq startkit-info
|
|
'((doom-emacs .
|
|
(lambda (dir)
|
|
(list
|
|
(concat "git clone git@github.com:shen390s/doom-emacs.git " dir)
|
|
(concat "cd " dir)
|
|
"cp init.example.el init.el"
|
|
"make install"
|
|
"y")))
|
|
(frontmacs .
|
|
(lambda (dir)
|
|
(list
|
|
(concat "mkdir -p " dir )
|
|
(concat "cd " dir)
|
|
"wget https://raw.githubusercontent.com/shen390s/frontmacs/master/scripts/init-frontmacs.el"
|
|
"echo \"(load (expand-file-name \\\"init-frontmacs.el\\\" user-emacs-directory))\" >>init.el")))
|
|
(graphene .
|
|
(lambda (dir)
|
|
(list
|
|
(concat "git clone git@github.com:shen390s/dotfiles-emacs.git " dir))))
|
|
(ohai-emacs .
|
|
(lambda (dir)
|
|
(list
|
|
(concat "git clone git@github.com:shen390s/ohai-emacs.git " dir))))
|
|
(prelude .
|
|
(lambda (dir)
|
|
(list
|
|
(concat "git clone git@github.com:shen390s/prelude.git " dir))))
|
|
(spacemacs .
|
|
(lambda (dir)
|
|
(list
|
|
(concat "git clone https://github.com/syl20bnr/spacemacs.git " dir))))))
|
|
|
|
(defun install-emacs-startkit (name location)
|
|
(progn (require 'comint)
|
|
(let* ((shell-buffer (make-comint-in-buffer "installer" nil "/bin/sh"))
|
|
(shell-process (get-buffer-process shell-buffer)))
|
|
(progn
|
|
(display-buffer shell-buffer)
|
|
(cl-loop for cmd in (funcall (cdr (assoc (intern name) startkit-info)) location)
|
|
do (comint-simple-send shell-process (concat cmd "\n")))
|
|
(comint-simple-send shell-process (concat "touch " installation-done-stat-file "\n"))
|
|
(comint-simple-send shell-process "exit\n")))))
|
|
|
|
(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")))
|
|
(if config-dir
|
|
(concat config-dir "/" emacs-config-name "/")
|
|
(concat (substitute-in-file-name "~/.config/emacs/")
|
|
emacs-config-name "/"))))
|
|
|
|
(unless (file-exists-p emacs-config-directory)
|
|
(make-directory emacs-config-directory t))
|
|
|
|
(setq user-emacs-directory emacs-config-directory)
|
|
|
|
(setq emacs-init-file
|
|
(expand-file-name "init.el" user-emacs-directory))
|
|
|
|
(defun load-emacs-init-idle ()
|
|
(if (file-exists-p installation-done-stat-file)
|
|
(when (file-exists-p emacs-init-file)
|
|
(load-file emacs-init-file)
|
|
(delete-file installation-done-stat-file))
|
|
(progn
|
|
(run-with-idle-timer 5 nil #'load-emacs-init-idle))))
|
|
|
|
(if (not (file-exists-p emacs-init-file))
|
|
(progn
|
|
(if (file-exists-p installation-done-stat-file)
|
|
(delete-file installatio-done-stat-file))
|
|
(run-with-idle-timer 5 nil #'load-emacs-init-idle)
|
|
(install-emacs-startkit emacs-start-kit
|
|
emacs-config-directory))
|
|
(load-file emacs-init-file))
|
|
|