diff --git a/elisp/ghc-flymake.el b/elisp/ghc-flymake.el index 4b45f8c..53b57c2 100644 --- a/elisp/ghc-flymake.el +++ b/elisp/ghc-flymake.el @@ -20,7 +20,7 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defconst ghc-flymake-allowed-file-name-masks - '("\\.l?hs$" ghc-flymake-init nil ghc-emacs23-larter-hack)) + '("\\.l?hs$" ghc-flymake-init nil ghc-emacs23-later-hack)) (defconst ghc-flymake-err-line-patterns '("^\\(.*\\):\\([0-9]+\\):\\([0-9]+\\):[ ]*\\(.+\\)" 1 2 3 4)) @@ -33,7 +33,7 @@ ;; flymake of Emacs 23 or later does not display errors ;; if they occurred in other files. So, let's cheat flymake. -(defun ghc-emacs23-larter-hack (tmp-file) +(defun ghc-emacs23-later-hack (tmp-file) (let ((real-name (flymake-get-real-file-name tmp-file)) (hack-name (flymake-get-real-file-name buffer-file-name))) (unless (string= real-name hack-name) diff --git a/elisp/ghc-func.el b/elisp/ghc-func.el index 8d2f533..1c74451 100644 --- a/elisp/ghc-func.el +++ b/elisp/ghc-func.el @@ -184,16 +184,17 @@ (defvar ghc-debug-buffer "*GHC Debug*") +(defmacro ghc-with-debug-buffer (&rest body) + `(with-current-buffer (set-buffer (get-buffer-create ghc-debug-buffer)) + (goto-char (point-max)) + ,@body)) + (defun ghc-call-process (cmd x y z &rest args) - (when ghc-debug - (with-current-buffer (set-buffer (get-buffer-create ghc-debug-buffer)) - (goto-char (point-max)) - (insert (format "%% %s %s\n" cmd (mapconcat 'identity args " "))))) (apply 'call-process cmd x y z args) (when ghc-debug (let ((cbuf (current-buffer))) - (with-current-buffer (set-buffer (get-buffer-create ghc-debug-buffer)) - (goto-char (point-max)) - (insert-buffer-substring cbuf))))) + (ghc-with-debug-buffer + (insert (format "%% %s %s\n" cmd (mapconcat 'identity args " "))) + (insert-buffer-substring cbuf))))) (provide 'ghc-func)