Merge pull request #88 from gleber/erlang-compile
Make C-c C-k aware of rebar and rebar.config
This commit is contained in:
commit
577be2e5e3
1 changed files with 19 additions and 0 deletions
|
@ -47,6 +47,25 @@
|
||||||
(add-to-list 'load-path wrangler-path)
|
(add-to-list 'load-path wrangler-path)
|
||||||
(require 'wrangler)))
|
(require 'wrangler)))
|
||||||
|
|
||||||
|
(defun erlang-rebar-compile ()
|
||||||
|
(interactive)
|
||||||
|
(let* ((dir (or (projectile-get-project-root)
|
||||||
|
(file-name-directory (buffer-file-name))))
|
||||||
|
(pref (concat "cd " dir " && "))
|
||||||
|
(cmd (cond ((file-exists-p (expand-file-name "rebar" dir)) "./rebar compile")
|
||||||
|
((executable-find "rebar") "rebar compile")
|
||||||
|
((file-exists-p (expand-file-name "Makefile" dir)) "Makefile")
|
||||||
|
(t nil))))
|
||||||
|
(if cmd
|
||||||
|
(compilation-start (concat pref cmd))
|
||||||
|
(call-interactively 'inferior-erlang-compile))
|
||||||
|
))
|
||||||
|
|
||||||
|
(add-hook 'erlang-mode-hook (lambda ()
|
||||||
|
(make-variable-buffer-local 'projectile-project-root-files)
|
||||||
|
(setq projectile-project-root-files '("rebar.config" ".git" ".hg" ".bzr" ".projectile"))
|
||||||
|
(setq erlang-compile-function 'erlang-rebar-compile)))
|
||||||
|
|
||||||
(provide 'prelude-erlang)
|
(provide 'prelude-erlang)
|
||||||
|
|
||||||
;;; prelude-erlang.el ends here
|
;;; prelude-erlang.el ends here
|
||||||
|
|
Loading…
Reference in a new issue