* Create new option, erlang-compile-outdir, which is concat'ed to the beam outdir...
[erlware-mode.git] / erlang-flymake.el
blobfae63e54e4b83245f0f573abd12e94f110bf8da3
1 ;; erlang-flymake.el --- Flymake support.
3 ;; Author: Mats Cronqvist
4 ;; Version: 0.1
5 ;; Keywords: erlang, flymake
6 ;; Created: 2009-05-14
8 ;; based on snippets stolen from
9 ;; http://www.emacswiki.org/emacs/FlyMake
10 ;; and
11 ;; http://www.emacswiki.org/emacs/FlymakeErlang
13 ;; to enable, put something like this in your erlang-mode-hook
14 ;; (flymake-mode)
15 ;; (local-set-key (kbd "M-'") 'erlang-flymake-next-error)
17 (if (locate-library "flymake")
18 (progn
19 (require '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)
26 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."
36 (interactive)
37 (flymake-goto-next-error)
38 (let ((err (get-char-property (point) 'help-echo)))
39 (when err
40 (message err))))
41 ;; add our init file to flymake's alist of filename regexps
42 (add-to-list
43 'flymake-allowed-file-name-masks
44 '(".+\\.erl$" erlang-flymake-init))))