add mirror of china

This commit is contained in:
Rongsong Shen 2018-12-14 14:54:39 +08:00
parent be8f9c68f4
commit 13ba0b8b03

View File

@ -1,36 +1,49 @@
(defun install-emacs-startkit (name location)
(let ((startkit-info
(require 'cl-lib)
(setq installation-done-stat-file "/tmp/.emacs.install.ok")
(setq 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 ")))
(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)
(concat "mkdir -p " dir " && cd " dir " && "
"wget https://raw.githubusercontent.com/shen390s/frontmacs/master/scripts/init-frontmacs.el && "
(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)
(concat "git clone git@github.com:shen390s/dotfiles-emacs.git " dir)))
(list
(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)))
(list
(concat "git clone git@github.com:shen390s/ohai-emacs.git " dir))))
(prelude .
(lambda (dir)
(concat "git clone git@github.com:shen390s/prelude.git " 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))))))
(let ((installer (funcall (cdr (assoc (intern name) startkit-info)) location)))
(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)
(comint-simple-send shell-process installer)
(comint-simple-send shell-process "exit\n")))))))
(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")))
@ -47,19 +60,26 @@
(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 emacs-init-file)
(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))