sebastiw / distel-completion

Erlang/distel completion backend for both auto-complete and company-mode
GNU General Public License v3.0
7 stars 5 forks source link

auto-complete wont work #7

Closed kradalby closed 8 years ago

kradalby commented 8 years ago

Hi

I am trying to use this plugin with auto-complete, but I cannot seem to figure out how.

I have added: (require 'auto-complete-distel) (setq ac-sources '(distel-completions))

to my config file, and I have made sure there is a connection between Emacs/distel and the erlang node. Both by pinging and by using distels M - Tab combination.

After some investigation, I see that emacs has not registered the function erl-ac-get-start, but the variable distel-completions is defined.

I have also tried to load auto-complete-distel.el manually, and it reports no errors.

Please let me know what information is needed.

sebastiw commented 8 years ago

Hi, please download latest commit and try again

kradalby commented 8 years ago

I have pulled the repo and updated the config. But it still wont work, I am starting to wonder if im just studpid.

I am pretty new to Emacs. And I see that i do not have a minor mode from this package, I only see Erlang-extended and Global-auto-complete.

Is there someway I could trigger it manually to see if that works?

When i test now, I do this

  1. Starting emacs
  2. start the erlang vm Cc Cz
  3. M x erl-ping
  4. tries to autocomplete, works with M TAB from destil, but not auto-complete i think.

In step 3. i am sometimes asked when connecting to the erlang vm to kill a process that is running:

*net-fsm* has a running process; kill it (y or n)
sebastiw commented 8 years ago

Hi, the net-fsm thing is quite normal i think. It happens when emacs tries to upload the erlang code to the erlang node AFAIK.

What does "C-h v ac-sources" (describe-variable) say? If it does not mention distel you may want to check the updated readme. (The part with the add-hook)

This is not a mode, merely a completion-source to auto-complete, so it won't show up as a minor-mode. On Apr 21, 2016 10:18 PM, "Kristoffer Dalby" notifications@github.com wrote:

I have pulled the repo and updated the config. But it still wont work, I am starting to wonder if im just studpid.

I am pretty new to Emacs. And I see that i do not have a minor mode from this package, I only see Erlang-extended and Global-auto-complete.

Is there someway I could trigger it manually to see if that works?

When i test now, I do this

  1. Starting emacs
  2. start the erlang vm Cc Cz
  3. M x erl-ping
  4. tries to autocomplete, works with M TAB from destil, but not auto-complete i think.

In step 3. i am sometimes asked when connecting to the erlang vm to kill a process that is running:

net-fsm has a running process; kill it (y or n)

— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/sebastiw/company-distel/issues/7#issuecomment-213098627

kradalby commented 8 years ago

It is loaded:

(distel-completions ac-source-abbrev ac-source-dictionary ac-source-words-in-same-mode-buffers)

Then I guess it must be something I'm doing wrong.

Am I totally wrong when I expect the following behaviour for a working installation?:

If i write for example lists:mem, it will suggest lists:member? I have tried to write functions that are not complete, and run the ac-expand and ac-complete functions aswell.

sebastiw commented 8 years ago

Your work flow looks correct to me. And you seem to have the node up.

Do you press "yes" on the kill-netfsm message? Does it print something like "successfully uploaded to backend" or something similar?

I think you should debug the elisp function "distel-completion-complete".

  1. open the file distel-completion-lib.el
  2. find the function "distel-completion-complete"
  3. M-x edebug-defun This will add the function to the debugger, the next time the function is about to be executed, emacs will stop at this function to let you step-through the code (with "C-n" or "[Enter]" I think).

If it does not break, then the code is not executed, and you should try to do the same with "erl-ac-get-start" in auto-complete-distel.el

To remove the function from the debugger so it does not break at the code: Move point to the last closing parenthesis of the function and press "C-x C-e" (eval-last-sexp) to evaluate the function (reload).

My .emacs looks something like this:

;; erlang (add-to-list 'auto-mode-alist '(".[eh]rl\'" . erlang-mode)) (add-to-list 'auto-mode-alist '(".yaws?\'" . erlang-mode)) (add-to-list 'auto-mode-alist '(".escript?\'" . erlang-mode)) (require 'erlang-start)

;; distel (add-to-list 'load-path "~/Programmering/distel/elisp/") (require 'distel) (distel-setup)

;; auto-completion (add-to-list 'load-path "~/Programmering/company-distel/") (require 'auto-complete) (require 'auto-complete-distel) (add-hook 'erlang-mode-hook '(lambda () (add-to-list 'ac-sources 'distel-completions))) Good luck and good night. I will reply more tomorrow If you still have troubles.

On Apr 21, 2016 10:41 PM, "Kristoffer Dalby" notifications@github.com wrote:

It is loaded:

(distel-completions ac-source-abbrev ac-source-dictionary ac-source-words-in-same-mode-buffers)

Then I guess it must be something I'm doing wrong.

Am I totally wrong when I expect the following behaviour for a working installation?:

If i write for example lists:mem, it will suggest lists:member? I have tried to write functions that are not complete, and run the ac-expand and ac-complete functions aswell.

— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/sebastiw/company-distel/issues/7#issuecomment-213105754

kradalby commented 8 years ago

Do you press "yes" on the kill-netfsm message? Does it print something like "successfully uploaded to backend" or something similar?

That is correct, and after i kill it, it succeeds and I can use the M + TAB to complete, which I guess is the original autocomplete from destil.

When I try to debug, it does not break at all, so I guess that it does not execute them at all. I have verified that my JS and Python completer works, so auto-complete is working.

I do not know if this is as intended, but one thing I noticed is that when i try to run the erl-ac-get-start or distel-completion-complete via M + x, they are "not available" (this may be the point, and I may not understand the scooping of elisp:P). However, when I check them through C + h f, they are both defined and I can read the "help text".

Thank you for your help so far, I will go away until Sunday. In case I maybe did something stupid in my emacs.d, here is my config if you want to take a look: https://github.com/kradalby/emacs.d

kradalby commented 8 years ago

Hi again

I figured it out.

I noticed that auto-complete-mode was disabled when erlang-mode was active.

I solved it by adding: (add-hook 'erlang-mode-hook 'auto-complete-mode)

Thank you so much for you help :) 👍

sebastiw commented 8 years ago

Nice! Good that it was nothing more serious :)