[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Proof General makes some configuration for other Emacs packages which provide various useful facilities that can make your editing more effective.
Sometimes this configuration is purely at the proof assistant specific level (and so not necessarily available), and sometimes it is made using Proof General settings.
When adding support for a new proof assistant, we suggest that these other packages are supported, as a convention.
The packages currently supported are
font-lock
,
x-symbol
,
func-menu
,
outline-mode
,
completion
,
and etags
.
5.1 Syntax highlighting | ||
5.2 X-Symbol support | ||
5.3 Imenu and Speedbar (and Function Menu) | ||
5.4 Support for outline mode | ||
5.5 Support for completion | ||
5.6 Support for tags |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Proof script buffers are decorated (or fontified) with colours, bold
and italic fonts, etc, according to the syntax of the proof language and
the settings for font-lock-keywords
made by the proof assistant
specific portion of Proof General. Moreover, Proof General usually
decorates the output from the proof assistant, also using
font-lock
.
In XEmacs, fontification is automatically turned on. To automatically
switch on fontification in GNU Emacs 20.4, you may need to engage
M-x global-font-lock-mode
. The old mechanism of adding hooks to
the mode hooks (lego-mode-hooks
, coq-mode-hooks
, etc) is
no longer recommended; it should not be needed in latest Emacs versions
which have more flexible customization.
Fontification for output is controlled by a separate switch in Proof
General. Set proof-output-fontify-enable
to nil
if you
don't want the output from your proof assistant to be fontified
according to the setting of font-lock-keywords
in the proof
assistant specific portion of Proof General. See section User options.
By the way, the choice of colour, font, etc, for each kind of markup is fully customizable in Proof General. Each face (Emacs terminology) is controlled by its own customization setting. You can display a list of all of them using the customize menu:
Proof General -> Advanced -> Customize -> Faces -> Proof Faces. |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The X-Symbol package displays characters from a variety of fonts in Emacs buffers, automatically converting between codes for special characters and tokens which are character sequences stored in files.
Proof General uses X-Symbol to allow interaction between the user and the proof assistant to use tokens, yet appear to be using special characters. So proof scripts and proofs can be processed with real mathematical symbols, Greek letters, etc.
The X-Symbol package is now bundled with Proof General. You will be able to enable X-Symbol support if support has been provided in Proof General for a token language for your proof assistant. To enable X-Symbol, use the menu item:
Proof-General -> Options -> X-Symbol |
To enable it automatically every time you use Proof General, just use
Proof-General -> Options -> Save Options |
once it has been selected. (Alternatively, customize the setting
PA-x-symbol-enable
).
You may also simply use M-x x-symbol-mode
to turn on and off
X-Symbol display in the scripting buffer, as you would when using
X-Symbol for other modes, or indeed, as for any other Emacs minor mode.
However, this way of turning on and off symbols will only affect the
current script buffer, and will not change the status of any symbol
configuration for the prover input/output (some proof assistants, such
as Isabelle, have switches for enabling symbol output). To make
sure that symbol output is switched on or off for the prover
as a whole, use the menu option mentioned above, or its underlying
command, M-x proof-x-symbol-toggle
.
Notice that for proper symbol support, the proof assistant needs to have
a special token language, or a special character set, to use
symbols. In this case, the proof assistant will output, and accept as
input, tokens like \longrightarrow
, which display as the
corresponding symbols. However, for proof assistants which do not have
such token support, we can use "fake" symbol support quite effectively,
displaying ordinary ASCII character sequences such as -->
with
symbols.
For more information about the X-Symbol package, please visit its home page at http://x-symbol.sourceforge.net/.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The Emacs packages imenu
(Index Menu) and func-menu
(Function Menu) each provide a menu built from the names of entities
(e.g., theorems, definitions, etc) declared in a buffer. This allows
easy navigation within the file. Proof General configures both packages
automatically so that you can quickly jump to particular proofs in a
script buffer.
(Developers note: the automatic configuration is done with the settings
proof-goal-with-hole-regexp
and
proof-save-with-hole-regexp
. Better configuration may be made
manually with several other settings, see the Adapting Proof General
manual for further details).
To use Imenu, select the option
Proof General -> Options -> Index Menu |
This adds an "Index" menu to the main menu bar for proof script buffers. You can also use M-x imenu for keyboard-driven completion of tags built from names in the buffer.
To use Function Menu (distributed only with XEmacs), use M-x
function-menu. To enable it by default each time you visit a proof
script file (i.e. avoid typing M-x function-menu
), you should
find the file `func-menu.el' and follow the instructions there.
Speedbar displays a file tree in a separate window on the display, allowing quick navigation. Middle/double-clicking or pressing + on a file icon opens up to display tags (definitions, theorems, etc) within the file. Middle/double-clicking on a file or tag jumps to that file or tag.
To use Speedbar, use
Tools -> Display Speedbar |
(for GNU Emacs), or
Proof General -> Advanced -> Speedbar |
(for XEmacs). If you prefer the old fashioned way, `M-x speedbar' does the same job.
For more information about Speedbar, see http://cedet.sourceforge.net/speedbar.shtml.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Proof General configures Emacs variables (outline-regexp
and
outline-heading-end-regexp
) so that outline minor mode can be
used on proof script files. The headings taken for outlining are the
"goal" statements at the start of goal-save sequences,
see section Goal-save sequences. If you want to use outline
to hide
parts of the proof script in the locked region, you need to disable
proof-strict-read-only
.
Use M-x outline-minor-mode to turn on outline minor mode. Functions for navigating, hiding, and revealing the proof script are available in menus.
Please note that outline-mode may not work well in processed proof
script files, because of read-only restrictions of the protected region.
This is an inherent problem with outline because it works by modifying
the buffer. If you want to use outline with processed scripts, you
can turn off the Strict Read Only
option.
See See ((xemacs))Outline Mode for more information about outline mode.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
You might find the completion facility of Emacs useful when
you're using Proof General. The key C-RET is defined to invoke
the complete
command. Pressing C-RET cycles through
completions displaying hints in the minibuffer.
Completions are filled in according to what has been recently typed, from a database of symbols. The database is automatically saved at the end of a session.
Proof General has the additional facility for setting a completion table for each supported proof assistant, which gets loaded into the completion database automatically. Ideally the completion table would be set from the running process according to the identifiers available are within the particular context of a script file. But until this is available, this table may be set to contain a number of standard identifiers available for your proof assistant.
The setting PA-completion-table
holds the list of
identifiers for a proof assistant. The function
proof-add-completions
adds these into the completion
database.
List of identifiers to use for completion for this proof assistant.
Completion is activated with C-return.
If this table is empty or needs adjusting, please make changes using
`customize-variable
' and send suggestions to da+pg-support@@inf.ed.ac.uk
The completion facility uses a library `completion.el' which
usually ships with XEmacs and GNU Emacs, and supplies the
complete
function.
Fill out a completion of the word before point.
Point is left at end. Consecutive calls rotate through all possibilities.
Prefix args:
leave point at the beginning of the completion, not the end.
rotate through the possible completions by that amount
same as -1 (insert previous completion)
See the comments at the top of `completion.el' for more info.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
An Emacs "tags table" is a description of how a multi-file system is broken up into files. It lists the names of the component files and the names and positions of the functions (or other named subunits) in each file. Grouping the related files makes it possible to search or replace through all the files with one command. Recording the function names and positions makes possible the M-. command which finds the definition of a function by looking up which of the files it is in.
Some instantiations of Proof General (currently LEGO and Coq) are supplied with external programs (`legotags' and `coqtags') for making tags tables. For example, invoking `coqtags *.v' produces a file `TAGS' for all files `*.v' in the current directory. Invoking `coqtags `find . -name \*.v`' produces a file `TAGS' for all files ending in `.v' in the current directory structure. Once a tag table has been made for your proof developments, you can use the Emacs tags mechanisms to find tags, and complete symbols from tags table.
One useful key-binding you might want to make is to set the usual
tags completion key M-tab to run tag-complete-symbol
to use
completion from names in the tag table. To set this binding in Proof
General script buffers, put this code in your `.emacs' file:
(add-hook 'proof-mode-hook (lambda () (local-set-key '(meta tab) 'tag-complete-symbol))) |
Since this key-binding interferes with a default binding that users may already have customized (or may be taken by the window manager), Proof General doesn't do this automatically.
Apart from completion, there are several other operations on tags. One
common one is replacing identifiers across all files using
tags-query-replace
. For more information on how to use tags,
See ((xemacs))Tags.
To use tags for completion at the same time as the completion mechanism mentioned already, you can use the command M-x add-completions-from-tags-table.
Add completions from the current tags table.
[ << ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated by David Aspinall on November, 7 2006 using texi2html 1.76.