<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta name="robots" content="index,nofollow">



<title>Emacs - MLton Standard ML Compiler (SML Compiler)</title>
<link rel="stylesheet" type="text/css" charset="iso-8859-1" media="all" href="common.css">
<link rel="stylesheet" type="text/css" charset="iso-8859-1" media="screen" href="screen.css">
<link rel="stylesheet" type="text/css" charset="iso-8859-1" media="print" href="print.css">


<link rel="Start" href="Home">


</head>

<body lang="en" dir="ltr">

<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-833377-1";
urchinTracker();
</script>
<table bgcolor = lightblue cellspacing = 0 style = "border: 0px;" width = 100%>
  <tr>
    <td style = "
		border: 0px;
		color: darkblue; 
		font-size: 150%;
		text-align: left;">
      <a class = mltona href="Home">MLton MLTONWIKIVERSION</a>
    <td style = "
		border: 0px;
		font-size: 150%;
		text-align: center;
		width: 50%;">
      Emacs
    <td style = "
		border: 0px;
		text-align: right;">
      <table cellspacing = 0 style = "border: 0px">
        <tr style = "vertical-align: middle;">
      </table>
  <tr style = "background-color: white;">
    <td colspan = 3
	style = "
		border: 0px;
		font-size:70%;
		text-align: right;">
      <a href = "Home">Home</a>
      &nbsp;<a href = "Index">Index</a>
      &nbsp;
</table>
<div id="content" lang="en" dir="ltr">
<h2 id="head-2e0730f57444eb865302c3917a4902e6ceae973f">SML Modes</h2>
<p>
There are a few Emacs modes for SML. 
</p>

    <ul>

    <li>
<p>
 <tt>sml-mode</tt> 
</p>
</li>

        <ul>

        <li>
<p>
 <a class="external" href="http://www.xemacs.org/Documentation/packages/html/sml-mode_3.html"><img src="moin-www.png" alt="[WWW]" height="11" width="11">http://www.xemacs.org/Documentation/packages/html/sml-mode_3.html</a> 
</p>
</li>
        <li>
<p>
 <a class="external" href="http://www.smlnj.org/doc/Emacs/sml-mode.html"><img src="moin-www.png" alt="[WWW]" height="11" width="11">http://www.smlnj.org/doc/Emacs/sml-mode.html</a> 
</p>
</li>

        </ul>


    <li class="gap">
<p>
 <a href = "http://mlton.org/cgi-bin/viewsvn.cgi/mlton/tags/on-MLTONWIKIVERSION-release/ide/emacs/mlton.el?view=markup"><img src="moin-www.png" alt="[WWW]" height="11" width="11">mlton.el</a> contains the Emacs lisp that <a href="StephenWeeks">StephenWeeks</a>  uses to interact with MLton (in addition to using <tt>sml-mode</tt>). 
</p>
</li>
    <li class="gap">
<p>
 <a class="external" href="http://primate.net/~itz/mindent.tar"><img src="moin-www.png" alt="[WWW]" height="11" width="11">http://primate.net/~itz/mindent.tar</a>, developed by Ian Zimmerman,  who writes: 
</p>
</li>

        <ul>

  Unlike the widespread <tt>sml-mode.el</tt> it doesn't try to indent   code based on ML syntax.  I gradually got skeptical about this   approach after writing the initial indentation support for caml mode   and watching it bloat insanely as the language added new features.   Also, any such attempts that I know of impose a particular coding   style, or at best a choice among a limited set of styles, which I   now oppose.  Instead my mode is based on a generic package which   provides manual bindable commands for common indentation operations   (example: indent the current line under the n-th occurrence of a   particular character in the previous non-blank line). 
        </ul>



    </ul>


<h3 id="head-ca4c2c588f94359116733bd5a53f0e418c8306bd">MLB modes</h3>
<p>
There is a mode for editing <a href="MLBasis"> ML Basis</a> files.  
</p>

    <ul>

    <li>
<p>
 <a href = "http://mlton.org/cgi-bin/viewsvn.cgi/mlton/tags/on-MLTONWIKIVERSION-release/ide/emacs/esml-mlb-mode.el?view=markup"><img src="moin-www.png" alt="[WWW]" height="11" width="11">esml-mlb-mode.el</a> (+ other files) 
</p>
</li>

    </ul>


<h2 id="head-50fc5c9c229626045a37381fd07f13e910551890">Definitions and uses</h2>
<p>
There is a mode that supports the precise def-use information that MLton can output.  It highlights definitions and uses and provides commands for navigation (e.g. jump-to-def, jump-to-next, list-all-refs).  It can be handy, for example, for navigating in the MLton compiler source code.  See <a href="EmacsDefUseMode">EmacsDefUseMode</a> for further information. 
</p>
<h2 id="head-7de6b40c953fe9d8e7942b13fb6e0adfff9a2f33">Building on the background</h2>
<p>
Tired of manually starting/stopping/restarting builds after editing files?  Now you don't have to.  See <a href="EmacsBgBuildMode">EmacsBgBuildMode</a> for further information. 
</p>
<h2 id="head-38a2998cc83b4215b89f0b96917e58d59fdfae52">Error messages</h2>
<p>
MLton's error messages are not in the format that the Emacs <tt>next-error</tt> parser natively understands.  There are a couple of ways to fix this.  The easiest way is to add the following to your <tt>.emacs</tt> to cause Emacs to recognize MLton's error messages. 
</p>

        <ul>

  
<pre>(require 'compile)
(add-to-list 'compilation-error-regexp-alist
             '("^Error: \\([^\t\n]*\\) \\([0-9]+\\)\\.\\([0-9]+\\)\\.$"
               1 2 3))
</pre>
        </ul>


<p>
Alternatively, you could use a sed script to rewrite MLton's errors. Here is one such script: 
</p>

        <ul>

  
<pre>sed -e 's/^\([W|E].*\): \([^ ]*\) \([0-9][0-9]*\)\.\([0-9][0-9]*\)\./\2:\3:\1:\4/'
</pre></ul>

</div>



<p>
<hr>
Last edited on 2007-08-15 22:05:44 by <span title="fenrir.uchicago.edu"><a href="MatthewFluet">MatthewFluet</a></span>.
</body></html>
