Home InternationalSetting up Emacs for OCaml Development: Neocaml Ed...
International⭐ Featured

Setting up Emacs for OCaml Development: Neocaml Edition

A few years ago I wrote about setting up Emacs for OCaml development. Back then the recommended stack was tuareg-mode + merlin-mode, with Merlin providing the bulk of the IDE experience. A lot has changed since then – the OCaml tooling has evolved considerably, and I’ve been working on some new tools myself. Time for an update.

7 April 2026 at 08:45 am
1 views
Setting up Emacs for OCaml Development: Neocaml Edition

In recent years, the OCaml ecosystem has seen significant advancements in tooling and development environments, particularly for those using Emacs as their editor. A few years ago, the recommended setup for OCaml development in Emacs involved tuareg-mode and merlin-mode, with Merlin serving as the primary source of IDE functionality. However, the OCaml community has evolved, and new tools have emerged, offering enhanced features and improved workflows. This article provides an updated guide to setting up Emacs for OCaml development, focusing on the Neocaml tool, which is designed to streamline the development process and provide a more integrated experience.

Neocaml is a modern tool that aims to simplify OCaml development within Emacs. It was created to address some of the limitations of the older tuareg-mode and merlin-mode setups, offering a more user-friendly and efficient environment for OCaml programmers. Neocaml is built on top of the OCaml compiler itself, leveraging its capabilities to provide real-time feedback and improved code navigation. This tool is part of a broader trend in the OCaml community towards more robust and integrated development environments, reflecting the growing maturity and popularity of the language.

To begin setting up Emacs for OCaml development with Neocaml, you'll need to ensure that you have the latest version of Emacs installed. You can download the latest release from the official Emacs website or use your system's package manager if available. Once you have Emacs installed, the next step is to install the necessary packages. Neocaml is available through the Emacs Package Manager (ELPA), which makes it easy to install and manage packages within your Emacs configuration.

To install Neocaml, open Emacs and run the following command in the Emacs minibuffer:

```elisp

M-x package-install RET neocaml RET

```

This will install the Neocaml package and its dependencies. After the installation is complete, you'll need to configure Emacs to use Neocaml as the primary OCaml development tool. Neocaml integrates with the built-in OCaml mode in Emacs, so you can start by adding the following lines to your `.emacs` or `init.el` file:

```elisp

(require 'neocaml)

(setq neocaml-ocaml-executable "ocaml")

(setq neocaml-topfind-executable "opam env")

```

These settings tell Emacs to use the `ocaml` compiler and the `opam env` command for resolving dependencies. If you have a different OCaml compiler or Opam environment set up, you can adjust these variables accordingly.

With Neocaml installed and configured, you can now start using its features within Emacs. One of the key benefits of Neocaml is its ability to provide real-time feedback as you type. This is achieved through a feature called "live parsing," which analyzes your code as you write it, highlighting any syntax errors or potential issues. Neocaml also offers enhanced code navigation, allowing you to jump to the definition of a function or module with a single keystroke. This makes it easier to understand and maintain larger OCaml projects.

Another significant improvement provided by Neocaml is its integration with the OCaml compiler's type inference system. By leveraging the compiler's capabilities, Neocaml can provide more accurate and detailed type information directly within Emacs. This means that you can see the inferred types of variables, functions, and expressions as you work, which can help you write more robust and maintainable code.

In addition to these core features, Neocaml also includes support for linting and code formatting. It integrates with the OCaml community's popular linter, ocamlformat, to ensure that your code adheres to standard formatting conventions. This not only makes your code more readable but also helps maintain consistency across projects.

As you start using Neocaml in your OCaml development workflow, you may also want to explore additional packages and configurations that can further enhance your experience. For example, the `ocaml-indent` package provides smart indentation for OCaml code, while the `ocaml-mode` package offers additional syntax highlighting and support for OCaml-specific language features.

In conclusion, the OCaml tooling landscape has evolved significantly in recent years, with Neocaml emerging as a powerful and user-friendly option for Emacs-based development. By leveraging the latest advancements in OCaml compiler technology and integrating them seamlessly into Emacs, Neocaml provides a more efficient and integrated development experience for OCaml programmers. Whether you're a seasoned OCaml developer or just starting out, adopting Neocaml can help you take advantage of the language's capabilities and streamline your workflow. As the OCaml community continues to innovate, tools like Neocaml are poised to shape the future of OCaml development, making it even more attractive for both academic and industrial use.

Source: OCaml Planet
📰 Related News
Ollama 0.2.6 Released with Native Gemma 4 Support and Enhanced Performance
Ollama 0.2.6 Released with Native Gemma 4 Support and Enhanced Performance
Ollama 0.2.6 is now live, featuring native support for Google's Gemma 4 models and improved local inference performance for Windows, macOS, and Linux.
14 Apr
Weekly news roundup: Shortages spread to MLCCs; SK Hynix reportedly in talks with Microsoft and Google
Weekly news roundup: Shortages spread to MLCCs; SK Hynix reportedly in talks with Microsoft and Google
Below are the most-read DIGITIMES Asia stories from the week of April 6-April 13, 2026:
14 Apr
cutile-stencil 0.2.0
cutile-stencil 0.2.0
An xDSL-based stencil compiler that generates optimized GPU kernels via NVIDIA cuTile
14 Apr
merlin-llm added to PyPI
merlin-llm added to PyPI
Merlin — a fast local LLM for agentic coding on Apple Silicon
14 Apr
Fluent Cut - Craft and compose videos programmatically in PHP with an elegant fluent API
Fluent Cut - Craft and compose videos programmatically in PHP with an elegant fluent API
Craft and compose videos programmatically in PHP with an elegant fluent API - b7s/fluentcut
14 Apr
Crypto Investor at Center of Trump Corruption Allegations Now Sees Himself as ‘Victim’
Crypto Investor at Center of Trump Corruption Allegations Now Sees Himself as ‘Victim’
Justin Sun has accused Trump-affiliated World Liberty Financial of misconduct and a general lack of transparency.
14 Apr
nvidia-nat-weave 1.7.0a20260413
nvidia-nat-weave 1.7.0a20260413
Subpackage for Weave integration in NeMo Agent Toolkit
14 Apr
nvidia-nat-s3 1.7.0a20260413
nvidia-nat-s3 1.7.0a20260413
Subpackage for S3-compatible integration in NeMo Agent Toolkit
14 Apr
Social Security Trust Fund to Run Dry in 2032: Just 6 Years From Now
Social Security Trust Fund to Run Dry in 2032: Just 6 Years From Now
Six years. That is how much time separates retirees from a Social Security system that, by its own projections, runs out of money. If you are 56 years old...
14 Apr
cane-gpu-perf added to PyPI
cane-gpu-perf added to PyPI
GPU inference benchmarking with opinionated diagnostics
13 Apr