minor improvement

This commit is contained in:
Rongsong Shen 2018-12-17 11:41:36 +08:00
parent 34d3a3ba72
commit 94a7f21ebb

View File

@ -18,7 +18,8 @@
(setq emacs-config-directory (setq emacs-config-directory
(let ((config-dir (getenv "EMACS_CONFIG_DIR"))) (let ((config-dir (getenv "EMACS_CONFIG_DIR")))
(if config-dir (if config-dir
(concat config-dir "/" emacs-config-name "/") (concat config-dir "/"
emacs-config-name "/")
(concat (substitute-in-file-name "~/.config/emacs/") (concat (substitute-in-file-name "~/.config/emacs/")
emacs-config-name "/")))) emacs-config-name "/"))))
@ -77,6 +78,11 @@
(list (list
(concat "git clone https://github.com/syl20bnr/spacemacs.git " dir)))))) (concat "git clone https://github.com/syl20bnr/spacemacs.git " dir))))))
(defun install-emacs-startkit (name location)
(progn (let* ((shell-buffer (make-comint-in-buffer "installer" nil "/bin/sh"))
(shell-process (get-buffer-process shell-buffer)))
(progn
(defun on-installer-finished (process event) (defun on-installer-finished (process event)
"Callback function when uinstaller process has finished. "Callback function when uinstaller process has finished.
We use this function to load startkit initialization file" We use this function to load startkit initialization file"
@ -84,15 +90,14 @@ We use this function to load startkit initialization file"
((string= event "finished\n") (load-file emacs-init-file)) ((string= event "finished\n") (load-file emacs-init-file))
(t (message "Event %s has been ignored" event)))) (t (message "Event %s has been ignored" event))))
(defun install-emacs-startkit (name location)
(progn (let* ((shell-buffer (make-comint-in-buffer "installer" nil "/bin/sh"))
(shell-process (get-buffer-process shell-buffer)))
(progn
(set-process-sentinel shell-process 'on-installer-finished) (set-process-sentinel shell-process 'on-installer-finished)
(display-buffer shell-buffer) (display-buffer shell-buffer)
(cl-loop for cmd in (funcall (cdr (assoc (intern name) startkit-info)) location) (cl-loop for cmd in (funcall (cdr (assoc (intern name) startkit-info))
do (comint-simple-send shell-process (concat cmd "\n"))) location)
(comint-simple-send shell-process "exit\n"))))) do (comint-simple-send shell-process
(concat cmd "\n")))
(comint-simple-send shell-process
"exit\n")))))
(if (not (file-exists-p emacs-init-file)) (if (not (file-exists-p emacs-init-file))
(progn (progn