GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - bbatsov/neocaml: A modern, TreeSitter-powered, Emacs package for programming in OCaml

BranchesTags
Open more actions menu

Latest commit

 

History

429 Commits
429 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
dev
dev
 
 
doc
doc
 
 
docs
docs
 
 
test
test
 
 
.dir-locals.el
.dir-locals.el
 
 
.elpaignore
.elpaignore
 
 
.gitignore
.gitignore
 
 
.markdownlint-cli2.yaml
.markdownlint-cli2.yaml
 
 
CHANGELOG.md
CHANGELOG.md
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
Eldev
Eldev
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
ROADMAP.md
ROADMAP.md
 
 
mkdocs.yml
mkdocs.yml
 
 
neocaml-common.el
neocaml-common.el
 
 
neocaml-cram.el
neocaml-cram.el
 
 
neocaml-dune-interaction.el
neocaml-dune-interaction.el
 
 
neocaml-dune.el
neocaml-dune.el
 
 
neocaml-menhir.el
neocaml-menhir.el
 
 
neocaml-mlx.el
neocaml-mlx.el
 
 
neocaml-objinfo.el
neocaml-objinfo.el
 
 
neocaml-ocamllex.el
neocaml-ocamllex.el
 
 
neocaml-odoc.el
neocaml-odoc.el
 
 
neocaml-opam.el
neocaml-opam.el
 
 
neocaml-repl.el
neocaml-repl.el
 
 
neocaml-utop.el
neocaml-utop.el
 
 
neocaml.el
neocaml.el
 
 

Repository files navigation

neocaml

MELPA MELPA Stable CI Sponsor

neocaml is a new Emacs package for programming in OCaml. Built on Tree-sitter, it provides major modes for editing OCaml (.ml) and OCaml Interface (.mli) files with font-locking, indentation, navigation, and toplevel (REPL) integration.

Beyond OCaml source code, neocaml also supports key parts of the OCaml ecosystem: dune build files, opam package definitions, OCamllex lexer definitions (.mll), Menhir parser definitions (.mly), cram test files (.t), and odoc documentation pages (.mld), each with a dedicated major mode.

You can also view compiled OCaml artifacts (.cmi, .cmo, .cmx, etc.) directly in Emacs via ocamlobjinfo.

It's also as cool as Neo from "The Matrix". ;-)

An OCaml file in neocaml-mode with the OCaml toplevel below it, its responses highlighted like OCaml code

Tip

For detailed configuration, usage guides, and migration help, see the full documentation.

Features

  • Tree-sitter based font-locking (4 levels) for .ml and .mli files
  • Ocamldoc markup rendering in doc comments: {b bold}, {i italic}, [code], {[...]} and {@ocaml[...]} blocks, headings, {!references} and @tags are displayed with real faces
  • Tree-sitter based indentation in three styles (ocp-indent's, and ocamlformat's conventional and janestreet profiles), picked from the project's .ocamlformat or .ocp-indent, with cycle-indent support
  • OxCaml syntax: modes, kinds, stack allocation, unboxed types and immutable arrays
  • Navigation (beginning-of-defun, end-of-defun, forward-sexp, sentence movement with M-a/M-e)
  • Imenu with language-specific categories for .ml and .mli
  • Toggling between implementation and interface via ff-find-other-file (C-c C-a)
  • OCaml toplevel (REPL) integration (neocaml-repl), with the toplevel's responses highlighted like OCaml code, clickable error locations, and findlib package completion for #require, plus an alternative utop backend (neocaml-utop) that speaks utop's native protocol for precise error highlighting and completion
  • Comment support: fill-paragraph (M-q), comment continuation (M-j), and comment-dwim (M-;)
  • Electric indentation on delimiter characters
  • opam file editing (neocaml-opam-mode) with font-lock, indentation, imenu, and opam lint integration (flymake and flycheck)
  • dune file editing (neocaml-dune-mode) for dune, dune-project, and dune-workspace files
  • dune build commands (neocaml-dune-interaction-mode): build, test, clean, promote, fmt, exec (with watch mode via prefix arg), plus running the current file's tests and reviewing and promoting their output
  • OCamllex file editing (neocaml-ocamllex-mode) with font-lock, indentation, imenu, and OCaml language injection (Emacs 30+)
  • Menhir file editing (neocaml-menhir-mode) with font-lock, indentation, imenu, and OCaml language injection (Emacs 30+)
  • OCaml/JSX file editing (neocaml-mlx-mode) for .mlx files (Melange/React and similar PPX-driven OCaml-JSX), with embedded JSX highlighting via tsx language injection (Emacs 30+)
  • Cram test file editing (neocaml-cram-mode) with font-lock for commands, output, modifiers, and prose, and keys for running the test and promoting its output
  • odoc documentation editing (neocaml-odoc-mode) with font-lock, indentation, imenu, and language injection into {@lang[...]} code blocks for OCaml, dune, and opam (Emacs 30+)
  • Easy installation of ocaml and ocaml-interface tree-sitter grammars via M-x neocaml-install-grammars (and the tsx/JSX grammar via M-x neocaml-mlx-install-grammar)
  • Compilation error regexp for M-x compile (errors, warnings, alerts, backtraces)
  • _build directory awareness (offers to switch to source when opening build artifacts)
  • Eglot integration (with ocaml-eglot support)
  • Debugging via dape + ocamlearlybird (bytecode)
  • Prettify-symbols for common OCaml operators

Quick Start

neocaml is available on MELPA:

(use-package neocaml
  :ensure t)

If the required tree-sitter grammars are not installed, run M-x neocaml-install-grammars. Eglot is auto-configured - just run M-x eglot in an OCaml buffer (requires ocaml-lsp-server).

See the documentation for alternative installation methods and detailed configuration.

Funding

While neocaml is free software and will always be, the project would benefit from some funding. Consider supporting its ongoing development if you find it useful.

You can support the development of neocaml via:

  • GitHub Sponsors
  • Patreon
  • PayPal

Roadmap

Curious where neocaml is headed? See ROADMAP.md for ideas and planned improvements. Feedback and contributions on any of them are welcome.

Contributing

See CONTRIBUTING.md for development setup, debugging, and how to run tests. Architecture and design notes live in doc/DESIGN.md.

License

Copyright (c) 2025-2026 Bozhidar Batsov and contributors.

Distributed under the GNU General Public License, version 3 or later. See LICENSE for details.

About

A modern, TreeSitter-powered, Emacs package for programming in OCaml

neocaml.org/

Topics

emacsemacs-lispmajor-modeocaml

Resources

Readme
GPL-3.0 license

Contributing

Contributing
Activity

Stars

134 stars

Watchers

4 watching

Forks

10 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.