Use rebar in emacs?

前端 未结 1 1743
我在风中等你
我在风中等你 2021-01-06 15:42

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
         


        
相关标签:
1条回答
  • 2021-01-06 15:49

    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:

    (defun my-find-rebar-root ()
      (let ((dir (locate-dominating-file default-directory "rebar.config")))
        (or dir default-directory)))
    

    and after that you can use this function for compilation:

    (defun my-inferior-erlang-compile ()
      (interactive)
      (let ((default-directory (my-find-rebar-root)))
        (compile "make")))
    

    Although, I'm not sure that the make is right command here - maybe it's better to use rebar 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.

    0 讨论(0)
提交回复
热议问题