Changes http://wiki.axiom-developer.org/EmacsTagsForAlgebra/diff
--
This page describes how to setup emacs to quickly search through the algebra
sources by using TAGS.
Emacs offers the commands 'find-tag' and 'tags-loop-continue' (which can be
accessed through M-. and M-,).
These commands look in a TAGS (index) file for the appropriate filenames and
positions of the corresponding tag.
Assume you want Emacs to jump to the definition of [Monoid]. You simply type::
M-. Monoid RET
and after a few milliseconds your cursor is at the right place in the righ file.
To generate the corresponding TAGS file that Emacs needs, just rund the
following program.
(You might have to change the path to point to the location of your algebra
sources.)
Here is the script::
#!/bin/bash
# This script generates a TAGS file under $OUT.
# Those files tag the axiom algebra library.
# The same regular expressions also work for Aldor code.
AXIOMALGEBRASRC=/path/to/axiom-silver/axiom/src/algebra
OUT=/directory/for/the/TAGS/files
ID="[A-Z][A-Za-z0-9]*"
IDX="\(${ID}\)[ \t]*[:(]"
CONSTRUCTOR="/^\(\(define\|extend\)[ \t]*\)?${IDX}/\3/"
id="[a-z][A-Za-z0-9]*[?!]?"
name="/^[ \t]*\(${id}\)[ \t]*[:(]/\1/"
ABBREV="/^)abbrev[ \t]+[a-z]+[ \t]+\([A-Z0-9]+\)/\1/"
function et {
echo $3
etags --language=none -r "$CONSTRUCTOR" -r "$name" -r "$ABBREV" -o
$OUT/$3 $(find $1 -type f -name "*.$2")
}
et $AXIOMALGEBRASRC spad.pamphlet TAGSaxiom
A similar script can be used to tag Aldor source files, too. You would then
just add a line::
et /path/to/myaldorlib/sources as.nw TAGSmylib
Of course the whole thing also works for .as files, but we are writing literate
programs, don't we?
All you now have to do is to let Emacs know that there is such a TAGS file. You
can do this by::
M-x customize-variable tag-table-alist RET
There you have to put in (regular expressions, TAGS files) pairs. Please read
the documentation.
For me and my XEmacs it resulted in the following entry in custom.el::
'(tag-table-alist (quote (
("\\.as\\.nw" . "~/scratch/emacs/TAGSallprose")
("\\.spad.pamhlet" . "~/scratch/emacs/TAGSaxiom")
("\\.spad" . "~/scratch/emacs/TAGSaxiom"))))
which lives inside '(custom-set-variables ... )'. This entry means that if I
edit a file ending in
.as.nw the TAGSallprose file will be used and if I am currently in a .spad
file, the TAGSaxiom file
will be relevant for 'M-.'.
--
forwarded from http://wiki.axiom-developer.org/[EMAIL PROTECTED]