Emacs OCaml IDE

I am happy to announce “Emacs OCaml IDE,” built on Emacs IDE Frametools. Shown below are screenshots of a proof of concept build of Emacs OCaml IDE.  This work pulls together a number of editing modes already available for Emacs and makes their functionality available in a graphical environment. Among the features working so far are code browsing, a context sensitive toolbar and a stepping debugger.

Emacs OCaml IDE

Detailed Feature List

  • Syntax highlighting & code browsing using outline mode
  • Build using make and OCamlMakefile
  • Tab trigged completion support
  • “Grok”ing the code base via “ack-grep”
  • Stepping debugger integration – setting breakpoints via GUI, inspecting variables, etc.
  • Context sensitive right-click support…
  • On-the-Fly Intelligent Error Highlighting As-You-Type


The main motivation was to create something that would leverage the excellent OCaml support in Tuareq but also provide IDE elements that people tend to be familiar with.  The OCamlEditor project provides an excellent code editor, but misses an integrated debugger & the Eclipse plugin provides integrated debugging, but misses the depth of features that come with Emas Tuareg mode.

Although Emacs users tend to frown upon the “guyfication” of their editor,  there are many users that find Emacs inaccessible precisely because it misses modern GUI appeal. Not principally an OCaml programmer myself, I put this together principally “for fun” and am looking for a maintainer for this project. If interested, please contact me at chrisk@manx.net.


Code Browsing, Tabbed Editing & Syntax Highlighting

The top left two toolbar buttons control what is displayed.

Emacs OCaml IDE

Emacs OCaml IDE

Build Support

The far right button starts the OCaml build process.

Integrated Build Support

On-the-Fly Intelligent Error Highlighting As-You-Type

The edit area will automatically highlight errors as you type and indicate any associate error message in the echo area, here: Unbound value xlet.

On the fly intelligent error highlighting

On the fly intelligent error highlighting

Completion Support

OCaml Completion Support

OCaml Completion Support

Code “Grok” via Ack-Grep

This feature allows in place editing in *ack* buffer and writing back to underlying buffer set.

I found this useful in refactoring though it is not strictly OCaml specific.

Code "Grok" via Ack-Grep

Code “Grok” via Ack-Grep

Stepping Debugger

Stepping Debugger

Stepping Debugger

The toolbar is context sensitive so, for example, the “watch” icon (set of glasses) appears only as I click on the definition of “pi” in the source view on the left with the debugger activated on the right.

Variable Inspection

Context Sensitive Right-Click Support

This includes a strictly limited set of options at the moment but is extensible.

Context Sensitive Right-Click Support

Selecting “Show type at point” over the variable Pi thus displays the following in the Emacs echo area:

OCaml Type Inference

OCaml Type Inference

Easy Integration with Emacs

Easy Emacs Integration

Written in Emacs Lisp

All-up 700 lines of Lisp…


  • ideframetools
  • flymake – for On-the-fly intelligent error highlighting in Ocaml
  • flymake-tuareg
  • mouse3 -for context sensitive right-click support
  • gud
  • imenu -symbol outlining
  • yasnippet
  • auto-complete
  • auto-complete-config
  • camldebug – contained in caml package


  • Embed icons in Emacs Lisp as text and write them out to a default location on startup to avoid dependency on manual installation of icons. Emacs IDE Frametools works this way.
  • Make both Emacs IDE Frametools and OCaml IDE available under EPAL package manager
  • Make various behaviours tunable as package custom variables so that the Emacs customization mechanism may be used.
  • Integrate support to Ocaml Merlin
  • Fix Integrated Help (F1) support


Released under the GPL









3 responses to “Emacs OCaml IDE

  1. b8bavard

    Have you tried to use “ocp-indent” for indentation, and “ocp-index” for completion ?

    • Hello Fabrice, and thank you for taking the time to comment. I am honoured by your visit to my humble blog spot. I will have a look at integrating ocp-indent and ocp-index. A more pressing concern might be to get the OCaml IDE and it’s underlying IDE Frametools onto ELPA so that Emacs users may install simply by way of the package manager.

      Incidentally, I’ve been sitting on this project for near enough two years which has prompted some bit-rot as it were, but a recent meeting with Yaron Minsky at UNSW in Sydney inspired me to put it on the web.

      Kind Regards

      Chris Kohlhepp

  2. This looks neat. Would be really nice to have it available via (M)ELPA.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s