Skip to content

Instantly share code, notes, and snippets.

@yonta
Forked from hebiyan/flycheck-mlton.el
Last active December 4, 2020 08:06
Show Gist options
  • Save yonta/80c938a54f4d14a1b75146e9c0b76fc2 to your computer and use it in GitHub Desktop.
Save yonta/80c938a54f4d14a1b75146e9c0b76fc2 to your computer and use it in GitHub Desktop.
Elisp code that enables syntax and type checking of Standard ML code using MLton through Flycheck.
;;; flycheck-mlton.el --- Flycheck: MLton support -*- lexical-binding: t; -*-
;; This code is modified by SAITOU Keita <keita44.f4@gmail.com>.
;;
;; Original source is available here,
;; URL: http://hebiyan.hatenablog.com/entry/20160316/1458125059
;; Package-Requires: ((emacs "24.1") (flycheck "0.22") (sml-mode "0.4"))
;;; Commentary:
;;; Code:
(require 'flycheck)
(flycheck-define-checker mlton
"Standard ML type and syntax checking with mlton compiler.
See URL 'http://mlton.org"
:command ("mlton" "-stop" "tc" source)
:error-patterns
(;; <= v20130715, and EOF error in >= v20180207
(error line-start "Error: " (file-name) (+ blank) line "." column ".\n"
(message (1+ line-start (+ blank) (+ nonl) "\n")))
;; >= v20180207
(error line-start "Error: " (file-name) (+ blank)
line "." column "-" (+ digit) "." (+ digit) ".\n"
(message (1+ line-start (+ blank) (+ nonl) "\n"))))
:modes sml-mode)
(provide 'flycheck-mlton)
;;; flycheck-mlton.el ends here
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment