caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Ocaml autocomplete support in Emacs
@ 2015-12-02 11:50 Matej Kosik
  2015-12-02 11:52 ` Lukasz Stafiniak
  0 siblings, 1 reply; 9+ messages in thread
From: Matej Kosik @ 2015-12-02 11:50 UTC (permalink / raw)
  To: caml-list

Hi,

I would like to ask how can I enable auto-complete within Emacs.

I have installed Merlin.
I've tested it and it seems to work.
(jump to definition; jump back; show the type of the expression)

Now, when I have some partial identifier I would like to Merlin auto-complete it (if there is no ambiguity) or show the list of possible completions,
how can I do that?

At the moment, pressing TAB does nothing.
I've also try some of the commands that were supposed to perfrom the auto-complete action, but Emacs does not recognize them (yet).

This is how my current ~/.emacs file looks like:
http://matej-kosik.github.io/www/tmp/emacs.txt

What should I do?

Thank you very much for any help/tips.

--

Matej

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Caml-list] Ocaml autocomplete support in Emacs
  2015-12-02 11:50 [Caml-list] Ocaml autocomplete support in Emacs Matej Kosik
@ 2015-12-02 11:52 ` Lukasz Stafiniak
  2015-12-02 12:03   ` Matej Kosik
  0 siblings, 1 reply; 9+ messages in thread
From: Lukasz Stafiniak @ 2015-12-02 11:52 UTC (permalink / raw)
  To: Matej Kosik; +Cc: Caml

On Wed, Dec 2, 2015 at 12:50 PM, Matej Kosik
<5764c029b688c1c0d24a2e97cd764f@gmail.com> wrote:
>
> Now, when I have some partial identifier I would like to Merlin auto-complete it (if there is no ambiguity) or show the list of possible completions,
> how can I do that?
>
> At the moment, pressing TAB does nothing.

Did you mean Meta-TAB here? (That's Emacs default for auto-complete.)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Caml-list] Ocaml autocomplete support in Emacs
  2015-12-02 11:52 ` Lukasz Stafiniak
@ 2015-12-02 12:03   ` Matej Kosik
  2015-12-02 13:04     ` Matthieu Dubuget
  2015-12-02 13:13     ` Francois Berenger
  0 siblings, 2 replies; 9+ messages in thread
From: Matej Kosik @ 2015-12-02 12:03 UTC (permalink / raw)
  To: Lukasz Stafiniak; +Cc: Caml

Hi Lukasz,

On 12/02/2015 12:52 PM, Lukasz Stafiniak wrote:
> On Wed, Dec 2, 2015 at 12:50 PM, Matej Kosik
> <5764c029b688c1c0d24a2e97cd764f@gmail.com> wrote:
>>
>> Now, when I have some partial identifier I would like to Merlin auto-complete it (if there is no ambiguity) or show the list of possible completions,
>> how can I do that?
>>
>> At the moment, pressing TAB does nothing.
> 
> Did you mean Meta-TAB here? (That's Emacs default for auto-complete.)
> 

When the cursor is located after the incomplete identifier then Alt+TAB (i.e. Meta-1?) it behaves the same as if I pressed SPACE in my case.

When the cursor is located after the incomplete identifier then AltGr+Tab has no effect.

I am not sure if that is relevant, but I've installed Merlin (2.3.1) from OPAM and emacs (24.4.1) via apt-get.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Caml-list] Ocaml autocomplete support in Emacs
  2015-12-02 12:03   ` Matej Kosik
@ 2015-12-02 13:04     ` Matthieu Dubuget
  2015-12-02 14:15       ` Matej Kosik
  2015-12-02 13:13     ` Francois Berenger
  1 sibling, 1 reply; 9+ messages in thread
From: Matthieu Dubuget @ 2015-12-02 13:04 UTC (permalink / raw)
  To: caml-list

Hello,

in order for autocompletion to work in emacs, I had to switch to company.

See this merlin's wiki page for details:
https://github.com/the-lambda-church/merlin/wiki/emacs-from-scratch#company-mode

I had to install the company from emacs using `M-x list-packages`.

The `.emacs` file additions were:

```lisp
;; Trying company instead
(require 'company)

; Make company aware of merlin
(add-to-list 'company-backends 'merlin-company-backend)
; Enable company on merlin managed buffers
(add-hook 'merlin-mode-hook 'company-mode)
```

That said, I just read the paragraph above in merlin's wiki page
(https://github.com/the-lambda-church/merlin/wiki/emacs-from-scratch#auto-complete),
but I can't remember if I tried this or not before switching to company:
did you add the following to your emacs configuration file?

```lisp
(setq merlin-ac-setup 'easy)
```

Salutations


-- 
Matthieu Dubuget
Guide d’autodéfense numérique : http://guide.boum.org

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Caml-list] Ocaml autocomplete support in Emacs
  2015-12-02 12:03   ` Matej Kosik
  2015-12-02 13:04     ` Matthieu Dubuget
@ 2015-12-02 13:13     ` Francois Berenger
  1 sibling, 0 replies; 9+ messages in thread
From: Francois Berenger @ 2015-12-02 13:13 UTC (permalink / raw)
  To: caml-list

On 12/02/2015 01:03 PM, Matej Kosik wrote:
> Hi Lukasz,
>
> On 12/02/2015 12:52 PM, Lukasz Stafiniak wrote:
>> On Wed, Dec 2, 2015 at 12:50 PM, Matej Kosik
>> <5764c029b688c1c0d24a2e97cd764f@gmail.com> wrote:
>>>
>>> Now, when I have some partial identifier I would like to Merlin auto-complete it (if there is no ambiguity) or show the list of possible completions,
>>> how can I do that?
>>>
>>> At the moment, pressing TAB does nothing.
>>
>> Did you mean Meta-TAB here? (That's Emacs default for auto-complete.)
>>
>
> When the cursor is located after the incomplete identifier then Alt+TAB (i.e. Meta-1?) it behaves the same as if I pressed SPACE in my case.
>
> When the cursor is located after the incomplete identifier then AltGr+Tab has no effect.
>
> I am not sure if that is relevant, but I've installed Merlin (2.3.1) from OPAM and emacs (24.4.1) via apt-get.

At some point in time, the emacs command was M-x merlin-try-completion.

-- 
Regards,
Francois.
"When in doubt, use more types"

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Caml-list] Ocaml autocomplete support in Emacs
  2015-12-02 13:04     ` Matthieu Dubuget
@ 2015-12-02 14:15       ` Matej Kosik
  2015-12-02 14:19         ` Thomas Refis
  2015-12-02 17:42         ` Alan Schmitt
  0 siblings, 2 replies; 9+ messages in thread
From: Matej Kosik @ 2015-12-02 14:15 UTC (permalink / raw)
  To: caml-list

Hi Matthieu

On 12/02/2015 02:04 PM, Matthieu Dubuget wrote:
> Hello,
> 
> in order for autocompletion to work in emacs, I had to switch to company.
> 
> See this merlin's wiki page for details:
> https://github.com/the-lambda-church/merlin/wiki/emacs-from-scratch#company-mode
> 
> I had to install the company from emacs using `M-x list-packages`.
> 
> The `.emacs` file additions were:
> 
> ```lisp
> ;; Trying company instead
> (require 'company)
> 
> ; Make company aware of merlin
> (add-to-list 'company-backends 'merlin-company-backend)
> ; Enable company on merlin managed buffers
> (add-hook 'merlin-mode-hook 'company-mode)
> ```

Thank you!
This helped.

<for_the_record>
   The only piece missing was that I needed to first do:

	(push "~/.emacs.d/elpa/company-0.8.12" load-path)     ; directory containing company.el

   before those other commands, otherwise

	(require 'company)

   would fail.
</for_the_record>

> 
> That said, I just read the paragraph above in merlin's wiki page
> (https://github.com/the-lambda-church/merlin/wiki/emacs-from-scratch#auto-complete),
> but I can't remember if I tried this or not before switching to company:
> did you add the following to your emacs configuration file?
> 
> ```lisp
> (setq merlin-ac-setup 'easy)
> ```

In my case, the above command had no effect I was able to perceive
altough I see that it is mentioned here:

  https://github.com/the-lambda-church/merlin/wiki/emacs-from-scratch#auto-complete

Is that page up to date?
There are at least two things that do not make sense:

(1) It mentions "merlin-try-completion" which does not exist, does it?

(2) It mentions the C-c <tab> shortcut but when I try it, I always get a message:

      Can't find completion for ...

    as if this was not supposed to work but it is still suggested by the page.

Those details I found confusing.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Caml-list] Ocaml autocomplete support in Emacs
  2015-12-02 14:15       ` Matej Kosik
@ 2015-12-02 14:19         ` Thomas Refis
  2015-12-02 17:42         ` Alan Schmitt
  1 sibling, 0 replies; 9+ messages in thread
From: Thomas Refis @ 2015-12-02 14:19 UTC (permalink / raw)
  To: Matej Kosik; +Cc: caml users

Hi,

Company is indeed the prefered completion engine nowadays, but
auto-complete mode is still supported.
The wiki page is indeed quite old; the [merlin-try-completion]
function was removed a few weeks ago.
See the following message from Frédéric on that topic:

2015-11-13 9:24 GMT+00:00 Frédéric Bour <notifications@github.com>:
>
> Merlin now tries to integrate with "normal" auto-complete infrastructure.
> merlin-try-completion has been removed and M-x auto-complete should do the work.
> Is it working for you?
>
> Note that you might need to (require 'auto-complete) in your .emacs.

( Source: https://github.com/the-lambda-church/merlin/issues/465 )

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Caml-list] Ocaml autocomplete support in Emacs
  2015-12-02 14:15       ` Matej Kosik
  2015-12-02 14:19         ` Thomas Refis
@ 2015-12-02 17:42         ` Alan Schmitt
  2015-12-02 19:10           ` Matej Kosik
  1 sibling, 1 reply; 9+ messages in thread
From: Alan Schmitt @ 2015-12-02 17:42 UTC (permalink / raw)
  To: Matej Kosik; +Cc: caml-list

[-- Attachment #1: Type: text/plain, Size: 623 bytes --]

On 2015-12-02 15:15, Matej Kosik <5764c029b688c1c0d24a2e97cd764f@gmail.com> writes:

> <for_the_record>
>    The only piece missing was that I needed to first do:
>
> 	(push "~/.emacs.d/elpa/company-0.8.12" load-path)     ; directory containing company.el
>
>    before those other commands, otherwise
>
> 	(require 'company)
>
>    would fail.
> </for_the_record>

This looks wrong: packages should autoload. Do you call
(package-initialize) in your init file before the require?

Alan

-- 
OpenPGP Key ID : 040D0A3B4ED2E5C7
Athmospheric CO₂ (Updated November 29, 2015, Mauna Loa Obs.): 400.37 ppm

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Caml-list] Ocaml autocomplete support in Emacs
  2015-12-02 17:42         ` Alan Schmitt
@ 2015-12-02 19:10           ` Matej Kosik
  0 siblings, 0 replies; 9+ messages in thread
From: Matej Kosik @ 2015-12-02 19:10 UTC (permalink / raw)
  To: Alan Schmitt; +Cc: caml-list

On 12/02/2015 06:42 PM, Alan Schmitt wrote:
> On 2015-12-02 15:15, Matej Kosik <5764c029b688c1c0d24a2e97cd764f@gmail.com> writes:
> 
>> <for_the_record> The only piece missing was that I needed to first do:
>> 
>> (push "~/.emacs.d/elpa/company-0.8.12" load-path)     ; directory containing company.el
>> 
>> before those other commands, otherwise
>> 
>> (require 'company)
>> 
>> would fail. </for_the_record>
> 
> This looks wrong: packages should autoload. Do you call (package-initialize) in your init file before the require?
> 
> Alan
> 

Thank you. That works for me too.

I know little about Emacs macros, hence my errors.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-12-02 19:10 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-02 11:50 [Caml-list] Ocaml autocomplete support in Emacs Matej Kosik
2015-12-02 11:52 ` Lukasz Stafiniak
2015-12-02 12:03   ` Matej Kosik
2015-12-02 13:04     ` Matthieu Dubuget
2015-12-02 14:15       ` Matej Kosik
2015-12-02 14:19         ` Thomas Refis
2015-12-02 17:42         ` Alan Schmitt
2015-12-02 19:10           ` Matej Kosik
2015-12-02 13:13     ` Francois Berenger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).