12.6 Coq and GNU Emacs
12.6.1 The Coq Emacs mode
Coq comes with a Major mode for GNU Emacs, coq.el. This mode provides
syntax highlighting (assuming your GNU Emacs library provides
hilit19.el) and also a rudimentary indentation facility
in the style of the Caml GNU Emacs mode.
Add the following lines to your .emacs
file:
(setq auto-mode-alist (cons '("\\.v$" . coq-mode) auto-mode-alist))
(autoload 'coq-mode "coq" "Major mode for editing Coq vernacular." t)
The Coq major mode is triggered by visiting a file with extension .v,
or manually with the command M-x coq-mode
.
It gives you the correct syntax table for
the Coq language, and also a rudimentary indentation facility:
-
pressing Tab at the beginning of a line indents the line like
the line above;
- extra Tabs increase the indentation level
(by 2 spaces by default);
- M-Tab decreases the indentation level.
An inferior mode to run Coq under Emacs, by Marco Maggesi, is also
included in the distribution, in file coq-inferior.el.
Instructions to use it are contained in this file.
12.6.2 Proof General
Proof General is a generic interface for proof assistants based on
Emacs (or XEmacs). The main idea is that the Coq commands you are
editing are sent to a Coq toplevel running behind Emacs and the
answers of the system automatically inserted into other Emacs buffers.
Thus you don't need to copy-paste the Coq material from your files
to the Coq toplevel or conversely from the Coq toplevel to some
files.
Proof General is developped and distributed independently of the
system Coq. It is freely available at www.proofgeneral.org
.