Erlang emacs mode - outdir setup

Does anyone know how to set up Erlang emacs mode so that the [Cc Ck] buffer compilation writes the beam file to the ebin directory and not to the current directory?

Thanks!

+6
erlang emacs
source share
2 answers

You might want to take a look at this thread on the Erlang Questions mailing list:

http://www.erlang.org/pipermail/erlang-questions/2007-August/028367.html

In addition, you should be able to compile the file in debug mode: Cu Cc Ck

The erlang-compile command must support prefix arguments. You might want to see:

http://www.gnu.org/software/emacs/manual/html_node/elisp/Prefix-Command-Arguments.html

+1
source share

If you configured your directory structure as follows:

/ /src/ /ebin/ 

and put your module (for example, "my_file.erl") in the directory "/ src /", then compile it (Cc Ck), then Emacs should automatically put the beam in the directory "/ ebin /".

However, if your module is not located in the directory with the name "/ src /" (or if the directory "ebin" is missing), the beam will be deleted along with the source file.

To find out how it works, take a look at $ ERL_TOP / lib / tools / emacs / erlang.el and search for "ebin". Here's what you find:

 (defun inferior-erlang-compile-outdir () "Return the directory to compile the current buffer into." (let* ((buffer-dir (directory-file-name (file-name-directory (buffer-file-name)))) (parent-dir (directory-file-name (file-name-directory buffer-dir))) (ebin-dir (concat (file-name-as-directory parent-dir) "ebin")) (buffer-dir-base-name (file-name-nondirectory (expand-file-name (concat (file-name-as-directory buffer-dir) "."))))) (if (and (string= buffer-dir-base-name "src") (file-directory-p ebin-dir)) (file-name-as-directory ebin-dir) (file-name-as-directory buffer-dir)))) 

Not sure when this product was added, but it was in OTP_R13B03 , and it works for me in R14B03.

+1
source share

All Articles