From 8e4086d2e31087eb485f161fce53984fe871881d Mon Sep 17 00:00:00 2001 From: Jonathan Date: Sun, 24 May 2020 18:01:50 +0100 Subject: [PATCH 1/3] Clarification for company mode completion 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) ``` --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 6e3f67dc..7341cbe3 100644 --- a/README.md +++ b/README.md @@ -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. If your emacs supports company but you aren't seeing the completion drop-down please try adding a global hook for company mode to your `~/.emacs`: + +```elisp` +(add-hook 'after-init-hook 'global-company-mode) +``` + ### Usage Then you can execute utop inside emacs with: `M-x utop`. From a80b60fc40b662a60788714bd66a781e53d56aa8 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Sun, 24 May 2020 18:06:02 +0100 Subject: [PATCH 2/3] understanding emacs a bit better adding that a company mode minor mode must be added to the utop major mode --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7341cbe3..5c7b3c41 100644 --- a/README.md +++ b/README.md @@ -176,10 +176,10 @@ 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. If your emacs supports company but you aren't seeing the completion drop-down please try adding a global hook for company mode to your `~/.emacs`: +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` -(add-hook 'after-init-hook 'global-company-mode) + (add-hook 'utop-mode-hook 'company-mode) ``` ### Usage From c9726c305c519efb78dd05cd327ec140df4acc90 Mon Sep 17 00:00:00 2001 From: jonathan Date: Thu, 23 Jun 2022 16:43:41 +0100 Subject: [PATCH 3/3] Fixing some typos! --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5c7b3c41..eacccc27 100644 --- a/README.md +++ b/README.md @@ -176,9 +176,9 @@ 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`: +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 separate 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` +```elisp (add-hook 'utop-mode-hook 'company-mode) ```