From 2e1df9c21f2624a52943eb745c82d5653116ab4c Mon Sep 17 00:00:00 2001 From: Kazu Yamamoto Date: Tue, 22 Apr 2014 11:32:51 +0900 Subject: [PATCH] ghc-with-process takes an optional hook. --- elisp/ghc-check.el | 5 +++-- elisp/ghc-process.el | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/elisp/ghc-check.el b/elisp/ghc-check.el index ff46d9f..1820ae8 100644 --- a/elisp/ghc-check.el +++ b/elisp/ghc-check.el @@ -46,8 +46,9 @@ nil does not display errors/warnings. (defun ghc-check-syntax () (interactive) - (setq mode-line-process " -:-") ;; fixme - (ghc-with-process (ghc-check-send) 'ghc-check-callback)) + (ghc-with-process (ghc-check-send) + 'ghc-check-callback + (lambda () (setq mode-line-process " -:-")))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; diff --git a/elisp/ghc-process.el b/elisp/ghc-process.el index 4495ec6..0b17ae4 100644 --- a/elisp/ghc-process.el +++ b/elisp/ghc-process.el @@ -25,10 +25,11 @@ (defun ghc-get-project-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 (setq ghc-process-process-name (ghc-get-project-root))) (when ghc-process-process-name + (if hook (funcall hook)) (let* ((cbuf (current-buffer)) (name ghc-process-process-name) (buf (get-buffer-create (concat " ghc-modi:" name)))