Illusory stillness

mumble mumble techblog

Setting Up Online Help in Homebrew Erlang/Emacs/Distel

Now IN THEORY, Distel-mode is supposed to show me the online help when I point by cursor at a function name and press C-c C-d h. What I actually get is:

I am unable to Google up a description of how to let Distel know where the HTML documentaiton is (as I installed Erlang from Homebrew, I find the HTML docs under /usr/local/Cellar/erlang/17.0/share/doc/erlang/doc/.)

Now looking in what distel.el actually does with a C-c C-d h I find that Distel contains a module otp_doc which is a singleton gen_server… so I go to an erlang shell on that node and type

1
2
(emacs@dekkera)3> whereis(otp_doc).
<0.44.0>

Now I also saw that the otp_doc module had a property list as the init of its gen_server state. The state contained a root_dir variable. The root_dir variable is initialized to a default of code:root_dir(), which is currently set to:

1
2
(emacs@dekkera)4> code:root_dir().
"/usr/local/Cellar/erlang/17.0/lib/erlang"

Aping Distel and calling otp_doc does:

1
2
(emacs@dekkera)9> otp_doc:distel(link, "orddict", "find", 2).
no_html

Meanwhile, another Distel function C-c C-d A which is bound to erl-show-arglist works fine when pressed ad orddict:find|. And C-c C-d d also comes up with useful information — but this information doesn’t look like /documentation/.

From Emacs. C-c C-d h does (erl-do-find-doc 'link 'point 'coderoot_dir 0)`,

And it looks like init() calls index_html() the no_html is coming from init() I guess. Here’s how:

1
2
3
html_index(file,Dir) ->
  FN = filename:join([Dir,"doc","man_index.html"]),
  fold_file(curry(fun lines/3,Dir),[],FN).

So do I need to set root_dir to /usr/local/Cellar/erlang/17.0/share/erlang? Or alter how otp_doc is being initialized? Looks like it is accessed through otp_doc:start.

So how to provide the start state from Emacs?

I can’t find where this value is configured, anywhere.

So I just crapped out and made a symlink:

1
2
dekkera:lib peter$ cd /usr/local/Cellar/erlang/17.0/lib/erlang
dekkera:lib peter$ ln -s ../../share/doc/erlang/doc doc

This got rid of no_html error but I still don’t find any HTML documentation! What the hell. I’ll have to see why it’s not reading the HTML file and populating the ETS database, or something.

This is more debugging of Erlang than I can handle when all I’m trying to do is write Erlang code. Argh.