Created
December 16, 2015 02:39
-
-
Save KeenS/d503f763d3359996a99d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
SMLSHARP=/usr/local/bin/smlsharp | |
OPTIONS=-ftypecheck-only | |
${SMLSHARP} ${OPTIONS} "$@" 2>&1 | ruby -ne 'BEGIN {buf=""}; if $_ =~ /^\s/ then buf += $_.chomp + "\\n" else puts buf; buf = $_.chomp end; END{puts buf}' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(add-to-list 'auto-mode-alist '("\\.ppg$" . sml-mode)) | |
(add-to-list 'auto-mode-alist '("\\.smi$" . sml-mode)) | |
(add-hook 'sml-mode-hook (lambda () | |
(prettify-symbols-mode t) | |
)) | |
(require 'flymake) | |
(defun flymake-smlsharp-init () | |
(let* ((temp-file (flymake-init-create-temp-buffer-copy | |
'flymake-create-temp-inplace)) | |
(local-file (file-relative-name | |
temp-file | |
(file-name-directory buffer-file-name)))) | |
(list (expand-file-name "~/.emacs.d/bin/sml-check.sh") (list "-ftypecheck-only" local-file)))) | |
;; (defun flymake-sml-lint-init () | |
;; (flymake-simple-make-init-impl | |
;; 'flymake-create-temp-inplace nil nil | |
;; buffer-file-name | |
;; 'flymake-get-sml-lint-cmdline)) | |
;; (defun flymake-get-sml-lint-cmdline (source base-dir) | |
;; `("~/Sml/SML-Lint/lint" (,source))) | |
;; (push '(".+\\.sml$" flymake-sml-lint-init) flymake-allowed-file-name-masks) | |
(eval-after-load 'flymake | |
'(progn | |
(add-to-list 'flymake-allowed-file-name-masks '(".+\\.sml$" flymake-smlsharp-init flymake-master-cleanup)) | |
(add-to-list 'flymake-err-line-patterns '("^\\([^: ]*\\):\\([0-9]+\\)\\.\\([0-9]+\\)-[0-9]+\\.[0-9]+ \\(\\(Error\\|Warning\\):.*\\)" | |
1 2 3 4)))) | |
(add-to-list 'compilation-error-regexp-alist-alist '(sml "^\\([^: ]*\\):\\([0-9]+\\)\\.\\([0-9]+\\)-\\([0-9]+\\)\\.\\([0-9]+\\) \\(Error:.*\\)" | |
(1 "%s.sml") (2 . 4) (3 . 5) 2)) | |
(add-to-list 'compilation-error-regexp-alist-alist '(sml "^\\([^: ]*\\):\\([0-9]+\\)\\.\\([0-9]+\\)-\\([0-9]+\\)\\.\\([0-9]+\\) \\(Warning:.*\\)" | |
(1 "%s.sml") (2 . 4) (3 . 5) 2)) | |
(flymake-reformat-err-line-patterns-from-compile-el compilation-error-regexp-alist-alist) | |
(add-hook 'sml-mode-hook (lambda () | |
(flymake-mode) | |
(prettify-symbols-mode))) | |
;; (push '("\\([^,]*\\), line \\([0-9]+\\), column \\([0-9]+\\): \\(.*\\)" | |
;; 1 2 3 4) | |
;; flymake-err-line-patterns) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment