aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/textmodes/reftex.el
diff options
context:
space:
mode:
authorRichard M. Stallman1997-06-19 01:18:23 +0000
committerRichard M. Stallman1997-06-19 01:18:23 +0000
commitc52bdfca7c0827cb155dfef385f5350c48caeb43 (patch)
tree590f597e806bd175db62f11862a06531ed12aff2 /lisp/textmodes/reftex.el
parent482e54f35454100166b305de90c29a96d9625fbb (diff)
downloademacs-c52bdfca7c0827cb155dfef385f5350c48caeb43.tar.gz
emacs-c52bdfca7c0827cb155dfef385f5350c48caeb43.zip
Changed all doc strings to comply with conventions.
(reftex-label-alist-builtin) New environment subfigure*. (reftex-toc) Introduced key g for revert-buffer. (reftex-extract-bib-entries) Allowed round parens as delimiter. (reftex-plug-into-AUCTeX) New variable and function. (reftex-make-master-buffer) Fixed bug with relative path names.
Diffstat (limited to 'lisp/textmodes/reftex.el')
-rw-r--r--lisp/textmodes/reftex.el753
1 files changed, 426 insertions, 327 deletions
diff --git a/lisp/textmodes/reftex.el b/lisp/textmodes/reftex.el
index 29624af71f1..d9470638085 100644
--- a/lisp/textmodes/reftex.el
+++ b/lisp/textmodes/reftex.el
@@ -47,50 +47,50 @@
47;; 47;;
48;; OVERVIEW 48;; OVERVIEW
49;; 49;;
50;; 1. USING \label AND \ref. Labels and references are one of the 50;; 1. USING \label AND \ref. Labels and references are one of the
51;; strong points of LaTeX. But, in documents with hundreds of 51;; strong points of LaTeX. But, in documents with hundreds of
52;; equations, figures, tables etc. it becomes quickly impossible to 52;; equations, figures, tables etc. it becomes quickly impossible to
53;; find good label names and to actually remember them. Then, also 53;; find good label names and to actually remember them. Then, also
54;; completion of labels in not enough. One actually needs to see the 54;; completion of labels in not enough. One actually needs to see the
55;; context of the label definition to find the right one. 55;; context of the label definition to find the right one.
56;; 56;;
57;; - RefTeX distinguishes labels for different environments. It 57;; - RefTeX distinguishes labels for different environments. It
58;; always knows if a certain label references a figure, table 58;; always knows if a certain label references a figure, table
59;; etc. You can configure RefTeX to recognize any additional 59;; etc.. You can configure RefTeX to recognize any additional
60;; labeled environments you might have defined yourself. 60;; labeled environments you might have defined yourself.
61;; 61;;
62;; - RefTeX defines automatically unique labels. Type `C-c (' 62;; - RefTeX defines automatically unique labels. Type `C-c ('
63;; (reftex-label) to insert a label at point. RefTeX will either 63;; (reftex-label) to insert a label at point. RefTeX will either
64;; - derive a label from context (default for section labels) 64;; - derive a label from context (default for section labels)
65;; - insert a simple label consisting of a prefix and a number 65;; - insert a simple label consisting of a prefix and a number
66;; (default for equations and enumerate items) or 66;; (default for equations and enumerate items) or
67;; - prompt for a label string (figures and tables) 67;; - prompt for a label string (figures and tables).
68;; Which labels are created how can be controlled with the variable 68;; Which labels are created how can be controlled with the variable
69;; reftex-insert-label-flags. 69;; `reftex-insert-label-flags'.
70;; 70;;
71;; - Referencing labels is a snap and I promise you'll love it. 71;; - Referencing labels is a snap and I promise you'll love it.
72;; In order to make a reference, type `C-c )' (reftex-reference). 72;; In order to make a reference, type `C-c )' (`reftex-reference').
73;; This shows an outline of the documents with all labels of a 73;; This shows an outline of the documents with all labels of a
74;; certain type (figure, equation,...) and context of the label 74;; certain type (figure, equation,...) and context of the label
75;; definition. Selecting one of the labels inserts a \ref macro 75;; definition. Selecting one of the labels inserts a \ref macro
76;; into the original buffer. Online help during the selection is 76;; into the original buffer. Online help during the selection is
77;; available with `?'. 77;; available with `?'.
78;; 78;;
79;; 2. CITATIONS. After typing `C-c [' (reftex-citation), RefTeX will 79;; 2. CITATIONS. After typing `C-c [' (`reftex-citation'), RefTeX will
80;; let you specify a regexp to search in current BibTeX database files 80;; let you specify a regexp to search in current BibTeX database files
81;; (as specified in the \bibliography command) and pull out a formatted 81;; (as specified in the \bibliography command) and pull out a formatted
82;; list of matches for you to choose from. The list is *formatted* and 82;; list of matches for you to choose from. The list is *formatted* and
83;; thus much easier to read than the raw database entries. It can also 83;; thus much easier to read than the raw database entries. It can also
84;; be sorted. The text inserted into the buffer is by default just 84;; be sorted. The text inserted into the buffer is by default just
85;; `\cite{KEY}', but can also contain author names and the year in a 85;; `\cite{KEY}', but can also contain author names and the year in a
86;; configurable way. See documentation of the variable 86;; configurable way. See documentation of the variable
87;; reftex-cite-format. 87;; `reftex-cite-format'.
88;; 88;;
89;; 3. TABLE OF CONTENTS. Typing `C-c =' (reftex-toc) will show 89;; 3. TABLE OF CONTENTS. Typing `C-c =' (`reftex-toc') will show
90;; a table of contents of the document. From that buffer, you can 90;; a table of contents of the document. From that buffer, you can
91;; jump quickly to every part of your document. This is similar to 91;; jump quickly to every part of your document. This is similar to
92;; imenu, only it works for entire multifile documents and uses the 92;; imenu, only it works for entire multifile documents and uses the
93;; keyboard rather than the mouse. The initial version of this 93;; keyboard rather than the mouse. The initial version of this
94;; function was contributed by Stephen Eglen. 94;; function was contributed by Stephen Eglen.
95;; 95;;
96;; 4. MULTIFILE DOCUMENTS are supported in the same way as by AUCTeX. 96;; 4. MULTIFILE DOCUMENTS are supported in the same way as by AUCTeX.
@@ -106,20 +106,20 @@
106;; This will only take effect when you load the file next time or when 106;; This will only take effect when you load the file next time or when
107;; you reset RefTeX with M-x reftex-reset-mode. 107;; you reset RefTeX with M-x reftex-reset-mode.
108;; 108;;
109;; RefTeX will also recognize the file variable tex-main-file. This 109;; RefTeX will also recognize the file variable tex-main-file. This
110;; variable is used by the Emacs TeX modes and works just like 110;; variable is used by the Emacs TeX modes and works just like
111;; AUCTeX's TeX-master variable. See the documentation of your TeX/LaTeX 111;; AUCTeX's TeX-master variable. See the documentation of your TeX/LaTeX
112;; modes. 112;; modes.
113;; 113;;
114;; RefTeX knows about all files related to a document via input and 114;; RefTeX knows about all files related to a document via input and
115;; include. It provides functions to run regular expression searches and 115;; include. It provides functions to run regular expression searches and
116;; replaces over the entire document and to create a TAGS file. 116;; replaces over the entire document and to create a TAGS file.
117;; 117;;
118;; 5. DOCUMENT PARSING. RefTeX needs to parse the document in order to find 118;; 5. DOCUMENT PARSING. RefTeX needs to parse the document in order to find
119;; labels and other information. It will do it automatically once, when 119;; labels and other information. It will do it automatically once, when
120;; you start working with a document. If you need to enforce reparsing 120;; you start working with a document. If you need to enforce reparsing
121;; later, call any of the functions reftex-citation, reftex-label, 121;; later, call any of the functions `reftex-citation', `reftex-label',
122;; reftex-reference, reftex-toc with a raw C-u prefix. 122;; `reftex-reference', `reftex-toc' with a raw C-u prefix.
123;; 123;;
124;;------------------------------------------------------------------------- 124;;-------------------------------------------------------------------------
125;; 125;;
@@ -131,17 +131,17 @@
131;; mark non-standard environments. RefTeX always understands LaTeX section 131;; mark non-standard environments. RefTeX always understands LaTeX section
132;; commands and the following environments: figure, figure*, 132;; commands and the following environments: figure, figure*,
133;; sidewaysfigure, table, table*, sidewaystable, equation, eqnarray, 133;; sidewaysfigure, table, table*, sidewaystable, equation, eqnarray,
134;; enumerate. For everythings else, it needs to be configured. 134;; enumerate. For everythings else, it needs to be configured.
135;; 135;;
136;; A good way to configure RefTeX is with the custom.el package by Per 136;; A good way to configure RefTeX is with the custom.el package by Per
137;; Abrahamsen, shipped with Emacs 20 and XEmacs 19.15. To do this, just 137;; Abrahamsen, shipped with Emacs 20 and XEmacs 19.15. To do this, just
138;; say `M-x reftex-customize'. This will not work with older versions 138;; say `M-x reftex-customize'. This will not work with older versions
139;; of custom.el. 139;; of custom.el.
140;; 140;;
141;; Here is a complete list of the RefTeX configuration variables with 141;; Here is a complete list of the RefTeX configuration variables with
142;; their default settings. You could copy this list to your .emacs file 142;; their default settings. You could copy this list to your .emacs file
143;; and change whatever is necessary. Each variable has an extensive 143;; and change whatever is necessary. Each variable has an extensive
144;; documentation string. Look it up for more information! 144;; documentation string. Look it up for more information!
145;; 145;;
146;; ;; Configuration Variables and User Options for RefTeX ------------------ 146;; ;; Configuration Variables and User Options for RefTeX ------------------
147;; ;; Support for \label and \ref -------------------------------------- 147;; ;; Support for \label and \ref --------------------------------------
@@ -166,6 +166,7 @@
166;; (setq reftex-toc-follow-mode nil) 166;; (setq reftex-toc-follow-mode nil)
167;; ;; Miscellaneous configurations ----------------------------------------- 167;; ;; Miscellaneous configurations -----------------------------------------
168;; (setq reftex-extra-bindings nil) 168;; (setq reftex-extra-bindings nil)
169;; (setq reftex-plug-into-AUCTeX nil)
169;; (setq reftex-use-fonts t) 170;; (setq reftex-use-fonts t)
170;; (setq reftex-keep-temporary-buffers t) 171;; (setq reftex-keep-temporary-buffers t)
171;; (setq reftex-auto-show-entry t) 172;; (setq reftex-auto-show-entry t)
@@ -212,27 +213,27 @@
212;; ("\\myfig" ?f "fig:" nil t))) 213;; ("\\myfig" ?f "fig:" nil t)))
213;; 214;;
214;; The type indicator characters ?a and ?h are used for prompts when 215;; The type indicator characters ?a and ?h are used for prompts when
215;; RefTeX queries for a label type. Note that "h" was chosen for "theorem" 216;; RefTeX queries for a label type. Note that "h" was chosen for "theorem"
216;; since "t" is already taken by "table". Note that also "s", "f", "e", "n" 217;; since "t" is already taken by "table". Note that also "s", "f", "e", "n"
217;; are taken by the standard environments. 218;; are taken by the standard environments.
218;; The automatic labels for Axioms and Theorems will look like "ax:23" or 219;; The automatic labels for Axioms and Theorems will look like "ax:23" or
219;; "thr:24". 220;; "thr:24".
220;; The "\ref{%s}" is a format string indicating how to insert references to 221;; The "\ref{%s}" is a format string indicating how to insert references to
221;; these labels. The nil format in the \myfig entry means to use the same 222;; these labels. The nil format in the \myfig entry means to use the same
222;; format as other figure labels. 223;; format as other figure labels.
223;; The next item indicates how to grab context of the label definition. 224;; The next item indicates how to grab context of the label definition.
224;; - t means to get it from a default location (from the beginning of a \macro 225;; - t means to get it from a default location (from the beginning of a \macro
225;; or after the \begin statement). t is *not* a good choice for eqnarray 226;; or after the \begin statement). t is *not* a good choice for eqnarray
226;; and similar environments. 227;; and similar environments.
227;; - nil means to use the text right after the label definition. 228;; - nil means to use the text right after the label definition.
228;; - For more complex ways of getting context, see the docstring of 229;; - For more complex ways of getting context, see the docstring of
229;; reftex-label-alist. 230;; `reftex-label-alist'.
230;; The strings at the end of each entry are used to guess the correct label 231;; The strings at the end of each entry are used to guess the correct label
231;; type from the word before point when creating a reference. E.g. if you 232;; type from the word before point when creating a reference. E.g. if you
232;; write: "as we have shown in Theorem" and then press `C-)', RefTeX will 233;; write: "as we have shown in Theorem" and then press `C-)', RefTeX will
233;; know that you are looking for a Theorem label and restrict the labels in 234;; know that you are looking for a Theorem label and restrict the labels in
234;; the menu to only these labels without even asking. 235;; the menu to only these labels without even asking.
235;; See also the documentation string of the variable reftex-label-alist. 236;; See also the documentation string of the variable `reftex-label-alist'.
236;; 237;;
237;; Depending on how you would like the label insertion and selection for the 238;; Depending on how you would like the label insertion and selection for the
238;; new environments to work, you might want to add the letters "a" and "h" 239;; new environments to work, you might want to add the letters "a" and "h"
@@ -242,12 +243,12 @@
242;; reftex-label-menu-flags 243;; reftex-label-menu-flags
243;; 244;;
244;; The individual flags in these variables can be set to t or nil to enable or 245;; The individual flags in these variables can be set to t or nil to enable or
245;; disable the feature for all label types. They may also contain a string of 246;; disable the feature for all label types. They may also contain a string of
246;; label type letters in order to turn on the feature for those types only. 247;; label type letters in order to turn on the feature for those types only.
247;; 248;;
248;; ----- 249;; -----
249;; If you are writing in a language different from english you might want to 250;; If you are writing in a language different from english you might want to
250;; add magic words for that language. Here is a German example: 251;; add magic words for that language. Here is a German example:
251;; 252;;
252;; (setq reftex-label-alist 253;; (setq reftex-label-alist
253;; '((nil ?s nil nil nil ("Kapitel" "Kap." "Abschnitt" "Teil")) 254;; '((nil ?s nil nil nil ("Kapitel" "Kap." "Abschnitt" "Teil"))
@@ -256,20 +257,20 @@
256;; (nil ?f nil nil nil ("Figur" "Abbildung" "Abb.")) 257;; (nil ?f nil nil nil ("Figur" "Abbildung" "Abb."))
257;; (nil ?n nil nil nil ("Punkt")))) 258;; (nil ?n nil nil nil ("Punkt"))))
258;; 259;;
259;; Using `nil' as first item in each entry makes sure that this entry does 260;; Using nil as first item in each entry makes sure that this entry does
260;; not replace the original entry for that label type. 261;; not replace the original entry for that label type.
261;; 262;;
262;; HOOKS 263;; HOOKS
263;; ----- 264;; -----
264;; Loading reftex.el runs the hook reftex-load-hook. Turning on reftex-mode 265;; Loading reftex.el runs the hook `reftex-load-hook'.
265;; runs reftex-mode-hook. 266;; Turning on reftex-mode runs `reftex-mode-hook'.
266;; 267;;
267;;------------------------------------------------------------------------- 268;;-------------------------------------------------------------------------
268;; 269;;
269;; KEY BINDINGS 270;; KEY BINDINGS
270;; 271;;
271;; All important functions of RefTeX can be reached from its menu which 272;; All important functions of RefTeX can be reached from its menu which
272;; is installed in the menu bar as "Ref" menu. Only the more frequently used 273;; is installed in the menu bar as "Ref" menu. Only the more frequently used
273;; functions have key bindings. 274;; functions have key bindings.
274;; 275;;
275;; Here is the default set of keybindings from RefTeX. 276;; Here is the default set of keybindings from RefTeX.
@@ -281,7 +282,7 @@
281;; C-c & reftex-view-crossref 282;; C-c & reftex-view-crossref
282;; 283;;
283;; I've used these bindings in order to avoid interfering with AUCTeX's 284;; I've used these bindings in order to avoid interfering with AUCTeX's
284;; settings. Personally, I also bind some functions in the C-c LETTER 285;; settings. Personally, I also bind some functions in the C-c LETTER
285;; map for easier access: 286;; map for easier access:
286;; 287;;
287;; C-c t reftex-toc 288;; C-c t reftex-toc
@@ -297,7 +298,7 @@
297;; (setq reftex-extra-bindings t) 298;; (setq reftex-extra-bindings t)
298;; 299;;
299;; It is possible to bind the function for viewing cross references to a 300;; It is possible to bind the function for viewing cross references to a
300;; mouse event. Something like the following in .emacs will do the trick: 301;; mouse event. Something like the following in .emacs will do the trick:
301;; 302;;
302;; (add-hook 'reftex-load-hook 303;; (add-hook 'reftex-load-hook
303;; '(lambda () 304;; '(lambda ()
@@ -316,21 +317,36 @@
316;; 317;;
317;; http://www.sunsite.auc.dk/auctex/ 318;; http://www.sunsite.auc.dk/auctex/
318;; 319;;
319;; AUCTeX version 9.7f and later can be configured to delegate label 320;; Instead of using the RefTeX functions described above directly, you
320;; insertion to RefTeX. Do do that, say in your .emacs file 321;; can also use them indirectly through AUCTeX (>9.7p). RefTeX provides
322;; several interface functions which can be used as replacement for
323;; corresponding AUCTeX functions dealing with labels and citations.
324;; In this way you can work normally with AUCTeX and use RefTeX
325;; internals to create and complete labels and citation keys.
321;; 326;;
322;; (setq LaTeX-label-function 'reftex-label) 327;; `reftex-label' can be used as the `LaTeX-label-function' which does
328;; label insertion when new environments are created with C-c C-e.
323;; 329;;
324;; RefTeX also provides functions which can replace TeX-arg-label and 330;; `reftex-arg-label', `reftex-arg-ref' and `reftex-arg-cite' can replace
325;; TeX-arg-cite in AUCTeX. These functions are compatible with the originals, 331;; the corresponding `TeX-arg-...' functions. E.g. when you insert a
326;; but use RefTeX internals to create and select labels and citation keys. 332;; label macro with `C-c RET label RET', RefTeX will be transparently used
327;; There are 3 functions: reftex-arg-label, reftex-arg-ref, reftex-arg-cite. 333;; to create the label.
328;; 334;;
329;; AUCTeX can support RefTeX via style files. A style file may contain 335;; In order to plug all 4 functions into AUCTeX, use in .emacs:
330;; calls to reftex-add-to-label-alist which defines additions to 336;;
331;; reftex-label-alist. The argument taken by this function must have 337;; (setq reftex-plug-into-AUCTeX t)
332;; the same format as reftex-label-alist. E.g. the amsmath.el style file 338;;
333;; of AUCTeX contains the following: 339;; You may also choose to plug in only some of these functions. The
340;; following setting will leave TeX-arg-cite as it was while replacing
341;; the other 3 AUCTeX functions:
342;;
343;; (setq reftex-plug-into-AUCTeX '(t t t nil))
344;;
345;; AUCTeX can support RefTeX via style files. A style file may contain
346;; calls to `reftex-add-to-label-alist' which defines additions to
347;; `reftex-label-alist'. The argument taken by this function must have
348;; the same format as `reftex-label-alist'. The `amsmath.el' style file
349;; of AUCTeX (>9.7p) for example contains the following:
334;; 350;;
335;; (TeX-add-style-hook "amsmath" 351;; (TeX-add-style-hook "amsmath"
336;; (function 352;; (function
@@ -351,13 +367,14 @@
351;; 367;;
352;; Bib-cite.el 368;; Bib-cite.el
353;; ----------- 369;; -----------
354;; Once you have written a document with labels, refs and citations, it can be 370;; Once you have written a document with labels, refs and citations,
355;; nice to read such a file like a hypertext document. RefTeX has some support 371;; it can be nice to read such a file like a hypertext document.
356;; for that (reftex-view-crossref, reftex-search-document). A more elegant 372;; RefTeX has some support for that (`reftex-view-crossref',
357;; interface with mouse support and links into Hyperbole is provided (among 373;; `reftex-search-document'). A more elegant interface with mouse
358;; other things) by Peter S. Galbraith's bib-cite.el. There is some overlap in 374;; support and links into Hyperbole is provided (among other things)
359;; the functionalities of bib-cite and RefTeX. Bib-cite.el comes bundled with 375;; by Peter S. Galbraith's `bib-cite.el'. There is some overlap in the
360;; AUCTeX. You can also get the latest version from 376;; functionalities of Bib-cite and RefTeX. Bib-cite.el comes bundled
377;; with AUCTeX. You can also get the latest version from
361;; 378;;
362;; ftp://ftp.phys.ocean.dal.ca/users/rhogee/elisp/bib-cite.el 379;; ftp://ftp.phys.ocean.dal.ca/users/rhogee/elisp/bib-cite.el
363;; 380;;
@@ -366,38 +383,38 @@
366;; PERFORMANCE ISSUES 383;; PERFORMANCE ISSUES
367;; 384;;
368;; 1. RefTeX will load other parts of a multifile document as well as BibTeX 385;; 1. RefTeX will load other parts of a multifile document as well as BibTeX
369;; database files for lookup purposes. These buffers are kept, so that 386;; database files for lookup purposes. These buffers are kept, so that
370;; subsequent lookup in the same files is fast. For large documents and 387;; subsequent lookup in the same files is fast. For large documents and
371;; large BibTeX databases, this can use up a lot of memory. If you have 388;; large BibTeX databases, this can use up a lot of memory. If you have
372;; more time than memory, try the following option, which will remove 389;; more time than memory, try the following option, which will remove
373;; buffers created for lookup after use. 390;; buffers created for lookup after use.
374;; 391;;
375;; (setq reftex-keep-temporary-buffers nil) 392;; (setq reftex-keep-temporary-buffers nil)
376;; 393;;
377;; 2. Parsing the document for labels and their context can be slow. 394;; 2. Parsing the document for labels and their context can be slow.
378;; Therefore, RefTeX does it just once automatically. Further parsing 395;; Therefore, RefTeX does it just once automatically. Further parsing
379;; happens only on user request 396;; happens only on user request
380;; - with a raw C-u prefix arg to any of the functions reftex-label, 397;; - with a raw C-u prefix arg to any of the functions `reftex-label',
381;; reftex-reference, reftex-citation, reftex-toc. 398;; `reftex-reference', `reftex-citation', `reftex-toc'.
382;; - with the `r' key from the label selection menu or the *toc* buffer. 399;; - with the `r' key from the label selection menu or the *toc* buffer.
383;; 400;;
384;; *** If you use reftex-label to create labels, the list will be updated 401;; *** If you use `reftex-label' to create labels, the list will be
385;; *** internally, so that no extra parsing is required. 402;; *** updated internally, so that no extra parsing is required.
386;; 403;;
387;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 404;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
388;; 405;;
389;; KNOWN BUGS 406;; KNOWN BUGS
390;; 407;;
391;; o If you change reftex-label-alist in an editing session, you need to 408;; o If you change `reftex-label-alist' in an editing session, you need to
392;; reset reftex with `M-x reftex-reset-mode' in order to make these 409;; reset reftex with `M-x reftex-reset-mode' in order to make these
393;; changes effective. Changes introduced with the function 410;; changes effective. Changes introduced with the function
394;; reftex-add-to-label-alist as well as changes applied from the 411;; `reftex-add-to-label-alist' as well as changes applied from the
395;; customization buffer automatically trigger a reset. 412;; customization buffer automatically trigger a reset.
396;; 413;;
397;; o At times the short context shown by RefTeX may not be what you want. 414;; o At times the short context shown by RefTeX may not be what you want.
398;; In particular, eqnarray environments can be difficult to 415;; In particular, eqnarray environments can be difficult to
399;; parse. RefTeX's default behavior for eqnarrays is to scan backwards to 416;; parse. RefTeX's default behavior for eqnarrays is to scan backwards to
400;; either a double backslash or the beginning of the environment. If this 417;; either a double backslash or the beginning of the environment. If this
401;; gives unsatisfactory results, make it a habit to place the label 418;; gives unsatisfactory results, make it a habit to place the label
402;; *before* each equation 419;; *before* each equation
403;; 420;;
@@ -424,21 +441,21 @@
424;; 441;;
425;; o When the document is scanned, RefTeX creates a large buffer containing 442;; o When the document is scanned, RefTeX creates a large buffer containing
426;; the entire document instead of scanning the individual files one by 443;; the entire document instead of scanning the individual files one by
427;; one. This is necessary since a file might not contain the context 444;; one. This is necessary since a file might not contain the context
428;; needed by RefTeX. 445;; needed by RefTeX.
429;; 446;;
430;; o If you have two identical section headings in the same file, 447;; o If you have two identical section headings in the same file,
431;; reftex-toc will only let you jump to the first one because it searches 448;; `reftex-toc' will only let you jump to the first one because it searches
432;; for the section heading from the beginning of the file. You can work 449;; for the section heading from the beginning of the file. You can work
433;; around this by changing one of the section titles in a way LaTeX does 450;; around this by changing one of the section titles in a way LaTeX does
434;; not see, e.g. with extra white space. RefTeX will distinguish 451;; not see, e.g. with extra white space. RefTeX will distinguish
435;; \section{Introduction} from \section{ Introduction}. 452;; \section{Introduction} from \section{ Introduction}.
436;; 453;;
437;; o RefTeX sees also labels in regions commented out and will refuse to 454;; o RefTeX sees also labels in regions commented out and will refuse to
438;; make duplicates of such a label. This is considered to be a feature. 455;; make duplicates of such a label. This is considered to be a feature.
439;; 456;;
440;; o When RefTeX tries to show a window full of context from inside a 457;; o When RefTeX tries to show a window full of context from inside a
441;; section hidden with outline-minor-mode, it will unhide that section. 458;; section hidden with `outline-minor-mode', it will unhide that section.
442;; This change will not be reversed automatically. 459;; This change will not be reversed automatically.
443;; 460;;
444;;--------------------------------------------------------------------------- 461;;---------------------------------------------------------------------------
@@ -481,6 +498,8 @@
481;; got me (some years ago) into supporting LaTeX labels and references 498;; got me (some years ago) into supporting LaTeX labels and references
482;; with an Editor (which was MicroEmacs at the time). 499;; with an Editor (which was MicroEmacs at the time).
483;; 500;;
501;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
502;;
484 503
485;;; Code: 504;;; Code:
486 505
@@ -518,11 +537,11 @@
518;; Support for \label and \ref -------------------------------------- 537;; Support for \label and \ref --------------------------------------
519 538
520(defgroup reftex-label-support nil 539(defgroup reftex-label-support nil
521 "Support for creation, insertion and referencing of labels in LaTeX" 540 "Support for creation, insertion and referencing of labels in LaTeX."
522 :group 'reftex) 541 :group 'reftex)
523 542
524(defgroup reftex-defining-label-environments nil 543(defgroup reftex-defining-label-environments nil
525 "Definition of environments and macros to do with label" 544 "Definition of environments and macros to do with label."
526 :group 'reftex-label-support) 545 :group 'reftex-label-support)
527 546
528 547
@@ -531,9 +550,9 @@
531See the definition of `reftex-label-alist-builtin' for examples. This variable 550See the definition of `reftex-label-alist-builtin' for examples. This variable
532should define additions and changes to the default. The only things you MUST 551should define additions and changes to the default. The only things you MUST
533NOT change is that `?s' is the type indicator for section labels and SPACE is 552NOT change is that `?s' is the type indicator for section labels and SPACE is
534for the 'any' label type. These are hard-coded at other places in the code. 553for the `any' label type. These are hard-coded at other places in the code.
535 554
536Changes to this variable after RefTeX has been loaded only become 555Changes to this variable after RefTeX has been loaded become only
537effective when RefTeX is reset with \\[reftex-reset-mode]. 556effective when RefTeX is reset with \\[reftex-reset-mode].
538 557
539Each list entry is a list describing an environment or macro carrying a 558Each list entry is a list describing an environment or macro carrying a
@@ -545,7 +564,7 @@ label. The elements of each list entry are:
545 This may also be nil if this entry is only meant to change some settings 564 This may also be nil if this entry is only meant to change some settings
546 associated with the type indicator character (see below). 565 associated with the type indicator character (see below).
547 566
5481. Type indicator character, like ?t. 5671. Type indicator character, like `?t'.
549 The type indicator is a single character used in prompts for 568 The type indicator is a single character used in prompts for
550 label types. It must be a printable character. The same character 569 label types. It must be a printable character. The same character
551 may occur several times in this list, to cover cases in which different 570 may occur several times in this list, to cover cases in which different
@@ -555,12 +574,11 @@ label. The elements of each list entry are:
555 The prefix is a short string used as the start of a label. It may be the 574 The prefix is a short string used as the start of a label. It may be the
556 empty string. 575 empty string.
557 576
5583. Format string for reference insert in buffer. Each `%s' will be 5773. Format string for reference insert in buffer. Each `%s' will be replaced
559 replaced by the label (you can use more than one several `%s', so 578 by the label (several `%s' can be there to do this:
560 that you can set this to: \"\\ref{%s} on page~\\pageref{%s}\"). 579 \"\\ref{%s} on page~\\pageref{%s}\").
561 When the format starts with `~', whitespace before point will be 580 When the format starts with `~', whitespace before point will be removed
562 removed so that the reference cannot be separated from the word 581 so that the reference cannot be separated from the word before it.
563 before it.
564 582
5654. Indication on how to find the short context. 5834. Indication on how to find the short context.
566 - If nil, use the text following the \\label{...} macro. 584 - If nil, use the text following the \\label{...} macro.
@@ -572,8 +590,8 @@ label. The elements of each list entry are:
572 - If a string, use as regexp to search *backward* from the label. Context 590 - If a string, use as regexp to search *backward* from the label. Context
573 is then the text following the end of the match. E.g. putting this to 591 is then the text following the end of the match. E.g. putting this to
574 \"\\\\\\\\caption{\" will use the beginning of the caption in a figure 592 \"\\\\\\\\caption{\" will use the beginning of the caption in a figure
575 or table environment. \"\\\\\\\\begin{eqnarray}\\\\|\\\\\\\\\\\\\\\\\" 593 or table environment.
576 works for eqnarrays. 594 \"\\\\\\\\begin{eqnarray}\\\\|\\\\\\\\\\\\\\\\\" works for eqnarrays.
577 - If a function, call this function with the name of the environment/macro 595 - If a function, call this function with the name of the environment/macro
578 as argument. On call, point will be just after the \\label macro. The 596 as argument. On call, point will be just after the \\label macro. The
579 function is expected to return a suitable context string. It should 597 function is expected to return a suitable context string. It should
@@ -589,8 +607,8 @@ label. The elements of each list entry are:
589 Setting the variable `reftex-use-text-after-label-as-context' to t 607 Setting the variable `reftex-use-text-after-label-as-context' to t
590 overrides the setting here. 608 overrides the setting here.
591 609
5925. List of magic words which identify a reference to be of this type. If the 6105. List of magic words which identify a reference to be of this type.
593 word before point is equal to one of these words when calling 611 If the word before point is equal to one of these words when calling
594 `reftex-reference', the label list offered will be automatically restricted 612 `reftex-reference', the label list offered will be automatically restricted
595 to labels of the correct type. 613 to labels of the correct type.
596 614
@@ -600,7 +618,7 @@ will use
600 - the magic words of all involved entries. 618 - the magic words of all involved entries.
601 619
602Any list entry may also be a symbol. If that has an association in 620Any list entry may also be a symbol. If that has an association in
603reftex-label-alist-builtin, the cdr of that association is spliced into the 621`reftex-label-alist-builtin', the cdr of that association is spliced into the
604list. See the AMSTeX configuration example in the comment section of 622list. See the AMSTeX configuration example in the comment section of
605`reftex.el'." 623`reftex.el'."
606 :group 'reftex-defining-label-environments 624 :group 'reftex-defining-label-environments
@@ -642,18 +660,17 @@ list. See the AMSTeX configuration example in the comment section of
642 widget)))) 660 widget))))
643 661
644(defcustom reftex-default-label-alist-entries '(Sideways LaTeX) 662(defcustom reftex-default-label-alist-entries '(Sideways LaTeX)
645 "Default label alist specifications. LaTeX should be the last entry. 663 "Default label alist specifications. LaTeX should be the last entry.
646This list describes the default label environments RefTeX should always use in 664This list describes the default label environments RefTeX should always use
647addition to the specifications in reftex-label-alist. It is probably a 665in addition to the specifications in reftex-label-alist. It is probably a
648mistake to remove the LaTeX symbol from this list. 666mistake to remove the LaTeX symbol from this list.
649 667
650The options include: 668The options include:
651LaTeX The standard LaTeX environments 669LaTeX The standard LaTeX environments
652Sideways The sidewaysfigure and sidewaystable environments 670Sideways The sidewaysfigure and sidewaystable environments
653AMSTeX The math environments in the AMS_LaTeX amsmath package 671AMSTeX The math environments in the AMS_LaTeX amsmath package
654AAS The deluxetable environment from the American Astronomical Society
655 672
656For the full list of options, see the constant reftex-label-alist-builtin. 673For the full list of options, see the constant `reftex-label-alist-builtin'.
657Better still, try 674Better still, try
658 675
659M-x customize-variable RET reftex-default-label-alist-entries RET." 676M-x customize-variable RET reftex-default-label-alist-entries RET."
@@ -676,8 +693,8 @@ M-x customize-variable RET reftex-default-label-alist-entries RET."
676(defcustom reftex-use-text-after-label-as-context nil 693(defcustom reftex-use-text-after-label-as-context nil
677 "*t means, grab context from directly after the \\label{..} macro. 694 "*t means, grab context from directly after the \\label{..} macro.
678This is the fastest method for obtaining context of the label definition, but 695This is the fastest method for obtaining context of the label definition, but
679requires discipline when placing labels. Setting this variable to t takes 696requires discipline when placing labels. Setting this variable to t takes
680precedence over the individual settings in reftex-label-alist. 697precedence over the individual settings in `reftex-label-alist'.
681This variable may be set to t, nil, or a string of label type letters 698This variable may be set to t, nil, or a string of label type letters
682indicating the label types for which it should be true." 699indicating the label types for which it should be true."
683 :group 'reftex-defining-label-environments 700 :group 'reftex-defining-label-environments
@@ -689,38 +706,38 @@ indicating the label types for which it should be true."
689;; Label insertion 706;; Label insertion
690 707
691(defgroup reftex-making-and-inserting-labels nil 708(defgroup reftex-making-and-inserting-labels nil
692 "Options on how to create new labels" 709 "Options on how to create new labels."
693 :group 'reftex-label-support) 710 :group 'reftex-label-support)
694 711
695(defcustom reftex-insert-label-flags '("s" "sft") 712(defcustom reftex-insert-label-flags '("s" "sft")
696 "Flags governing label insertion. First flag DERIVE, second flag PROMPT. 713 "Flags governing label insertion. First flag DERIVE, second flag PROMPT.
697 714
698If DERIVE is t, RefTeX will try to derive a sensible label from context. 715If DERIVE is t, RefTeX will try to derive a sensible label from context.
699A section label for example will be derived from the section heading. 716A section label for example will be derived from the section heading.
700The conversion of the context to a legal label is governed by the 717The conversion of the context to a legal label is governed by the
701specifications given in reftex-derive-label-parameters. 718specifications given in `reftex-derive-label-parameters'.
702If RefTeX fails to derive a label, it will prompt the user. 719If RefTeX fails to derive a label, it will prompt the user.
703 720
704If PROMPT is t, the user will be prompted for a label string. The prompt will 721If PROMPT is t, the user will be prompted for a label string. The prompt will
705already contain the prefix, and (if DERIVE is t) a default label derived from 722already contain the prefix, and (if DERIVE is t) a default label derived from
706context. When PROMPT is nil, the default label will be inserted without 723context. When PROMPT is nil, the default label will be inserted without
707query. 724query.
708 725
709So the combination of DERIVE and PROMPT controls label insertion. Here is a 726So the combination of DERIVE and PROMPT controls label insertion. Here is a
710table describing all four possibilities: 727table describing all four possibilities:
711 728
712DERIVE PROMPT ACTION 729DERIVE PROMPT ACTION
713------------------------------------------------------------------------- 730-------------------------------------------------------------------------
714 nil nil Insert simple label, like eq:22 or sec:13. No query. 731 nil nil Insert simple label, like eq:22 or sec:13. No query.
715 nil t Prompt for label 732 nil t Prompt for label.
716 t nil Derive a label from context and insert without query 733 t nil Derive a label from context and insert without query.
717 t t Derive a label from context and prompt for confirmation 734 t t Derive a label from context and prompt for confirmation.
718 735
719Each flag may be set to t, nil, or a string of label type letters 736Each flag may be set to t, nil, or a string of label type letters
720indicating the label types for which it should be true. 737indicating the label types for which it should be true.
721Thus, the combination may be set differently for each label type. The 738Thus, the combination may be set differently for each label type. The
722default settings \"s\" and \"sft\" mean: Derive section labels from headings 739default settings \"s\" and \"sft\" mean: Derive section labels from headings
723(with confirmation). Prompt for figure and table labels. Use simple labels 740(with confirmation). Prompt for figure and table labels. Use simple labels
724without confirmation for everything else." 741without confirmation for everything else."
725 :group 'reftex-making-and-inserting-labels 742 :group 'reftex-making-and-inserting-labels
726 :type '(list (choice :tag "Derive label from context" 743 :type '(list (choice :tag "Derive label from context"
@@ -741,11 +758,11 @@ MAXCHAR Maximum number of characters in a label string.
741ILLEGAL nil: Throw away any words containing characters illegal in labels. 758ILLEGAL nil: Throw away any words containing characters illegal in labels.
742 t: Throw away only the illegal characters, not the whole word. 759 t: Throw away only the illegal characters, not the whole word.
743ABBREV nil: Never abbreviate words. 760ABBREV nil: Never abbreviate words.
744 t: Always abbreviate words (see reftex-abbrev-parameters). 761 t: Always abbreviate words (see `reftex-abbrev-parameters').
745 not t and not nil: Abbreviate words if necessary to shorten 762 not t and not nil: Abbreviate words if necessary to shorten
746 label string below MAXCHAR. 763 label string below MAXCHAR.
747SEPARATOR String separating different words in the label 764SEPARATOR String separating different words in the label.
748IGNOREWORDS List of words which should not be part of labels" 765IGNOREWORDS List of words which should not be part of labels."
749 :group 'reftex-making-and-inserting-labels 766 :group 'reftex-making-and-inserting-labels
750 :type '(list (integer :tag "Number of words " 3) 767 :type '(list (integer :tag "Number of words " 3)
751 (integer :tag "Maximum label length " 20) 768 (integer :tag "Maximum label length " 20)
@@ -769,10 +786,10 @@ For historic reasons, this character class comes *with* the [] brackets."
769 786
770(defcustom reftex-abbrev-parameters '(4 2 "^saeiou" "aeiou") 787(defcustom reftex-abbrev-parameters '(4 2 "^saeiou" "aeiou")
771 "Parameters for abbreviation of words. 788 "Parameters for abbreviation of words.
772MIN-CHARS minimum number of characters remaining after abbreviation 789MIN-CHARS Minimum number of characters remaining after abbreviation.
773MIN-KILL minimum number of characters to remove when abbreviating words 790MIN-KILL Minimum number of characters to remove when abbreviating words.
774BEFORE character class before abbrev point in word 791BEFORE Character class before abbrev point in word.
775AFTER character class after abbrev point in word" 792AFTER Character class after abbrev point in word."
776 :group 'reftex-making-and-inserting-labels 793 :group 'reftex-making-and-inserting-labels
777 :type '(list 794 :type '(list
778 (integer :tag "Minimum chars per word" 4) 795 (integer :tag "Minimum chars per word" 4)
@@ -784,7 +801,7 @@ AFTER character class after abbrev point in word"
784;; Label referencing 801;; Label referencing
785 802
786(defgroup reftex-referencing-labels nil 803(defgroup reftex-referencing-labels nil
787 "Options on how to reference labels" 804 "Options on how to reference labels."
788 :group 'reftex-label-support) 805 :group 'reftex-label-support)
789 806
790(defcustom reftex-label-menu-flags '(t t nil nil nil nil) 807(defcustom reftex-label-menu-flags '(t t nil nil nil nil)
@@ -793,17 +810,17 @@ The flags are:
793 810
794TABLE-OF-CONTENTS Show the labels embedded in a table of context. 811TABLE-OF-CONTENTS Show the labels embedded in a table of context.
795SECTION-NUMBERS Include section numbers (like 4.1.3) in table of contents. 812SECTION-NUMBERS Include section numbers (like 4.1.3) in table of contents.
796COUNTERS Show counters. This just numbers the labels in the menu. 813COUNTERS Show counters. This just numbers the labels in the menu.
797NO-CONTEXT Non-nil means do NOT show the short context. 814NO-CONTEXT Non-nil means do NOT show the short context.
798FOLLOW follow full context in other window. 815FOLLOW Follow full context in other window.
799SHOW-COMMENTED Show labels from regions which are commented out. RefTeX 816SHOW-COMMENTED Show labels from regions which are commented out. RefTeX
800 sees these labels, but does not normally show them. 817 sees these labels, but does not normally show them.
801 818
802Each of these flags can be set to t or nil, or to a string of type letters 819Each of these flags can be set to t or nil, or to a string of type letters
803indicating the label types for which it should be true. These strings work 820indicating the label types for which it should be true. These strings work
804like character classes in regular expressions. Thus, setting one of the 821like character classes in regular expressions. Thus, setting one of the
805flags to \"sf\" makes the flag true for section and figure labels, nil 822flags to \"sf\" makes the flag true for section and figure labels, nil
806for everything else. Setting it to \"^ft\" makes it the other way round. 823for everything else. Setting it to \"^ft\" makes it the other way round.
807 824
808Most options can also be switched from the label menu itself - so if you 825Most options can also be switched from the label menu itself - so if you
809decide here to not have a table of contents in the label menu, you can still 826decide here to not have a table of contents in the label menu, you can still
@@ -830,18 +847,18 @@ get one interactively during selection from the label menu."
830 847
831 848
832(defcustom reftex-guess-label-type t 849(defcustom reftex-guess-label-type t
833 "*Non-nil means, reftex-reference will try to guess the label type. 850 "*Non-nil means, `reftex-reference' will try to guess the label type.
834To do that, RefTeX will look at the word before the cursor and compare it with 851To do that, RefTeX will look at the word before the cursor and compare it with
835the words given in reftex-label-alist. When it finds a match, RefTeX will 852the words given in `reftex-label-alist'. When it finds a match, RefTeX will
836immediately offer the correct label menu - otherwise it will prompt you for 853immediately offer the correct label menu - otherwise it will prompt you for
837a label type. If you set this variable to nil, RefTeX will always prompt." 854a label type. If you set this variable to nil, RefTeX will always prompt."
838 :group 'reftex-referencing-labels 855 :group 'reftex-referencing-labels
839 :type '(boolean)) 856 :type '(boolean))
840 857
841;; BibteX citation configuration ---------------------------------------- 858;; BibteX citation configuration ----------------------------------------
842 859
843(defgroup reftex-citation-support nil 860(defgroup reftex-citation-support nil
844 "Support for referencing bibliographic data with BibTeX" 861 "Support for referencing bibliographic data with BibTeX."
845 :group 'reftex) 862 :group 'reftex)
846 863
847(defcustom reftex-bibpath-environment-variables '("BIBINPUTS" "TEXBIB") 864(defcustom reftex-bibpath-environment-variables '("BIBINPUTS" "TEXBIB")
@@ -853,7 +870,7 @@ a label type. If you set this variable to nil, RefTeX will always prompt."
853(defcustom reftex-bibfile-ignore-list nil 870(defcustom reftex-bibfile-ignore-list nil
854 "List of files in \\bibliography{..} RefTeX should *not* parse. 871 "List of files in \\bibliography{..} RefTeX should *not* parse.
855The file names have to be in the exact same form as in the bibliography 872The file names have to be in the exact same form as in the bibliography
856macro - i.e. without the .bib extension. 873macro - i.e. without the `.bib' extension.
857Intended for files which contain only `@string' macro definitions and the 874Intended for files which contain only `@string' macro definitions and the
858like, which are ignored by RefTeX anyway." 875like, which are ignored by RefTeX anyway."
859 :group 'reftex-citation-support 876 :group 'reftex-citation-support
@@ -876,29 +893,29 @@ nil Do not sort entries.
876(defcustom reftex-cite-format 'reftex-cite-format-default 893(defcustom reftex-cite-format 'reftex-cite-format-default
877 "Defines the format of citations to be inserted into the buffer. 894 "Defines the format of citations to be inserted into the buffer.
878It can be a string, a list of strings, or an alist with characters as keys 895It can be a string, a list of strings, or an alist with characters as keys
879and a list of strings in the car. In the simplest case, this can just 896and a list of strings in the car. In the simplest case, this can just
880be the string \"\\cite{KEY}\", which is also the default. See the 897be the string \"\\cite{KEY}\", which is also the default. See the
881definition of the reftex-cite-format-XXXX constants for more complex 898definition of the `reftex-cite-format-XXXX' constants for more complex
882examples. 899examples.
883 If reftex-cite-format is a string, it will be used as the format. In 900 If `reftex-cite-format' is a string, it will be used as the format.
884the format, AUTHOR will be replaced by the last name of the 901In the format, AUTHOR will be replaced by the last name of the
885author, YEAR will be replaced by the year and KEY by the citation 902author, YEAR will be replaced by the year and KEY by the citation
886key. If AUTHOR is present several times, it will be replaced with 903key. If AUTHOR is present several times, it will be replaced with
887successive author names. 904successive author names.
888See the constant reftex-cite-format-default for an example. 905See the constant `reftex-cite-format-default' for an example.
889 If reftex-cite-format is a list of strings, the string used will 906 If `reftex-cite-format' is a list of strings, the string used will
890depend upon the number of authors of the article. No authors means, 907depend upon the number of authors of the article. No authors means,
891the first string will be used, 1 author means, the second string will 908the first string will be used; 1 author means, the second string will
892be used etc. The last string in the list will be used for all articles 909be used etc.. The last string in the list will be used for all articles
893with too many authors. See reftex-cite-format-1-author-simple for an 910with too many authors. See `reftex-cite-format-1-author-simple' for an
894example. 911example.
895 If reftex-cite-format is a list of cons cells, the car of each cell 912 If `reftex-cite-format' is a list of cons cells, the car of each cell
896needs to be a character. When a selected reference is accepted by 913needs to be a character. When a selected reference is accepted by
897pressing that key, the cdr of the associated list will be used as 914pressing that key, the cdr of the associated list will be used as
898described above. See reftex-cite-format-2-authors for an example. 915described above. See `reftex-cite-format-2-authors' for an example.
899 In order to configure this variable, you can either set 916 In order to configure this variable, you can either set
900reftex-cite-format directly yourself or set it to the SYMBOL of one of 917`reftex-cite-format' directly yourself or set it to the SYMBOL of one of
901the predefined constants. E.g.: 918the predefined constants. E.g.:
902(setq reftex-cite-format 'reftex-cite-format-2-authors)" 919(setq reftex-cite-format 'reftex-cite-format-2-authors)"
903 :group 'reftex-citation-support 920 :group 'reftex-citation-support
904 :type 921 :type
@@ -935,15 +952,46 @@ This flag can be toggled from within the *toc* buffer with the `f' key."
935;; Miscellaneous configurations ----------------------------------------- 952;; Miscellaneous configurations -----------------------------------------
936 953
937(defgroup reftex-miscellaneous-configurations nil 954(defgroup reftex-miscellaneous-configurations nil
938 "Collection of further configurations" 955 "Collection of further configurations."
939 :group 'reftex) 956 :group 'reftex)
940 957
941(defcustom reftex-extra-bindings nil 958(defcustom reftex-extra-bindings nil
942 "Non-nil means, make additional key bindings on startup. 959 "Non-nil means, make additional key bindings on startup.
943These extra bindings are located in the users C-c letter map." 960These extra bindings are located in the users `C-c letter' map."
944 :group 'reftex-miscellaneous-configurations 961 :group 'reftex-miscellaneous-configurations
945 :type '(boolean)) 962 :type '(boolean))
946 963
964(defcustom reftex-plug-into-AUCTeX nil
965 "Plug-in flags for AUCTeX interface.
966This variable is a list of 4 boolean flags. When a flag is non-nil, it
967means:
968
969 Flag 1: use `reftex-label' as `LaTeX-label-function'.
970 Flag 2: use `reftex-arg-label' as `TeX-arg-label'
971 Flag 3: use `reftex-arg-ref' as `TeX-arg-ref'
972 Flag 4: use `reftex-arg-cite' as `TeX-arg-cite'
973
974You may also set the variable itself to t or nil in order to turn all
975plug-ins on or off, respectively.
976\\<LaTeX-mode-map>`LaTeX-label-function' is the function used for label insertion when you
977enter a new environment in AUCTeX with \\[LaTeX-environment].
978The `TeX-arg-label' etc. functions are for entering macro arguments during
979macro insertion with \\[TeX-insert-macro].
980See the AUCTeX documentation for more information.
981RefTeX uses `fset' to take over the function calls. Changing the variable
982may require a restart of Emacs in order to become effective."
983 :group 'reftex-miscellaneous-configurations
984 :type '(choice (const :tag "No plug-ins" nil)
985 (const :tag "All possible plug-ins" t)
986 (list
987 :tag "Individual choice"
988 :value (nil nil nil nil)
989 (boolean :tag "Use reftex-label as LaTeX-label-function")
990 (boolean :tag "Use reftex-arg-label as TeX-arg-label ")
991 (boolean :tag "Use reftex-arg-ref as TeX-arg-ref ")
992 (boolean :tag "Use reftex-arg-cite as TeX-arg-cite ")
993 )))
994
947(defcustom reftex-use-fonts t 995(defcustom reftex-use-fonts t
948 "*Non-nil means, use fonts in label menu and on-the-fly help. 996 "*Non-nil means, use fonts in label menu and on-the-fly help.
949Font-lock must be loaded as well to actually get fontified display." 997Font-lock must be loaded as well to actually get fontified display."
@@ -953,16 +1001,16 @@ Font-lock must be loaded as well to actually get fontified display."
953(defcustom reftex-keep-temporary-buffers t 1001(defcustom reftex-keep-temporary-buffers t
954 "*Non-nil means, keep any TeX and BibTeX files loaded for lookup. 1002 "*Non-nil means, keep any TeX and BibTeX files loaded for lookup.
955Nil means, kill it immediately after use unless it was already an existing 1003Nil means, kill it immediately after use unless it was already an existing
956buffer before the lookup happened. It is faster to keep the buffers, but can 1004buffer before the lookup happened. It is faster to keep the buffers, but can
957use a lot of memory, depending on the size of your database and document." 1005use a lot of memory, depending on the size of your database and document."
958 :group 'reftex-miscellaneous-configurations 1006 :group 'reftex-miscellaneous-configurations
959 :type '(boolean)) 1007 :type '(boolean))
960 1008
961(defcustom reftex-auto-show-entry t 1009(defcustom reftex-auto-show-entry t
962 "*Non-nil means, showing context in another window may unhide a section. 1010 "*Non-nil means, showing context in another window may unhide a section.
963This is important when using outline-minor-mode. If the context to be shown 1011This is important when using outline-minor-mode. If the context to be shown
964is in a hidden section, RefTeX will issue a \"show-entry\" command in order 1012is in a hidden section, RefTeX will issue a \"show-entry\" command in order
965to show it. This is not reversed when the label is selected - so the section 1013to show it. This is not reversed when the label is selected - so the section
966remains shown after command completion." 1014remains shown after command completion."
967 :group 'reftex-miscellaneous-configurations 1015 :group 'reftex-miscellaneous-configurations
968 :type '(boolean)) 1016 :type '(boolean))
@@ -975,6 +1023,9 @@ remains shown after command completion."
975;;; Define the formal stuff for a minor mode named RefTeX. 1023;;; Define the formal stuff for a minor mode named RefTeX.
976;;; 1024;;;
977 1025
1026(defconst reftex-version "2.14 for Emacs distribution."
1027 "Version string for RefTeX.")
1028
978(defvar reftex-mode nil 1029(defvar reftex-mode nil
979 "Determines if RefTeX minor mode is active.") 1030 "Determines if RefTeX minor mode is active.")
980(make-variable-buffer-local 'reftex-mode) 1031(make-variable-buffer-local 'reftex-mode)
@@ -995,21 +1046,23 @@ remains shown after command completion."
995 1046
996Labels can be created with `\\[reftex-label]' and referenced with `\\[reftex-reference]'. 1047Labels can be created with `\\[reftex-label]' and referenced with `\\[reftex-reference]'.
997When referencing, you get a menu with all labels of a given type and 1048When referencing, you get a menu with all labels of a given type and
998context of the label definition. The selected label is inserted as a 1049context of the label definition. The selected label is inserted as a
999\\ref macro. 1050\\ref macro.
1000 1051
1001Citations can be made with `\\[reftex-citation]' which will use a regular expression 1052Citations can be made with `\\[reftex-citation]' which will use a regular expression
1002to pull out a *formatted* list of articles from your BibTeX 1053to pull out a *formatted* list of articles from your BibTeX
1003database. The selected citation is inserted as a \\cite macro. 1054database. The selected citation is inserted as a \\cite macro.
1004 1055
1005A Table of Contents of the entire (multifile) document with browsing 1056A Table of Contents of the entire (multifile) document with browsing
1006capabilities is available with `\\[reftex-toc]'. 1057capabilities is available with `\\[reftex-toc]'.
1007 1058
1008Most command have help available on the fly. This help is accessed by 1059Most command have help available on the fly. This help is accessed by
1009pressing `?' to any prompt mentioning this feature. 1060pressing `?' to any prompt mentioning this feature.
1010 1061
1062Extensive documentation about reftex is in the file header of `reftex.el'.
1063
1011\\{reftex-mode-map} 1064\\{reftex-mode-map}
1012Under X, these functions will be available also in a menu on the menu bar. 1065Under X, these functions will also be available in a menu on the menu bar.
1013 1066
1014------------------------------------------------------------------------------" 1067------------------------------------------------------------------------------"
1015 1068
@@ -1021,6 +1074,7 @@ Under X, these functions will be available also in a menu on the menu bar.
1021 (if reftex-mode 1074 (if reftex-mode
1022 (progn 1075 (progn
1023 (easy-menu-add reftex-mode-menu) 1076 (easy-menu-add reftex-mode-menu)
1077 (reftex-plug-into-AUCTeX)
1024 (run-hooks 'reftex-mode-hook)) 1078 (run-hooks 'reftex-mode-hook))
1025 (easy-menu-remove reftex-mode-menu))) 1079 (easy-menu-remove reftex-mode-menu)))
1026 1080
@@ -1034,6 +1088,22 @@ Under X, these functions will be available also in a menu on the menu bar.
1034 minor-mode-map-alist))) 1088 minor-mode-map-alist)))
1035 1089
1036 1090
1091
1092
1093
1094
1095
1096
1097
1098
1099;;; ===========================================================================
1100;;;
1101;;; Silence warnings about variables in other packages.
1102(defvar TeX-master)
1103(defvar LaTeX-label-function)
1104(defvar tex-main-file)
1105(defvar outline-minor-mode)
1106
1037;;; =========================================================================== 1107;;; ===========================================================================
1038;;; 1108;;;
1039;;; Interfaces for other packages 1109;;; Interfaces for other packages
@@ -1043,7 +1113,7 @@ Under X, these functions will be available also in a menu on the menu bar.
1043;;; ------ 1113;;; ------
1044 1114
1045(defun reftex-arg-label (optional &optional prompt definition) 1115(defun reftex-arg-label (optional &optional prompt definition)
1046 "Use reftex-label to create a label and insert it with TeX-argument-insert. 1116 "Use `reftex-label' to create label. Insert it with `TeX-argument-insert'.
1047This function is intended for AUCTeX macro support." 1117This function is intended for AUCTeX macro support."
1048 (let ((label (reftex-label nil t))) 1118 (let ((label (reftex-label nil t)))
1049 (if (and definition (not (string-equal "" label))) 1119 (if (and definition (not (string-equal "" label)))
@@ -1051,7 +1121,7 @@ This function is intended for AUCTeX macro support."
1051 (TeX-argument-insert label optional optional))) 1121 (TeX-argument-insert label optional optional)))
1052 1122
1053(defun reftex-arg-ref (optional &optional prompt definition) 1123(defun reftex-arg-ref (optional &optional prompt definition)
1054 "Use reftex-reference to select a label, insert it with TeX-argument-insert. 1124 "Use `reftex-reference' to select label. Insert with `TeX-argument-insert'.
1055This function is intended for AUCTeX macro support." 1125This function is intended for AUCTeX macro support."
1056 (let ((label (reftex-reference nil t))) 1126 (let ((label (reftex-reference nil t)))
1057 (if (and definition (not (string-equal "" label))) 1127 (if (and definition (not (string-equal "" label)))
@@ -1059,24 +1129,50 @@ This function is intended for AUCTeX macro support."
1059 (TeX-argument-insert label optional optional))) 1129 (TeX-argument-insert label optional optional)))
1060 1130
1061(defun reftex-arg-cite (optional &optional prompt definition) 1131(defun reftex-arg-cite (optional &optional prompt definition)
1062 "Use reftex-citation to select a key, insert it with TeX-argument-insert. 1132 "Use reftex-citation to select a key. Insert with `TeX-argument-insert'.
1063This function is intended for AUCTeX macro support." 1133This function is intended for AUCTeX macro support."
1064 (let ((key (reftex-citation nil t))) 1134 (let ((key (reftex-citation nil t)))
1065 (TeX-argument-insert (or key "") optional optional))) 1135 (TeX-argument-insert (or key "") optional optional)))
1066 1136
1137(defun reftex-plug-into-AUCTeX ()
1138 ;; Replace AucTeX functions with RefTeX functions.
1139 ;; Which functions are replaced is controlled by the variable
1140 ;; `reftex-plug-into-AUCTeX'.
1141 (let ((flags
1142 (cond ((eq reftex-plug-into-AUCTeX t) '(t t t t))
1143 ((eq reftex-plug-into-AUCTeX nil) '(nil nil nil nil))
1144 (t reftex-plug-into-AUCTeX))))
1145
1146 (and (nth 0 flags)
1147 (boundp 'LaTeX-label-function)
1148 (setq LaTeX-label-function 'reftex-label))
1149
1150 (and (nth 1 flags)
1151 (fboundp 'TeX-arg-label)
1152 (fset 'TeX-arg-label 'reftex-arg-label))
1153
1154 (and (nth 2 flags)
1155 (fboundp 'TeX-arg-ref)
1156 (fset 'TeX-arg-ref 'reftex-arg-ref))
1157
1158 (and (nth 3 flags)
1159 (fboundp 'TeX-arg-cite)
1160 (fset 'TeX-arg-cite 'reftex-arg-cite))))
1161
1162
1067(defvar reftex-label-alist-external-add-ons nil 1163(defvar reftex-label-alist-external-add-ons nil
1068 "List of label alist entries added with reftex-add-to-label-alist.") 1164 "List of label alist entries added with reftex-add-to-label-alist.")
1069 1165
1070;;;###autoload 1166;;;###autoload
1071(defun reftex-add-to-label-alist (entry-list) 1167(defun reftex-add-to-label-alist (entry-list)
1072 "Add label environment descriptions to reftex-label-alist-external-add-ons. 1168 "Add label environment descriptions to `reftex-label-alist-external-add-ons'.
1073The format of ENTRY-LIST is exactly like reftex-label-alist. See there 1169The format of ENTRY-LIST is exactly like `reftex-label-alist'. See there
1074for details. 1170for details.
1075This function makes it possible to support RefTeX from AUCTeX style files. 1171This function makes it possible to support RefTeX from AUCTeX style files.
1076The entries in ENTRY-LIST will be processed after the user settings in 1172The entries in ENTRY-LIST will be processed after the user settings in
1077reftex-label-alist, and before the defaults (specified in 1173`reftex-label-alist', and before the defaults (specified in
1078reftex-default-label-alist-entries). Any changes made to 1174`reftex-default-label-alist-entries'). Any changes made to
1079reftex-label-alist-external-add-ons will raise a flag to the effect that a 1175`reftex-label-alist-external-add-ons' will raise a flag to the effect that a
1080mode reset is done on the next occasion." 1176mode reset is done on the next occasion."
1081 (let (entry) 1177 (let (entry)
1082 (while entry-list 1178 (while entry-list
@@ -1093,9 +1189,9 @@ mode reset is done on the next occasion."
1093;;; 1189;;;
1094;;; Technical notes: Multifile works as follows: We keep just one list 1190;;; Technical notes: Multifile works as follows: We keep just one list
1095;;; of labels for each master file - this can save a lot of memory. 1191;;; of labels for each master file - this can save a lot of memory.
1096;;; reftex-master-index-list is an alist which connects the true file name 1192;;; `reftex-master-index-list' is an alist which connects the true file name
1097;;; of each master file with the symbols holding the information on that 1193;;; of each master file with the symbols holding the information on that
1098;;; document. Each buffer has local variables which point to these symbols. 1194;;; document. Each buffer has local variables which point to these symbols.
1099 1195
1100;; List of variables which handle the multifile stuff. 1196;; List of variables which handle the multifile stuff.
1101;; This list is used to tie, untie, and reset these symbols. 1197;; This list is used to tie, untie, and reset these symbols.
@@ -1103,37 +1199,29 @@ mode reset is done on the next occasion."
1103 '(reftex-label-numbers-symbol reftex-list-of-labels-symbol 1199 '(reftex-label-numbers-symbol reftex-list-of-labels-symbol
1104 reftex-bibfile-list-symbol)) 1200 reftex-bibfile-list-symbol))
1105 1201
1106;; Silence warnings about TeX-master, which is defined in AUCTeX. 1202;; Alist connecting master file names with the corresponding lisp symbols.
1107(defvar TeX-master)
1108
1109;; Silence additional warnings.
1110(defvar tex-main-file)
1111(defvar outline-minor-mode)
1112
1113;; Alist connecting master file names with the corresponding Lisp symbols.
1114(defvar reftex-master-index-list nil) 1203(defvar reftex-master-index-list nil)
1115 1204
1116;; Last index used for a master file 1205;; Last index used for a master file.
1117(defvar reftex-multifile-index 0) 1206(defvar reftex-multifile-index 0)
1118 1207
1119;; Alist connecting a master file with all included files. 1208;; Alist connecting a master file with all included files.
1120;; This information is not yet used, just collected.
1121(defvar reftex-master-include-list nil) 1209(defvar reftex-master-include-list nil)
1122 1210
1123;; Variable holding the symbol with current value of label postfix 1211;; Variable holding the symbol with current value of label postfix.
1124(defvar reftex-label-numbers-symbol nil ) 1212(defvar reftex-label-numbers-symbol nil )
1125(make-variable-buffer-local 'reftex-label-numbers-symbol) 1213(make-variable-buffer-local 'reftex-label-numbers-symbol)
1126 1214
1127;; Variable holding the symbol with the label list of the document. 1215;; Variable holding the symbol with the label list of the document.
1128;; Each element of the label list is again a list with the following elements: 1216;; Each element of the label list is again a list with the following elements:
1129;; 0: One character label type indicator 1217;; 0: One character label type indicator.
1130;; 1: Short context to put into label menu 1218;; 1: Short context to put into label menu.
1131;; 2: The label 1219;; 2: The label.
1132;; 3: The name of the file where the label is defined 1220;; 3: The name of the file where the label is defined.
1133(defvar reftex-list-of-labels-symbol nil) 1221(defvar reftex-list-of-labels-symbol nil)
1134(make-variable-buffer-local 'reftex-list-of-labels-symbol) 1222(make-variable-buffer-local 'reftex-list-of-labels-symbol)
1135 1223
1136;; Variable holding the symbol with a list of library files for this document 1224;; Variable holding the symbol with a list of library files for this document.
1137(defvar reftex-bibfile-list-symbol nil) 1225(defvar reftex-bibfile-list-symbol nil)
1138(make-variable-buffer-local 'reftex-bibfile-list-symbol) 1226(make-variable-buffer-local 'reftex-bibfile-list-symbol)
1139 1227
@@ -1151,27 +1239,27 @@ mode reset is done on the next occasion."
1151 (symbol nil) 1239 (symbol nil)
1152 (symname nil) 1240 (symname nil)
1153 (newflag nil)) 1241 (newflag nil))
1154 ;; find the correct index 1242 ;; Find the correct index.
1155 (if index 1243 (if index
1156 ;; symbols do exist 1244 ;; symbols do exist
1157 (setq index (cdr index)) 1245 (setq index (cdr index))
1158 ;; get a new index and add info to the alist 1246 ;; Get a new index and add info to the alist.
1159 (setq index (reftex-next-multifile-index) 1247 (setq index (reftex-next-multifile-index)
1160 reftex-master-index-list (cons 1248 reftex-master-index-list (cons
1161 (cons master index) 1249 (cons master index)
1162 reftex-master-index-list) 1250 reftex-master-index-list)
1163 newflag t)) 1251 newflag t))
1164 1252
1165 ;; get/create symbols and tie them 1253 ;; Get/create symbols and tie them.
1166 (while symlist 1254 (while symlist
1167 (setq symbol (car symlist) 1255 (setq symbol (car symlist)
1168 symlist (cdr symlist) 1256 symlist (cdr symlist)
1169 symname (symbol-name symbol)) 1257 symname (symbol-name symbol))
1170 (set symbol (intern (concat symname "-" (int-to-string index)))) 1258 (set symbol (intern (concat symname "-" (int-to-string index))))
1171 ;; initialize if new symbols 1259 ;; Initialize if new symbols.
1172 (if newflag (set (symbol-value symbol) nil))) 1260 (if newflag (set (symbol-value symbol) nil)))
1173 1261
1174 ;; Return t if the symbols did already exist, nil when we've made them 1262 ;; Return t if the symbols did already exist, nil when we've made them.
1175 (not newflag))) 1263 (not newflag)))
1176 1264
1177(defun reftex-untie-multifile-symbols () 1265(defun reftex-untie-multifile-symbols ()
@@ -1192,7 +1280,7 @@ mode reset is done on the next occasion."
1192 (let 1280 (let
1193 ((master 1281 ((master
1194 (cond 1282 (cond
1195 ((fboundp 'TeX-master-file) ; AUCTeX is loaded. Use its mechanism. 1283 ((fboundp 'TeX-master-file) ; AUCTeX is loaded. Use its mechanism.
1196 (TeX-master-file t)) 1284 (TeX-master-file t))
1197 ((boundp 'TeX-master) ; The variable is defined - lets use it. 1285 ((boundp 'TeX-master) ; The variable is defined - lets use it.
1198 (cond 1286 (cond
@@ -1206,37 +1294,37 @@ mode reset is done on the next occasion."
1206 (setq TeX-master (read-file-name "Master file: " 1294 (setq TeX-master (read-file-name "Master file: "
1207 nil nil t nil))))) 1295 nil nil t nil)))))
1208 ((boundp 'tex-main-file) 1296 ((boundp 'tex-main-file)
1209 ;; This is the variable from the default TeX modes 1297 ;; This is the variable from the default TeX modes.
1210 (cond 1298 (cond
1211 ((stringp tex-main-file) 1299 ((stringp tex-main-file)
1212 ;; ok, this must be it 1300 ;; ok, this must be it
1213 tex-main-file) 1301 tex-main-file)
1214 (t 1302 (t
1215 ;; In this case, the buffer is its own master 1303 ;; In this case, the buffer is its own master.
1216 (buffer-file-name)))) 1304 (buffer-file-name))))
1217 (t 1305 (t
1218 ;; Know nothing about master file. Assume this is a master file. 1306 ;; Know nothing about master file. Assume this is a master file.
1219 (buffer-file-name))))) 1307 (buffer-file-name)))))
1220 (cond 1308 (cond
1221 ((null master) 1309 ((null master)
1222 (error "Need a filename for this buffer. Please save it first.")) 1310 (error "Need a filename for this buffer. Please save it first."))
1223 ((or (file-exists-p master) 1311 ((or (file-exists-p master)
1224 (reftex-get-buffer-visiting master)) 1312 (reftex-get-buffer-visiting master))
1225 ;; We either see the file, or have a buffer on it. OK. 1313 ;; We either see the file, or have a buffer on it. OK.
1226 ) 1314 )
1227 ((or (file-exists-p (concat master ".tex")) 1315 ((or (file-exists-p (concat master ".tex"))
1228 (reftex-get-buffer-visiting (concat master ".tex"))) 1316 (reftex-get-buffer-visiting (concat master ".tex")))
1229 ;; Ahh, an extra .tex was missing... 1317 ;; Ahh, an extra .tex was missing...
1230 (setq master (concat master ".tex"))) 1318 (setq master (concat master ".tex")))
1231 (t 1319 (t
1232 ;; Something is wrong here. Throw an exception. 1320 ;; Something is wrong here. Throw an exception.
1233 (error "No such master file %s" master))) 1321 (error "No such master file %s" master)))
1234 (expand-file-name master))) 1322 (expand-file-name master)))
1235 1323
1236(defun reftex-make-master-buffer (master-file mode) 1324(defun reftex-make-master-buffer (master-file mode)
1237 "Make a master buffer which contains the MASTER-FILE and all includes. 1325 "Make a master buffer which contains the MASTER-FILE and all includes.
1238This is to prepare a buffer containing the entire document in correct 1326This is to prepare a buffer containing the entire document in correct
1239sequence for parsing. Therefore it will even expand includes which are 1327sequence for parsing. Therefore it will even expand includes which are
1240commented out. 1328commented out.
1241The function returns the number of input/include files not found." 1329The function returns the number of input/include files not found."
1242 1330
@@ -1246,26 +1334,26 @@ The function returns the number of input/include files not found."
1246 (erase-buffer) 1334 (erase-buffer)
1247 (if (not (eq major-mode mode)) 1335 (if (not (eq major-mode mode))
1248 (funcall mode)) 1336 (funcall mode))
1249 ;; first insert the master file 1337 ;; First insert the master file.
1250 (if (not (file-exists-p master-file)) 1338 (if (not (file-exists-p master-file))
1251 (error "No such master file: %s" master-file)) 1339 (error "No such master file: %s" master-file))
1252 (reftex-insert-buffer-or-file master-file) 1340 (reftex-insert-buffer-or-file master-file)
1253 (subst-char-in-region (point-min) (point-max) ?\r ?\n t) 1341 (subst-char-in-region (point-min) (point-max) ?\r ?\n t)
1254 (setq file-list (cons master-file file-list)) 1342 (setq file-list (cons master-file file-list))
1255 (goto-char 1) 1343 (goto-char 1)
1256 ;; remember from which file these lines came 1344 ;; Remember from which file these lines came.
1257 (put-text-property (point-min) (point-max) 'file 1345 (put-text-property (point-min) (point-max) 'file
1258 (expand-file-name master-file)) 1346 (expand-file-name master-file))
1259 ;; Now find recursively all include/input statements and expand them 1347 ;; Make the default directory that of the master file.
1348 ;; All input and include stuff works relative to that directory.
1349 (cd (file-name-directory (expand-file-name master-file)))
1350 ;; Now find recursively all include/input statements and expand them.
1260 (while (re-search-forward 1351 (while (re-search-forward
1261 "^[ \t]*\\\\\\(include\\|input\\){\\([^}\n]+\\)}" nil t) 1352 "^[ \t]*\\\\\\(include\\|input\\){\\([^}\n]+\\)}" nil t)
1262 ;; Change default directory, so that relative fine names work correctly
1263 (setq file (reftex-no-props (match-string 2))) 1353 (setq file (reftex-no-props (match-string 2)))
1264 (save-match-data 1354 (if (not (and (> (length file) 4)
1265 (cd (file-name-directory 1355 (string= (substring file -4) ".tex")))
1266 (get-text-property (match-beginning 0) 'file))) 1356 (setq file (concat file ".tex")))
1267 (if (not (string-match "\\.tex$" file))
1268 (setq file (concat file ".tex"))))
1269 (if (file-exists-p file) 1357 (if (file-exists-p file)
1270 (progn 1358 (progn
1271 (replace-match 1359 (replace-match
@@ -1274,16 +1362,16 @@ The function returns the number of input/include files not found."
1274 (match-string 1) file)) 1362 (match-string 1) file))
1275 (beginning-of-line 0) 1363 (beginning-of-line 0)
1276 (narrow-to-region (point) (point)) 1364 (narrow-to-region (point) (point))
1277 ;; insert the file 1365 ;; Insert the file.
1278 (reftex-insert-buffer-or-file file) 1366 (reftex-insert-buffer-or-file file)
1279 (subst-char-in-region (point-min) (point-max) ?\r ?\n t) 1367 (subst-char-in-region (point-min) (point-max) ?\r ?\n t)
1280 (setq file-list (cons (expand-file-name file) file-list)) 1368 (setq file-list (cons (expand-file-name file) file-list))
1281 ;; remember from which file these lines came 1369 ;; Remember from which file these lines came.
1282 (put-text-property (point-min) (point-max) 1370 (put-text-property (point-min) (point-max)
1283 'file (expand-file-name file)) 1371 'file (expand-file-name file))
1284 (goto-char (point-min)) 1372 (goto-char (point-min))
1285 (widen)) 1373 (widen))
1286 (message "Input/include file %s not found. Ignored. Continuing..." 1374 (message "Input/include file %s not found. Ignored. Continuing..."
1287 file) 1375 file)
1288 (setq not-found (1+ not-found)))) 1376 (setq not-found (1+ not-found))))
1289 (setq file-list (nreverse file-list)) 1377 (setq file-list (nreverse file-list))
@@ -1298,7 +1386,7 @@ The function returns the number of input/include files not found."
1298 (if buffer 1386 (if buffer
1299 (let (beg end beg1 end1) 1387 (let (beg end beg1 end1)
1300 (save-excursion 1388 (save-excursion
1301 ;; make sure we get the whole buffer 1389 ;; Make sure we get the whole buffer.
1302 (set-buffer buffer) 1390 (set-buffer buffer)
1303 (setq beg (point-min) end (point-max)) 1391 (setq beg (point-min) end (point-max))
1304 (widen) 1392 (widen)
@@ -1322,8 +1410,8 @@ The function returns the number of input/include files not found."
1322 (reftex-access-scan-info t)))) 1410 (reftex-access-scan-info t))))
1323 1411
1324(defun reftex-access-scan-info (&optional rescan) 1412(defun reftex-access-scan-info (&optional rescan)
1325 ;; Access the scanning info. When the multifile symbols are not yet tied, 1413 ;; Access the scanning info. When the multifile symbols are not yet tied,
1326 ;; tie them. When they are have to be created, do a buffer scan to 1414 ;; tie them. When they are have to be created, do a buffer scan to
1327 ;; fill them. 1415 ;; fill them.
1328 1416
1329 ;; If RESCAN is non-nil, enforce document scanning 1417 ;; If RESCAN is non-nil, enforce document scanning
@@ -1331,12 +1419,12 @@ The function returns the number of input/include files not found."
1331 (catch 'exit 1419 (catch 'exit
1332 (let ((rescan (or (equal rescan t) (equal rescan '(4))))) 1420 (let ((rescan (or (equal rescan t) (equal rescan '(4)))))
1333 1421
1334 ;; Reset the mode if we had changes from style hooks 1422 ;; Reset the mode if we had changes from style hooks.
1335 (and reftex-tables-dirty 1423 (and reftex-tables-dirty
1336 (reftex-reset-mode)) 1424 (reftex-reset-mode))
1337 1425
1338 (if (eq reftex-list-of-labels-symbol nil) 1426 (if (eq reftex-list-of-labels-symbol nil)
1339 ;; Symbols are not yet tied: Tie them and see if they are set 1427 ;; Symbols are not yet tied: Tie them and see if they are set.
1340 (reftex-tie-multifile-symbols)) 1428 (reftex-tie-multifile-symbols))
1341 1429
1342 (if (and (symbol-value reftex-list-of-labels-symbol) 1430 (if (and (symbol-value reftex-list-of-labels-symbol)
@@ -1352,7 +1440,7 @@ The function returns the number of input/include files not found."
1352 (save-window-excursion 1440 (save-window-excursion
1353 (save-excursion 1441 (save-excursion
1354 1442
1355 ;; do the scanning 1443 ;; Do the scanning.
1356 1444
1357 (let ((label-list-symbol reftex-list-of-labels-symbol) 1445 (let ((label-list-symbol reftex-list-of-labels-symbol)
1358 (label-numbers-symbol reftex-label-numbers-symbol) 1446 (label-numbers-symbol reftex-label-numbers-symbol)
@@ -1376,7 +1464,7 @@ The function returns the number of input/include files not found."
1376 1464
1377(defun reftex-create-tags-file () 1465(defun reftex-create-tags-file ()
1378 "Create TAGS file by running `etags' on the current document. 1466 "Create TAGS file by running `etags' on the current document.
1379The TAGS file is also immediately visited with `visit-tags-table." 1467The TAGS file is also immediately visited with `visit-tags-table'."
1380 (interactive) 1468 (interactive)
1381 (reftex-access-scan-info current-prefix-arg) 1469 (reftex-access-scan-info current-prefix-arg)
1382 (let* ((master (reftex-TeX-master-file)) 1470 (let* ((master (reftex-TeX-master-file))
@@ -1394,7 +1482,7 @@ The TAGS file is also immediately visited with `visit-tags-table."
1394 "Last grep command used in \\[reftex-grep-document]; default for next grep.") 1482 "Last grep command used in \\[reftex-grep-document]; default for next grep.")
1395 1483
1396(defun reftex-grep-document (grep-cmd) 1484(defun reftex-grep-document (grep-cmd)
1397 "Run grep query through all files related to this document. 1485 "Run grep query through all files related to this document.
1398With prefix arg, force to rescan document. 1486With prefix arg, force to rescan document.
1399This works also without an active TAGS table." 1487This works also without an active TAGS table."
1400 1488
@@ -1419,7 +1507,7 @@ This works also without an active TAGS table."
1419 1507
1420(defun reftex-search-document (&optional regexp) 1508(defun reftex-search-document (&optional regexp)
1421 "Regexp search through all files of the current TeX document. 1509 "Regexp search through all files of the current TeX document.
1422Starts always in the master file. Stops when a match is found. 1510Starts always in the master file. Stops when a match is found.
1423To continue searching for next match, use command \\[tags-loop-continue]. 1511To continue searching for next match, use command \\[tags-loop-continue].
1424This works also without an active TAGS table." 1512This works also without an active TAGS table."
1425 (interactive) 1513 (interactive)
@@ -1473,7 +1561,7 @@ This works also without an active TAGS table."
1473 (format "\\\\\\1{%s}" to)))) 1561 (format "\\\\\\1{%s}" to))))
1474 1562
1475(defun reftex-this-word (&optional class) 1563(defun reftex-this-word (&optional class)
1476;; grab the word around point 1564;; Grab the word around point.
1477 (setq class (or class "-a-zA-Z0-9:_/.*;|")) 1565 (setq class (or class "-a-zA-Z0-9:_/.*;|"))
1478 (save-excursion 1566 (save-excursion
1479 (buffer-substring-no-properties 1567 (buffer-substring-no-properties
@@ -1482,41 +1570,41 @@ This works also without an active TAGS table."
1482 1570
1483;;; =========================================================================== 1571;;; ===========================================================================
1484;;; 1572;;;
1485;;; Functions to create and reference automatic labels 1573;;; Functions to create and reference automatic labels.
1486 1574
1487;; The following constants are derived from reftex-label-alist 1575;; The following constants are derived from `reftex-label-alist'.
1488 1576
1489;; Prompt used for label type querys directed to the user 1577;; Prompt used for label type querys directed to the user.
1490(defconst reftex-type-query-prompt nil) 1578(defconst reftex-type-query-prompt nil)
1491 1579
1492;; Help string for label type querys 1580;; Help string for label type querys.
1493(defconst reftex-type-query-help nil) 1581(defconst reftex-type-query-help nil)
1494 1582
1495;; Alist relating label type to reference format 1583;; Alist relating label type to reference format.
1496(defconst reftex-typekey-to-format-alist nil) 1584(defconst reftex-typekey-to-format-alist nil)
1497 1585
1498;; Alist relating label type to label affix 1586;; Alist relating label type to label affix.
1499(defconst reftex-typekey-to-prefix-alist nil) 1587(defconst reftex-typekey-to-prefix-alist nil)
1500 1588
1501;; Alist relating environments or macros to label type and context regexp 1589;; Alist relating environments or macros to label type and context regexp.
1502(defconst reftex-env-or-mac-alist nil) 1590(defconst reftex-env-or-mac-alist nil)
1503 1591
1504;; List of macros carrying a label 1592;; List of macros carrying a label.
1505(defconst reftex-label-mac-list nil) 1593(defconst reftex-label-mac-list nil)
1506 1594
1507;; List of environments carrying a label 1595;; List of environments carrying a label.
1508(defconst reftex-label-env-list nil) 1596(defconst reftex-label-env-list nil)
1509 1597
1510;; List of all typekey letters in use 1598;; List of all typekey letters in use.
1511(defconst reftex-typekey-list nil) 1599(defconst reftex-typekey-list nil)
1512 1600
1513;; Alist relating magic words to a label type 1601;; Alist relating magic words to a label type.
1514(defconst reftex-words-to-typekey-alist nil) 1602(defconst reftex-words-to-typekey-alist nil)
1515 1603
1516;; The last list-of-labels entry used in a reference 1604;; The last list-of-labels entry used in a reference.
1517(defvar reftex-last-used-reference (list nil nil nil nil)) 1605(defvar reftex-last-used-reference (list nil nil nil nil))
1518 1606
1519;; The regular expression used to abbreviate words 1607;; The regular expression used to abbreviate words.
1520(defconst reftex-abbrev-regexp 1608(defconst reftex-abbrev-regexp
1521 (concat 1609 (concat
1522 "^\\(" 1610 "^\\("
@@ -1526,15 +1614,15 @@ This works also without an active TAGS table."
1526 "[" (nth 3 reftex-abbrev-parameters) "]" 1614 "[" (nth 3 reftex-abbrev-parameters) "]"
1527 (make-string (1- (nth 1 reftex-abbrev-parameters)) ?.))) 1615 (make-string (1- (nth 1 reftex-abbrev-parameters)) ?.)))
1528 1616
1529;; Global variables used for communication between functions 1617;; Global variables used for communication between functions.
1530(defvar reftex-default-context-position nil) 1618(defvar reftex-default-context-position nil)
1531(defvar reftex-location-start nil) 1619(defvar reftex-location-start nil)
1532(defvar reftex-call-back-to-this-buffer nil) 1620(defvar reftex-call-back-to-this-buffer nil)
1533 1621
1534;; List of buffers created temporarily for lookup, which should be killed 1622;; List of buffers created temporarily for lookup, which should be killed.
1535(defvar reftex-buffers-to-kill nil) 1623(defvar reftex-buffers-to-kill nil)
1536 1624
1537;; The regexp used to find section statements 1625;; The regexp used to find section statements.
1538(defconst reftex-section-regexp "^[ ]*\\\\\\(part\\|chapter\\|section\\|subsection\\|subsubsection\\|paragraph\\|subparagraph\\|subsubparagraph\\)\\*?\\(\\[[^]]*\\]\\)?{") 1626(defconst reftex-section-regexp "^[ ]*\\\\\\(part\\|chapter\\|section\\|subsection\\|subsubsection\\|paragraph\\|subparagraph\\|subsubparagraph\\)\\*?\\(\\[[^]]*\\]\\)?{")
1539 1627
1540;; LaTeX section commands and level numbers 1628;; LaTeX section commands and level numbers
@@ -1551,7 +1639,7 @@ This works also without an active TAGS table."
1551 )) 1639 ))
1552 1640
1553(defun reftex-label (&optional environment no-insert) 1641(defun reftex-label (&optional environment no-insert)
1554 "Insert a unique label. Return the label. 1642 "Insert a unique label. Return the label.
1555If ENVIRONMENT is given, don't bother to find out yourself. 1643If ENVIRONMENT is given, don't bother to find out yourself.
1556If NO-INSERT is non-nil, do not insert label into buffer. 1644If NO-INSERT is non-nil, do not insert label into buffer.
1557With prefix arg, force to rescan document first. 1645With prefix arg, force to rescan document first.
@@ -1560,30 +1648,30 @@ This function is controlled by the settings of reftex-insert-label-flags."
1560 1648
1561 (interactive) 1649 (interactive)
1562 1650
1563 ;; Ensure access to scanning info and rescan buffer if prefix are is '(4) 1651 ;; Ensure access to scanning info and rescan buffer if prefix are is '(4).
1564 (reftex-access-scan-info current-prefix-arg) 1652 (reftex-access-scan-info current-prefix-arg)
1565 1653
1566 ;; Find out what kind of environment this is and abort if necessary 1654 ;; Find out what kind of environment this is and abort if necessary.
1567 (if (or (not environment) 1655 (if (or (not environment)
1568 (not (assoc environment reftex-env-or-mac-alist))) 1656 (not (assoc environment reftex-env-or-mac-alist)))
1569 (setq environment (reftex-label-location))) 1657 (setq environment (reftex-label-location)))
1570 (if (not environment) 1658 (if (not environment)
1571 (error "Can't figure out what kind of label should be inserted")) 1659 (error "Can't figure out what kind of label should be inserted"))
1572 1660
1573 ;; Ok, go ahead 1661 ;; Ok, go ahead.
1574 (let (label num typekey prefix entry cell lab valid default force-prompt) 1662 (let (label num typekey prefix entry cell lab valid default force-prompt)
1575 (setq typekey (nth 1 (assoc environment 1663 (setq typekey (nth 1 (assoc environment
1576 reftex-env-or-mac-alist))) 1664 reftex-env-or-mac-alist)))
1577 (setq prefix (or (cdr (assoc typekey reftex-typekey-to-prefix-alist)) 1665 (setq prefix (or (cdr (assoc typekey reftex-typekey-to-prefix-alist))
1578 (concat typekey "-"))) 1666 (concat typekey "-")))
1579 1667
1580 ;; make a default label 1668 ;; Make a default label.
1581 (cond 1669 (cond
1582 1670
1583 ((reftex-typekey-check typekey (nth 0 reftex-insert-label-flags)) 1671 ((reftex-typekey-check typekey (nth 0 reftex-insert-label-flags))
1584 ;; derive a label from context 1672 ;; Derive a label from context.
1585 (setq default (nth 2 (reftex-label-info " "))) 1673 (setq default (nth 2 (reftex-label-info " ")))
1586 ;; catch the cases where the is actually no context available 1674 ;; Catch the cases where the is actually no context available.
1587 (if (or (string-match "NO MATCH FOR CONTEXT REGEXP" default) 1675 (if (or (string-match "NO MATCH FOR CONTEXT REGEXP" default)
1588 (string-match "ILLEGAL VALUE OF PARSE" default) 1676 (string-match "ILLEGAL VALUE OF PARSE" default)
1589 (string-match "SECTION HEADING NOT FOUND" default) 1677 (string-match "SECTION HEADING NOT FOUND" default)
@@ -1593,7 +1681,7 @@ This function is controlled by the settings of reftex-insert-label-flags."
1593 force-prompt t) ; need to prompt 1681 force-prompt t) ; need to prompt
1594 (setq default (concat prefix (reftex-string-to-label default))) 1682 (setq default (concat prefix (reftex-string-to-label default)))
1595 1683
1596 ;; make it unique 1684 ;; Make it unique.
1597 (setq label default) 1685 (setq label default)
1598 (setq num 1) 1686 (setq num 1)
1599 (while (assoc label (symbol-value reftex-list-of-labels-symbol)) 1687 (while (assoc label (symbol-value reftex-list-of-labels-symbol))
@@ -1601,11 +1689,11 @@ This function is controlled by the settings of reftex-insert-label-flags."
1601 (setq default label))) 1689 (setq default label)))
1602 1690
1603 ((reftex-typekey-check typekey (nth 1 reftex-insert-label-flags)) ; prompt 1691 ((reftex-typekey-check typekey (nth 1 reftex-insert-label-flags)) ; prompt
1604 ;; Minimal default: the user will be prompted 1692 ;; Minimal default: the user will be prompted.
1605 (setq default prefix)) 1693 (setq default prefix))
1606 1694
1607 (t 1695 (t
1608 ;; make an automatic label 1696 ;; Make an automatic label.
1609 (while (assoc 1697 (while (assoc
1610 (setq default (concat prefix (reftex-next-label-number typekey))) 1698 (setq default (concat prefix (reftex-next-label-number typekey)))
1611 (symbol-value reftex-list-of-labels-symbol))))) 1699 (symbol-value reftex-list-of-labels-symbol)))))
@@ -1664,7 +1752,7 @@ This function is controlled by the settings of reftex-insert-label-flags."
1664 "\\\\\\(include\\|input\\){[^}\n]+}" pos t) 1752 "\\\\\\(include\\|input\\){[^}\n]+}" pos t)
1665 (re-search-forward reftex-section-regexp pos t) 1753 (re-search-forward reftex-section-regexp pos t)
1666 (null look-for)) 1754 (null look-for))
1667 (setq note "POSITION UNCERTAIN. RESCAN TO FIX."))) 1755 (setq note "POSITION UNCERTAIN. RESCAN TO FIX.")))
1668 (if (not look-for) 1756 (if (not look-for)
1669 (set reftex-list-of-labels-symbol 1757 (set reftex-list-of-labels-symbol
1670 (cons (list label typekey text file note) 1758 (cons (list label typekey text file note)
@@ -1765,7 +1853,7 @@ This function is controlled by the settings of reftex-insert-label-flags."
1765 1853
1766 1854
1767(defun reftex-next-label-number (type) 1855(defun reftex-next-label-number (type)
1768 ;; Increment value of automatic labels in current buffer. Return new value. 1856 ;; Increment value of automatic labels in current buffer. Return new value.
1769 1857
1770 ;; Ensure access to scanning info 1858 ;; Ensure access to scanning info
1771 (reftex-access-scan-info) 1859 (reftex-access-scan-info)
@@ -1797,10 +1885,10 @@ This function is controlled by the settings of reftex-insert-label-flags."
1797 RETURN Accept current label") 1885 RETURN Accept current label")
1798 1886
1799(defun reftex-reference (&optional type no-insert) 1887(defun reftex-reference (&optional type no-insert)
1800 "Make a LaTeX reference. Look only for labels of a certain TYPE. 1888 "Make a LaTeX reference. Look only for labels of a certain TYPE.
1801With prefix arg, force to rescan buffer for labels. This should only be 1889With prefix arg, force to rescan buffer for labels. This should only be
1802necessary if you have recently entered labels yourself without using 1890necessary if you have recently entered labels yourself without using
1803reftex-label. Rescanning of the buffer can also be requested from the 1891reftex-label. Rescanning of the buffer can also be requested from the
1804label selection menu. 1892label selection menu.
1805The function returns the selected label or nil. 1893The function returns the selected label or nil.
1806If NO-INSERT is non-nil, do not insert \\ref command, just return label. 1894If NO-INSERT is non-nil, do not insert \\ref command, just return label.
@@ -1847,7 +1935,7 @@ When called with 2 C-u prefix args, disable magic word recognition."
1847 label)) 1935 label))
1848 1936
1849(defun reftex-goto-label (&optional arg) 1937(defun reftex-goto-label (&optional arg)
1850 "Go to a LaTeX label. With prefix ARG: go to label in another window." 1938 "Go to a LaTeX label. With prefix ARG, go to label in another window."
1851 (interactive "P") 1939 (interactive "P")
1852 (let (type label file pair) 1940 (let (type label file pair)
1853 (if (not type) 1941 (if (not type)
@@ -1873,7 +1961,7 @@ When called with 2 C-u prefix args, disable magic word recognition."
1873(defvar reftex-label-index-list nil) 1961(defvar reftex-label-index-list nil)
1874 1962
1875(defun reftex-offer-label-menu (typekey) 1963(defun reftex-offer-label-menu (typekey)
1876 ;; Offer a menu with the appropriate labels. Return (label . file). 1964 ;; Offer a menu with the appropriate labels. Return (label . file).
1877 (let* ((buf (current-buffer)) 1965 (let* ((buf (current-buffer))
1878 (near-label (reftex-find-nearby-label)) 1966 (near-label (reftex-find-nearby-label))
1879 (toc (reftex-typekey-check typekey reftex-label-menu-flags 0)) 1967 (toc (reftex-typekey-check typekey reftex-label-menu-flags 0))
@@ -1913,7 +2001,7 @@ When called with 2 C-u prefix args, disable magic word recognition."
1913 "\n[^.]" 2001 "\n[^.]"
1914 2 2002 2
1915 reftex-reference-label-help 2003 reftex-reference-label-help
1916 '(?r ?c ?t ?s ?# ?a) 2004 '(?r ?g ?c ?t ?s ?# ?a)
1917 offset 2005 offset
1918 'reftex-select-label-callback follow)) 2006 'reftex-select-label-callback follow))
1919 (setq key (car rtn) 2007 (setq key (car rtn)
@@ -1921,7 +2009,8 @@ When called with 2 C-u prefix args, disable magic word recognition."
1921 offset (1+ cnt)) 2009 offset (1+ cnt))
1922 (if (not key) (throw 'exit nil)) 2010 (if (not key) (throw 'exit nil))
1923 (cond 2011 (cond
1924 ((equal key ?r) 2012 ((or (equal key ?r)
2013 (equal key ?g))
1925 ;; rescan buffer 2014 ;; rescan buffer
1926 (reftex-parse-document buf)) 2015 (reftex-parse-document buf))
1927 ((equal key ?c) 2016 ((equal key ?c)
@@ -1995,7 +2084,7 @@ Changing this is only fully operational after the next buffer scan.")
1995 all (cdr all)) 2084 all (cdr all))
1996 2085
1997 (if (null (nth 2 cell)) 2086 (if (null (nth 2 cell))
1998 ;; No context yet. Quick update 2087 ;; No context yet. Quick update
1999 (progn 2088 (progn
2000 (setq cell (reftex-label-info-update cell)) 2089 (setq cell (reftex-label-info-update cell))
2001 (setcar (nthcdr index 2090 (setcar (nthcdr index
@@ -2160,7 +2249,7 @@ Changing this is only fully operational after the next buffer scan.")
2160 (buf (reftex-get-file-buffer-force 2249 (buf (reftex-get-file-buffer-force
2161 file (not reftex-keep-temporary-buffers)))) 2250 file (not reftex-keep-temporary-buffers))))
2162 (if (not buf) 2251 (if (not buf)
2163 (list label typekey "" file "LOST LABEL. RESCAN TO FIX.") 2252 (list label typekey "" file "LOST LABEL. RESCAN TO FIX.")
2164 (save-excursion 2253 (save-excursion
2165 (set-buffer buf) 2254 (set-buffer buf)
2166 (save-restriction 2255 (save-restriction
@@ -2170,7 +2259,7 @@ Changing this is only fully operational after the next buffer scan.")
2170 (if (re-search-forward (concat "\\\\label{" (regexp-quote label) "}") 2259 (if (re-search-forward (concat "\\\\label{" (regexp-quote label) "}")
2171 nil t) 2260 nil t)
2172 (append (reftex-label-info label file) (list note)) 2261 (append (reftex-label-info label file) (list note))
2173 (list label typekey "" file "LOST LABEL. RESCAN TO FIX."))))))) 2262 (list label typekey "" file "LOST LABEL. RESCAN TO FIX.")))))))
2174 2263
2175(defun reftex-label-info (label &optional file bound) 2264(defun reftex-label-info (label &optional file bound)
2176 ;; Return info list on LABEL at point. 2265 ;; Return info list on LABEL at point.
@@ -2223,7 +2312,7 @@ Changing this is only fully operational after the next buffer scan.")
2223 (reftex-context-substring)) 2312 (reftex-context-substring))
2224 "NO MATCH FOR CONTEXT REGEXP"))) 2313 "NO MATCH FOR CONTEXT REGEXP")))
2225 ((fboundp parse) 2314 ((fboundp parse)
2226 ;; A hook function. Call it. 2315 ;; A hook function. Call it.
2227 (save-excursion 2316 (save-excursion
2228 (condition-case error-var 2317 (condition-case error-var
2229 (funcall parse env) 2318 (funcall parse env)
@@ -2301,7 +2390,7 @@ Changing this is only fully operational after the next buffer scan.")
2301 (if buffer 2390 (if buffer
2302 ;; good - the file is available 2391 ;; good - the file is available
2303 (switch-to-buffer-other-window buffer) 2392 (switch-to-buffer-other-window buffer)
2304 ;; we have got a problem here. The file does not exist. 2393 ;; we have got a problem here. The file does not exist.
2305 ;; Let' get out of here.. 2394 ;; Let' get out of here..
2306 (ding) 2395 (ding)
2307 (throw 'exit nil)) 2396 (throw 'exit nil))
@@ -2390,7 +2479,7 @@ Changing this is only fully operational after the next buffer scan.")
2390 (goto-char (point-min)))) 2479 (goto-char (point-min))))
2391 2480
2392(defun reftex-all-assoc-string (key list) 2481(defun reftex-all-assoc-string (key list)
2393 ;; Return a list of all associations of KEY in LIST. Comparison with string= 2482 ;; Return a list of all associations of KEY in LIST. Comparison with string=
2394 (let (rtn) 2483 (let (rtn)
2395 (while list 2484 (while list
2396 (if (string= (car (car list)) key) 2485 (if (string= (car (car list)) key)
@@ -2460,7 +2549,7 @@ Changing this is only fully operational after the next buffer scan.")
2460 "Stores the name of the tex file that `reftex-toc' was last run on.") 2549 "Stores the name of the tex file that `reftex-toc' was last run on.")
2461 2550
2462(defvar reftex-last-toc-file nil 2551(defvar reftex-last-toc-file nil
2463 "Stores the file name from which `reftex-toc' was called. For redo command.") 2552 "Stores the file name from which `reftex-toc' was called. For redo command.")
2464 2553
2465(defvar reftex-toc-return-marker (make-marker) 2554(defvar reftex-toc-return-marker (make-marker)
2466 "Marker which makes it possible to return from toc to old position.") 2555 "Marker which makes it possible to return from toc to old position.")
@@ -2470,11 +2559,13 @@ Changing this is only fully operational after the next buffer scan.")
2470To see the corresponding part of the LaTeX document, use within the 2559To see the corresponding part of the LaTeX document, use within the
2471*toc* buffer: 2560*toc* buffer:
2472 2561
2473SPC Show the corresponding section of the LaTeX document 2562SPC Show the corresponding section of the LaTeX document.
2474RET Goto the section and hide the *toc* buffer 2563RET Goto the section and hide the *toc* buffer.
2475q Hide the *toc* window and return to position of last reftex-toc command 2564q Hide the *toc* window and return to position of last reftex-toc command.
2476Q Kill the *toc* buffer and return to position of last reftex-toc command 2565Q Kill the *toc* buffer and return to position of last reftex-toc command.
2477f Toggle follow mode on and off 2566f Toggle follow mode on and off.
2567r Reparse the LaTeX document.
2568g Revert buffer (like `r').
2478 2569
2479When called with a raw C-u prefix, rescan the document first." 2570When called with a raw C-u prefix, rescan the document first."
2480 2571
@@ -2518,9 +2609,12 @@ When called with a raw C-u prefix, rescan the document first."
2518 (local-set-key " " 'reftex-toc-view-line) 2609 (local-set-key " " 'reftex-toc-view-line)
2519 (local-set-key "\C-m" 'reftex-toc-goto-line-and-hide) 2610 (local-set-key "\C-m" 'reftex-toc-goto-line-and-hide)
2520 (local-set-key "r" 'reftex-toc-redo) 2611 (local-set-key "r" 'reftex-toc-redo)
2612 (local-set-key "g" 'revert-buffer)
2521 (local-set-key "q" 'reftex-toc-quit) 2613 (local-set-key "q" 'reftex-toc-quit)
2522 (local-set-key "Q" 'reftex-toc-quit-and-kill) 2614 (local-set-key "Q" 'reftex-toc-quit-and-kill)
2523 (local-set-key "f" 'reftex-toc-toggle-follow) 2615 (local-set-key "f" 'reftex-toc-toggle-follow)
2616 (make-local-variable 'revert-buffer-function)
2617 (setq revert-buffer-function 'reftex-toc-redo)
2524 (setq truncate-lines t) 2618 (setq truncate-lines t)
2525 (make-local-hook 'post-command-hook) 2619 (make-local-hook 'post-command-hook)
2526 (make-local-hook 'pre-command-hook) 2620 (make-local-hook 'pre-command-hook)
@@ -2529,7 +2623,7 @@ When called with a raw C-u prefix, rescan the document first."
2529 2623
2530 (insert (format 2624 (insert (format
2531"TABLE-OF-CONTENTS on %s 2625"TABLE-OF-CONTENTS on %s
2532MENU: SPC=view RET=goto [q]uit [Q]uit+kill [r]escan [f]ollow-mode on/off 2626MENU: SPC=view RET=goto [q]uit [Q]uit+kill [r]escan [f]ollow-mode
2533------------------------------------------------------------------------------- 2627-------------------------------------------------------------------------------
2534" (abbreviate-file-name reftex-last-toc-master))) 2628" (abbreviate-file-name reftex-last-toc-master)))
2535 (setq startpos (point)) 2629 (setq startpos (point))
@@ -2623,7 +2717,7 @@ MENU: SPC=view RET=goto [q]uit [Q]uit+kill [r]escan [f]ollow-mode on/off
2623 2717
2624(defun reftex-toc-toggle-follow () 2718(defun reftex-toc-toggle-follow ()
2625 "Toggle toc-follow mode. 2719 "Toggle toc-follow mode.
2626(it is not really a mode, just a flag)." 2720(It is not really a mode, just a flag)."
2627 (interactive) 2721 (interactive)
2628 (setq reftex-toc-follow-mode (not reftex-toc-follow-mode))) 2722 (setq reftex-toc-follow-mode (not reftex-toc-follow-mode)))
2629(defun reftex-toc-view-line () 2723(defun reftex-toc-view-line ()
@@ -2631,7 +2725,7 @@ MENU: SPC=view RET=goto [q]uit [Q]uit+kill [r]escan [f]ollow-mode on/off
2631 (interactive) 2725 (interactive)
2632 (reftex-toc-visit-line)) 2726 (reftex-toc-visit-line))
2633(defun reftex-toc-goto-line-and-hide () 2727(defun reftex-toc-goto-line-and-hide ()
2634 "Go to document location in other window. Hide the *toc* window." 2728 "Go to document location in other window. Hide the *toc* window."
2635 (interactive) 2729 (interactive)
2636 (reftex-toc-visit-line 'hide)) 2730 (reftex-toc-visit-line 'hide))
2637(defun reftex-toc-quit () 2731(defun reftex-toc-quit ()
@@ -2647,7 +2741,7 @@ MENU: SPC=view RET=goto [q]uit [Q]uit+kill [r]escan [f]ollow-mode on/off
2647 (delete-window) 2741 (delete-window)
2648 (switch-to-buffer (marker-buffer reftex-toc-return-marker)) 2742 (switch-to-buffer (marker-buffer reftex-toc-return-marker))
2649 (goto-char (marker-position reftex-toc-return-marker))) 2743 (goto-char (marker-position reftex-toc-return-marker)))
2650(defun reftex-toc-redo () 2744(defun reftex-toc-redo (&rest ignore)
2651 "Regenerate the *toc* buffer. Call only from within the *toc* buffer" 2745 "Regenerate the *toc* buffer. Call only from within the *toc* buffer"
2652 (interactive) 2746 (interactive)
2653 (switch-to-buffer (reftex-get-file-buffer-force reftex-last-toc-file)) 2747 (switch-to-buffer (reftex-get-file-buffer-force reftex-last-toc-file))
@@ -2719,25 +2813,25 @@ MENU: SPC=view RET=goto [q]uit [Q]uit+kill [r]escan [f]ollow-mode on/off
2719(defconst reftex-citation-help 2813(defconst reftex-citation-help
2720 "AVAILABLE KEYS IN MAKE CITATION MENU 2814 "AVAILABLE KEYS IN MAKE CITATION MENU
2721--------------------------------------- 2815---------------------------------------
2722 n / p Go to next/previous entry (Cursor motion works as well) 2816 n / p Go to next/previous entry (Cursor motion works as well).
2723 r restrict selection with another regexp 2817 r Restrict selection with another regexp.
2724 SPACE Show full database entry in other window 2818 SPACE Show full database entry in other window.
2725 f Toggle follow mode: Other window will follow with full db entry 2819 f Toggle follow mode: Other window will follow with full db entry.
2726 q Quit without inserting \\cite macro into buffer 2820 q Quit without inserting \\cite macro into buffer.
2727 ? Display this help message 2821 ? Display this help message.
2728 C-r Recursive edit into other window 2822 C-r Recursive edit into other window.
2729 RETURN ... Accept current entry and insert in format according to 2823 RETURN ... Accept current entry and insert in format according to
2730 reftex-cite-format") 2824 `reftex-cite-format'")
2731 2825
2732(defconst reftex-cite-format-default "\\cite{KEY}" 2826(defconst reftex-cite-format-default "\\cite{KEY}"
2733 "The default value for reftex-cite-format. 2827 "The default value for reftex-cite-format.
2734Uses the string version of scitex-cite-format.") 2828Uses the string version of `reftex-cite-format'.")
2735 2829
2736(defconst reftex-cite-format-1-author-simple 2830(defconst reftex-cite-format-1-author-simple
2737 '( "\\cite{KEY}" "AUTHOR \\cite{KEY}" "AUTHOR {\it et al.} \\cite{KEY}") 2831 '( "\\cite{KEY}" "AUTHOR \\cite{KEY}" "AUTHOR {\it et al.} \\cite{KEY}")
2738 "Value for reftex-cite format establishing a simple citation with name 2832 "Value for reftex-cite format establishing a simple citation with name
2739of the first author. 2833of the first author.
2740Uses the list version of reftex-cite-format.") 2834Uses the list version of `reftex-cite-format'.")
2741 2835
2742(defconst reftex-cite-format-2-authors 2836(defconst reftex-cite-format-2-authors
2743 '((?\C-m 2837 '((?\C-m
@@ -2758,11 +2852,11 @@ Uses the list version of reftex-cite-format.")
2758 (?\[ 2852 (?\[
2759 . ("[\\cite{KEY}]" "AUTHOR [\\cite{KEY}]" 2853 . ("[\\cite{KEY}]" "AUTHOR [\\cite{KEY}]"
2760 "AUTHOR \\& AUTHOR [\\cite{KEY}]" "AUTHOR \\etal{} [\\cite{KEY}]"))) 2854 "AUTHOR \\& AUTHOR [\\cite{KEY}]" "AUTHOR \\etal{} [\\cite{KEY}]")))
2761 "Value for reftex-cite-format that estabishes an Author/Year citation 2855 "Value for `reftex-cite-format' that estabishes an Author/Year citation
2762where the year is supplied from BibTeX. Depending on which character 2856where the year is supplied from BibTeX. Depending on which character
2763is used during selection to accept the label, an extra ,;: or pair of 2857is used during selection to accept the label, an extra ,;: or pair of
2764parenthesis will be inserted. 2858parenthesis will be inserted.
2765Uses the list-of-cons-cells version of reftex-cite-format.") 2859Uses the list-of-cons-cells version of `reftex-cite-format'.")
2766 2860
2767;; Find bibtex files 2861;; Find bibtex files
2768 2862
@@ -2807,7 +2901,7 @@ Uses the list-of-cons-cells version of reftex-cite-format.")
2807 nil)))) 2901 nil))))
2808 2902
2809(defun reftex-find-files-on-path (file-list path-list &optional error-string) 2903(defun reftex-find-files-on-path (file-list path-list &optional error-string)
2810 ;; Search for all files in FILE-LIST on the PATH-LIST. Return absolute names. 2904 ;; Search for all files in FILE-LIST on the PATH-LIST. Return absolute names.
2811 ;; A missing file throws an exception with the error message ERROR-STRING. 2905 ;; A missing file throws an exception with the error message ERROR-STRING.
2812 (let (found-list found file) 2906 (let (found-list found file)
2813 (while file-list 2907 (while file-list
@@ -2836,7 +2930,7 @@ Uses the list-of-cons-cells version of reftex-cite-format.")
2836 ;; Find BibTeX KEY in any file in FILE-LIST in another window. 2930 ;; Find BibTeX KEY in any file in FILE-LIST in another window.
2837 ;; If mark-to-kill is non-nil, mark new buffer to kill." 2931 ;; If mark-to-kill is non-nil, mark new buffer to kill."
2838 2932
2839 (let* ((re (concat "@[a-zA-Z]+[ \t\n\r]*{[ \t\n\r]*" (regexp-quote key) "[ \t\n\r,]")) 2933 (let* ((re (concat "@[a-zA-Z]+[ \t\n\r]*[{(][ \t\n\r]*" (regexp-quote key) "[ \t\n\r,]"))
2840 (window-conf (current-window-configuration)) 2934 (window-conf (current-window-configuration))
2841 file buf) 2935 file buf)
2842 (catch 'exit 2936 (catch 'exit
@@ -2905,7 +2999,7 @@ Uses the list-of-cons-cells version of reftex-cite-format.")
2905 (catch 'search-again 2999 (catch 'search-again
2906 (setq key-point (point)) 3000 (setq key-point (point))
2907 (if (not (re-search-backward 3001 (if (not (re-search-backward
2908 "^[ \t]*@\\([a-zA-Z]+\\)[ \t\n\r]*{" nil t)) 3002 "^[ \t]*@\\([a-zA-Z]+\\)[ \t\n\r]*[{(]" nil t))
2909 (throw 'search-again nil)) 3003 (throw 'search-again nil))
2910 (setq start-point (point)) 3004 (setq start-point (point))
2911 (goto-char (match-end 0)) 3005 (goto-char (match-end 0))
@@ -2995,7 +3089,7 @@ Uses the list-of-cons-cells version of reftex-cite-format.")
2995 (save-restriction 3089 (save-restriction
2996 (widen) 3090 (widen)
2997 (if (re-search-forward 3091 (if (re-search-forward
2998 (concat "@\\w+{[ \t\n\r]*" (regexp-quote crkey) "[ \t\n\r]*,") nil t) 3092 (concat "@\\w+[{(][ \t\n\r]*" (regexp-quote crkey) "[ \t\n\r]*,") nil t)
2999 (progn 3093 (progn
3000 (setq start (match-beginning 0)) 3094 (setq start (match-beginning 0))
3001 (condition-case nil 3095 (condition-case nil
@@ -3037,7 +3131,7 @@ Uses the list-of-cons-cells version of reftex-cite-format.")
3037 (goto-char (point-min)) 3131 (goto-char (point-min))
3038 3132
3039 (if (re-search-forward 3133 (if (re-search-forward
3040 "@\\(\\w+\\)[ \t\n\r]*{[ \t\n\r]*\\([^ \t\n\r,]+\\)" nil t) 3134 "@\\(\\w+\\)[ \t\n\r]*[{(][ \t\n\r]*\\([^ \t\n\r,]+\\)" nil t)
3041 (setq alist 3135 (setq alist
3042 (list 3136 (list
3043 (cons "&type" (downcase (reftex-no-props (match-string 1)))) 3137 (cons "&type" (downcase (reftex-no-props (match-string 1))))
@@ -3134,16 +3228,16 @@ Uses the list-of-cons-cells version of reftex-cite-format.")
3134;; Make a citation 3228;; Make a citation
3135 3229
3136(defun reftex-citation (&optional arg no-insert) 3230(defun reftex-citation (&optional arg no-insert)
3137 "Make a citation unsing BibTeX database files. 3231 "Make a citation using BibTeX database files.
3138After asking for a Regular Expression, it scans the buffers with 3232After asking for a Regular Expression, it scans the buffers with
3139bibtex entries (taken from the \\bibliography command) and offers the 3233bibtex entries (taken from the \\bibliography command) and offers the
3140matching entries for selection. The selected entry is formated according 3234matching entries for selection. The selected entry is formated according
3141to reftex-cite-format and inserted into the buffer. 3235to `reftex-cite-format' and inserted into the buffer.
3142If NO-INSERT is non-nil, nothing is inserted, only the selected key returned. 3236If NO-INSERT is non-nil, nothing is inserted, only the selected key returned.
3143The regular expression uses an expanded syntax: && is interpreted as 'and'. 3237The regular expression uses an expanded syntax: && is interpreted as `and'.
3144Thus, aaaa&&bbb matches entries which contain both aaaa and bbb. 3238Thus, `aaaa&&bbb' matches entries which contain both `aaaa' and `bbb'.
3145When this function is called with point inside the braces of a \\cite 3239When this function is called with point inside the braces of a \\cite
3146command, it will add another key, ignoring the value of reftex-cite-format. 3240command, it will add another key, ignoring the value of `reftex-cite-format'.
3147When called with a numeric prefix, that many citations will be made and all 3241When called with a numeric prefix, that many citations will be made and all
3148put into the same \\cite command. 3242put into the same \\cite command.
3149When called with just C-u as prefix, enforces rescan of buffer for 3243When called with just C-u as prefix, enforces rescan of buffer for
@@ -3341,7 +3435,7 @@ bibliography statement (e.g. if it was changed)."
3341;; this is slow and not recommended for follow mode 3435;; this is slow and not recommended for follow mode
3342(defun reftex-bibtex-selection-callback (cnt) 3436(defun reftex-bibtex-selection-callback (cnt)
3343 ;; Callback function to be called from the BibTeX selection, in 3437 ;; Callback function to be called from the BibTeX selection, in
3344 ;; order to display context. This function is relatively slow and not 3438 ;; order to display context. This function is relatively slow and not
3345 ;; recommended for follow mode, just for individual lookups. 3439 ;; recommended for follow mode, just for individual lookups.
3346 (let ((win (selected-window)) 3440 (let ((win (selected-window))
3347 (key (reftex-get-bib-field "&key" (nth cnt reftex-found-list))) 3441 (key (reftex-get-bib-field "&key" (nth cnt reftex-found-list)))
@@ -3360,7 +3454,7 @@ bibliography statement (e.g. if it was changed)."
3360(defvar reftex-recursive-edit-marker (make-marker)) 3454(defvar reftex-recursive-edit-marker (make-marker))
3361 3455
3362(defun reftex-check-recursive-edit () 3456(defun reftex-check-recursive-edit ()
3363 ;; Check if we are already in a recursive edit. Abort with helpful 3457 ;; Check if we are already in a recursive edit. Abort with helpful
3364 ;; message if so. 3458 ;; message if so.
3365 (if (marker-position reftex-recursive-edit-marker) 3459 (if (marker-position reftex-recursive-edit-marker)
3366 (error 3460 (error
@@ -3370,11 +3464,11 @@ bibliography statement (e.g. if it was changed)."
3370(defun reftex-select-item (buffer prompt next-re end-re size help-string 3464(defun reftex-select-item (buffer prompt next-re end-re size help-string
3371 event-list &optional offset 3465 event-list &optional offset
3372 call-back cb-flag) 3466 call-back cb-flag)
3373;; Select an item from the buffer BUFFER. Show PROMPT to user, find 3467;; Select an item from the buffer BUFFER. Show PROMPT to user, find
3374;; next item with NEXT-RE regular expression, return on any of the 3468;; next item with NEXT-RE regular expression, return on any of the
3375;; events listed in EVENT-LIST. The function returns the event along 3469;; events listed in EVENT-LIST. The function returns the event along
3376;; with an integer indicating which item was selected. When OFFSET is 3470;; with an integer indicating which item was selected. When OFFSET is
3377;; specified, starts at that item in the list. When CALL-BACK is 3471;; specified, starts at that item in the list. When CALL-BACK is
3378;; given, it is a function which is called with the match of the 3472;; given, it is a function which is called with the match of the
3379;; NEXT-RE match and the index of the element. 3473;; NEXT-RE match and the index of the element.
3380 (let* (key key-sq b e ev cnt cmd 3474 (let* (key key-sq b e ev cnt cmd
@@ -3493,7 +3587,7 @@ bibliography statement (e.g. if it was changed)."
3493 (other-window 1) 3587 (other-window 1)
3494 (message 3588 (message
3495 (substitute-command-keys 3589 (substitute-command-keys
3496 "Recursive edit. Return to selection with \\[exit-recursive-edit]")) 3590 "Recursive edit. Return to selection with \\[exit-recursive-edit]"))
3497 (recursive-edit))) 3591 (recursive-edit)))
3498 (if (not (equal (marker-buffer 3592 (if (not (equal (marker-buffer
3499 reftex-recursive-edit-marker) 3593 reftex-recursive-edit-marker)
@@ -3595,20 +3689,20 @@ With argument, actually select the window showing the cross reference."
3595 3689
3596(defun reftex-what-macro (which &optional bound) 3690(defun reftex-what-macro (which &optional bound)
3597 ;; Find out if point is within the arguments of any TeX-macro. 3691 ;; Find out if point is within the arguments of any TeX-macro.
3598 ;; The return value is either (\"\\\\macro\" . (point)) or a list of them. 3692 ;; The return value is either ("\\macro" . (point)) or a list of them.
3599 3693
3600 ;; If WHICH is nil, immediately return nil. 3694 ;; If WHICH is nil, immediately return nil.
3601 ;; If WHICH is t, return list of all macros enclosing point. 3695 ;; If WHICH is t, return list of all macros enclosing point.
3602 ;; If WHICH is a list of macros, look only for those macros and return the 3696 ;; If WHICH is a list of macros, look only for those macros and return the
3603 ;; name of the first macro in this list found to enclose point. 3697 ;; name of the first macro in this list found to enclose point.
3604 ;; If the optional BOUND is an integer, bound backwards directed 3698 ;; If the optional BOUND is an integer, bound backwards directed
3605 ;; searches to this point. If it is nil, limit to nearest \\section - 3699 ;; searches to this point. If it is nil, limit to nearest \section -
3606 ;; like statement. 3700 ;; like statement.
3607 3701
3608 ;; This function is pretty stable, but can be fooled if the text contains 3702 ;; This function is pretty stable, but can be fooled if the text contains
3609 ;; things like \\macro{aa}{bb} where \\macro is defined to take only one 3703 ;; things like \macro{aa}{bb} where \macro is defined to take only one
3610 ;; argument. As RefTeX cannot know this, the string \"bb\" would still be 3704 ;; argument. As RefTeX cannot know this, the string "bb" would still be
3611 ;; considered an argument of macro \\macro. 3705 ;; considered an argument of macro \macro.
3612 3706
3613 (catch 'exit 3707 (catch 'exit
3614 (if (null which) (throw 'exit nil)) 3708 (if (null which) (throw 'exit nil))
@@ -3644,7 +3738,7 @@ With argument, actually select the window showing the cross reference."
3644 3738
3645(defun reftex-what-environment (which &optional bound) 3739(defun reftex-what-environment (which &optional bound)
3646 ;; Find out if point is inside a LaTeX environment. 3740 ;; Find out if point is inside a LaTeX environment.
3647 ;; The return value is (e.g.) either (\"equation\" . (point)) or a list of 3741 ;; The return value is (e.g.) either ("equation" . (point)) or a list of
3648 ;; them. 3742 ;; them.
3649 3743
3650 ;; If WHICH is nil, immediately return nil. 3744 ;; If WHICH is nil, immediately return nil.
@@ -3654,7 +3748,7 @@ With argument, actually select the window showing the cross reference."
3654 ;; point. 3748 ;; point.
3655 3749
3656 ;; If the optional BOUND is an integer, bound backwards directed searches to 3750 ;; If the optional BOUND is an integer, bound backwards directed searches to
3657 ;; this point. If it is nil, limit to nearest \\section - like statement. 3751 ;; this point. If it is nil, limit to nearest \section - like statement.
3658 3752
3659 (catch 'exit 3753 (catch 'exit
3660 (save-excursion 3754 (save-excursion
@@ -3679,7 +3773,7 @@ With argument, actually select the window showing the cross reference."
3679 (nreverse env-list))))) 3773 (nreverse env-list)))))
3680 3774
3681(defun reftex-word-before-point () 3775(defun reftex-word-before-point ()
3682 ;; Return the word before point. Word means here: 3776 ;; Return the word before point. Word means here:
3683 ;; Consists of [a-zA-Z0-9.:] and ends at point or whitespace. 3777 ;; Consists of [a-zA-Z0-9.:] and ends at point or whitespace.
3684 (let ((pos (point))) 3778 (let ((pos (point)))
3685 (save-excursion 3779 (save-excursion
@@ -3734,7 +3828,7 @@ With argument, actually select the window showing the cross reference."
3734 (t (error "Please report this problem to dominik@strw.leidenuniv.nl")))) 3828 (t (error "Please report this problem to dominik@strw.leidenuniv.nl"))))
3735 3829
3736(defun reftex-get-file-buffer-force (file &optional mark-to-kill) 3830(defun reftex-get-file-buffer-force (file &optional mark-to-kill)
3737 ;; Return a buffer visiting file. Make one, if necessary. 3831 ;; Return a buffer visiting file. Make one, if necessary.
3738 ;; If neither such a buffer no the file exist, return nil. 3832 ;; If neither such a buffer no the file exist, return nil.
3739 ;; If MARK-TO-KILL in non-nil, put any new buffers into the kill list." 3833 ;; If MARK-TO-KILL in non-nil, put any new buffers into the kill list."
3740 3834
@@ -3767,8 +3861,8 @@ With argument, actually select the window showing the cross reference."
3767 (nreverse rtn))) 3861 (nreverse rtn)))
3768 3862
3769(defun reftex-uniquify (alist &optional keep-list) 3863(defun reftex-uniquify (alist &optional keep-list)
3770 ;; Return a list of all elements in ALIST, but each car only once 3864 ;; Return a list of all elements in ALIST, but each car only once.
3771 ;; Elements of KEEP-LIST are not removed even if duplicate 3865 ;; Elements of KEEP-LIST are not removed even if duplicate.
3772 (let (new elm) 3866 (let (new elm)
3773 (while alist 3867 (while alist
3774 (setq elm (car alist) 3868 (setq elm (car alist)
@@ -3780,12 +3874,12 @@ With argument, actually select the window showing the cross reference."
3780 new)) 3874 new))
3781 3875
3782(defun reftex-use-fonts () 3876(defun reftex-use-fonts ()
3783 ;; Return t if we can and want to use fonts 3877 ;; Return t if we can and want to use fonts.
3784 (and window-system 3878 (and window-system
3785 reftex-use-fonts 3879 reftex-use-fonts
3786 (boundp 'font-lock-keyword-face))) 3880 (boundp 'font-lock-keyword-face)))
3787 3881
3788;; Highlighting uses overlays. If this is for XEmacs, we need to load 3882;; Highlighting uses overlays. If this is for XEmacs, we need to load
3789;; the overlay library, available in version 19.15 3883;; the overlay library, available in version 19.15
3790(and (not (fboundp 'make-overlay)) 3884(and (not (fboundp 'make-overlay))
3791 (condition-case nil 3885 (condition-case nil
@@ -3812,7 +3906,7 @@ With argument, actually select the window showing the cross reference."
3812 (delete-overlay (aref reftex-highlight-overlays index))) 3906 (delete-overlay (aref reftex-highlight-overlays index)))
3813 3907
3814(defun reftex-highlight-shall-die () 3908(defun reftex-highlight-shall-die ()
3815 ;; Function used in pre-command-hook to remove highlights 3909 ;; Function used in pre-command-hook to remove highlights.
3816 (remove-hook 'pre-command-hook 'reftex-highlight-shall-die) 3910 (remove-hook 'pre-command-hook 'reftex-highlight-shall-die)
3817 (reftex-unhighlight 0)) 3911 (reftex-unhighlight 0))
3818 3912
@@ -3892,8 +3986,9 @@ With argument, actually select the window showing the cross reference."
3892 ("sidewaystable" ?t nil nil "\\\\caption\\(\\[[^]]*\\]\\)?{")) 3986 ("sidewaystable" ?t nil nil "\\\\caption\\(\\[[^]]*\\]\\)?{"))
3893 3987
3894 (Subfigure 3988 (Subfigure
3895 "Subfigure environment and macro" 3989 "Subfigure environments and macro"
3896 ("subfigure" ?f nil nil "\\\\caption\\(\\[[^]]*\\]\\)?{") 3990 ("subfigure" ?f nil nil "\\\\caption\\(\\[[^]]*\\]\\)?{")
3991 ("subfigure*" ?f nil nil "\\\\caption\\(\\[[^]]*\\]\\)?{")
3897 ("\\subfigure" ?f nil nil "\\\\subfigure[[{]")) 3992 ("\\subfigure" ?f nil nil "\\\\subfigure[[{]"))
3898 3993
3899 (AMSTeX 3994 (AMSTeX
@@ -3914,10 +4009,10 @@ With argument, actually select the window showing the cross reference."
3914;;; Functions to compile the tables, reset the mode etc. 4009;;; Functions to compile the tables, reset the mode etc.
3915 4010
3916(defun reftex-reset-mode () 4011(defun reftex-reset-mode ()
3917 "Reset RefTeX Mode. Required to implement changes to some list variables. 4012 "Reset RefTeX Mode. Required to implement changes to some list variables.
3918This function will compile the information in reftex-label-alist and similar 4013This function will compile the information in `reftex-label-alist' and similar
3919variables. It is called when RefTeX is first used, and after changes to 4014variables. It is called when RefTeX is first used, and after changes to
3920these variables via reftex-add-to-label-alist." 4015these variables via `reftex-add-to-label-alist'."
3921 (interactive) 4016 (interactive)
3922 4017
3923 ;; Record that we have done this 4018 ;; Record that we have done this
@@ -3932,6 +4027,9 @@ these variables via reftex-add-to-label-alist."
3932 (kill-buffer (car buffer-list))) 4027 (kill-buffer (car buffer-list)))
3933 (setq buffer-list (cdr buffer-list)))) 4028 (setq buffer-list (cdr buffer-list))))
3934 4029
4030 ;; Plug functions into AUCTeX if the user option says so
4031 (reftex-plug-into-AUCTeX)
4032
3935 ;; To update buffer-local variables 4033 ;; To update buffer-local variables
3936 (hack-local-variables) 4034 (hack-local-variables)
3937 (message "updating internal tables...") 4035 (message "updating internal tables...")
@@ -4113,10 +4211,11 @@ This enforces rescanning the buffer on next use."
4113; Make sure tabels are compiled 4211; Make sure tabels are compiled
4114(message "updating internal tables...") 4212(message "updating internal tables...")
4115(reftex-compute-ref-cite-tables) 4213(reftex-compute-ref-cite-tables)
4214(message "updating internal tables...done")
4116(setq reftex-tables-dirty nil) 4215(setq reftex-tables-dirty nil)
4117 4216
4118(provide 'reftex) 4217(provide 'reftex)
4119 4218
4120;;;============================================================================ 4219;;;============================================================================
4121 4220
4122;;; reftex.el end here 4221;;; reftex.el ends here