/usr/share/doc/mlton/guide/EmacsBgBuildMode is in mlton-doc 20100608-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 | <!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>EmacsBgBuildMode - 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%;">
EmacsBgBuildMode
<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>
<a href = "TitleIndex">Index</a>
</table>
<div id="content" lang="en" dir="ltr">
Do you really want to think about starting a build of you project? What if you had a personal slave that would restart a build of your project whenever you save any file belonging to that project? The bg-build mode does just that. Just save the file, a compile is started (silently!), you can continue working without even thinking about starting a build, and if there are errors, you are notified (with a message), and can then jump to errors. <p>
This mode is not specific to MLton per se, but is particularly useful for working with MLton due to the longer compile times. By the time you start wondering about possible errors, the build is already on the way.
</p>
<h3 id="head-f43ab5658e2e88669c0e231c0c31ef466c4c6dc2">Functionality and Features</h3>
<ul>
<li>
<p>
Each time a file is saved, and after a user configurable delay period has been exhausted, a build is started silently in the background.
</p>
</li>
<li>
<p>
When the build is finished, a status indicator (message) is displayed non-intrusively.
</p>
</li>
<li>
<p>
At any time, you can switch to a build process buffer where all the messages from the build are shown.
</p>
</li>
<li>
<p>
After a build has finished, you can jump to locations of warnings and errors from the build process buffer or by using the <tt>first-error</tt> and <tt>next-error</tt> commands.
</p>
</li>
<li>
<p>
When a build fails, bg-build mode can optionally execute a user specified command. By default, bg-build mode executes <tt>first-error</tt>.
</p>
</li>
<li>
<p>
When starting a build of a particular project, a possible previous live build of the same project is interrupted first.
</p>
</li>
<li>
<p>
A project configuration file specifies the commands required to build a project.
</p>
</li>
<li>
<p>
Multiple projects can be loaded into bg-build mode and bg-build mode can build a given maximum number of projects concurrently.
</p>
</li>
<li>
<p>
Supports both <a class="external" href="http://www.gnu.org/software/emacs/"><img src="moin-www.png" alt="[WWW]" height="11" width="11">Gnu Emacs</a> and <a class="external" href="http://www.xemacs.org"><img src="moin-www.png" alt="[WWW]" height="11" width="11">XEmacs</a>.
</p>
</li>
</ul>
<h3 id="head-a479c9c34e878d07b4d67a73a48f432ad7dc53c8">Download</h3>
<p>
There is no package for the mode at the moment. To install the mode you need to fetch the Emacs lisp, <tt>*.el</tt>, files from the MLton repository: <a class="external" href="http://mlton.org/cgi-bin/viewsvn.cgi/mlton/trunk/ide/emacs/"><img src="moin-www.png" alt="[WWW]" height="11" width="11">emacs</a>.
</p>
<h3 id="head-cdd7bb2816b7a8f88bce0e47be39943bc369516b">Setup</h3>
<p>
The easiest way to load the mode is to first tell Emacs where to find the files. For example, add
</p>
<ul>
<pre class=code>
(add-to-list 'load-path (file-truename <B><FONT COLOR="#BC8F8F">"path-to-the-el-files"</FONT></B>))
</PRE>
<p>
</p>
</ul>
<p>
to your <tt>~/.emacs</tt> or <tt>~/.xemacs/init.el</tt>. You'll probably also want to start the mode automatically by adding
</p>
<ul>
<pre class=code>
(require 'bg-build-mode)
(bg-build-mode)
</PRE>
<p>
</p>
</ul>
<p>
to your Emacs init file. Once the mode is activated, you should see the <tt>BGB</tt> indicator on the mode line.
</p>
<h4 id="head-d2e4cb08e10e25decb4889c2548e69aa63efaf40">MLton and Compilation-Mode</h4>
<p>
At the time of writing, neither Gnu Emacs nor XEmacs contain an error regexp that would match MLton's messages.
</p>
<p>
If you use Gnu Emacs, insert the following code into your <tt>.emacs</tt> file:
</p>
<ul>
<pre class=code>
(require 'compile)
(add-to-list
'compilation-error-regexp-alist
'(<B><FONT COLOR="#BC8F8F">"^\\(Warning\\|Error\\): \\(.+\\) \\([0-9]+\\)\\.\\([0-9]+\\)\\.$"</FONT></B>
2 3 4))
</PRE>
<p>
</p>
</ul>
<p>
If you use XEmacs, insert the following code into your <tt>init.el</tt> file:
</p>
<ul>
<pre class=code>
(require 'compile)
(add-to-list
'compilation-error-regexp-alist-alist
'(mlton
(<B><FONT COLOR="#BC8F8F">"^\\(Warning\\|Error\\): \\(.+\\) \\([0-9]+\\)\\.\\([0-9]+\\)\\.$"</FONT></B>
2 3 4)))
(compilation-build-compilation-error-regexp-alist)
</PRE>
<p>
</p>
</ul>
<h3 id="head-0bb18642b70b9f8a9c12ccf39487328f306b8e19">Usage</h3>
<p>
Typically projects are built (or compiled) using a tool like <a class="external" href="http://www.gnu.org/software/make/"><img src="moin-www.png" alt="[WWW]" height="11" width="11">make</a>, but the details vary. The bg-build mode needs a project configuration file to know how to build your project. A project configuration file basically contains an Emacs Lisp expression calling a function named <tt>bg-build</tt> that returns a project object. A simple example of a project configuration file would be the (<a href = "http://mlton.org/cgi-bin/viewsvn.cgi/mltonlib/trunk/com/ssh/async/unstable/example/smlbot/Build.bgb?view=markup"><img src="moin-www.png" alt="[WWW]" height="11" width="11">Build.bgb</a>) file used with smlbot:
</p>
<ul>
<pre class=code>(bg-build
<B><FONT COLOR="#5F9EA0">:name</FONT></B> <B><FONT COLOR="#BC8F8F">"SML-Bot"</FONT></B>
<B><FONT COLOR="#5F9EA0">:shell</FONT></B> <B><FONT COLOR="#BC8F8F">"nice -n5 make all"</FONT></B>)
</PRE>
</ul>
<p>
The <tt>bg-build</tt> function takes a number of keyword arguments:
</p>
<ul>
<li>
<p>
<tt>:name</tt> specifies the name of the project. This can be any expression that evaluates to a string or to a nullary function that returns a string.
</p>
</li>
<li>
<p>
<tt>:shell</tt> specifies a shell command to execute. This can be any expression that evaluates to a string, a list of strings, or to a nullary function returning a list of strings.
</p>
</li>
<li>
<p>
<tt>:build?</tt> specifies a predicate to determine whether the project should be built after some files have been modified. The predicate is given a list of filenames and should return a non-nil value when the project should be built and nil otherwise.
</p>
</li>
</ul>
<p>
All of the keyword arguments, except <tt>:shell</tt>, are optional and can be left out.
</p>
<p>
Note the use of the <tt>nice</tt> command above. It means that background build process is given a lower priority by the system process scheduler. Assuming your machine has enough memory, using nice ensures that your computer remains responsive. (You probably won't even notice when a build is started.)
</p>
<p>
Once you have written a project file for bg-build mode. Use the <tt>bg-build-add-project</tt> command to load the project file for bg-build mode. The bg-build mode can also optionally load recent project files automatically at startup.
</p>
<p>
After the project file has been loaded and bg-build mode activated, each time you save a file in Emacs, the bg-build mode tries to build your project.
</p>
<p>
The <tt>bg-build-status</tt> command creates a buffer that displays some status information on builds and allows you to manage projects (start builds explicitly, remove a project from bg-build, ...) as well as visit buffers created by bg-build. Notice the count of started builds. At the end of the day it can be in the hundreds or thousands. Imagine the number of times you've been relieved of starting a build explicitly!
</p>
</div>
<p>
<hr>
Last edited on 2007-07-07 04:01:31 by <span title="cs27019070.pp.htv.fi"><a href="VesaKarvonen">VesaKarvonen</a></span>.
</body></html>
|