osiire’s blog

ふしぎなそふとやさん

emacs+omakeなocamler向けのflymake設定

下記の設定を.emacsに入れてocaml-flymake.shを適当な場所に置くだけ。色はお好みにどうぞ。

(require 'flymake)
(push '("File \"\\(.*\\)\", line \\([0-9]+\\), characters \\([0-9]+\\)--?\\([0-9]+\\):\\(.*\\)" 1 2 3 5) flymake-err-line-patterns)
(push '("\\.ml\\'" flymake-ocaml-init) flymake-allowed-file-name-masks)
(defun flymake-ocaml-init ()
  (list "~/.emacs.d/ocaml-flymake.sh"))
(custom-set-faces
 '(flymake-errline ((((class color)) (:background "LightYellow" :underline "OrangeRed"))))
 '(flymake-warnline ((((class color)) (:background "LightBlue2" :underline "Yellow")))))

ocaml-flymake.sh(/opt/ocaml/binはocamlのバイナリがインストールしてあるパス)

#!/bin/sh
env PATH=${PATH}:/opt/ocaml/bin omake -s 2>&1 | tr -d "\n" | sed -e 's/\t//g'