ghc-mod/elisp/ghc-flymake.el
2010-03-12 13:39:38 +09:00

32 lines
851 B
EmacsLisp

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; ghc-flymake.el
;;;
;; Author: Kazu Yamamoto <Kazu@Mew.org>
;; Created: Mar 12, 2010
;;; Code:
(require 'flymake)
(defvar ghc-flymake-allowed-file-name-masks
'("\\.l?hs$" ghc-flymake-init flymake-simple-cleanup flymake-get-real-file-name))
(defvar ghc-flymake-err-line-patterns
'("^\\(.*\\.l?hs\\):\\([0-9]+\\):\\([0-9]+\\):\\(.+\\)" 1 2 3 4))
(add-to-list 'flymake-allowed-file-name-masks
ghc-flymake-allowed-file-name-masks)
(add-to-list 'flymake-err-line-patterns
ghc-flymake-err-line-patterns)
(defun ghc-flymake-init ()
(let ((after-save-hook nil))
(save-buffer))
(let ((file (file-name-nondirectory (buffer-file-name))))
(list ghc-module-command (append (ghc-module-command-args)
(list "check" file)))))
(provide 'ghc-flymake)