ChangeLog.
[erlware-mode.git] / erlang-flymake.el
blobb9ae501048a8ef62c0d771e38764b9b5ea91f8c2
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-init ()
21 "Set up the command used to parse our buffer"
22 (let* ((erlang-dir (file-name-directory (locate-library "erlang")))
23 (temp-file (flymake-init-create-temp-buffer-copy
24 'flymake-create-temp-inplace))
25 (local-file (file-relative-name
26 temp-file
27 (file-name-directory buffer-file-name))))
28 (list (concat erlang-dir "flymaker.sh") (list local-file))))
29 (defun erlang-flymake-next-error ()
30 "Goto next error, if any. Display error in mini-buffer."
31 (interactive)
32 (let ((err-buf nil))
33 (condition-case err
34 (setq err-buf (next-error-find-buffer))
35 (error))
36 (if err-buf
37 (next-error)
38 (progn
39 (flymake-goto-next-error)
40 (let ((err (get-char-property (point) 'help-echo)))
41 (when err
42 (message err)))))))
43 ;; add our init file to flymake's alist of filename regexps
44 (add-to-list
45 'flymake-allowed-file-name-masks
46 '(".+\\.erl$" erlang-flymake-init))))