Main menu

User Manual

Previous    |    Up    |    Next

4. Integration into IDEs

  • Local configuration (.ocamlwizard files)

Instead of passing options to Ocamlwizard on its command line, they can be provided in local .ocamlwizard files.

For instance, if source files are locates in two subdirectories foo/ and bar/ then foo/ may contain a .ocamlwizard file as follows:

-I ../bar
Additionally, if files are compiled from the top directory, then .ocamlwizard files in foo/ and bar/ may also contain the line
-root-dir ..
to indicate that filenames in .owz files are to be understood from this directory.
  • Makefile
It is rather immediate to patch an existing Makefile to make a project ocamlwizard-compliant. You simply need to add ocamlwizard compile commands to the existing compilation commands present in the Makefile.

For bytecode compilation, update the rules as follows:

.mli.cmi :
ocamlwizard compile $(FLAGS) $<
ocamlc -c $(FLAGS) $<
.ml.cmo :
ocamlwizard compile $(FLAGS) $<
ocamlc -c $(FLAGS) $<

For native code compilation, add the following line:

.ml.cmx :
ocamlwizard compile $(FLAGS) $<
ocamlopt -c $(FLAGS) $<

  • Emacs

A minimal Emacs Lisp integration is provided. It is contained in file emacs/ocamlwizard.el in Ocamlwizard sources. Once loaded, it adds the following key bindings to Emacs:

  • f1: jumps to an identifier declaration/definition using ocamlwizard locate; when there are several locations (one declaration and one definition typically), you can jump to the second one using Emacs next-error
  • f3: completes a match with expression, when cursor is located right after the with keyword
  • f11: expands a pattern-matching variable
  • f12: proposes possible expansions for a (possibly incomplete) path expression

Note: This is a quick and dirty implementation, which uses global-set-key to set the key bindings. A better implementation should provide these bindinds in the Tuareg-mode only, or some Emacs minor mode.


  • Eclipse

A proof-of-concept integration in Eclipse has been implemented. It is an Eclipse plugin providing a new editor, called OcamlwizardToolEditor. Within this editor, Ctrl-space triggers completion and F5 jumps to declaration/definition point (and F6 to the next point, if any).

To install the plugin, use menu Help -> Software Updates -> Find and Install in Eclipse and then use the New Local Site button, pointing to the subdirectory eclipse/ in Ocamlwizard sources.


Previous    |    Up    |    Next