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
'((doom-emacs .
(lambda (dir)
@ -23,9 +23,14 @@
(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)))))
(let ((installer (funcall (cdr (assoc (intern name) startkit-info)) 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")))))))
(setq emacs-start-kit
(let ((start-kit (getenv "EMACS_STARTKIT")))
@ -47,9 +52,16 @@
(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))
(defun load-emacs-init-idle ()
(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)))
(when (file-exists-p init-file)
(load-file init-file)))
(if (not (file-exists-p emacs-init-file))
(progn
(run-with-idle-timer 1 nil #'load-emacs-init-idle)
(install-emacs-startkit emacs-start-kit
emacs-config-directory))
(load-file emacs-init-file))