[ANN] Release of GopCaml-mode (0.0.3) and GopCaml-mode-Merlin (0.0.4) - Wizardry release

Hi all!

I’m pleased to announce the latest version of GopCaml-mode (0.0.3), and the new release of GopCaml-mode-Merlin (0.0.4).

GopCaml-mode-Merlin is a brand new! variant of GopCaml-mode that uses the Merlin parser rather than the OCaml compiler-libs one, and thus has some level of robustness to invalid syntax:


If that’s piqued your interest, I’d recommend checking out the release posts for the previous versions for more details on what GopCaml can do, and how to get it: 0.0.2 release, 0.0.1 release

The Merlin parser seems to assign text-regions for syntactic constructs slightly more liberally than the standard OCaml parser, so the overlays can feel a bit weird if you’re used to the normal GopCaml overlays, but the benefit is that all your favorite structural movement/transformation operations work even when you’re dealing with ill-formed programs, allowing for a more fluid editing experience:


Detailed Changelog

  • new! [for GopCaml-mode-Merlin] Robustness to ill-formated syntax
    • Vendored a copy of Merlin to reuse its parser and thereby gain it’s robustness to invalid syntax.
  • new! Added support for customisable verbosity
    • Customise the Emacs variable gopcaml-messaging-level to change the level of messages that are output by GopCaml. Set it to 'none to disable messages entirely.
  • new! Fixed bug when starting zipper mode at the start of a file.
    • Zipper mode selects the immediately prior byte position to avoid inconsistencies when the cursor is just on the edge of an expression, but when the cursor is at position 1, this causes an error as 0 is not a valid point.
  • new! Special casing of shebangs
    • Added support for handling shebangs at the start of a buffer.
    • Implemented as part of a larger library for preprocessing buffertext before running the parser on it - could be extended to support additional preprocessing in the future.
    • Another possible direction for extension is to use an Emacs callback to modify the text, although this may not be ideal, as the parsing has to be as fast as possible.

Get Gopcaml-mode

Its as easy as 1, 2, 3!

  1. Install from opam (either gopcaml-mode xor gopcaml-mode-merlin):
opam install gopcaml-mode


opam install gopcaml-mode-merlin
  1. Compile your emacs with support for dynamic modules
  2. Load gopcaml-mode in your init.el:
 (let ((opam-share (ignore-errors (car (process-lines "opam" "var" "share")))))
	   (when (and opam-share (file-directory-p opam-share))
	     ;; Register Gopcaml mode
	     (add-to-list 'load-path (expand-file-name "emacs/site-lisp" opam-share))
         (autoload 'gopcaml-mode "gopcaml-mode" nil t nil)
         (autoload 'tuareg-mode "tuareg" nil t nil)
         (autoload 'merlin-mode "merlin" "Merlin mode" t)
	     ;; Automatically start it in OCaml buffers
	     (setq auto-mode-alist
		   (append '(("\\.ml[ily]?$" . gopcaml-mode)
			     ("\\.topml$" . gopcaml-mode))

See the release post for version 0.0.1 for detailed instructions on how you can install it.