A 21st Century IDE
Richard Mortier · October 13, 2013 · #ocaml #tech #config #emacsI finally decided to sit down and get the shiny new merlin mode for OCaml working with my emacs configuration. Basically, really rather simple in the end although (in the usual fashion!) I did end up spending considerable time tweaking various other customisations…
Most of the information below is based on the following sources:
- http://github.com/def-lkb/merlin#emacs-interface
- http://zheng.li/buzzlogs-ocaml/2013/08/23/irc.html
- http://www.ocamlpro.com/blog/2013/03/18/monthly-03.html
Before we begin, install merlin
:
$ opam install merlin
The complete commit change is in my github account (combined with a large cleanup of various other aborted OCaml configurations). Breaking it down a bit, first setup some paths: where to find ocp-indent
, merlin.el
for merlin-mode
, and the ocamlmerlin
command itself. Note that this relies on the current state of opam
, so when you start emacs
be sure to have selected the opam
compiler-switch that you installed the merlin
package into, above.
;; ocp-indent
;; merlin-mode
Now the meat: when we select tuareg-mode
, use ocp-indent
to indent lines, turn on merlin
auto-complete, and finally set a couple of local key bindings so that I can fix up merlin
to not conflict with my now-neurologically-hardwired navigation keys.
Finally, do the usual to use tuareg-mode
for OCaml/F# editing.
And that’s it!