Browse Source

make C-c C-k aware of rebar and rebar.config

custom
Gleb Peregud 14 years ago
parent
commit
5921ed3a91
  1. 19
      modules/prelude-erlang.el

19
modules/prelude-erlang.el

@ -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…
Cancel
Save