Simply passing GHC options to ghc-mod check command.

This commit is contained in:
khibino
2011-10-19 19:09:36 +09:00
parent 8051e7df2e
commit cbed907038
4 changed files with 14 additions and 9 deletions

View File

@@ -13,6 +13,7 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defvar ghc-hlint-options nil "*Hlint options")
(defvar ghc-ghc-options nil "*GHC options")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -45,18 +46,17 @@
(let ((after-save-hook nil))
(save-buffer))
(let ((file (file-name-nondirectory (buffer-file-name))))
(list ghc-module-command (ghc-flymake-command file ghc-hlint-options))))
(list ghc-module-command (ghc-flymake-command file))))
(defvar ghc-flymake-command nil) ;; nil: check, t: lint
(defun ghc-flymake-command (file opts)
(defun ghc-flymake-command (file)
(if ghc-flymake-command
(let ((hopts (ghc-mapconcat (lambda (x) (list "-h" x)) opts)))
(let ((hopts (ghc-mapconcat (lambda (x) (list "-h" x)) ghc-hlint-options)))
`(,@hopts "lint" ,file))
(if (null ghc-flymake-check-includes)
(list "check" file)
(let ((includes (ghc-mapconcat (lambda (x) (list "-i" x)) ghc-flymake-check-includes)))
`("check" ,@includes ,file)))))
(let ((gopts (ghc-mapconcat (lambda (x) (list "-g" x)) ghc-ghc-options))
(includes (ghc-mapconcat (lambda (x) (list "-i" x)) ghc-flymake-check-includes)))
`(,@gopts "check" ,@includes ,file))))
(defun ghc-flymake-toggle-command ()
(interactive)