[erlang-questions] emacs compilation command

Dominic Williams xpdoka@REDACTED
Thu Aug 9 14:23:00 CEST 2007

Hi Roberto,

> Unfortunately I am not proficient enough in elisp, is there anybody
> who has more elisp experience  and can point me into the right
> direction ? I see below at the relevant code-snippet of the function
> inferior-erlang-compile, that the current directory is retrieved with
> file:get_cwd(), but how can I go from there in elisp to ../ebin ?

I think that code snippet can be left alone. However, it uses the
elisp variable "dir" to set the "outdir" option of c(). The dir variable
gets set a few lines up like this:

  (let ((dir (file-name-directory (buffer-file-name)))

I.e. it uses the buffer's directory.

So, setting dir to a different value is what you want. The
following elisp code uses ../ebin if it exists, and otherwise
reverts to the current behaviour:

  (let* ((buffer-dir (file-name-directory (buffer-file-name)))
	(ebin (concat buffer-dir "../ebin/"))
	(dir (if (file-readable-p ebin) ebin buffer-dir))

Hope that helps! Regards,

Dominic Williams


More information about the erlang-questions mailing list