Configuring GNU Emacs for Standard ML

As mentioned on a previous post, I’ve been writing quite a bit of Standard ML on the past few weeks. This also involved setting up GNU Emacs for development.

The first thing you need is sml-mode, you can install and configure it with the following:

(use-package sml-mode
  :defer t
  :mode ("\\.\\(sml\\|sig\\)\\'" . sml-mode))

Now, the cool part is that Standard ML has a Language Server called Millet. You can use it with eglot, the builtin Language Server Protocol client for GNU Emacs.1

(use-package eglot
  :ensure t
  :hook ((sml-mode . eglot-ensure))
  (add-to-list 'eglot-server-programs '((sml-mode) "millet-ls")))

  1. Since GNU Emacs 29. ↩︎