massemanet/distel

I cannot get autocomplete to work

azimut opened this issue · 1 comments

I am new to erlang so I am not sure how to troubleshoot yet.

I am using the 2018 branch without the last commit.

Trying to autocomplete otp_doc:fire with M-TAB It does not work. Albeit I can still jump into code source definition with M-. above otp_doc:firefox.

This is after I tried to fix my installation, because on my system code:root_dir(). is /usr/lib64/erlang and in that dir there isn't a doc dir so I copied it from /usr/share

> cd /usr/lib64/erlang
> mkdir doc
> sudo cp -r /usr/share/doc/erlang-21.1.1/* doc/
> ls -l  doc/man_index.html doc/kernel-6.1/doc/html/index.html
-rw-r--r-- 1 root root 53377 Mar 13 17:00 doc/kernel-6.1/doc/html/index.html
-rw-r--r-- 1 root root 97435 Mar 13 17:00 doc/man_index.html

Logs:

On *messages*

epmd-process - msg: \0�zemacs
epmd-recv-port-resp - Event: data
epmd-recv-port-resp - data: w\0M\0\0�\0�\0�emacs\0\0
epmd-recv-port-resp - arg: w\0M\0\0�\0�\0�emacs\0\0
nodeup: emacs@sabayon
nodedown: emacs@sabayon [2 times]
error in process filter: cl--assertion-failed: Assertion failed: (eq (erlext-get-code (quote null)) (erlext-read1))
error in process filter: Assertion failed: (eq (erlext-get-code (quote null)) (erlext-read1))

On *trace*

>> REG_SEND: [TYPE erl-pid distel_19038@sabayon 11 0 0] rex [[TYPE erl-pid distel_19038@sabayon 11 0 0] [call code ensure_loaded (distel) [TYPE erl-pid distel_19038@sabayon 1 0 0]]]
>> REG_SEND: [TYPE erl-pid distel_19038@sabayon 10 0 0] rex [[TYPE erl-pid distel_19038@sabayon 10 0 0] [call distel rpc_entry (distel functions (otp_doc "fir")) [TYPE erl-pid distel_19038@sabayon 1 0 0]]]
<< SEND: [TYPE erl-pid distel_19038@sabayon 11 0 0] [rex [module distel]]

Still working on it. A couple of thoughts:

  • Since I used the 2018 branch it seems i need to load massemanet/trane beforehand.
  • My main_index.html has relative path pointing to "../lib/", probably a thing of my distro to fix.
  • Code seems to be case sensitive, i think it might be better lowercase when parsing html. My man_index.html at least didn't match what the code expected. For example lines/3 I change it to the following in order to have otp_doc ets load the {file,*} tuples at least.
lines(Line,_,Dir) ->
  L_Line = string:lowercase(Line),
  case string:tokens(L_Line, "<> \"") of
    ["td", "a", "href=", "../lib/"++Href, M|_] ->
      case filename:basename(Href,".html") of
        "index" -> ok;
        M -> e_set({file,M}, filename:join([Dir,"doc",Href]))
      end;
    _ -> ok
  end.