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

Clarification for company mode completion #326

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

rottened23
Copy link

@rottened23 rottened23 commented May 24, 2020

(Very) New to emacs so not sure if this is was implied or obvious. Was using the Spacemacs flavour of emacs and wasn't getting any code completion in utop despite seeing it work properly with tuareg when ending *.ml/mli files. Turns out just needed to enable company as a minor mode when using utop as a major mode ~/.emacs

Figured might as well try posting in-case as it took me a couple of hours of elisp debugging to figure this out.

After additional debugging it seems that opam-user-setup actually did a lot of this heavy lifting for tuareg mode

New to emacs so not sure if this is was implied or anything. Was using the spacemacs flavour of emacs and wasn't getting any code completion in utop despite seeing it work properly with the merlin-mode. Was able to fix this by adding this to my `~/.emacs`

```elisp`
(add-hook 'after-init-hook 'global-company-mode)
```
Figured might as well try posting in-case it helps anyone else in a similar position.

But as mentioned for some reason this worked out of the box for merlin mode - my (very much a) guess is due to:

```
(require 'company)
```
adding that a company mode minor mode must be added to the utop major mode
README.md Outdated
@@ -176,6 +176,12 @@ copy&paste this to your `~/.emacs`:
(autoload 'utop "utop" "Toplevel for OCaml" t)
```

Utop in emacs also supports TAB-completion. If your version of emacs includes `company` completion will appear at the code point. Otherwise completion will appear in a seperate buffer. In the case of `company` a hook **must** be added to enable `company` as a minor mode when running utop in major mode. To enable please add the following to your `~/.emacs`:

```elisp`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's an unnecessary backtick after elisp

README.md Outdated
@@ -176,6 +176,12 @@ copy&paste this to your `~/.emacs`:
(autoload 'utop "utop" "Toplevel for OCaml" t)
```

Utop in emacs also supports TAB-completion. If your version of emacs includes `company` completion will appear at the code point. Otherwise completion will appear in a seperate buffer. In the case of `company` a hook **must** be added to enable `company` as a minor mode when running utop in major mode. To enable please add the following to your `~/.emacs`:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seperate -> separate

@rottened23
Copy link
Author

Good catch and resolved the spelling mistake/extra backtick!

@bbatsov
Copy link
Contributor

bbatsov commented Jul 19, 2022

company-mode is mostly used as a global mode (global-company-mode), so I wouldn't recommend the current wording. (or we can have more examples)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants