Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Troubles regarding ocaml layer #1674

Closed
cjf-666 opened this issue May 21, 2015 · 13 comments
Closed

Troubles regarding ocaml layer #1674

cjf-666 opened this issue May 21, 2015 · 13 comments

Comments

@cjf-666
Copy link
Contributor

cjf-666 commented May 21, 2015

Since ocaml layer's merlin package heavily rely on fuzzy and auto-complete, it is strange to find that the package.el in ocaml layer actually doesn't include fuzzy neither turn on auto-complete-mode.

I found auto-completion layer has perfectly instructed how to enable company-mode for a specific mode, but I can't figure out how to do the same with auto-complete. Can anybody give me a hint?

I am expecting to use spacemacs for ocaml code editing. Any help would be appreciated.

Thanks!

@syl20bnr
Copy link
Owner

Try the develop branch, there is a lot of improvements for ocaml in there.

@cjf-666
Copy link
Contributor Author

cjf-666 commented May 22, 2015

Thank you for your help.

Actually I tried out the develop branch but still got some problems:

  1. In the function ocaml/init-merlin, merlin-mode has been hooked to tuareg-mode-hook, (add-hook 'tuareg-mode-hook 'merlin-mode), but when editing ocaml code, ie, when tuareg-mode is on, merlin-mode isn't enabled.
  2. This layer config in the develop branch disable auto-complete and use company backend instead. However, merlin heavily rely on auto-complete and fuzzy, company doesn't make the best completion. Is there a way to actually turn them on instead using company like right now?

@kingcons
Copy link
Contributor

Paging @edwintorok?

@edwintorok
Copy link
Contributor

@ChingfanTsou do you have opam and merlin installed and did you run eval $(opam config -env)? I see merlin (default) utop in my status bar, and the merlin commands definitely work for me.

I'll take a look at using auto-complete instead of company, I just went with company because that is what spacemacs's autocompletion/README.md had an example for.

@edwintorok
Copy link
Contributor

@ChingfanTsou Please try my ocaml-auto-complete branch: https://github.com/edwintorok/spacemacs/tree/ocaml-auto-complete

@cjf-666
Copy link
Contributor Author

cjf-666 commented May 23, 2015

@edwintorok Thanks for the update.

Yes, I have opam and merlin installed and worked pretty well, and my own emacs config about tuareg and merlin worked just fine as well.
After trying out your branch, I found that merlin was automatically enabled and auto-complete worked as expected.

It seemed strange, I guess disabling auto-complete in the develop branch has something to do with it?

@edwintorok
Copy link
Contributor

Can you also try this branch? It doesn't have auto-complete enabled, but fixes some errors with flycheck initialization.

@cjf-666
Copy link
Contributor Author

cjf-666 commented May 24, 2015

@edwintorok ocaml-tweaks branch works fine. Thanks for the excellent work!

It looks strange though. auto-complete is commented out within ocaml-packages, merlin-use-auto-complete-mode is still set to t, and spacemacs|enable-auto-complete is still invoked, which means auto-complete is actually enabled.

It won't cause too much troubles, although it makes both company and auto-complete enabled. However, why enable company when it is auto-complete who actually does the job?

@edwintorok
Copy link
Contributor

On 05/24/2015 06:13 AM, Chingfan Tsao wrote:

@edwintorok https://github.com/edwintorok |ocaml-tweaks| branch works fine. Thanks for the excellent work!

It looks strange though. |auto-complete| was commented out within |ocaml-packages|, |merlin-use-auto-complete-mode| was still set to |t|, and |spacemacs|enable-auto-complete| was still invoked.

It won't cause too much troubles, although it made both |company| and |auto-complete| enabled.

I've commented out the auto-complete initialization here (i.e. it uses company):
https://github.com/edwintorok/spacemacs/tree/ocaml-tweaks

And I've commented out the company mode initialization here (i.e. it uses auto-complete):
https://github.com/edwintorok/spacemacs/tree/ocaml-auto-complete

Please try these two branches and let me know how they work for you.

Apparently Merlin prefers company-mode slightly over auto-complete: ocaml/merlin#55 (comment)

BTW, how did you manage to make merlin work with company? Just curious.

Merlin supports both auto-complete and company, I only followed the spacemacs documentation: https://github.com/syl20bnr/spacemacs/tree/develop/contrib/auto-completion#add-auto-completion-in-a-layer, and Merlin's documentation: https://github.com/the-lambda-church/merlin/wiki/emacs-from-scratch#company-mode on how to enable it.

BTW which version of Merlin do you have? I'm testing my layer with Merlin 2.2.

@cjf-666
Copy link
Contributor Author

cjf-666 commented May 26, 2015

@edwintorok both ocaml-auto-complete and ocaml-tweaks work fine. I'm currently use merlin 2.1.2. It looks like merlin works well with company.

Thanks for the excellent work!

@syl20bnr
Copy link
Owner

It looks like merlin works well with company.

@ChingfanTsou so what do we do here ? If company is fine then we prefer to use company in spacemacs, but if there is a big missing feature in the company backend then we might consider auto-complete. What's your current thought about auto-completion for ocaml ?

@cjf-666
Copy link
Contributor Author

cjf-666 commented May 28, 2015

@syl20bnr Actually according to this given by @edwintorok , company is definitely fine. I don't think there's a big missing feature in the company backend.

Thanks!

@TheBB
Copy link
Collaborator

TheBB commented Sep 17, 2015

I'm assuming I can close this, then. I'm a bit confused whether there is actually a problem that needs to be solved. If there is, please let us know.

@TheBB TheBB closed this as completed Sep 17, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants