Import Upstream version 20180207
[hcoop/debian/mlton.git] / doc / guide / src / Emacs.adoc
... / ...
CommitLineData
1Emacs
2=====
3
4== SML modes ==
5
6There are a few Emacs modes for SML.
7
8* `sml-mode`
9** http://www.xemacs.org/Documentation/packages/html/sml-mode_3.html
10** http://www.smlnj.org/doc/Emacs/sml-mode.html
11** http://www.iro.umontreal.ca/%7Emonnier/elisp/
12
13* <!ViewGitFile(mlton,master,ide/emacs/mlton.el)> contains the Emacs lisp that <:StephenWeeks:> uses to interact with MLton (in addition to using `sml-mode`).
14
15* http://primate.net/%7Eitz/mindent.tar, developed by Ian Zimmerman, who writes:
16+
17_____
18Unlike the widespread `sml-mode.el` it doesn't try to indent code
19based on ML syntax. I gradually got skeptical about this approach
20after writing the initial indentation support for caml mode and
21watching it bloat insanely as the language added new features. Also,
22any such attempts that I know of impose a particular coding style, or
23at best a choice among a limited set of styles, which I now oppose.
24Instead my mode is based on a generic package which provides manual
25bindable commands for common indentation operations (example: indent
26the current line under the n-th occurrence of a particular character
27in the previous non-blank line).
28_____
29
30== MLB modes ==
31
32There is a mode for editing <:MLBasis: ML Basis> files.
33
34* <!ViewGitFile(mlton,master,ide/emacs/esml-mlb-mode.el)> (plus other files)
35
36== Definitions and uses ==
37
38There is a mode that supports the precise def-use information that
39MLton can output. It highlights definitions and uses and provides
40commands for navigation (e.g., `jump-to-def`, `jump-to-next`,
41`list-all-refs`). It can be handy, for example, for navigating in the
42MLton compiler source code. See <:EmacsDefUseMode:> for further
43information.
44
45== Building on the background ==
46
47Tired of manually starting/stopping/restarting builds after editing
48files? Now you don't have to. See <:EmacsBgBuildMode:> for further
49information.
50
51== Error messages ==
52
53MLton's error messages are not among those that the Emacs `next-error`
54parser natively understands. The easiest way to fix this is to add
55the following to your `.emacs` to teach Emacs to recognize MLton's
56error messages.
57
58[source,cl]
59----
60(require 'compile)
61(add-to-list 'compilation-error-regexp-alist 'mlton)
62(add-to-list 'compilation-error-regexp-alist-alist
63 '(mlton
64 "^[[:space:]]*\\(\\(?:\\(Error\\)\\|\\(Warning\\)\\|\\(\\(?:\\(?:defn\\|spec\\) at\\)\\|\\(?:escape \\(?:from\\|to\\)\\)\\|\\(?:scoped at\\)\\)\\): \\(.+\\) \\([0-9]+\\)\\.\\([0-9]+\\)\\(?:-\\([0-9]+\\)\\.\\([0-9]+\\)\\)?\\.?\\)$"
65 5 (6 . 8) (7 . 9) (3 . 4) 1))
66----