Tuareg Mode is a GOOD Emacs mode to edit Objective Caml code. It has a parser that let you recognize syntax errors by the meaning of special indentation, it can start an Ocaml toplevel and let you interact with it in a dedicated Emacs buffer.
Furthermore, the tuareg-imenu companion improves the capabilities of tuareg-mode: it parses the current buffer to provide definition navigation and let you browse interface files (that may contain library documentation) in the library directory.
You can get Tuareg mode and learn more about Objective Caml at the following sites:
To install, put the Tuareg files in ~/.elisp/tuareg-mode and add the following to your ~/.emacs file:
(add-to-list 'load-path "~/.elisp/tuareg-mode") (autoload 'tuareg-mode "tuareg" "Major mode for editing Caml code" t) (autoload 'camldebug "camldebug" "Run the Caml debugger" t) (autoload 'tuareg-imenu-set-imenu "tuareg-imenu" ; tuareg-imenu.el is not part of in Tuareg 2.2.0, "Configuration of imenu for tuareg" t) ; so this is unlikely to work
(add-hook 'tuareg-mode-hook 'tuareg-imenu-set-imenu) ; does not work in Tuareg 2.2.0
(setq auto-mode-alist (append '(("\\.ml[ily]?$" . tuareg-mode) ("\\.topml$" . tuareg-mode)) auto-mode-alist))
Please add usage examples to this page.
See also CamlMode.