This chapter describes how Caml Light can be used in conjunction with Gnu Emacs version 19 (version 18 is also partially supported).
The following initializations must be added to your .emacs file:
(setq auto-mode-alist (cons '("\\.ml[iylp]?" . caml-mode) auto-mode-alist))
(autoload 'caml-mode "caml" "Major mode for editing Caml code." t)
(autoload 'run-caml "inf-caml" "Run an inferior Caml process." t)
(autoload 'camldebug "camldebug" "Run the Caml debugger." t)
The caml-mode function is a major editing mode for Caml source files. It provides the correct syntax tables, comment syntax, ... for the Caml language. An extremely crude indentation facility is provided, as well as a slightly enhanced next-error command (to display the location of a compilation error). The following key bindings are performed:
below), set a breakpoint at the current
position of the point.
below), send it the
the Caml phrase that contains the point. The phrase will then be
evaluated by the inferior toplevel as usual. The phrase is delimited
by ;; as described for the caml-mark-phrase command.
M-x run-caml starts a Caml toplevel with input and output in an Emacs buffer named *inferior-caml*. This gives you the full power of Emacs to edit the input to the Caml toplevel. An history of input lines is maintained, as in Shell mode. This includes the following commands (see the function comint-mode for a complete description):
Phrases can also be sent to the Caml toplevel for evaluation from any buffer in Caml mode, using M-C-x, C-c C-e or C-c C-r.
The Caml debugger is started by the command M-x camldebug, with argument the name of the executable file progname to debug. Communication with the debugger takes place in an Emacs buffer named *camldebug-progname*. The editing and history facilities of Shell mode are available for interacting with the debugger.
In addition, Emacs displays the source files containing the current event (the current position in the program execution) and highlights the location of the event. This display is updated synchronously with the debugger action.
The following bindings for the most common debugger commands are
available in the *camldebug-progname* buffer (see
section
for a full explanation of the
commands):
In a buffer in Caml editing mode, C-x SPC sets a breakpoint at the current position of the point.