- Prerequisites (two):
- You need to install this patch (Enhtop:
Enhanced Toplevel), and the completion
patch (see below section on Enhtop+ for a more
verbose description) to OCaml which enhances the ocaml
toplevel. Or you can use this prepatched OCaml
which has both patches already builtin.
To patch:
copy the patch file into the root of the ocaml distribution.
patch -p1 -i thefile.diff
Once patched, do the usual ./configure, make, install as
usual to install ocaml.
If you use Godi, Zheng Li, who wrote the original
Enhtop, has directions on how to install in Godi. Just
follow those instructions and perform the
completion-patch immediately after performing the
original patch. One tip on following those directions:
after untarring godi-ocaml-src and making the changes to
the hash and size, delete or move the original
godi-ocaml-src tar ball out of the way (eg. /tmp).
Otherwise you may end up with two godi-ocaml-src
menu-items in godi and you won't be able to tell which
one has the corrected hash and size. A convenience
godi-ocaml-src is also available here. Be sure as
above, to remove the original godi-ocaml-src file and
directory.
- You need to install these .el files (completion and insta-help)
which enhances tuareg-mode and ocaml-mode into the
Superior mode that it can be. Installing is as simple
as putting it in some-directory and appending the
following into your .emacs file.
(setq load-path (cons "some-directory" load-path))
(setq ocaml-info-prefix "ocaml")
(setq ocaml-info-alist 'ocaml-ocamldoc-info)
(add-hook 'tuareg-mode-hook
'(lambda ()
(require 'tuareg-completion)
(require 'info)
(info-initialize)
(require 'caml-help)
(require 'caml-help-additions)
))
(add-hook 'tuareg-interactive-mode-hook
'(lambda ()
(require 'tuareg-completion)
(require 'info)
(info-initialize)
(require 'caml-help)
(require 'caml-help-additions)
))
(setq tuareg-startup-script "#use \"mystart.ml\";;")
- Install the OCaml manual info files if you don't have
them (needed for insta-help). You can get a
prepackaged version here or use
ocamldoc to make your own. If you want insta-help
for your own libraries you will need to use ocamldoc
to make your own.
Installing the info tar featured above is as simple
as untaring it into some directory and adding that
directory into your INFOPATH. For example:
mkdir ~/ocaml-manual
cd ~/ocaml-manual
tar zxvf /somedirectory/ocaml-3.07.info.tar
export INFOPATH=~/ocaml-manual:$INFOPATH
echo 'export INFOPATH=~/ocaml-manual:$INFOPATH' >> ~/.bash_profile
You're all set! SOLID should be ready to go. Load up a .ml
file and try alt-enter on a partially written identifier for
completion. You can hit ctrl-c h to get help on the
identifier at point. You can hit ctrl-c w to get the
value/signature/whatever of identifier at point. Remember
that everything is based on the toplevel, so if you haven't
defined "x" in the toplevel don't expect it to complete or
be able to get its value.