save work status

This commit is contained in:
Rongsong Shen 2018-12-13 14:39:58 +08:00
parent 30adec6a96
commit a3bfead367

View File

@ -1,4 +1,4 @@
(defun install-emacs-startkit (name directory) (defun install-emacs-startkit (name location)
(let ((startkit-info (let ((startkit-info
'((doom-emacs . '((doom-emacs .
(lambda (dir) (lambda (dir)
@ -23,9 +23,14 @@
(spacemacs . (spacemacs .
(lambda (dir) (lambda (dir)
(concat "git clone https://github.com/syl20bnr/spacemacs.git " dir)))))) (concat "git clone https://github.com/syl20bnr/spacemacs.git " dir))))))
(let ((installer (funcall (cdr (assoc (intern name) startkit-info)) directory))) (let ((installer (funcall (cdr (assoc (intern name) startkit-info)) location)))
(let ((output (shell-command-to-string installer))) (progn (require 'comint)
(message "%s" output))))) (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")))))))
(setq emacs-start-kit (setq emacs-start-kit
(let ((start-kit (getenv "EMACS_STARTKIT"))) (let ((start-kit (getenv "EMACS_STARTKIT")))
@ -47,9 +52,16 @@
(setq emacs-init-file (setq emacs-init-file
(expand-file-name "init.el" user-emacs-directory)) (expand-file-name "init.el" user-emacs-directory))
(if (not (file-exists-p emacs-init-file)) (defun load-emacs-init-idle ()
(install-emacs-startkit emacs-start-kit emacs-config-directory)) (if (file-exists-p emacs-init-file)
(load-file emacs-init-file)
(progn
(run-with-idle-timer 1 nil #'load-emacs-init-idle))))
(let ((init-file (expand-file-name "init.el" user-emacs-directory))) (if (not (file-exists-p emacs-init-file))
(when (file-exists-p init-file) (progn
(load-file init-file))) (run-with-idle-timer 1 nil #'load-emacs-init-idle)
(install-emacs-startkit emacs-start-kit
emacs-config-directory))
(load-file emacs-init-file))