[MLton] Emacs mode for editing ML Basis files

Vesa Karvonen vesa.karvonen@cs.helsinki.fi
Thu, 4 Aug 2005 08:49:00 +0300


Quoting Stephen Weeks <sweeks@sweeks.com>:
[...]
> FYI, Ray Racine submitted an MLB-mode (mlb.el) last year.  It was
> pre-wiki, so it didn't make it up there.  Anyways, I added that to the
> wiki for comparison.

Ray's MLB-mode seems to be based on code from SML-mode.

I have to say I'm pleased about the simple indentation algorithm I developed
for esml-mlb-mode. It is essentially table driven (well, it currently uses
cond/case, but it would be easy to make it truly table driven) and robust
enough to just do

  M-x indent-buffer

and be done with. No need to adjust indentation manually. The same can't
be said about SML-mode. Perhaps I'll try to develop an indentation algorithm
for SML when I have some extra time.

The esml-mlb-mode indentation algorithm works by first figuring out the
"previous" indentation level with "evidence". It does this by looking for
lines starting with certain keywords and the evidence is the keyword it
found. Then it indents the current line based on the first keyword or
non-whitespace character on the current line, the previous indentation
level, and the evidence. This seems to yield a surprisingly robust
indentation algorithm.

-Vesa Karvonen