Import Upstream version 20180207
[hcoop/debian/mlton.git] / doc / guide / localhost / Emacs
1 <!DOCTYPE html>
2 <html lang="en">
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <meta name="generator" content="AsciiDoc 8.6.9">
6 <title>Emacs</title>
7 <link rel="stylesheet" href="./asciidoc.css" type="text/css">
8 <link rel="stylesheet" href="./pygments.css" type="text/css">
9
10
11 <script type="text/javascript" src="./asciidoc.js"></script>
12 <script type="text/javascript">
13 /*<![CDATA[*/
14 asciidoc.install();
15 /*]]>*/
16 </script>
17 <link rel="stylesheet" href="./mlton.css" type="text/css">
18 </head>
19 <body class="article">
20 <div id="banner">
21 <div id="banner-home">
22 <a href="./Home">MLton 20180207</a>
23 </div>
24 </div>
25 <div id="header">
26 <h1>Emacs</h1>
27 </div>
28 <div id="content">
29 <div class="sect1">
30 <h2 id="_sml_modes">SML modes</h2>
31 <div class="sectionbody">
32 <div class="paragraph"><p>There are a few Emacs modes for SML.</p></div>
33 <div class="ulist"><ul>
34 <li>
35 <p>
36 <span class="monospaced">sml-mode</span>
37 </p>
38 <div class="ulist"><ul>
39 <li>
40 <p>
41 <a href="http://www.xemacs.org/Documentation/packages/html/sml-mode_3.html">http://www.xemacs.org/Documentation/packages/html/sml-mode_3.html</a>
42 </p>
43 </li>
44 <li>
45 <p>
46 <a href="http://www.smlnj.org/doc/Emacs/sml-mode.html">http://www.smlnj.org/doc/Emacs/sml-mode.html</a>
47 </p>
48 </li>
49 <li>
50 <p>
51 <a href="http://www.iro.umontreal.ca/%7Emonnier/elisp/">http://www.iro.umontreal.ca/%7Emonnier/elisp/</a>
52 </p>
53 </li>
54 </ul></div>
55 </li>
56 <li>
57 <p>
58 <a href="https://github.com/MLton/mlton/blob/master/ide/emacs/mlton.el"><span class="monospaced">mlton.el</span></a> contains the Emacs lisp that <a href="StephenWeeks">StephenWeeks</a> uses to interact with MLton (in addition to using <span class="monospaced">sml-mode</span>).
59 </p>
60 </li>
61 <li>
62 <p>
63 <a href="http://primate.net/%7Eitz/mindent.tar">http://primate.net/%7Eitz/mindent.tar</a>, developed by Ian Zimmerman, who writes:
64 </p>
65 <div class="quoteblock">
66 <div class="content">
67 <div class="paragraph"><p>Unlike the widespread <span class="monospaced">sml-mode.el</span> it doesn&#8217;t try to indent code
68 based on ML syntax. I gradually got skeptical about this approach
69 after writing the initial indentation support for caml mode and
70 watching it bloat insanely as the language added new features. Also,
71 any such attempts that I know of impose a particular coding style, or
72 at best a choice among a limited set of styles, which I now oppose.
73 Instead my mode is based on a generic package which provides manual
74 bindable commands for common indentation operations (example: indent
75 the current line under the n-th occurrence of a particular character
76 in the previous non-blank line).</p></div>
77 </div>
78 <div class="attribution">
79 </div></div>
80 </li>
81 </ul></div>
82 </div>
83 </div>
84 <div class="sect1">
85 <h2 id="_mlb_modes">MLB modes</h2>
86 <div class="sectionbody">
87 <div class="paragraph"><p>There is a mode for editing <a href="MLBasis"> ML Basis</a> files.</p></div>
88 <div class="ulist"><ul>
89 <li>
90 <p>
91 <a href="https://github.com/MLton/mlton/blob/master/ide/emacs/esml-mlb-mode.el"><span class="monospaced">esml-mlb-mode.el</span></a> (plus other files)
92 </p>
93 </li>
94 </ul></div>
95 </div>
96 </div>
97 <div class="sect1">
98 <h2 id="_definitions_and_uses">Definitions and uses</h2>
99 <div class="sectionbody">
100 <div class="paragraph"><p>There is a mode that supports the precise def-use information that
101 MLton can output. It highlights definitions and uses and provides
102 commands for navigation (e.g., <span class="monospaced">jump-to-def</span>, <span class="monospaced">jump-to-next</span>,
103 <span class="monospaced">list-all-refs</span>). It can be handy, for example, for navigating in the
104 MLton compiler source code. See <a href="EmacsDefUseMode">EmacsDefUseMode</a> for further
105 information.</p></div>
106 </div>
107 </div>
108 <div class="sect1">
109 <h2 id="_building_on_the_background">Building on the background</h2>
110 <div class="sectionbody">
111 <div class="paragraph"><p>Tired of manually starting/stopping/restarting builds after editing
112 files? Now you don&#8217;t have to. See <a href="EmacsBgBuildMode">EmacsBgBuildMode</a> for further
113 information.</p></div>
114 </div>
115 </div>
116 <div class="sect1">
117 <h2 id="_error_messages">Error messages</h2>
118 <div class="sectionbody">
119 <div class="paragraph"><p>MLton&#8217;s error messages are not among those that the Emacs <span class="monospaced">next-error</span>
120 parser natively understands. The easiest way to fix this is to add
121 the following to your <span class="monospaced">.emacs</span> to teach Emacs to recognize MLton&#8217;s
122 error messages.</p></div>
123 <div class="listingblock">
124 <div class="content"><div class="highlight"><pre><span class="p">(</span><span class="nb">require</span> <span class="ss">&#39;compile</span><span class="p">)</span>
125 <span class="p">(</span><span class="nv">add-to-list</span> <span class="ss">&#39;compilation-error-regexp-alist</span> <span class="ss">&#39;mlton</span><span class="p">)</span>
126 <span class="p">(</span><span class="nv">add-to-list</span> <span class="ss">&#39;compilation-error-regexp-alist-alist</span>
127 <span class="o">&#39;</span><span class="p">(</span><span class="nv">mlton</span>
128 <span class="s">&quot;^[[:space:]]*\\(\\(?:\\(Error\\)\\|\\(Warning\\)\\|\\(\\(?:\\(?:defn\\|spec\\) at\\)\\|\\(?:escape \\(?:from\\|to\\)\\)\\|\\(?:scoped at\\)\\)\\): \\(.+\\) \\([0-9]+\\)\\.\\([0-9]+\\)\\(?:-\\([0-9]+\\)\\.\\([0-9]+\\)\\)?\\.?\\)$&quot;</span>
129 <span class="mi">5</span> <span class="p">(</span><span class="mi">6</span> <span class="o">.</span> <span class="mi">8</span><span class="p">)</span> <span class="p">(</span><span class="mi">7</span> <span class="o">.</span> <span class="mi">9</span><span class="p">)</span> <span class="p">(</span><span class="mi">3</span> <span class="o">.</span> <span class="mi">4</span><span class="p">)</span> <span class="mi">1</span><span class="p">))</span>
130 </pre></div></div></div>
131 </div>
132 </div>
133 </div>
134 <div id="footnotes"><hr></div>
135 <div id="footer">
136 <div id="footer-text">
137 </div>
138 <div id="footer-badges">
139 </div>
140 </div>
141 </body>
142 </html>