]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/ocaml/ocaml/contrib/emacs/README
Update
[l4.git] / l4 / pkg / ocaml / ocaml / contrib / emacs / README
1         O'Caml emacs mode, snapshot of $Date: 2008-01-11 17:13:18 +0100 (Fri, 11 Jan 2008) $
2
3 The files in this archive define a caml-mode for emacs, for editing
4 Objective Caml and Objective Label programs, as well as an
5 inferior-caml-mode, to run a toplevel.
6
7 Caml-mode supports indentation, compilation and error retrieving,
8 sending phrases to the toplevel. Moreover support for hilit,
9 font-lock and imenu was added.
10
11 This package is based on the original caml-mode for caml-light by
12 Xavier Leroy, extended with indentation by Ian Zimmerman. For details
13 see README.itz, which is the README from Ian Zimmerman's package.
14
15 To use it, just put the .el files in your path, and add the following
16 three lines in your .emacs.
17
18     (setq auto-mode-alist
19           (cons '("\\.ml[iylp]?$" . caml-mode) auto-mode-alist))
20     (autoload 'caml-mode "caml" "Major mode for editing Caml code." t)
21     (autoload 'run-caml "inf-caml" "Run an inferior Caml process." t)
22
23 I added camldebug.el from the original distribution, since there will
24 soon be a debugger for Objective Caml, but I do not know enough about
25 it.
26
27 To install the mode itself, edit the Makefile and do
28
29     % make install
30
31 To install ocamltags, do
32
33     % make install-ocamltags
34
35 To use highlighting capabilities, add ONE of the following two lines
36 to your .emacs.  The second one works better on recent versions of
37 emacs.
38
39     (if window-system (require 'caml-hilit))
40     (if window-system (require 'caml-font))
41
42 caml.el and inf-caml.el can be used collectively, but it might be a
43 good idea to copy caml-hilit.el or caml-font.el to you own directory,
44 and edit it to your taste and colors.
45
46 Main key bindings:
47
48 TAB indent current line
49 M-C-q   indent phrase
50 M-C-h   mark phrase
51 C-c C-a switch between interface and implementation
52 C-c C-c compile (usually make)
53 C-x`    goto next error (also mouse button 2 in the compilation log)
54
55 Once you have started caml by M-x run-caml:
56
57 M-C-x   send phrase to inferior caml process
58 C-c C-r send region to inferior caml process
59 C-c C-s show inferior caml process
60 C-c`    goto error in expression sent by M-C-x
61
62 For other bindings, see C-h b.
63
64 Changes log:
65 -----------
66 Version 3.10.1:
67 ---------------
68 * use caml-font.el from Olivier Andrieu
69   old version is left as caml-font-old.el for compatibility
70
71 Version 3.07:
72 -------------
73 * support for showing type information <Damien Doligez>
74
75 Version 3.05:
76 -------------
77 * improved interaction with inferior caml mode
78
79 * access help from the source
80
81 * fixes in indentation code
82
83 Version 3.03:
84 -------------
85 * process ;; properly
86
87 Version 3.00:
88 -------------
89 * adapt to new label syntax
90
91 * intelligent indentation of parenthesis
92
93 Version 2.02:
94 -------------
95 * improved ocamltags <ITZ and JG>
96
97 * added support for multibyte characters in emacs 20
98
99 Version 2.01+:
100 --------------
101 * corrected a bug in caml-font.el <Adam P. Jenkins>
102
103 * corrected abbreviations and added ocamltags script <Ian T Zimmerman>
104
105 Version 2.01:
106 ------------
107 * code for interactive errors added by ITZ
108
109 Version 2.00:
110 ------------
111 * changed the algorithm to skip comments
112
113 * adapted for the new object syntax
114
115 Version 1.07:
116 ------------
117 * next-error bug fix by John Malecki
118
119 * camldebug.el modified by Xavier Leroy
120
121 Version 1.06:
122 ------------
123 * new keywords in O'Caml 1.06
124
125 * compatibility with GNU Emacs 20
126
127 * changed from caml-imenu-disable to caml-imenu-enable (off by default)
128
129 Version 1.05:
130 ------------
131 * a few indentation bugs corrected. let, val ... are now indented
132   correctly even when you write them at the beginning of a line.
133
134 * added a Caml menu, and Imenu support. Imenu menu can be disabled
135   by setting the variable caml-imenu-disable to t.
136   Xemacs support for the Menu, but no Imenu.
137
138 * key bindings closer to lisp-mode.
139
140 * O'Labl compatibility (":" is part of words) may be switched off by
141   setting caml-olabl-disable to t.
142
143 * camldebug.el was updated by Xavier Leroy.
144
145 Version 1.03b:
146 -------------
147 * many bugs corrected.
148
149 * (partial) compatibility with Caml-Light added.
150     (setq caml-quote-char "`")
151     (setq inferior-caml-program "camllight")
152   Literals will be correctly understood and highlighted. However,
153   indentation rules are still Objective Caml's: this just happens to
154   work well in most cases, but is only intended for occasional use.
155
156 * as many people asked for it, application is now indented. This seems
157   to work well: this time differences in indentation between the
158   compiler's source and this mode are really exceptionnal. On the
159   other hand, you may think that some special cases are strange. No
160   miracle.
161
162 * nicer behaviour when sending a phrase/region to the inferior caml
163   process.
164
165 Version 1.03:
166 ------------
167 * support of Objective Caml and Objective Label.
168
169 * an indentation very close to mine, which happens to be the same as
170   Xavier's, since the sources of the Objective Caml compiler do not
171   change if you indent them in this mode.
172
173 * highlighting.
174
175 Some remarks about the style supported:
176 --------------------------------------
177
178 Since Objective Caml's syntax is very liberal (more than 100
179 shift-reduce conflicts with yacc), automatic indentation is far from
180 easy. Moreover, you expect the indentation to be not purely syntactic,
181 but also semantic: reflecting the meaning of your program.
182
183 This mode tries to be intelligent. For instance some operators are
184 indented differently in the middle and at the end of a line (thanks to
185 Ian Zimmerman). Also, we do not indent after if .. then .. else, when
186 else is on the same line, to reflect that this idiom is equivalent to
187 a return instruction in a more imperative language, or after the in of
188 let .. in, since you may see that as an assignment.
189
190 However, you may want to use a different indentation style. This is
191 made partly possible by a number of variables at the beginning of
192 caml.el. Try to set them. However this only changes the size of
193 indentations, not really the look of your program. This is enough to
194 disable the two idioms above, but to do anything more you will have to
195 edit the code... Enjoy!
196
197 This mode does not force you to put ;; in your program. This means
198 that we had to use a heuristic to decide where a phrase starts and
199 stops, to speed up the code. A phrase starts when any of the keywords
200 let, type, class, module, functor, exception, val, external, appears
201 at the beginning of a line. Using the first column for such keywords
202 in other cases may confuse the phrase selection function.
203
204 Comments and bug reports to
205
206     Jacques Garrigue <garrigue@math.nagoya-u.ac.jp>