This is small proposal to improve erlang navigation when coding. It is a
two piece adjustment:
In the Makefile
tags:
find src include deps -name "*.[he]rl" -print | xargs etags -o TAGS
And in emacs, you can do this:
(defun le2m/erlang-update-tags ()
(interactive)
(let ((root (locate-dominating-file default-directory "Makefile")))
(when root
(let ((default-directory root))
(shell-command "gmake tags")
(message "Tags updated")))))
(advice-add 'erlang-compile :before #'le2m/erlang-update-tags)
When typing C-c C-k, the TAGS file will be “automagically” created
Let’s dive into some new language programming. Functional of
course… Erlang!
In Openbsd, did some tweaks into the installation process…
~> doas pkg_add erlang rebar
~> ln -s /usr/local/bin/erl<version> ~/bin/erl # my personal bin directory
~> ln -s /usr/local/bin/rebar<version> ~/bin/rebar
It was not so obvious for me but it seems that rebar is to erlang like
leiningen is to clojure. And as such, you can initialize your project
quite easily
rebar new umbrella prj-name
Also your first time?
A bit more on rebar
You can see all templates and understand them better with
Now what?
Well, now with the template one can really program in Emacs. I am
currently using erlang mode from this instruction. However, my load
path was a bit different.
(setq load-path (cons "/usr/local/lib/erlang<version>/lib/tools-<tools version>/emacs"
load-path))
(setq erlang-root-dir "/usr/local/erlang<version>")
(setq exec-path (cons "/usr/local/erlang<version>/bin" exec-path))
(require 'erlang-start)
Once that is fired up, in the *app*.erl file, C-c C-k to compile
(quite ciderish… very comfy).
Doubts?
If in doubt with rebar
rebar help <command that clouds your mind>
If in doubt with erlang:
/comments ~lucasemmoreira/opinions@lists.sr.ht?Subject=Re: Erlang small QoL