I just find that company isn't helpful and is distracting. The advantage to corfu, is that I spent the time to understand and configure it to act the way that I find helpful.
4.2 KiB
Emacs OCaml Integration
A literate programming file for integrating the OCaml programming language.
Introduction
After reading Batsov's OCaml overview essay, I became intrigued with learning more about it. Like him, I’ll probably start learning OCaml using the following resources:
- Getting Started: At the primary ocaml website.
- Real World OCaml: A free book about OCaml, that's considered one of the best starting points in the community.
- Cornell University's course on OCaml: It's taught at the university, but the textbook and the video lectures are freely available online.
- OCamlverse: An OCaml community wiki.
As these installation instructions state, the primary binary to install is the package manager, like:
brew install opam
Initialize the opam package database by running:
opam init
The book suggests installing utop:
opam install core core_bench utop
The book also mentions that opam comes with a user-setup package to install Emacs configs. You can install it as follows, along with some related packages:
opam install user-setup tuareg ocamlformat merlin
opam user-setup install
But I won’t be doing that, as I can configure it.
Basics
I kicked off this code by following with these instructions from Batsov.
Use the tuareg package for OCaml programming:
(use-package tuareg
:mode (((rx ".ocamlinit" eos) . tuareg-mode)))
Use dune.el to edit Dune project files:
(use-package dune)
Merlin provides advanced IDE features:
(use-package merlin
:config
(add-hook 'tuareg-mode-hook #'merlin-mode)
;; we're using flycheck instead
(setq merlin-error-after-save nil))
(use-package merlin-eldoc
:hook ((tuareg-mode) . merlin-eldoc-setup))
The flycheck package uses Merlin internally:
(use-package flycheck-ocaml
:config (flycheck-ocaml-setup))
If I get into utop, I can also setup some integration with it like this:
(use-package utop
:config
(add-hook 'tuareg-mode-hook #'utop-minor-mode))