Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

make flymake use $HOME/.erlang-flymake as temp dir. Ought to work on …

…windows, and (more importantly) if the erl file is write protected.

smarter(?) include path guessing.

spawn_monitor highlighted as a bif.
  • Loading branch information...
commit 6984b6e13be2f0bcc60ded108cc2caabe1be4080 1 parent 5c6ebcd
@massemanet massemanet authored
Showing with 48 additions and 22 deletions.
  1. +13 −9 erlang-flymake.el
  2. +1 −1  erlang.el
  3. +29 −9 flymaker.sh
  4. +5 −3 test.erl
View
22 erlang-flymake.el
@@ -17,21 +17,25 @@
(if (locate-library "flymake")
(progn
(require 'flymake)
+ (defun flymake-tmp-filename(filename prefix)
+ (let*
+ ((tmp-dir (concat (getenv "HOME") "/.erlang-flymake"))
+ (tmp-name (file-name-nondirectory filename))
+ (tmp-file (concat tmp-dir "/" tmp-name)))
+ (flymake-log 3 "made temp-file: %s" tmp-file)
+ tmp-file))
+ (defun erlang-flymake-init ()
+ "Set up the command used to parse our buffer"
+ (let* ((erlang-dir (file-name-directory (locate-library "erlang")))
+ (temp-file (flymake-init-create-temp-buffer-copy
+ 'flymake-tmp-filename)))
+ (list (concat erlang-dir "flymaker.sh") (list temp-file))))
(defun flymake-siblicide()
"Kill all next-error capable buffers."
(condition-case nil
(progn (kill-buffer (next-error-find-buffer))
(flymake-siblicide))
(error nil)))
- (defun erlang-flymake-init ()
- "Set up the command used to parse our buffer"
- (let* ((erlang-dir (file-name-directory (locate-library "erlang")))
- (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 (concat erlang-dir "flymaker.sh") (list local-file))))
(defun erlang-flymake-next-error ()
"Goto next error, if any. Display error in mini-buffer."
(interactive)
View
2  erlang.el
@@ -551,7 +551,7 @@ This is used to determine matches in complex regexps which contains
"p\\(id_to_list\\|rocess\\(_\\(flag\\|info\\)\\|es\\)\\|ut\\)\\|"
"r\\(egister\\(\\|ed\\)\\|ound\\)\\|"
"s\\(e\\(lf\\|telement\\)\\|ize"
- "\\|p\\(awn\\(\\|_link\\)\\|lit_binary\\)\\|tatistics\\)\\|"
+ "\\|p\\(awn\\(\\|_link\\|_monitor\\)\\|lit_binary\\)\\|tatistics\\)\\|"
"t\\(erm_to_binary\\|hrow\\|ime\\|l\\|r\\(ace\\|unc\\)\\|uple_to_list\\)\\|"
"un\\(link\\|"
"register\\)\\|"
View
38 flymaker.sh
@@ -1,15 +1,35 @@
#!/bin/bash
-echo $1
+dname (){ (cd $1 ; pwd); }
+bdname(){ basename `dname $1`; }
+
+# if our module lives in a src dir, we attempt to handle the cases
+# .../lib/<app>/src/<our module>
+# and
+# .../<app>/src/<our module>
+# assuming that include and ebin are parallel to src
Is=""
PAs=""
-for i in `dirname $1`/../../*/include; do
- Is="-I$i $Is"
-done
-for e in `dirname $1`/../../*/ebin; do
- PAs="-pa$e $PAs"
-done
-
-erlc -o/tmp $Is $PAs -Wall -P $1 | grep -v "list comprehension has no gene"
+if [ `bdname $2` == "src" ]; then
+ if [ `bdname $2/../..` == "lib" ]; then
+ top=`dname $2/../..`
+ else
+ top=`dname $2/..`
+ fi
+ for i in $top/*/include; do
+ Is="-I$i $Is"
+ done
+ for e in $top/*/ebin; do
+ PAs="-pa$e $PAs"
+ done
+else
+ top=`dname $2`
+ PAs="-pa $top"
+ Is="-I $top"
+fi
+
+OUT=`dirname $1`
+
+erlc -o$OUT $Is $PAs -Wall -P $1 | grep -v "list comprehension has no gene"
exit 0
View
8 test.erl
@@ -42,8 +42,8 @@ func4() ->
error
end.
-func5(X)
- when is_atom(X) ->
+func5(Xyz)
+ when is_atom(Xyz) ->
% `is_atom' should be highlighted as a guard above
% All functions below should be highlighted as functions, not
@@ -55,8 +55,10 @@ func5(X)
func6(),
deregistered(),
+ % Xyz should be highlighted as a variabla
+ AppSpec = Xyz/2,
% atom_to_list and element should be highlighted as bifs
- AppName = atom_to_list(element(1, AppSpec)),
+ atom_to_list(element(1, AppSpec)),
% These should be highlighted as bifs.
erlang:registered(),
Please sign in to comment.
Something went wrong with that request. Please try again.