ghc-with-process takes an optional hook.

This commit is contained in:
Kazu Yamamoto 2014-04-22 11:32:51 +09:00
parent b3fd99fa7d
commit 2e1df9c21f
2 changed files with 5 additions and 3 deletions

View File

@ -46,8 +46,9 @@ nil does not display errors/warnings.
(defun ghc-check-syntax () (defun ghc-check-syntax ()
(interactive) (interactive)
(setq mode-line-process " -:-") ;; fixme (ghc-with-process (ghc-check-send)
(ghc-with-process (ghc-check-send) 'ghc-check-callback)) 'ghc-check-callback
(lambda () (setq mode-line-process " -:-"))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

View File

@ -25,10 +25,11 @@
(defun ghc-get-project-root () (defun ghc-get-project-root ()
(ghc-run-ghc-mod '("root"))) (ghc-run-ghc-mod '("root")))
(defun ghc-with-process (cmd callback) (defun ghc-with-process (cmd callback &optional hook)
(unless ghc-process-process-name (unless ghc-process-process-name
(setq ghc-process-process-name (ghc-get-project-root))) (setq ghc-process-process-name (ghc-get-project-root)))
(when ghc-process-process-name (when ghc-process-process-name
(if hook (funcall hook))
(let* ((cbuf (current-buffer)) (let* ((cbuf (current-buffer))
(name ghc-process-process-name) (name ghc-process-process-name)
(buf (get-buffer-create (concat " ghc-modi:" name))) (buf (get-buffer-create (concat " ghc-modi:" name)))