1 ;; erlang-flymake.el --- Flymake support.
3 ;; Author: Mats Cronqvist
5 ;; Keywords: erlang, flymake
8 ;; based on snippets stolen from
9 ;; http://www.emacswiki.org/emacs/FlyMake
11 ;; http://www.emacswiki.org/emacs/FlymakeErlang
13 ;; to enable, put something like this in your erlang-mode-hook
15 ;; (local-set-key (kbd "M-'") 'erlang-flymake-next-error)
17 (if (locate-library "flymake")
20 (defun erlang-flymake-tmp-filename(filename prefix
)
21 "Make a temp file name (in $HOME/.erlang-flymake)"
22 (let* ((tmp-dir (concat (getenv "HOME") "/.erlang-flymake"))
23 (tmp-name (file-name-nondirectory filename
))
24 (tmp-file (concat tmp-dir
"/" tmp-name
)))
25 (flymake-log 3 "temp-file is: %s" tmp-file
)
27 (defun erlang-flymake-init ()
28 "Set up the command used to parse our buffer"
29 (let* ((erlang-dir (file-name-directory (locate-library "erlang")))
30 (temp-file (flymake-init-create-temp-buffer-copy
31 'erlang-flymake-tmp-filename
)))
32 (list (concat erlang-dir
"flymaker.sh")
33 (list temp-file default-directory
))))
34 (defun erlang-flymake-next-error ()
35 "Goto next error, if any. Display error in mini-buffer."
37 (flymake-goto-next-error)
38 (let ((err (get-char-property (point) 'help-echo
)))
41 ;; add our init file to flymake's alist of filename regexps
43 'flymake-allowed-file-name-masks
44 '(".+\\.erl$" erlang-flymake-init
))))