MLton 20070826 EmacsDefUseMode
Home  Index  
MLton provides an option, -show-def-use file, to output precise and accurate whole-program def-use information to a file. Unlike typical tags facilities, the information includes local variables and distinguishes between different definitions even when they have the same name. The def-use Emacs mode uses the information to provide navigation support, which can be particularly useful while reading SML programs compiled with MLton (such as the MLton compiler itself).

Features

Download

There is no package for the def-use mode at the moment. To install the mode you need to fetch the Emacs lisp, *.el, files from the MLton repository: [WWW]emacs.

Setup

The easiest way to load def-use mode is to first tell Emacs where to find the files. For example, add

to your ~/.emacs or ~/.xemacs/init.el. You'll probably also want to start def-use-mode automatically by adding

to your Emacs init file. Once the def-use mode is activated, you should see the DU indicator on the mode line.

Usage

To use def-use mode one typically first sets up the program's makefile or build script so that the def-use information is saved each time the program is compiled. In addition to the -show-def-use file option, the -prefer-abs-paths true expert option is required. Note that the time it takes to save the information is small (compared to type-checking), so it is recommended to simply add the options to the MLton invocation that type-checks or compiles the program.

Finally, one needs to tell the mode where to find the def-use information. This is done with the esml-du-mlton command. The esml-du package can also load recently used def-use files automatically at startup.

After doing all of the above, find an SML file covered by the def-use information, and place the cursor at some variable (definition or use, it doesn't matter).


Last edited on 2007-08-23 04:24:24 by MatthewFluet.