Features
-
Highlighting of definitions and uses.
-
Navigation: jump-to-def, jump-to-next, and jump-to-prev.
-
Listing, visiting and marking of all references to a definition (within a program).
-
Loads def-use files in the background.
-
Automatically reloads updated def-use files.
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: emacs.
Setup
The easiest way to load def-use mode is to first tell Emacs where to find the files. For example, add
(add-to-list 'load-path (file-truename "path-to-the-el-files"))
to your ~/.emacs or ~/.xemacs/init.el. You'll probably also want to start def-use-mode automatically by adding
(require 'esml-du-mlton) (def-use-mode)
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).