抱歉我的英语不好。
我正在使用erlang flymake配置我的emacs。 src嵌套文件夹中的源文件报告“找不到包含文件”,但src/
文件夹中的文件可以找到包含文件。
我的erlang的emacs设置:
;; erlang-mode
(setq load-path (cons "/usr/local/Cellar/erlang/R15B02/lib/erlang/lib/tools-2.6.8/emacs" load-path))
(setq erlang-root-dir "/usr/local/Cellar/erlang/R15B02/lib/erlang")
(setq exec-path (cons "/usr/local/Cellar/erlang/R15B02/lib/erlang/bin" exec-path))
(require 'erlang-start)
;; distel
(add-to-list 'load-path "/usr/local/share/distel/elisp/")
(require 'distel)
(distel-setup)
;; erlang-flymake
(require 'erlang-flymake)
(erlang-flymake-only-on-save)
我的erlang应用程序文件夹如下所示:
app/src/ (source code)
src/mod
src/lib
app/include/ (hrls)
app/ebin/ (compiled code)
...etc
答案 0 :(得分:2)
在erlang-flymake
中有2个变量(erlang-flymake-get-include-dirs-function
和erlang-flymake-get-code-path-dirs-function
),用于指定要搜索的功能包括& ebin目录。现在,他们指向的函数erlang-flymake-get-include-dirs
和erlang-flymake-get-code-path-dirs
只是相应地返回当前目录+ include
和ebin
。例如,您可以使用以下代码执行此操作:
(defun get-erlang-app-dir ()
(let* ((src-path (file-name-directory (buffer-file-name)))
(pos (string-match "/src/" src-path)))
(if pos
(substring src-path 0 (+ 1 pos))
src-path)))
(setq erlang-flymake-get-code-path-dirs-function
(lambda ()
(concat (get-erlang-app-dir) "ebin")))
(setq erlang-flymake-get-code-include-dirs-function
(lambda ()
(concat (get-erlang-app-dir) "include")))
P.S。你使用螺纹钢来维护你的项目吗?
答案 1 :(得分:1)
如果您使用erlang-flymake,您可能需要查看https://github.com/ten0s/syntaxerl。它是Erlang的语法检查程序。它使用了erlang-flymake,但它不使用“erlc”,它使用自定义语法检查器来评估.erl,.hrl,.config,.rel,.app,.app.src,.escript文件。语法检查器可以识别钢筋,但也适用于标准的Erlang / OTP目录结构。 Emacs的设置也在那里。