Skip to content

Instantly share code, notes, and snippets.

@epost
Created September 18, 2015 14:57
Show Gist options
  • Save epost/9488b8d435a1946f81de to your computer and use it in GitHub Desktop.
Save epost/9488b8d435a1946f81de to your computer and use it in GitHub Desktop.
;; TODO
;; - Use temp files so emacs can write the current buffer status to an intermediate save file
;; and have pulp compile that. This way, flycheck doesn't have to wait until the user
;; saves the buffer manually, and provide *actual* on-the-fly checking.
;;
;; - Format links to error explanations on purescript wiki nicely.
;; adapted from https://github.com/spion/purscheck/blob/master/purscheck.el
(eval-after-load 'flycheck
'(progn
(flycheck-define-checker purescript-pulp
"Flycheck PureScript code."
;; :command ("pulp" "--monochrome" "build" source source-original temporary-file-name)
;; ;; compiles the SOURCE FILE instead of the project, and with the src dir as cwd
;; :command ("pulp" "--monochrome" "build" source-inplace)
;; :command ("/opt/purescript/psc" source-inplace)
:command ("pulp" "--monochrome" "build")
:error-patterns
((error line-start
(or (and (zero-or-more " ") "Error at " (file-name) " line " line ", column " column (zero-or-more " ") (or ":" "-") (zero-or-more not-newline))
(and "\"" (file-name) "\" (line " line ", column " column "):"))
(or (message (one-or-more not-newline))
(and (or "\r" "\n" "\r\n")
(message
(zero-or-more " ") (one-or-more not-newline)
(zero-or-more (or "\r" "\n")
(zero-or-more " ")
(one-or-more not-newline)))))
line-end))
:modes purescript-mode)
(add-to-list 'flycheck-checkers 'purescript-pulp)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment