There is a defun
in .emacs to get erlang project path, how can I execute a shell-command to do the following:
cd *~/erlang-project-folder*
make
I'm using rebar to build my project, and there is a Makefile to do everything.
I can compile by overriding erlang-compile-function
, but I'm not familiar with Emacs Lisp, please help.
Here is my .emacs:
(defun erlang-project-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)))
;; there is an error: wrong type argument: commandp
(defun my-inferior-erlang-compile ()
(shell-command.
(concat (concat (concat "cd" erlang-project-dir) "; make"))))
(defvar erlang-compile-function 'my-inferior-erlang-compile)
Instead of relying on directory structure, it's better to try to locate the
rebar.config
file that is in the root of your project. This could be achieved with following code:and after that you can use this function for compilation:
Although, I'm not sure that the
make
is right command here - maybe it's better to userebar compile
instead?P.S. I hope, that I'll find some free time, and will finish rebar support in EDE - in this case, it will be the same unified interface for work with projects.