annotate lisp/textmodes/reftex.el @ 91073:4bc33ffdda1a

Merge from emacs--devo--0 Patches applied: * emacs--devo--0 (patch 902-908) - Update from CVS - Merge from emacs--rel--22 * emacs--rel--22 (patch 131-137) - Update from CVS - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 261-262) - Update from CVS Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-278
author Miles Bader <miles@gnu.org>
date Sat, 27 Oct 2007 09:12:07 +0000
parents d38543a1c0f9 0dcd1f3c9909
children 880960b70474
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38422
7a94f1c588c4 Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 37998
diff changeset
1 ;;; reftex.el --- minor mode for doing \label, \ref, \cite, \index in LaTeX
68648
067115a6e738 Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 66926
diff changeset
2 ;; Copyright (C) 1997, 1998, 1999, 2000, 2003, 2004, 2005,
75347
e3694f1cb928 Add 2007 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 69101
diff changeset
3 ;; 2006, 2007 Free Software Foundation, Inc.
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4
46612
7522419c4db0 Updated to reftex 4.17
Carsten Dominik <dominik@science.uva.nl>
parents: 38422
diff changeset
5 ;; Author: Carsten Dominik <dominik@science.uva.nl>
76672
690423f53b08 * textmodes/reftex.el: Add maintainer address.
David Kastrup <dak@gnu.org>
parents: 75347
diff changeset
6 ;; Maintainer: auctex-devel@gnu.org
69093
0ab6ebe82ad7 (reftex-locate-file): Search all extensions if
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7 ;; Version: 4.31
38422
7a94f1c588c4 Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 37998
diff changeset
8 ;; Keywords: tex
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9
27034
a171ee1ca955 Fix in license info.
Richard M. Stallman <rms@gnu.org>
parents: 26910
diff changeset
10 ;; This file is part of GNU Emacs.
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12 ;; GNU Emacs is free software; you can redistribute it and/or modify
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13 ;; it under the terms of the GNU General Public License as published by
78225
b6d25790aab2 Switch license to GPLv3 or later.
Glenn Morris <rgm@gnu.org>
parents: 78189
diff changeset
14 ;; the Free Software Foundation; either version 3, or (at your option)
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15 ;; any later version.
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
17 ;; GNU Emacs is distributed in the hope that it will be useful,
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
20 ;; GNU General Public License for more details.
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
21
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
22 ;; You should have received a copy of the GNU General Public License
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the
65638
e274642bf5d5 Update FSF street address; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 65548
diff changeset
24 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
e274642bf5d5 Update FSF street address; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 65548
diff changeset
25 ;; Boston, MA 02110-1301, USA.
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
26
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
27 ;;---------------------------------------------------------------------------
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
28 ;;
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
29 ;;; Commentary:
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
30 ;;
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
31 ;; RefTeX is a minor mode with distinct support for \ref, \label, \cite,
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
32 ;; and \index commands in (multi-file) LaTeX documents.
23707
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
33 ;; - A table of contents provides easy access to any part of a document.
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
34 ;; - Labels are created semi-automatically.
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
35 ;; - Definition context of labels is provided when creating a reference.
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
36 ;; - Citations are simplified with efficient database lookup.
26910
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
37 ;; - Text phrases can be collected in a file, for later global indexing.
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
38 ;; - The index preview buffer helps to check and edit index entries.
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
39 ;;
20829
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
40 ;;
23200
4750ba95a176 (reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents: 22991
diff changeset
41 ;; INSTALLATION
4750ba95a176 (reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents: 22991
diff changeset
42 ;; ------------
4750ba95a176 (reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents: 22991
diff changeset
43 ;;
23707
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
44 ;; - If this file is part of an X/Emacs distribution, it is installed.
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
45 ;; - For XEmacs 21.x, you need to install the RefTeX plug-in package
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
46 ;; available from the XEmacs distribution sites.
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
47 ;; - If you have downloaded this file from the maintainers webpage, follow
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
48 ;; the instructions in the INSTALL file of the distrubution.
23200
4750ba95a176 (reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents: 22991
diff changeset
49 ;;
23707
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
50 ;; To turn RefTeX Mode on and off in a buffer, use `M-x reftex-mode'.
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
51 ;;
23707
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
52 ;; To turn on RefTeX Mode for all LaTeX files, add the following lines
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
53 ;; to your .emacs file:
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
54 ;;
23707
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
55 ;; (add-hook 'LaTeX-mode-hook 'turn-on-reftex) ; AUCTeX LaTeX mode
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
56 ;; (add-hook 'latex-mode-hook 'turn-on-reftex) ; Emacs latex mode
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
57 ;;
20829
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
58 ;;
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
59 ;; DOCUMENTATION
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
60 ;; -------------
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
61 ;;
23200
4750ba95a176 (reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents: 22991
diff changeset
62 ;; See below for a short summary of how to use RefTeX.
4750ba95a176 (reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents: 22991
diff changeset
63 ;;
20829
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
64 ;; There is an extensive texinfo document describing RefTeX in detail.
23707
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
65 ;; One way to view this documentation is `M-x reftex-info RET'.
20829
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
66 ;;
23200
4750ba95a176 (reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents: 22991
diff changeset
67 ;; The documentation in various formats is also available at
20829
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
68 ;;
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
69 ;; http://zon.astro.uva.nl/~dominik/Tools/
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
70 ;;
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
71 ;;---------------------------------------------------------------------------
23707
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
72 ;;
26910
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
73 ;; Introduction
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
74 ;; ************
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
75 ;;
26910
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
76 ;; RefTeX is a specialized package for support of labels, references,
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
77 ;; citations, and the index in LaTeX. RefTeX wraps itself round 4 LaTeX
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
78 ;; macros: `\label', `\ref', `\cite', and `\index'. Using these macros
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
79 ;; usually requires looking up different parts of the document and
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
80 ;; searching through BibTeX database files. RefTeX automates these
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
81 ;; time-consuming tasks almost entirely. It also provides functions to
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
82 ;; display the structure of a document and to move around in this
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
83 ;; structure quickly.
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
84 ;;
26910
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
85 ;; *Note Imprint::, for information about who to contact for help, bug
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
86 ;; reports or suggestions.
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
87 ;;
26910
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
88 ;; Environment
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
89 ;; ===========
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
90 ;;
26910
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
91 ;; RefTeX needs to access all files which are part of a multifile
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
92 ;; document, and the BibTeX database files requested by the
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
93 ;; `\bibliography' command. To find these files, RefTeX will require a
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
94 ;; search path, i.e. a list of directories to check. Normally this list
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
95 ;; is stored in the environment variables `TEXINPUTS' and `BIBINPUTS'
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
96 ;; which are also used by RefTeX. However, on some systems these
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
97 ;; variables do not contain the full search path. If RefTeX does not work
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
98 ;; for you because it cannot find some files, read *Note Finding Files::.
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
99 ;;
26910
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
100 ;; Entering RefTeX Mode
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
101 ;; ====================
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
102 ;;
26910
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
103 ;; To turn RefTeX Mode on and off in a particular buffer, use `M-x
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
104 ;; reftex-mode'. To turn on RefTeX Mode for all LaTeX files, add the
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
105 ;; following lines to your `.emacs' file:
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
106 ;;
26910
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
107 ;; (add-hook 'LaTeX-mode-hook 'turn-on-reftex) ; with AUCTeX LaTeX mode
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
108 ;; (add-hook 'latex-mode-hook 'turn-on-reftex) ; with Emacs latex mode
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
109 ;;
20829
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
110 ;; RefTeX in a Nutshell
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
111 ;; ====================
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
112 ;;
23707
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
113 ;; 1. Table of Contents
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
114 ;; Typing `C-c =' (`reftex-toc') will show a table of contents of the
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
115 ;; document. This buffer can display sections, labels and index
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
116 ;; entries defined in the document. From the buffer, you can jump
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
117 ;; quickly to every part of your document. Press `?' to get help.
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
118 ;;
23707
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
119 ;; 2. Labels and References
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
120 ;; RefTeX helps to create unique labels and to find the correct key
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
121 ;; for references quickly. It distinguishes labels for different
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
122 ;; environments, knows about all standard environments (and many
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
123 ;; others), and can be configured to recognize any additional labeled
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
124 ;; environments you have defined yourself (variable
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
125 ;; `reftex-label-alist').
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
126 ;;
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
127 ;; * Creating Labels
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
128 ;; Type `C-c (' (`reftex-label') to insert a label at point.
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
129 ;; RefTeX will either
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
130 ;; - derive a label from context (default for section labels)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
131 ;; - prompt for a label string (default for figures and
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
132 ;; tables) or
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
133 ;; - insert a simple label made of a prefix and a number (all
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
134 ;; other environments)
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
135 ;;
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
136 ;; Which labels are created how is configurable with the variable
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
137 ;; `reftex-insert-label-flags'.
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
138 ;;
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
139 ;; * Referencing Labels
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
140 ;; To make a reference, type `C-c )' (`reftex-reference'). This
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
141 ;; shows an outline of the document with all labels of a certain
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
142 ;; type (figure, equation,...) and some label context.
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
143 ;; Selecting a label inserts a `\ref{LABEL}' macro into the
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
144 ;; original buffer.
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
145 ;;
23707
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
146 ;; 3. Citations
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
147 ;; Typing `C-c [' (`reftex-citation') will let you specify a regular
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
148 ;; expression to search in current BibTeX database files (as
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
149 ;; specified in the `\bibliography' command) and pull out a list of
26910
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
150 ;; matches for you to choose from. The list is _formatted_ and
23707
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
151 ;; sorted. The selected article is referenced as `\cite{KEY}' (see
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
152 ;; the variable `reftex-cite-format' if you want to insert different
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
153 ;; macros).
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
154 ;;
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
155 ;; 4. Index Support
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
156 ;; RefTeX helps to enter index entries. It also compiles all entries
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
157 ;; into an alphabetically sorted `*Index*' buffer which you can use
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
158 ;; to check and edit the entries. RefTeX knows about the standard
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
159 ;; index macros and can be configured to recognize any additional
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
160 ;; macros you have defined (`reftex-index-macros'). Multiple indices
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
161 ;; are supported.
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
162 ;;
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
163 ;; * Creating Index Entries
26910
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
164 ;; To index the current selection or the word at point, type
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
165 ;; `C-c /' (`reftex-index-selection-or-word'). The default macro
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
166 ;; `reftex-index-default-macro' will be used. For a more
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
167 ;; complex entry type `C-c <' (`reftex-index'), select any of
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
168 ;; the index macros and enter the arguments with completion.
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
169 ;;
26910
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
170 ;; * The Index Phrases File (Delayed Indexing)
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
171 ;; Type `C-c \' (`reftex-index-phrase-selection-or-word') to add
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
172 ;; the current word or selection to a special _index phrase
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
173 ;; file_. RefTeX can later search the document for occurrences
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
174 ;; of these phrases and let you interactively index the matches.
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
175 ;;
26910
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
176 ;; * Displaying and Editing the Index
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
177 ;; To display the compiled index in a special buffer, type `C-c
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
178 ;; >' (`reftex-display-index'). From that buffer you can check
26910
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
179 ;; and edit all entries.
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
180 ;;
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
181 ;; 5. Viewing Cross-References
23995
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
182 ;; When point is on the KEY argument of a cross-referencing macro
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
183 ;; (`\label', `\ref', `\cite', `\bibitem', `\index', and variations)
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
184 ;; or inside a BibTeX database entry, you can press `C-c &'
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
185 ;; (`reftex-view-crossref') to display corresponding locations in the
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
186 ;; document and associated BibTeX database files.
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
187 ;; When the enclosing macro is `\cite' or `\ref' and no other message
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
188 ;; occupies the echo area, information about the citation or label
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
189 ;; will automatically be displayed in the echo area.
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
190 ;;
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
191 ;; 6. Multifile Documents
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
192 ;; Multifile Documents are fully supported. The included files must
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
193 ;; have a file variable `TeX-master' or `tex-main-file' pointing to
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
194 ;; the master file. RefTeX provides cross-referencing information
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
195 ;; from all parts of the document, and across document borders
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
196 ;; (`xr.sty').
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
197 ;;
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
198 ;; 7. Document Parsing
23707
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
199 ;; RefTeX needs to parse the document in order to find labels and
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
200 ;; other information. It does it automatically once and updates its
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
201 ;; list internally when `reftex-label' and `reftex-index' are used.
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
202 ;; To enforce reparsing, call any of the commands described above
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
203 ;; with a raw `C-u' prefix, or press the `r' key in the label
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
204 ;; selection buffer, the table of contents buffer, or the index
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
205 ;; buffer.
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
206 ;;
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
207 ;; 8. AUCTeX
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
208 ;; If your major LaTeX mode is AUCTeX, RefTeX can cooperate with it
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
209 ;; (see variable `reftex-plug-into-AUCTeX'). AUCTeX contains style
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
210 ;; files which trigger appropriate settings in RefTeX, so that for
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
211 ;; many of the popular LaTeX packages no additional customizations
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
212 ;; will be necessary.
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
213 ;;
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
214 ;; 9. Useful Settings
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
215 ;; To make RefTeX faster for large documents, try these:
23707
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
216 ;; (setq reftex-enable-partial-scans t)
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
217 ;; (setq reftex-save-parse-info t)
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
218 ;; (setq reftex-use-multiple-selection-buffers t)
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
219 ;;
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
220 ;; To integrate with AUCTeX, use
23707
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
221 ;; (setq reftex-plug-into-AUCTeX t)
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
222 ;;
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
223 ;; To make your own LaTeX macro definitions known to RefTeX,
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
224 ;; customize the variables
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
225 ;; `reftex-label-alist' (for label macros/environments)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
226 ;; `reftex-section-levels' (for sectioning commands)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
227 ;; `reftex-cite-format' (for `\cite'-like macros)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
228 ;; `reftex-index-macros' (for `\index'-like macros)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
229 ;; `reftex-index-default-macro' (to set the default macro)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
230 ;; If you have a large number of macros defined, you may want to write
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
231 ;; an AUCTeX style file to support them with both AUCTeX and RefTeX.
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
232 ;;
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
233 ;; 10. Where Next?
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
234 ;; Go ahead and use RefTeX. Use its menus until you have picked up
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
235 ;; the key bindings. For an overview of what you can do in each of
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
236 ;; the different special buffers, press `?'. Read the manual if you
26910
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
237 ;; get stuck, of if you are curious what else might be available.
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
238 ;; The first part of the manual explains in a tutorial way how to use
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
239 ;; and customize RefTeX. The second part is a command and variable
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
240 ;; reference.
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
241 ;;
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
242 ;;---------------------------------------------------------------------------
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
243 ;;
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
244 ;; AUTHOR
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
245 ;; ======
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
246 ;;
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
247 ;; Carsten Dominik <dominik@science.uva.nl>
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
248 ;;
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
249 ;; with contributions from Stephen Eglen
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
250 ;;
23707
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
251 ;; RefTeX is bundled with Emacs and available as a plug-in package for
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
252 ;; XEmacs 21.x. If you need to install it yourself, you can find a
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
253 ;; distribution at
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
254 ;;
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
255 ;; http://zon.astro.uva.nl/~dominik/Tools/
20829
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
256 ;;
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
257 ;; THANKS TO:
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
258 ;; ---------
20829
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
259 ;; Thanks to the people on the Net who have used RefTeX and helped
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
260 ;; developing it with their reports. In particular thanks to
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
261 ;;
23707
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
262 ;; Fran Burstall, Alastair Burt, Soren Dayton, Stephen Eglen,
23344
608bc56ca20e (reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents: 23200
diff changeset
263 ;; Karl Eichwalder, Peter Galbraith, Dieter Kraft, Kai Grossjohann,
26910
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
264 ;; Frank Harrell, Adrian Lanz, Rory Molinari, Stefan Monnier,
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
265 ;; Laurent Mugnier, Sudeep Kumar Palat, Daniel Polani, Robin Socha,
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
266 ;; Richard Stanton, Allan Strand, Jan Vroonhof, Christoph Wedler,
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
267 ;; Alan Williams.
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
268 ;;
20829
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
269 ;; Finally thanks to Uwe Bolick who first got me (some years ago) into
23707
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
270 ;; supporting LaTeX labels and references with an editor (which was
20829
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
271 ;; MicroEmacs at the time).
18219
aaeaae005e98 Updated documentation at several points in the file.
Richard M. Stallman <rms@gnu.org>
parents: 18123
diff changeset
272 ;;
23200
4750ba95a176 (reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents: 22991
diff changeset
273 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
18321
0ed97be54a28 Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents: 18220
diff changeset
274 ;;
23200
4750ba95a176 (reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents: 22991
diff changeset
275 ;;;;;;
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
276
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
277 ;;; Code:
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
278
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
279 (eval-when-compile (require 'cl))
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
280
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
281 ;; Stuff that needs to be there when we use defcustom
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
282 (require 'custom)
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
283
85500
0dcd1f3c9909 * textmodes/reftex.el: Move require easymenu before first use.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85194
diff changeset
284 (require 'easymenu)
0dcd1f3c9909 * textmodes/reftex.el: Move require easymenu before first use.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85194
diff changeset
285
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
286 (defvar reftex-tables-dirty t
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
287 "Flag showing if tables need to be re-computed.")
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
288
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
289 (eval-and-compile
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
290 (defun reftex-set-dirty (symbol value)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
291 (setq reftex-tables-dirty t)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
292 (set symbol value)))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
293
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
294
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
295 ;;; =========================================================================
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
296 ;;;
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
297 ;;; Configuration variables
23707
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
298
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
299 (require 'reftex-vars)
21114
3e8ab19bdccb 1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents: 21075
diff changeset
300
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
301
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
302 ;;; =========================================================================
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
303 ;;;
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
304 ;;; Define the formal stuff for a minor mode named RefTeX.
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
305 ;;;
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
306
69093
0ab6ebe82ad7 (reftex-locate-file): Search all extensions if
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
307 (defconst reftex-version "RefTeX version 4.31"
23200
4750ba95a176 (reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents: 22991
diff changeset
308 "Version string for RefTeX.")
20177
6ebc3e300106 The menu now used toggle and radio for some items.
Karl Heuer <kwzh@gnu.org>
parents: 20102
diff changeset
309
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
310 (defvar reftex-mode nil
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
311 "Determines if RefTeX mode is active.")
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
312 (make-variable-buffer-local 'reftex-mode)
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
313
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
314 (defvar reftex-mode-map (make-sparse-keymap)
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
315 "Keymap for RefTeX mode.")
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
316
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
317 (defvar reftex-mode-menu nil)
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
318 (defvar reftex-syntax-table nil)
46612
7522419c4db0 Updated to reftex 4.17
Carsten Dominik <dominik@science.uva.nl>
parents: 38422
diff changeset
319 (defvar reftex-syntax-table-for-bib nil)
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
320
46904
7af0f250bfd0 (reftex-mode): Moved creation of special syntax tables to top-level.
Carsten Dominik <dominik@science.uva.nl>
parents: 46683
diff changeset
321 (unless reftex-syntax-table
46928
cbd08432d202 * reftex.el (reftex-mode): Create special syntax tables.
Carsten Dominik <dominik@science.uva.nl>
parents: 46904
diff changeset
322 (setq reftex-syntax-table (copy-syntax-table))
46904
7af0f250bfd0 (reftex-mode): Moved creation of special syntax tables to top-level.
Carsten Dominik <dominik@science.uva.nl>
parents: 46683
diff changeset
323 (modify-syntax-entry ?\( "." reftex-syntax-table)
7af0f250bfd0 (reftex-mode): Moved creation of special syntax tables to top-level.
Carsten Dominik <dominik@science.uva.nl>
parents: 46683
diff changeset
324 (modify-syntax-entry ?\) "." reftex-syntax-table))
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
325
46904
7af0f250bfd0 (reftex-mode): Moved creation of special syntax tables to top-level.
Carsten Dominik <dominik@science.uva.nl>
parents: 46683
diff changeset
326 (unless reftex-syntax-table-for-bib
46928
cbd08432d202 * reftex.el (reftex-mode): Create special syntax tables.
Carsten Dominik <dominik@science.uva.nl>
parents: 46904
diff changeset
327 (setq reftex-syntax-table-for-bib
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
328 (copy-syntax-table reftex-syntax-table))
46904
7af0f250bfd0 (reftex-mode): Moved creation of special syntax tables to top-level.
Carsten Dominik <dominik@science.uva.nl>
parents: 46683
diff changeset
329 (modify-syntax-entry ?\' "." reftex-syntax-table-for-bib)
7af0f250bfd0 (reftex-mode): Moved creation of special syntax tables to top-level.
Carsten Dominik <dominik@science.uva.nl>
parents: 46683
diff changeset
330 (modify-syntax-entry ?\" "." reftex-syntax-table-for-bib)
7af0f250bfd0 (reftex-mode): Moved creation of special syntax tables to top-level.
Carsten Dominik <dominik@science.uva.nl>
parents: 46683
diff changeset
331 (modify-syntax-entry ?\[ "." reftex-syntax-table-for-bib)
7af0f250bfd0 (reftex-mode): Moved creation of special syntax tables to top-level.
Carsten Dominik <dominik@science.uva.nl>
parents: 46683
diff changeset
332 (modify-syntax-entry ?\] "." reftex-syntax-table-for-bib))
7af0f250bfd0 (reftex-mode): Moved creation of special syntax tables to top-level.
Carsten Dominik <dominik@science.uva.nl>
parents: 46683
diff changeset
333
47050
904fd28be439 Update to RefTeX 4.19
Carsten Dominik <dominik@science.uva.nl>
parents: 46973
diff changeset
334 ;; The following definitions are out of place, but I need them here
904fd28be439 Update to RefTeX 4.19
Carsten Dominik <dominik@science.uva.nl>
parents: 46973
diff changeset
335 ;; to make the compilation of reftex-mode not complain.
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
336 (defvar reftex-auto-view-crossref-timer nil
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
337 "The timer used for auto-view-crossref.")
47050
904fd28be439 Update to RefTeX 4.19
Carsten Dominik <dominik@science.uva.nl>
parents: 46973
diff changeset
338 (defvar reftex-toc-auto-recenter-timer nil
904fd28be439 Update to RefTeX 4.19
Carsten Dominik <dominik@science.uva.nl>
parents: 46973
diff changeset
339 "The idle timer used to recenter the toc window.")
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
340
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
341 ;;;###autoload
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
342 (defun turn-on-reftex ()
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
343 "Turn on RefTeX mode."
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
344 (reftex-mode t))
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
345
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
346 ;;;###autoload
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
347 (defun reftex-mode (&optional arg)
18123
7831ac89a334 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18050
diff changeset
348 "Minor mode with distinct support for \\label, \\ref and \\cite in LaTeX.
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
349
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
350 \\<reftex-mode-map>A Table of Contents of the entire (multifile) document with browsing
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
351 capabilities is available with `\\[reftex-toc]'.
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
352
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
353 Labels can be created with `\\[reftex-label]' and referenced with `\\[reftex-reference]'.
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
354 When referencing, you get a menu with all labels of a given type and
18321
0ed97be54a28 Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents: 18220
diff changeset
355 context of the label definition. The selected label is inserted as a
18123
7831ac89a334 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18050
diff changeset
356 \\ref macro.
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
357
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
358 Citations can be made with `\\[reftex-citation]' which will use a regular expression
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
359 to pull out a *formatted* list of articles from your BibTeX
18321
0ed97be54a28 Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents: 18220
diff changeset
360 database. The selected citation is inserted as a \\cite macro.
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
361
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
362 Index entries can be made with `\\[reftex-index-selection-or-word]' which indexes the word at point
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
363 or the current selection. More general index entries are created with
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
364 `\\[reftex-index]'. `\\[reftex-display-index]' displays the compiled index.
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
365
18321
0ed97be54a28 Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents: 18220
diff changeset
366 Most command have help available on the fly. This help is accessed by
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
367 pressing `?' to any prompt mentioning this feature.
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
368
23707
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
369 Extensive documentation about RefTeX is available in Info format.
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
370 You can view this information with `\\[reftex-info]'.
18321
0ed97be54a28 Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents: 18220
diff changeset
371
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
372 \\{reftex-mode-map}
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
373 Under X, these and other functions will also be available as `Ref' menu
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
374 on the menu bar.
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
375
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
376 ------------------------------------------------------------------------------"
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
377
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
378 (interactive "P")
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
379 (setq reftex-mode (not (or (and (null arg) reftex-mode)
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
380 (<= (prefix-numeric-value arg) 0))))
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
381
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
382 (if reftex-mode
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
383 (progn
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
384 ;; Mode was turned on
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
385 (easy-menu-add reftex-mode-menu)
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
386 (and reftex-plug-into-AUCTeX
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
387 (reftex-plug-into-AUCTeX))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
388 (unless (get 'reftex-auto-view-crossref 'initialized)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
389 (and reftex-auto-view-crossref
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
390 (reftex-toggle-auto-view-crossref))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
391 (put 'reftex-auto-view-crossref 'initialized t))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
392 (unless (get 'reftex-auto-recenter-toc 'initialized)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
393 (and (eq reftex-auto-recenter-toc t)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
394 (reftex-toggle-auto-toc-recenter))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
395 (put 'reftex-auto-recenter-toc 'initialized t))
46928
cbd08432d202 * reftex.el (reftex-mode): Create special syntax tables.
Carsten Dominik <dominik@science.uva.nl>
parents: 46904
diff changeset
396
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
397 ;; Prepare the special syntax tables.
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
398 (setq reftex-syntax-table (copy-syntax-table (syntax-table)))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
399 (modify-syntax-entry ?\( "." reftex-syntax-table)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
400 (modify-syntax-entry ?\) "." reftex-syntax-table)
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
401
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
402 (setq reftex-syntax-table-for-bib
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
403 (copy-syntax-table reftex-syntax-table))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
404 (modify-syntax-entry ?\' "." reftex-syntax-table-for-bib)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
405 (modify-syntax-entry ?\" "." reftex-syntax-table-for-bib)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
406 (modify-syntax-entry ?\[ "." reftex-syntax-table-for-bib)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
407 (modify-syntax-entry ?\] "." reftex-syntax-table-for-bib)
46928
cbd08432d202 * reftex.el (reftex-mode): Create special syntax tables.
Carsten Dominik <dominik@science.uva.nl>
parents: 46904
diff changeset
408
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
409 (run-hooks 'reftex-mode-hook))
23707
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
410 ;; Mode was turned off
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
411 (easy-menu-remove reftex-mode-menu)))
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
412
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
413 (if (fboundp 'add-minor-mode)
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
414 ;; Use it so that we get the extras
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
415 (progn
23995
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
416 (put 'reftex-mode :included '(memq major-mode '(latex-mode tex-mode)))
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
417 (put 'reftex-mode :menu-tag "RefTeX Mode")
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
418 (add-minor-mode 'reftex-mode " Ref" reftex-mode-map))
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
419 ;; The standard way
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
420 (unless (assoc 'reftex-mode minor-mode-alist)
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
421 (push '(reftex-mode " Ref") minor-mode-alist))
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
422 (unless (assoc 'reftex-mode minor-mode-map-alist)
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
423 (push (cons 'reftex-mode reftex-mode-map) minor-mode-map-alist)))
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
424
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
425 (defvar reftex-docstruct-symbol)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
426 (defun reftex-kill-buffer-hook ()
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
427 "Save RefTeX's parse file for this buffer if the information has changed."
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
428 ;; Save the parsing information if it was modified.
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
429 ;; This function should be installed in `kill-buffer-hook'.
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
430 ;; We are careful to make sure nothing goes wring in this function.
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
431 (when (and (boundp 'reftex-mode) reftex-mode
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
432 (boundp 'reftex-save-parse-info) reftex-save-parse-info
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
433 (boundp 'reftex-docstruct-symbol) reftex-docstruct-symbol
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
434 (symbol-value reftex-docstruct-symbol)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
435 (get reftex-docstruct-symbol 'modified))
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
436 ;; Write the file.
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
437 (condition-case nil
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
438 (reftex-access-parse-file 'write)
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
439 (error nil))))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
440
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
441 (defun reftex-kill-emacs-hook ()
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
442 "Call `reftex-kill-buffer-hook' on all buffers."
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
443 ;; This function should be installed in `kill-emacs-hook'.
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
444 (save-excursion
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
445 (mapcar (lambda (buf)
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
446 (set-buffer buf)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
447 (reftex-kill-buffer-hook))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
448 (buffer-list))))
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
449
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
450 ;;; =========================================================================
18321
0ed97be54a28 Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents: 18220
diff changeset
451 ;;;
0ed97be54a28 Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents: 18220
diff changeset
452 ;;; Silence warnings about variables in other packages.
36469
30b2f9d3d959 (defvar): Wrap some defvars in
Dave Love <fx@gnu.org>
parents: 34402
diff changeset
453 (eval-when-compile
30b2f9d3d959 (defvar): Wrap some defvars in
Dave Love <fx@gnu.org>
parents: 34402
diff changeset
454 (defvar TeX-master)
30b2f9d3d959 (defvar): Wrap some defvars in
Dave Love <fx@gnu.org>
parents: 34402
diff changeset
455 (defvar LaTeX-section-hook)
30b2f9d3d959 (defvar): Wrap some defvars in
Dave Love <fx@gnu.org>
parents: 34402
diff changeset
456 (defvar LaTeX-label-function)
30b2f9d3d959 (defvar): Wrap some defvars in
Dave Love <fx@gnu.org>
parents: 34402
diff changeset
457 (defvar tex-main-file)
30b2f9d3d959 (defvar): Wrap some defvars in
Dave Love <fx@gnu.org>
parents: 34402
diff changeset
458 (defvar outline-minor-mode)
30b2f9d3d959 (defvar): Wrap some defvars in
Dave Love <fx@gnu.org>
parents: 34402
diff changeset
459 (defvar font-lock-mode)
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
460 (defvar font-lock-keywords)
36469
30b2f9d3d959 (defvar): Wrap some defvars in
Dave Love <fx@gnu.org>
parents: 34402
diff changeset
461 (defvar font-lock-fontify-region-function)
30b2f9d3d959 (defvar): Wrap some defvars in
Dave Love <fx@gnu.org>
parents: 34402
diff changeset
462 (defvar font-lock-syntactic-keywords))
18321
0ed97be54a28 Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents: 18220
diff changeset
463
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
464 ;;; =========================================================================
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
465 ;;;
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
466 ;;; Multibuffer Variables
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
467 ;;;
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
468 ;;; Technical notes: These work as follows: We keep just one list
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
469 ;;; of labels for each master file - this can save a lot of memory.
18321
0ed97be54a28 Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents: 18220
diff changeset
470 ;;; `reftex-master-index-list' is an alist which connects the true file name
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
471 ;;; of each master file with the symbols holding the information on that
18321
0ed97be54a28 Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents: 18220
diff changeset
472 ;;; document. Each buffer has local variables which point to these symbols.
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
473
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
474 ;; List of variables which handle the multifile stuff.
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
475 ;; This list is used to tie, untie, and reset these symbols.
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
476 (defconst reftex-multifile-symbols
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
477 '(reftex-docstruct-symbol))
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
478
18321
0ed97be54a28 Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents: 18220
diff changeset
479 ;; Alist connecting master file names with the corresponding lisp symbols.
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
480 (defvar reftex-master-index-list nil)
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
481
18321
0ed97be54a28 Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents: 18220
diff changeset
482 ;; Last index used for a master file.
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
483 (defvar reftex-multifile-index 0)
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
484
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
485 ;; Variable holding the symbol with the label list of the document.
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
486 (defvar reftex-docstruct-symbol nil)
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
487 (make-variable-buffer-local 'reftex-docstruct-symbol)
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
488
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
489 (defun reftex-next-multifile-index ()
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
490 ;; Return the next free index for multifile symbols.
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
491 (incf reftex-multifile-index))
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
492
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
493 (defun reftex-tie-multifile-symbols ()
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
494 ;; Tie the buffer-local symbols to globals connected with the master file.
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
495 ;; If the symbols for the current master file do not exist, they are created.
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
496
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
497 (let* ((master (file-truename (reftex-TeX-master-file)))
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
498 (index (assoc master reftex-master-index-list))
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
499 (symlist reftex-multifile-symbols)
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
500 symbol symname newflag)
18321
0ed97be54a28 Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents: 18220
diff changeset
501 ;; Find the correct index.
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
502 (if index
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
503 ;; symbols do exist
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
504 (setq index (cdr index))
18321
0ed97be54a28 Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents: 18220
diff changeset
505 ;; Get a new index and add info to the alist.
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
506 (setq index (reftex-next-multifile-index)
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
507 newflag t)
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
508 (push (cons master index) reftex-master-index-list))
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
509
18321
0ed97be54a28 Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents: 18220
diff changeset
510 ;; Get/create symbols and tie them.
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
511 (while symlist
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
512 (setq symbol (car symlist)
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
513 symlist (cdr symlist)
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
514 symname (symbol-name symbol))
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
515 (set symbol (intern (concat symname "-" (int-to-string index))))
23995
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
516 (put (symbol-value symbol) :master-index index)
18321
0ed97be54a28 Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents: 18220
diff changeset
517 ;; Initialize if new symbols.
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
518 (when newflag
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
519 (set (symbol-value symbol) nil)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
520 (put (symbol-value symbol) 'reftex-index-macros-style '(default))))
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
521
18321
0ed97be54a28 Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents: 18220
diff changeset
522 ;; Return t if the symbols did already exist, nil when we've made them.
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
523 (not newflag)))
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
524
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
525 (defun reftex-untie-multifile-symbols ()
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
526 ;; Remove ties from multifile symbols, so that next use makes new ones.
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
527 (let ((symlist reftex-multifile-symbols)
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
528 (symbol nil))
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
529 (while symlist
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
530 (setq symbol (car symlist)
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
531 symlist (cdr symlist))
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
532 (set symbol nil))))
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
533
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
534 (defun reftex-TeX-master-file ()
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
535 ;; Return the name of the master file associated with the current buffer.
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
536 ;; When AUCTeX is loaded, we will use it's more sophisticated method.
18219
aaeaae005e98 Updated documentation at several points in the file.
Richard M. Stallman <rms@gnu.org>
parents: 18123
diff changeset
537 ;; We also support the default TeX and LaTeX modes by checking for a
aaeaae005e98 Updated documentation at several points in the file.
Richard M. Stallman <rms@gnu.org>
parents: 18123
diff changeset
538 ;; variable tex-main-file.
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
539 (let
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
540 ((master
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
541 (cond
18321
0ed97be54a28 Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents: 18220
diff changeset
542 ((fboundp 'TeX-master-file) ; AUCTeX is loaded. Use its mechanism.
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
543 (condition-case nil
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
544 (TeX-master-file t)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
545 (error (buffer-file-name))))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
546 ((fboundp 'tex-main-file) (tex-main-file)) ; Emacs LaTeX mode
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
547 ((boundp 'TeX-master) ; The variable is defined - lets use it.
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
548 (cond
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
549 ((eq TeX-master t)
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
550 (buffer-file-name))
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
551 ((eq TeX-master 'shared)
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
552 (setq TeX-master (read-file-name "Master file: "
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
553 nil nil t nil)))
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
554 (TeX-master)
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
555 (t
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
556 (setq TeX-master (read-file-name "Master file: "
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
557 nil nil t nil)))))
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
558 ((boundp 'tex-main-file)
18321
0ed97be54a28 Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents: 18220
diff changeset
559 ;; This is the variable from the default TeX modes.
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
560 (cond
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
561 ((stringp tex-main-file)
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
562 ;; ok, this must be it
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
563 tex-main-file)
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
564 (t
18321
0ed97be54a28 Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents: 18220
diff changeset
565 ;; In this case, the buffer is its own master.
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
566 (buffer-file-name))))
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
567 (t
18321
0ed97be54a28 Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents: 18220
diff changeset
568 ;; Know nothing about master file. Assume this is a master file.
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
569 (buffer-file-name)))))
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
570 (cond
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
571 ((null master)
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
572 (error "Need a filename for this buffer, please save it first"))
23200
4750ba95a176 (reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents: 22991
diff changeset
573 ((or (file-exists-p (concat master ".tex"))
4750ba95a176 (reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents: 22991
diff changeset
574 (reftex-get-buffer-visiting (concat master ".tex")))
4750ba95a176 (reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents: 22991
diff changeset
575 ;; Ahh, an extra .tex was missing...
4750ba95a176 (reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents: 22991
diff changeset
576 (setq master (concat master ".tex")))
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
577 ((or (file-exists-p master)
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
578 (reftex-get-buffer-visiting master))
18321
0ed97be54a28 Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents: 18220
diff changeset
579 ;; We either see the file, or have a buffer on it. OK.
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
580 )
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
581 (t
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
582 ;; Use buffer file name.
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
583 (setq master (buffer-file-name))))
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
584 (expand-file-name master)))
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
585
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
586 (defun reftex-is-multi ()
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
587 ;; Tell if this is a multifile document. When not sure, say yes.
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
588 (let ((entry (assq 'is-multi (symbol-value reftex-docstruct-symbol))))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
589 (if entry
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
590 (nth 1 entry)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
591 t)))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
592
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
593 (defun reftex-set-cite-format (value)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
594 "Set the document-local value of `reftex-cite-format'.
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
595 When such a value exists, it overwrites the setting given with
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
596 `reftex-cite-format'. See the documentation of `reftex-cite-format'
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
597 for possible values. This function should be used from AUCTeX style files."
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
598 (unless reftex-docstruct-symbol
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
599 (reftex-tie-multifile-symbols))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
600 (when (and reftex-docstruct-symbol
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
601 (symbolp reftex-docstruct-symbol))
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
602 (put reftex-docstruct-symbol 'reftex-cite-format value)))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
603
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
604 (defun reftex-get-cite-format ()
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
605 ;; Return the current citation format. Either the document-local value in
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
606 ;; reftex-cite-format-symbol, or the global value in reftex-cite-format.
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
607 (if (and reftex-docstruct-symbol
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
608 (symbolp reftex-docstruct-symbol)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
609 (get reftex-docstruct-symbol 'reftex-cite-format))
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
610 (get reftex-docstruct-symbol 'reftex-cite-format)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
611 reftex-cite-format))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
612
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
613 (defun reftex-add-index-macros (entry-list)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
614 "Add index macro descriptions to `reftex-index-macros-style'.
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
615 The format of ENTRY-LIST is exactly like `reftex-index-macros'. See there
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
616 for details.
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
617 This function makes it possible to support RefTeX from AUCTeX style files.
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
618 The entries in ENTRY-LIST will be processed after the user settings in
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
619 `reftex-index-entries', and before the defaults. Any changes made to
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
620 `reftex-label-alist-style' will raise a flag to the effect that
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
621 the label information is recompiled on next use."
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
622 (unless reftex-docstruct-symbol
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
623 (reftex-tie-multifile-symbols))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
624 (when (and reftex-docstruct-symbol
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
625 (symbolp reftex-docstruct-symbol))
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
626 (let ((list (get reftex-docstruct-symbol 'reftex-index-macros-style))
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
627 entry changed)
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
628 (while entry-list
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
629 (setq entry (pop entry-list))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
630 ;; When it is a symbol, remove all other symbols
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
631 (and (symbolp entry)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
632 (not (memq entry list))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
633 (setq list (reftex-remove-symbols-from-list list)))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
634 ;; Add to list unless already member
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
635 (unless (member entry list)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
636 (setq reftex-tables-dirty t
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
637 changed t)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
638 (push entry list)))
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
639 (when changed
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
640 (put reftex-docstruct-symbol 'reftex-index-macros-style list)))))
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
641
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
642 ;;; =========================================================================
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
643 ;;;
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
644 ;;; Functions to compile the tables, reset the mode etc.
18321
0ed97be54a28 Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents: 18220
diff changeset
645
0ed97be54a28 Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents: 18220
diff changeset
646 ;; The following constants are derived from `reftex-label-alist'.
0ed97be54a28 Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents: 18220
diff changeset
647
20829
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
648 ;; Prompt used for label type queries directed to the user.
46612
7522419c4db0 Updated to reftex 4.17
Carsten Dominik <dominik@science.uva.nl>
parents: 38422
diff changeset
649 (defvar reftex-type-query-prompt nil)
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
650
20829
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
651 ;; Help string for label type queries.
46612
7522419c4db0 Updated to reftex 4.17
Carsten Dominik <dominik@science.uva.nl>
parents: 38422
diff changeset
652 (defvar reftex-type-query-help nil)
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
653
18321
0ed97be54a28 Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents: 18220
diff changeset
654 ;; Alist relating label type to reference format.
46612
7522419c4db0 Updated to reftex 4.17
Carsten Dominik <dominik@science.uva.nl>
parents: 38422
diff changeset
655 (defvar reftex-typekey-to-format-alist nil)
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
656
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
657 ;; Alist relating label type to label prefix.
46612
7522419c4db0 Updated to reftex 4.17
Carsten Dominik <dominik@science.uva.nl>
parents: 38422
diff changeset
658 (defvar reftex-typekey-to-prefix-alist nil)
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
659
18321
0ed97be54a28 Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents: 18220
diff changeset
660 ;; Alist relating environments or macros to label type and context regexp.
46612
7522419c4db0 Updated to reftex 4.17
Carsten Dominik <dominik@science.uva.nl>
parents: 38422
diff changeset
661 (defvar reftex-env-or-mac-alist nil)
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
662
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
663 ;; List of special environment parser functions
46612
7522419c4db0 Updated to reftex 4.17
Carsten Dominik <dominik@science.uva.nl>
parents: 38422
diff changeset
664 (defvar reftex-special-env-parsers nil)
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
665
18321
0ed97be54a28 Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents: 18220
diff changeset
666 ;; List of macros carrying a label.
46612
7522419c4db0 Updated to reftex 4.17
Carsten Dominik <dominik@science.uva.nl>
parents: 38422
diff changeset
667 (defvar reftex-label-mac-list nil)
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
668
18321
0ed97be54a28 Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents: 18220
diff changeset
669 ;; List of environments carrying a label.
46612
7522419c4db0 Updated to reftex 4.17
Carsten Dominik <dominik@science.uva.nl>
parents: 38422
diff changeset
670 (defvar reftex-label-env-list nil)
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
671
18321
0ed97be54a28 Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents: 18220
diff changeset
672 ;; List of all typekey letters in use.
46612
7522419c4db0 Updated to reftex 4.17
Carsten Dominik <dominik@science.uva.nl>
parents: 38422
diff changeset
673 (defvar reftex-typekey-list nil)
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
674
18321
0ed97be54a28 Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents: 18220
diff changeset
675 ;; Alist relating magic words to a label type.
46612
7522419c4db0 Updated to reftex 4.17
Carsten Dominik <dominik@science.uva.nl>
parents: 38422
diff changeset
676 (defvar reftex-words-to-typekey-alist nil)
59534
9bad65481674 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 52401
diff changeset
677 ;; Alist relating label prefixes to a label type.
9bad65481674 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 52401
diff changeset
678 (defvar reftex-prefix-to-typekey-alist nil)
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
679
18321
0ed97be54a28 Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents: 18220
diff changeset
680 ;; The last list-of-labels entry used in a reference.
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
681 (defvar reftex-last-used-reference (list nil nil nil nil))
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
682
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
683 ;; Alist relating index macros to other info.
46612
7522419c4db0 Updated to reftex 4.17
Carsten Dominik <dominik@science.uva.nl>
parents: 38422
diff changeset
684 (defvar reftex-key-to-index-macro-alist nil)
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
685 ;; Prompt for index macro queries
46612
7522419c4db0 Updated to reftex 4.17
Carsten Dominik <dominik@science.uva.nl>
parents: 38422
diff changeset
686 (defvar reftex-query-index-macro-prompt nil)
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
687 ;; Help string for index macro queries
46612
7522419c4db0 Updated to reftex 4.17
Carsten Dominik <dominik@science.uva.nl>
parents: 38422
diff changeset
688 (defvar reftex-query-index-macro-help nil)
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
689
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
690 ;; The message when follow-mode is suspended
46612
7522419c4db0 Updated to reftex 4.17
Carsten Dominik <dominik@science.uva.nl>
parents: 38422
diff changeset
691 (defvar reftex-no-follow-message
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
692 "No follow-mode into unvisited file. Press SPC to visit it.")
46612
7522419c4db0 Updated to reftex 4.17
Carsten Dominik <dominik@science.uva.nl>
parents: 38422
diff changeset
693 (defvar reftex-no-info-message
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
694 "%s: info not available, use `\\[reftex-view-crossref]' to get it.")
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
695
18321
0ed97be54a28 Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents: 18220
diff changeset
696 ;; Global variables used for communication between functions.
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
697 (defvar reftex-default-context-position nil)
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
698 (defvar reftex-location-start nil)
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
699 (defvar reftex-call-back-to-this-buffer nil)
20979
38e7bcbb3595 (reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents: 20953
diff changeset
700 (defvar reftex-select-return-marker (make-marker))
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
701 (defvar reftex-active-toc nil)
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
702 (defvar reftex-tex-path nil)
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
703 (defvar reftex-bib-path nil)
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
704 (defvar reftex-select-marked nil)
20979
38e7bcbb3595 (reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents: 20953
diff changeset
705 (defvar reftex-last-follow-point nil)
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
706 (defvar reftex-latex-syntax-table nil)
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
707 (defvar reftex-prefix nil)
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
708 (defvar reftex-section-levels-all nil)
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
709 (defvar reftex-buffers-with-changed-invisibility nil)
23707
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
710 (defvar reftex-callback-fwd t)
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
711 (defvar reftex-last-toc-master nil
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
712 "Stores the name of the tex file that `reftex-toc' was last run on.")
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
713 ;; Marker for return point from recursive edit
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
714 (defvar reftex-recursive-edit-marker (make-marker))
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
715
18321
0ed97be54a28 Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents: 18220
diff changeset
716 ;; List of buffers created temporarily for lookup, which should be killed.
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
717 (defvar reftex-buffers-to-kill nil)
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
718
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
719 ;; Regexp to find anything.
19660
fa3d4e7a76d9 (reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents: 18321
diff changeset
720 (defvar reftex-section-regexp nil)
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
721 (defvar reftex-section-or-include-regexp nil)
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
722 (defvar reftex-index-macro-regexp nil)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
723 (defvar reftex-index-level-re nil)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
724 (defvar reftex-index-key-end-re nil)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
725 (defvar reftex-find-index-entry-regexp-format nil)
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
726 (defvar reftex-everything-regexp nil)
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
727 (defvar reftex-everything-regexp-no-index nil)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
728 (defvar reftex-index-re nil)
23995
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
729 (defvar reftex-find-citation-regexp-format
29775
31536c6cf2e3 * textmodes/reftex.el (reftex-find-citation-regexp-format):
Carsten Dominik <dominik@science.uva.nl>
parents: 27601
diff changeset
730 "\\\\\\([a-zA-Z]*cite[*a-zA-Z]*\\*?\\|bibentry\\)\\(\\[[^]]*\\]\\|{[^}]*}\\)*{\\([^}]*,\\)?\\(%s\\)[},]")
23995
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
731 (defvar reftex-find-reference-format
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
732 "\\\\\\(ref[a-zA-Z]*\\|[a-zA-Z]*ref\\(range\\)?\\)\\*?\\(\\[[^]]*\\]\\|{[^}]*}\\)*{\\(%s\\)}")
23995
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
733 (defvar reftex-macros-with-labels nil)
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
734 (defvar reftex-macros-with-index nil)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
735 (defvar reftex-index-macro-alist nil)
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
736 (defvar reftex-find-label-regexp-format nil)
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
737 (defvar reftex-find-label-regexp-format2 nil)
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
738
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
739 (defvar reftex-memory nil
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
740 "Memorizes old variable values to indicate changes in these variables.")
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
741
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
742 ;; A list of all variables in the cache.
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
743 ;; The cache is used to save the compiled versions of some variables.
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
744 (defconst reftex-cache-variables
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
745 '(reftex-memory ;; This MUST ALWAYS be the first!
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
746
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
747 ;; Outline
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
748 reftex-section-levels-all
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
749
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
750 ;; Labels
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
751 reftex-env-or-mac-alist
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
752 reftex-special-env-parsers
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
753 reftex-macros-with-labels
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
754 reftex-label-mac-list
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
755 reftex-label-env-list
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
756 reftex-typekey-list
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
757 reftex-typekey-to-format-alist
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
758 reftex-typekey-to-prefix-alist
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
759 reftex-words-to-typekey-alist
59534
9bad65481674 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 52401
diff changeset
760 reftex-prefix-to-typekey-alist
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
761 reftex-type-query-prompt
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
762 reftex-type-query-help
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
763
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
764 ;; Index
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
765 reftex-index-macro-alist
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
766 reftex-macros-with-index
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
767 reftex-query-index-macro-prompt
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
768 reftex-query-index-macro-help
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
769 reftex-key-to-index-macro-alist
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
770
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
771 ;; Regular expressions
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
772 reftex-section-regexp
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
773 reftex-section-or-include-regexp
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
774 reftex-index-re
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
775 reftex-everything-regexp
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
776 reftex-everything-regexp-no-index
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
777 reftex-find-label-regexp-format
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
778 reftex-find-label-regexp-format2
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
779 reftex-find-index-entry-regexp-format
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
780 ))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
781
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
782 (defun reftex-ensure-compiled-variables ()
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
783 ;; Recompile the label alist when necessary
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
784 (let* ((mem reftex-memory)
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
785 (cache (get reftex-docstruct-symbol 'reftex-cache))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
786 (cmem (car cache))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
787 (alist reftex-label-alist)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
788 (levels (get reftex-docstruct-symbol 'reftex-section-levels))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
789 (style (get reftex-docstruct-symbol 'reftex-label-alist-style))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
790 (default reftex-default-label-alist-entries)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
791 (index reftex-index-macros)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
792 (istyle (get reftex-docstruct-symbol 'reftex-index-macros-style)))
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
793 (cond
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
794 (reftex-tables-dirty (reftex-compile-variables))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
795 ((and (eq alist (nth 0 mem))
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
796 (eq levels (nth 1 mem))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
797 (eq style (nth 2 mem))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
798 (eq default (nth 3 mem))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
799 (eq index (nth 4 mem))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
800 (eq istyle (nth 5 mem)))) ;; everything is OK
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
801 ((and (eq alist (nth 0 cmem))
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
802 (eq levels (nth 1 cmem))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
803 (eq style (nth 2 cmem))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
804 (eq default (nth 2 cmem))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
805 (eq index (nth 4 cmem))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
806 (eq istyle (nth 5 cmem)))
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
807 ;; restore the cache
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
808 (message "Restoring cache")
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
809 (mapcar (lambda (sym) (set sym (pop cache))) reftex-cache-variables))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
810 (t (reftex-compile-variables)))))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
811
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
812 (defun reftex-reset-mode ()
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
813 "Reset RefTeX Mode.
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
814 This will re-compile the configuration information and remove all
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
815 current scanning information and the parse file to enforce a rescan
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
816 on next use."
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
817 (interactive)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
818
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
819 ;; Reset the file search path variables
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
820 (loop for prop in '(status master-dir recursive-path rec-type) do
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
821 (put 'reftex-tex-path prop nil)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
822 (put 'reftex-bib-path prop nil))
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
823
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
824 ;; Kill temporary buffers associated with RefTeX - just in case they
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
825 ;; were not cleaned up properly
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
826 (save-excursion
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
827 (let ((buffer-list '("*RefTeX Help*" "*RefTeX Select*"
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
828 "*Duplicate Labels*" "*toc*" " *RefTeX-scratch*"))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
829 buf)
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
830 (while (setq buf (pop buffer-list))
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
831 (if (get-buffer buf)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
832 (kill-buffer buf))))
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
833 (reftex-erase-all-selection-and-index-buffers))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
834
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
835 ;; Make sure the current document will be rescanned soon.
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
836 (reftex-reset-scanning-information)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
837
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
838 ;; Remove any parse info file
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
839 (reftex-access-parse-file 'kill)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
840
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
841 ;; Plug functions into AUCTeX if the user option says so.
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
842 (and reftex-plug-into-AUCTeX
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
843 (reftex-plug-into-AUCTeX))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
844
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
845 (reftex-compile-variables))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
846
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
847 ;;;###autoload
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
848 (defun reftex-reset-scanning-information ()
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
849 "Reset the symbols containing information from buffer scanning.
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
850 This enforces rescanning the buffer on next use."
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
851 (if (string= reftex-last-toc-master (reftex-TeX-master-file))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
852 (reftex-erase-buffer "*toc*"))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
853 (let ((symlist reftex-multifile-symbols)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
854 symbol)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
855 (while symlist
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
856 (setq symbol (car symlist)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
857 symlist (cdr symlist))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
858 (if (and (symbolp (symbol-value symbol))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
859 (not (null (symbol-value symbol))))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
860 (set (symbol-value symbol) nil)))))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
861
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
862 (defun reftex-erase-all-selection-and-index-buffers ()
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
863 ;; Remove all selection buffers associated with current document.
85194
b4b8e47fe18b (reftex-erase-all-selection-and-index-buffers)
Glenn Morris <rgm@gnu.org>
parents: 82140
diff changeset
864 (mapc
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
865 (lambda (type)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
866 (reftex-erase-buffer (reftex-make-selection-buffer-name type)))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
867 reftex-typekey-list)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
868 ;; Kill all index buffers
85194
b4b8e47fe18b (reftex-erase-all-selection-and-index-buffers)
Glenn Morris <rgm@gnu.org>
parents: 82140
diff changeset
869 (mapc
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
870 (lambda (tag)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
871 (reftex-kill-buffer (reftex-make-index-buffer-name tag)))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
872 (cdr (assoc 'index-tags (symbol-value reftex-docstruct-symbol)))))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
873
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
874 (defun reftex-compile-variables ()
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
875 ;; Compile the information in reftex-label-alist & Co.
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
876
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
877 (message "Compiling label environment definitions...")
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
878
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
879 ;; Update AUCTeX style information
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
880 (when (and (featurep 'tex-site) (fboundp 'TeX-update-style))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
881 (condition-case nil (TeX-update-style) (error nil)))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
882
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
883 ;; Record that we have done this, and what we have used.
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
884 (setq reftex-tables-dirty nil)
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
885 (setq reftex-memory
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
886 (list reftex-label-alist
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
887 (get reftex-docstruct-symbol 'reftex-section-levels)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
888 (get reftex-docstruct-symbol 'reftex-label-alist-style)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
889 reftex-default-label-alist-entries
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
890 reftex-index-macros
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
891 (get reftex-docstruct-symbol 'reftex-index-macros-style)))
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
892
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
893 ;; Compile information in reftex-label-alist
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
894 (let ((all (reftex-uniquify-by-car
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
895 (reftex-splice-symbols-into-list
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
896 (append reftex-label-alist
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
897 (get reftex-docstruct-symbol
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
898 'reftex-label-alist-style)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
899 reftex-default-label-alist-entries)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
900 reftex-label-alist-builtin)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
901 '(nil)))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
902 (all-index (reftex-uniquify-by-car
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
903 (reftex-splice-symbols-into-list
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
904 (append reftex-index-macros
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
905 (get reftex-docstruct-symbol
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
906 'reftex-index-macros-style)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
907 '(default))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
908 reftex-index-macros-builtin)))
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
909 entry env-or-mac typekeychar typekey prefix context word
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
910 fmt reffmt labelfmt wordlist qh-list macros-with-labels
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
911 nargs nlabel opt-args cell sum i
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
912 macro verify repeat nindex tag key toc-level toc-levels)
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
913
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
914 (setq reftex-words-to-typekey-alist nil
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
915 reftex-prefix-to-typekey-alist
59534
9bad65481674 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 52401
diff changeset
916 '(("sec:" . "s") ("cha:" . "s") ("chap:" . "s"))
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
917 reftex-typekey-list nil
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
918 reftex-typekey-to-format-alist nil
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
919 reftex-typekey-to-prefix-alist nil
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
920 reftex-env-or-mac-alist nil
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
921 reftex-label-env-list nil
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
922 reftex-label-mac-list nil)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
923 (while all
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
924 (catch 'next-entry
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
925 (setq entry (car all)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
926 env-or-mac (car entry)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
927 entry (cdr entry)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
928 all (cdr all))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
929 (if (null env-or-mac)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
930 (setq env-or-mac ""))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
931 (if (stringp (car entry))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
932 ;; This is before version 2.00 - convert entry to new format
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
933 ;; This is just to keep old users happy
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
934 (setq entry (cons (string-to-char (car entry))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
935 (cons (concat (car entry) ":")
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
936 (cdr entry)))))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
937 (setq typekeychar (nth 0 entry)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
938 typekey (if typekeychar (char-to-string typekeychar) nil)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
939 prefix (nth 1 entry)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
940 fmt (nth 2 entry)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
941 context (nth 3 entry)
26910
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
942 wordlist (nth 4 entry)
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
943 toc-level (nth 5 entry))
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
944 (if (stringp wordlist)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
945 ;; This is before version 2.04 - convert to new format
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
946 (setq wordlist (nthcdr 4 entry)))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
947
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
948 (if (and (stringp fmt)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
949 (string-match "@" fmt))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
950 ;; Special syntax for specifying a label format
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
951 (setq fmt (split-string fmt "@+"))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
952 (setq fmt (list "\\label{%s}" fmt)))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
953 (setq labelfmt (car fmt)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
954 reffmt (nth 1 fmt))
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
955 ;; Note a new typekey
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
956 (if typekey
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
957 (add-to-list 'reftex-typekey-list typekey))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
958 (if (and typekey prefix
59534
9bad65481674 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 52401
diff changeset
959 (not (assoc prefix reftex-prefix-to-typekey-alist)))
9bad65481674 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 52401
diff changeset
960 (add-to-list 'reftex-prefix-to-typekey-alist
9bad65481674 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 52401
diff changeset
961 (cons prefix typekey)))
9bad65481674 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 52401
diff changeset
962 (if (and typekey prefix
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
963 (not (assoc typekey reftex-typekey-to-prefix-alist)))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
964 (add-to-list 'reftex-typekey-to-prefix-alist
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
965 (cons typekey prefix)))
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
966 ;; Check if this is a macro or environment
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
967 (cond
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
968 ((symbolp env-or-mac)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
969 ;; A special parser function
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
970 (unless (fboundp env-or-mac)
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
971 (message "Warning: %s does not seem to be a valid function"
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
972 env-or-mac))
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
973 (setq nargs nil nlabel nil opt-args nil)
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
974 (add-to-list 'reftex-special-env-parsers env-or-mac)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
975 (setq env-or-mac (symbol-name env-or-mac)))
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
976 ((string-match "\\`\\\\" env-or-mac)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
977 ;; It's a macro
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
978 (let ((result (reftex-parse-args env-or-mac)))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
979 (setq env-or-mac (or (first result) env-or-mac)
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
980 nargs (second result)
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
981 nlabel (third result)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
982 opt-args (fourth result))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
983 (if nlabel (add-to-list 'macros-with-labels env-or-mac)))
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
984 (if typekey (add-to-list 'reftex-label-mac-list env-or-mac)))
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
985 (t
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
986 ;; It's an environment
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
987 (setq nargs nil nlabel nil opt-args nil)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
988 (cond ((string= env-or-mac "any"))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
989 ((string= env-or-mac ""))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
990 ((string= env-or-mac "section"))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
991 (t
26910
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
992 (add-to-list 'reftex-label-env-list env-or-mac)
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
993 (if toc-level
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
994 (let ((string (format "begin{%s}" env-or-mac)))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
995 (or (assoc string toc-levels)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
996 (push (cons string toc-level) toc-levels))))))))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
997 ;; Translate some special context cases
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
998 (when (assq context reftex-default-context-regexps)
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
999 (setq context
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
1000 (format
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1001 (cdr (assq context reftex-default-context-regexps))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1002 (regexp-quote env-or-mac))))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1003 ;; See if this is the first format for this typekey
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1004 (and reffmt
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1005 (not (assoc typekey reftex-typekey-to-format-alist))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1006 (push (cons typekey reffmt) reftex-typekey-to-format-alist))
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1007 ;; See if this is the first definition for this env-or-mac
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1008 (and (not (string= env-or-mac "any"))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1009 (not (string= env-or-mac ""))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1010 (not (assoc env-or-mac reftex-env-or-mac-alist))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1011 (push (list env-or-mac typekey context labelfmt
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1012 nargs nlabel opt-args)
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1013 reftex-env-or-mac-alist))
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1014 ;; Are the magic words regular expressions? Quote normal words.
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1015 (if (eq (car wordlist) 'regexp)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1016 (setq wordlist (cdr wordlist))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1017 (setq wordlist (mapcar 'regexp-quote wordlist)))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1018 ;; Remember the first association of each word.
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1019 (while (stringp (setq word (pop wordlist)))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1020 (or (assoc word reftex-words-to-typekey-alist)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1021 (push (cons word typekey) reftex-words-to-typekey-alist)))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1022 (cond
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1023 ((string= "" env-or-mac) nil)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1024 ((setq cell (assoc typekey qh-list))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1025 (push env-or-mac (cdr cell)))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1026 (typekey
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1027 (push (list typekey env-or-mac) qh-list)))))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1028
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1029 (setq reftex-typekey-to-prefix-alist
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1030 (nreverse reftex-typekey-to-prefix-alist))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1031
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1032 ;; Prepare the typekey query prompt and help string.
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
1033 (setq qh-list
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1034 (sort qh-list
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1035 (lambda (x1 x2)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1036 (string< (downcase (car x1)) (downcase (car x2))))))
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1037 (setq reftex-type-query-prompt
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1038 (concat "Label type: ["
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1039 (mapconcat (lambda(x) (format "%s" (car x)))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1040 qh-list "")
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1041 "]"))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1042 ;; In the help string, we need to wrap lines...
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1043 (setq reftex-type-query-help
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
1044 (concat
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1045 "SELECT A LABEL TYPE:\n--------------------\n"
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1046 (mapconcat
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1047 (lambda(x)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1048 (setq sum 0)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1049 (format " [%s] %s"
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1050 (car x)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1051 (mapconcat (lambda(env)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1052 (setq sum (+ sum (length env)))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1053 (if (< sum 60)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1054 env
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1055 (setq sum 0)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1056 (concat "\n " env)))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1057 (cdr x) " ")))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1058 qh-list "\n")))
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1059
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1060 ;; Convert magic words to regular expressions. We make regular expressions
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1061 ;; which allow for some chars from the ref format to be in the buffer.
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1062 ;; These characters will be seen and removed.
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1063 (setq reftex-words-to-typekey-alist
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
1064 (mapcar
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1065 (lambda (x)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1066 (setq word (car x)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1067 typekey (cdr x)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1068 fmt (cdr (assoc typekey reftex-typekey-to-format-alist)))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1069 (setq word (concat "\\W\\(" word "[ \t\n\r]*\\)\\("))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1070 (setq i 0)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1071 (while (and (< i 10) ; maximum number of format chars allowed
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1072 (< i (length fmt))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1073 (not (member (aref fmt i) '(?%))))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1074 (setq word (concat word "\\|" (regexp-quote
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1075 (substring fmt 0 (1+ i)))))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1076 (incf i))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1077 (cons (concat word "\\)\\=") typekey))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1078 (nreverse reftex-words-to-typekey-alist)))
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1079
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1080 ;; Parse the index macros
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1081 (setq reftex-index-macro-alist nil
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1082 reftex-key-to-index-macro-alist nil
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1083 reftex-macros-with-index nil)
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1084 (while all-index
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1085 (setq entry (car all-index)
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1086 macro (car entry)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1087 tag (nth 1 entry)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1088 key (nth 2 entry)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1089 prefix (or (nth 3 entry) "")
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1090 verify (nth 4 entry)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1091 ;; For repeat, we need to be compatible with older code
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1092 ;; This information used to be given only for the default macro,
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1093 ;; but later we required to have it for *every* index macro
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1094 repeat (cond ((> (length entry) 5) (nth 5 entry))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1095 ((and (eq key (car reftex-index-default-macro))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1096 (> (length reftex-index-default-macro) 2))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1097 ;; User has old setting - respect it
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1098 (nth 2 reftex-index-default-macro))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1099 (t t))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1100 all-index (cdr all-index))
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1101 (let ((result (reftex-parse-args macro)))
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1102 (setq macro (or (first result) macro)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1103 nargs (second result)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1104 nindex (third result)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1105 opt-args (fourth result))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1106 (unless (member macro reftex-macros-with-index)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1107 ;; 0 1 2 3 4 5 6 7
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1108 (push (list macro tag prefix verify nargs nindex opt-args repeat)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1109 reftex-index-macro-alist)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1110 (or (assoc key reftex-key-to-index-macro-alist)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1111 (push (list key macro) reftex-key-to-index-macro-alist))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1112 (push macro reftex-macros-with-index))))
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1113 ;; Make the prompt and help string for index macros query
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1114 (setq reftex-key-to-index-macro-alist
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1115 (sort reftex-key-to-index-macro-alist
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1116 (lambda (a b) (< (downcase (car a)) (downcase (car b))))))
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
1117 (setq reftex-query-index-macro-prompt
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1118 (concat "Index macro: ["
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1119 (mapconcat (lambda (x) (char-to-string (car x)))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1120 reftex-key-to-index-macro-alist "")
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1121 "]"))
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1122 (setq i 0
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1123 reftex-query-index-macro-help
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
1124 (concat
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1125 "SELECT A MACRO:\n---------------\n"
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1126 (mapconcat
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1127 (lambda(x)
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
1128 (format "[%c] %-20.20s%s" (car x) (nth 1 x)
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1129 (if (= 0 (mod (incf i) 3)) "\n" "")))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1130 reftex-key-to-index-macro-alist "")))
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1131
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1132 ;; Make the full list of section levels
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1133 (setq reftex-section-levels-all
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1134 (append toc-levels
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1135 (get reftex-docstruct-symbol 'reftex-section-levels)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1136 reftex-section-levels))
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1137
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1138 ;; Calculate the regular expressions
46612
7522419c4db0 Updated to reftex 4.17
Carsten Dominik <dominik@science.uva.nl>
parents: 38422
diff changeset
1139 (let* (
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1140 ; (wbol "\\(\\`\\|[\n\r]\\)[ \t]*")
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1141 (wbol "\\(^\\)[ \t]*") ; Need to keep the empty group because
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
1142 ;;; because match number are hard coded
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1143 (label-re "\\\\label{\\([^}]*\\)}")
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
1144 (include-re (concat wbol
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1145 "\\\\\\("
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
1146 (mapconcat 'identity
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1147 reftex-include-file-commands "\\|")
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1148 "\\)[{ \t]+\\([^} \t\n\r]+\\)"))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1149 (section-re
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1150 (concat wbol "\\\\\\("
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1151 (mapconcat (lambda (x) (regexp-quote (car x)))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1152 reftex-section-levels-all "\\|")
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1153 "\\)\\*?\\(\\[[^]]*\\]\\)?[[{ \t\r\n]"))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1154 (appendix-re (concat wbol "\\(\\\\appendix\\)"))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1155 (macro-re
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1156 (if macros-with-labels
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1157 (concat "\\("
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1158 (mapconcat 'regexp-quote macros-with-labels "\\|")
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1159 "\\)[[{]")
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1160 ""))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1161 (index-re
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1162 (concat "\\("
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1163 (mapconcat 'regexp-quote reftex-macros-with-index "\\|")
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1164 "\\)[[{]"))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1165 (find-index-re-format
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1166 (concat "\\("
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1167 (mapconcat 'regexp-quote reftex-macros-with-index "\\|")
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1168 "\\)\\([[{][^]}]*[]}]\\)*[[{]\\(%s\\)[]}]"))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1169 (find-label-re-format
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1170 (concat "\\("
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1171 (mapconcat 'regexp-quote (append '("\\label")
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1172 macros-with-labels) "\\|")
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1173 "\\)\\([[{][^]}]*[]}]\\)*[[{]\\(%s\\)[]}]"))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1174 (index-level-re
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1175 (regexp-quote (nth 0 reftex-index-special-chars)))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1176 (index-key-end-re ;; ^]- not allowed
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1177 (concat "[^" (nth 3 reftex-index-special-chars) "]"
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1178 "[" (nth 1 reftex-index-special-chars)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1179 (nth 2 reftex-index-special-chars) "]"))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1180 )
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1181 (setq reftex-section-regexp section-re
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1182 reftex-section-or-include-regexp
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1183 (concat section-re "\\|" include-re)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1184 reftex-everything-regexp
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1185 (concat label-re "\\|" section-re "\\|" include-re
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1186 "\\|" appendix-re
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1187 "\\|" index-re
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1188 (if macros-with-labels "\\|" "") macro-re)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1189 reftex-everything-regexp-no-index
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1190 (concat label-re "\\|" section-re "\\|" include-re
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1191 "\\|" appendix-re
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1192 "\\|" "\\(\\\\6\\\\3\\\\1\\)" ; This is unlikely to match
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1193 (if macros-with-labels "\\|" "") macro-re)
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1194 reftex-index-re index-re
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1195 reftex-index-level-re index-level-re
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1196 reftex-index-key-end-re index-key-end-re
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1197 reftex-macros-with-labels macros-with-labels
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1198 reftex-find-index-entry-regexp-format find-index-re-format
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1199 reftex-find-label-regexp-format find-label-re-format
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
1200 reftex-find-label-regexp-format2
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1201 "\\([]} \t\n\r]\\)\\([[{]\\)\\(%s\\)[]}]")
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1202 (message "Compiling label environment definitions...done")))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1203 (put reftex-docstruct-symbol 'reftex-cache
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1204 (mapcar 'symbol-value reftex-cache-variables)))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1205
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1206 (defun reftex-parse-args (macro)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1207 ;; Return a list of macro name, nargs, arg-nr which is label and a list of
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1208 ;; optional argument indices.
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1209 (if (string-match "[[{]\\*?[]}]" macro)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1210 (progn
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1211 (let ((must-match (substring macro 0 (match-beginning 0)))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1212 (args (substring macro (match-beginning 0)))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1213 opt-list nlabel (cnt 0))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1214 (while (string-match "\\`[[{]\\(\\*\\)?[]}]" args)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1215 (incf cnt)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1216 (when (eq ?\[ (string-to-char args))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1217 (push cnt opt-list))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1218 (when (and (match-end 1)
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1219 (not nlabel))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1220 (setq nlabel cnt))
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1221 (setq args (substring args (match-end 0))))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1222 (list must-match cnt nlabel opt-list)))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1223 nil))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1224
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1225 ;;; =========================================================================
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1226 ;;;
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1227 ;;; Accessing the parse information
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1228
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1229 (defun reftex-access-scan-info (&optional rescan file)
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1230 "Ensure access to the scanning info for the current file."
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1231 ;; When the multifile symbols are not yet tied,
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1232 ;; tie them. When they are empty or RESCAN is non-nil, scan the document.
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1233 ;; But, when RESCAN is -1, don't rescan even if docstruct is empty.
20829
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
1234 ;; When FILE is non-nil, parse only from that file.
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1235
59845
17819269525e (reftex-access-scan-info): Error out in a
Carsten Dominik <dominik@science.uva.nl>
parents: 59735
diff changeset
1236 ;; Error out in a buffer without a file.
17819269525e (reftex-access-scan-info): Error out in a
Carsten Dominik <dominik@science.uva.nl>
parents: 59735
diff changeset
1237 (if (and reftex-mode
17819269525e (reftex-access-scan-info): Error out in a
Carsten Dominik <dominik@science.uva.nl>
parents: 59735
diff changeset
1238 (not (buffer-file-name)))
63432
5c521403da03 (reftex-access-scan-info): Follow error conventions.
Juanma Barranquero <lekktu@gmail.com>
parents: 62512
diff changeset
1239 (error "RefTeX works only in buffers visiting a file"))
59845
17819269525e (reftex-access-scan-info): Error out in a
Carsten Dominik <dominik@science.uva.nl>
parents: 59735
diff changeset
1240
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1241 ;; Make sure we have the symbols tied
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1242 (if (eq reftex-docstruct-symbol nil)
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1243 ;; Symbols are not yet tied: Tie them.
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1244 (reftex-tie-multifile-symbols))
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1245
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1246 (reftex-ensure-compiled-variables)
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1247
20829
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
1248 (when (or (null (symbol-value reftex-docstruct-symbol))
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1249 (member rescan '(t 1 (4) (16))))
20829
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
1250 ;; The docstruct will change: Remove selection buffers.
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
1251 (save-excursion
23707
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
1252 (reftex-erase-buffer "*toc*")
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1253 (reftex-erase-all-selection-and-index-buffers)))
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1254
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1255 (if (and (null (symbol-value reftex-docstruct-symbol))
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1256 (not (member rescan '(t 1 (4) (16))))
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1257 reftex-save-parse-info)
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1258 ;; Try to read the stuff from a file
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1259 (reftex-access-parse-file 'read))
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1260
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1261 (cond
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1262 ((equal rescan -1)) ;; We are not allowed to scan.
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1263 ((not (symbol-value reftex-docstruct-symbol))
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1264 ;; Scan the whole document
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1265 (reftex-do-parse 1 file))
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1266 ((member rescan '(t 1 (4) (16)))
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1267 ;; Scan whatever was required by the caller.
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1268 (reftex-do-parse rescan file))))
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1269
34402
5eec8d1d09f0 Update to RefTeX 4.15, see ChangeLog for details
Carsten Dominik <dominik@science.uva.nl>
parents: 29775
diff changeset
1270 (defun reftex-scanning-info-available-p ()
5eec8d1d09f0 Update to RefTeX 4.15, see ChangeLog for details
Carsten Dominik <dominik@science.uva.nl>
parents: 29775
diff changeset
1271 "Is the scanning info about the current document available?"
5eec8d1d09f0 Update to RefTeX 4.15, see ChangeLog for details
Carsten Dominik <dominik@science.uva.nl>
parents: 29775
diff changeset
1272 (unless reftex-docstruct-symbol
5eec8d1d09f0 Update to RefTeX 4.15, see ChangeLog for details
Carsten Dominik <dominik@science.uva.nl>
parents: 29775
diff changeset
1273 (reftex-tie-multifile-symbols))
5eec8d1d09f0 Update to RefTeX 4.15, see ChangeLog for details
Carsten Dominik <dominik@science.uva.nl>
parents: 29775
diff changeset
1274 (and (symbolp reftex-docstruct-symbol)
5eec8d1d09f0 Update to RefTeX 4.15, see ChangeLog for details
Carsten Dominik <dominik@science.uva.nl>
parents: 29775
diff changeset
1275 (symbol-value reftex-docstruct-symbol)
5eec8d1d09f0 Update to RefTeX 4.15, see ChangeLog for details
Carsten Dominik <dominik@science.uva.nl>
parents: 29775
diff changeset
1276 t))
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
1277
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1278 (defun reftex-silence-toc-markers (list n)
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1279 ;; Set all toc markers in the first N entries in list to nil
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1280 (while (and list (> (decf n) -1))
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1281 (and (eq (car (car list)) 'toc)
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1282 (markerp (nth 4 (car list)))
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1283 (set-marker (nth 4 (car list)) nil))
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1284 (pop list)))
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1285
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1286 (defun reftex-access-parse-file (action)
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1287 "Perform ACTION on the parse file (the .rel file).
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1288 Valid actions are: readable, restore, read, kill, write."
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1289 (let* ((list (symbol-value reftex-docstruct-symbol))
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1290 (docstruct-symbol reftex-docstruct-symbol)
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1291 (master (reftex-TeX-master-file))
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1292 (enable-local-variables nil)
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1293 (file (if (string-match "\\.[a-zA-Z]+\\'" master)
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
1294 (concat (substring master 0 (match-beginning 0))
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1295 reftex-parse-file-extension)
27192
f70a80cecdd3 New version number.
Carsten Dominik <dominik@science.uva.nl>
parents: 27170
diff changeset
1296 (concat master reftex-parse-file-extension))))
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1297 (cond
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1298 ((eq action 'readable)
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1299 (file-readable-p file))
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1300 ((eq action 'restore)
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1301 (put reftex-docstruct-symbol 'modified nil)
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1302 (if (eq reftex-docstruct-symbol nil)
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1303 ;; Symbols are not yet tied: Tie them.
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1304 (reftex-tie-multifile-symbols))
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1305 (if (file-exists-p file)
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1306 ;; load the file and return t for success
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1307 (condition-case nil
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1308 (progn (load-file file) t)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1309 (error (set reftex-docstruct-symbol nil)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1310 (error "Error while loading file %s" file)))
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1311 ;; Throw an exception if the file does not exist
20829
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
1312 (error "No restore file %s" file)))
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1313 ((eq action 'read)
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1314 (put reftex-docstruct-symbol 'modified nil)
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1315 (if (file-exists-p file)
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1316 ;; load the file and return t for success
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1317 (condition-case nil
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1318 (progn
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1319 (load-file file)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1320 (reftex-check-parse-consistency)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1321 t)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1322 (error (message "Error while restoring file %s" file)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1323 (set reftex-docstruct-symbol nil)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1324 nil))
20829
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
1325 ;; return nil for failure, but no exception
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1326 nil))
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1327 ((eq action 'kill)
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1328 ;; Remove the file
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1329 (when (and (file-exists-p file) (file-writable-p file))
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1330 (message "Unlinking file %s" file)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1331 (delete-file file)))
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1332 (t
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1333 (put docstruct-symbol 'modified nil)
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1334 (save-excursion
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1335 (if (file-writable-p file)
78189
253d28d87f2a (reftex-access-parse-file): Do not risk destroying an existing buffer.
Reiner Steib <Reiner.Steib@gmx.de>
parents: 78185
diff changeset
1336 (with-temp-file file
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1337 (message "Writing parse file %s" (abbreviate-file-name file))
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1338 (insert (format ";; RefTeX parse info file\n"))
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1339 (insert (format ";; File: %s\n" master))
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1340 (insert (format ";; User: %s (%s)\n\n"
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1341 (user-login-name) (user-full-name)))
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1342 (insert "(set reftex-docstruct-symbol '(\n\n")
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1343 (let ((standard-output (current-buffer)))
85194
b4b8e47fe18b (reftex-erase-all-selection-and-index-buffers)
Glenn Morris <rgm@gnu.org>
parents: 82140
diff changeset
1344 (mapc
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1345 (lambda (x)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1346 (cond ((eq (car x) 'toc)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1347 ;; A toc entry. Do not save the marker.
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1348 ;; Save the markers position at position 8
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1349 (print (list 'toc "toc" (nth 2 x) (nth 3 x)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1350 nil (nth 5 x) (nth 6 x) (nth 7 x)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1351 (or (and (markerp (nth 4 x))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1352 (marker-position (nth 4 x)))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1353 (nth 8 x)))))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1354 ((and (not (eq t reftex-support-index))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1355 (eq (car x) 'index))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1356 ;; Don't save index entries
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1357 )
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1358 (t (print x))))
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1359 list))
78189
253d28d87f2a (reftex-access-parse-file): Do not risk destroying an existing buffer.
Reiner Steib <Reiner.Steib@gmx.de>
parents: 78185
diff changeset
1360 (insert "))\n\n"))
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1361 (error "Cannot write to file %s" file)))
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1362 t))))
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1363
23995
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
1364 (defun reftex-check-parse-consistency ()
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
1365 ;; Check if parse file is consistent, throw an error if not.
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
1366
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
1367 ;; Check if the master is the same: when moving a document, this will see it.
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
1368 (let* ((real-master (reftex-TeX-master-file))
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
1369 (parsed-master
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1370 (nth 1 (assq 'bof (symbol-value reftex-docstruct-symbol)))))
23995
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
1371 (unless (string= (file-truename real-master) (file-truename parsed-master))
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
1372 (message "Master file name in load file is different: %s versus %s"
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1373 parsed-master real-master)
23995
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
1374 (error "Master file name error")))
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
1375
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
1376 ;; Check for the existence of all document files
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
1377 ;;; (let* ((all (symbol-value reftex-docstruct-symbol)))
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
1378 ;;; (while all
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
1379 ;;; (when (and (eq (car (car all)) 'bof)
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1380 ;;; (not (file-regular-p (nth 1 (car all)))))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1381 ;;; (message "File %s in saved parse info not avalable" (cdr (car all)))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1382 ;;; (error "File not found"))
23995
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
1383 ;;; (setq all (cdr all))))
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
1384 )
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
1385
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1386 (defun reftex-select-external-document (xr-alist xr-index)
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1387 ;; Return index of an external document.
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1388 (let* ((len (length xr-alist)) (highest (1- (+ ?0 len)))
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
1389 (prompt (format "[%c-%c] Select TAB: Read prefix with completion"
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1390 ?0 highest))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1391 key prefix)
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1392 (cond
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1393 ((= len 1)
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1394 (message "No external documents available")
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1395 (ding) (sit-for 1) 0)
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1396 ((= len 2)
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1397 (- 1 xr-index))
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1398 (t
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1399 (save-excursion
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
1400 (let* ((length (apply 'max (mapcar
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1401 (lambda(x) (length (car x))) xr-alist)))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1402 (fmt (format " [%%c] %%-%ds %%s\n" length))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1403 (n (1- ?0)))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1404 (setq key
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1405 (reftex-select-with-char
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1406 prompt
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1407 (concat
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1408 "SELECT EXTERNAL DOCUMENT\n------------------------\n"
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1409 (mapconcat
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
1410 (lambda (x)
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1411 (format fmt (incf n) (or (car x) "")
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1412 (abbreviate-file-name (cdr x))))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1413 xr-alist ""))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1414 nil t))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1415 (cond
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1416 ((and (>= key ?0) (<= key highest)) (- key ?0))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1417 ((= key ?\C-i)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1418 (setq prefix (completing-read "Prefix: " xr-alist nil t))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1419 (- len (length (memq (assoc prefix xr-alist) xr-alist))))
60918
58a53f588384 * textmodes/refbib.el, textmodes/refer.el, textmodes/reftex-cite.el,
Werner LEMBERG <wl@gnu.org>
parents: 59845
diff changeset
1420 (t (error "Invalid document selection [%c]" key)))))))))
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1421
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1422 ;;; =========================================================================
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1423 ;;;
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1424 ;;; Finding files
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1425
23707
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
1426 (defun reftex-locate-file (file type master-dir &optional die)
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
1427 "Find FILE of type TYPE in MASTER-DIR or on the path associcted with TYPE.
60926
89202ce14f61 * textmodes/reftex-vars.el, textmodes/reftex.el: Replace `legal'
Werner LEMBERG <wl@gnu.org>
parents: 60918
diff changeset
1428 If the file does not have any of the valid extensions for TYPE,
23707
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
1429 try first the default extension and only then the naked file name.
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
1430 When DIE is non-nil, throw an error if file not found."
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
1431 (let* ((rec-values (if reftex-search-unrecursed-path-first '(nil t) '(t)))
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1432 (extensions (cdr (assoc type reftex-file-extensions)))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1433 (def-ext (car extensions))
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
1434 (ext-re (concat "\\("
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1435 (mapconcat 'regexp-quote extensions "\\|")
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1436 "\\)\\'"))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1437 (files (if (string-match ext-re file)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1438 (cons file nil)
69093
0ab6ebe82ad7 (reftex-locate-file): Search all extensions if
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
1439 (if reftex-try-all-extensions
0ab6ebe82ad7 (reftex-locate-file): Search all extensions if
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
1440 (append (mapcar (lambda (x) (concat file x))
0ab6ebe82ad7 (reftex-locate-file): Search all extensions if
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
1441 extensions)
0ab6ebe82ad7 (reftex-locate-file): Search all extensions if
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
1442 (list file))
0ab6ebe82ad7 (reftex-locate-file): Search all extensions if
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
1443 (list (concat file def-ext) file))))
0ab6ebe82ad7 (reftex-locate-file): Search all extensions if
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
1444 path old-path file1 f fs)
0ab6ebe82ad7 (reftex-locate-file): Search all extensions if
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
1445 (cond
0ab6ebe82ad7 (reftex-locate-file): Search all extensions if
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
1446 ((file-name-absolute-p file)
0ab6ebe82ad7 (reftex-locate-file): Search all extensions if
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
1447 (while (setq f (pop files))
0ab6ebe82ad7 (reftex-locate-file): Search all extensions if
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
1448 (if (file-regular-p f)
0ab6ebe82ad7 (reftex-locate-file): Search all extensions if
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
1449 (setq file1 f files nil))))
0ab6ebe82ad7 (reftex-locate-file): Search all extensions if
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
1450 ((and reftex-use-external-file-finders
0ab6ebe82ad7 (reftex-locate-file): Search all extensions if
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
1451 (assoc type reftex-external-file-finders))
0ab6ebe82ad7 (reftex-locate-file): Search all extensions if
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
1452 (setq file1 (reftex-find-file-externally file type master-dir)))
0ab6ebe82ad7 (reftex-locate-file): Search all extensions if
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
1453 (t
0ab6ebe82ad7 (reftex-locate-file): Search all extensions if
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
1454 (while (and (null file1) rec-values)
0ab6ebe82ad7 (reftex-locate-file): Search all extensions if
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
1455 (setq path (reftex-access-search-path
0ab6ebe82ad7 (reftex-locate-file): Search all extensions if
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
1456 type (pop rec-values) master-dir file))
0ab6ebe82ad7 (reftex-locate-file): Search all extensions if
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
1457 (setq fs files)
0ab6ebe82ad7 (reftex-locate-file): Search all extensions if
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
1458 (while (and (null file1) (setq f (pop fs)))
0ab6ebe82ad7 (reftex-locate-file): Search all extensions if
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
1459 (when (or (null old-path)
0ab6ebe82ad7 (reftex-locate-file): Search all extensions if
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
1460 (not (eq old-path path)))
0ab6ebe82ad7 (reftex-locate-file): Search all extensions if
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
1461 (setq old-path path
0ab6ebe82ad7 (reftex-locate-file): Search all extensions if
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
1462 path (cons master-dir path))
0ab6ebe82ad7 (reftex-locate-file): Search all extensions if
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
1463 (setq file1 (reftex-find-file-on-path f path master-dir)))))))
0ab6ebe82ad7 (reftex-locate-file): Search all extensions if
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
1464 (cond (file1 file1)
0ab6ebe82ad7 (reftex-locate-file): Search all extensions if
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
1465 (die (error "No such file: %s" file) nil)
0ab6ebe82ad7 (reftex-locate-file): Search all extensions if
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
1466 (t (message "No such file: %s (ignored)" file) nil))))
0ab6ebe82ad7 (reftex-locate-file): Search all extensions if
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
1467
23344
608bc56ca20e (reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents: 23200
diff changeset
1468 (defun reftex-find-file-externally (file type &optional master-dir)
608bc56ca20e (reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents: 23200
diff changeset
1469 ;; Use external program to find FILE.
23707
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
1470 ;; The program is taken from `reftex-external-file-finders'.
23344
608bc56ca20e (reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents: 23200
diff changeset
1471 ;; Interprete relative path definitions starting from MASTER-DIR.
608bc56ca20e (reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents: 23200
diff changeset
1472 (let ((default-directory (or master-dir default-directory))
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1473 (prg (cdr (assoc type reftex-external-file-finders)))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1474 out)
23344
608bc56ca20e (reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents: 23200
diff changeset
1475 (if (string-match "%f" prg)
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1476 (setq prg (replace-match file t t prg)))
23344
608bc56ca20e (reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents: 23200
diff changeset
1477 (setq out (apply 'reftex-process-string (split-string prg)))
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1478 (if (string-match "[ \t\n]+\\'" out) ; chomp
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1479 (setq out (replace-match "" nil nil out)))
23344
608bc56ca20e (reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents: 23200
diff changeset
1480 (cond ((equal out "") nil)
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1481 ((file-regular-p out) (expand-file-name out master-dir))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1482 (t nil))))
23344
608bc56ca20e (reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents: 23200
diff changeset
1483
608bc56ca20e (reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents: 23200
diff changeset
1484 (defun reftex-process-string (program &rest args)
608bc56ca20e (reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents: 23200
diff changeset
1485 "Execute PROGRAM with arguments ARGS and return its STDOUT as a string."
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1486 (let ((calling-dir default-directory)) ; remember default directory
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1487 (with-output-to-string
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1488 (with-current-buffer standard-output
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1489 (let ((default-directory calling-dir)) ; set default directory
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1490 (apply 'call-process program nil '(t nil) nil args))))))
23344
608bc56ca20e (reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents: 23200
diff changeset
1491
23707
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
1492 (defun reftex-access-search-path (type &optional recurse master-dir file)
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
1493 ;; Access path from environment variables. TYPE is either "tex" or "bib".
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1494 ;; When RECURSE is t, expand path elements ending in `//' recursively.
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1495 ;; Relative path elements are left as they are. However, relative recursive
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1496 ;; elements are expanded with MASTER-DIR as default directory.
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1497 ;; The expanded path is cached for the next search.
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1498 ;; FILE is just for the progress message.
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1499 ;; Returns the derived path.
23707
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
1500 (let* ((pathvar (intern (concat "reftex-" type "-path"))))
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1501 (when (null (get pathvar 'status))
23707
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
1502 ;; Get basic path
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
1503 (set pathvar
62467
35f6599373fc * textmodes/reftex-vars.el (reftex-cite-format-builtin): Support
Carsten Dominik <dominik@science.uva.nl>
parents: 60926
diff changeset
1504 (reftex-uniquify
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1505 (reftex-parse-colon-path
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1506 (mapconcat
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
1507 (lambda(x)
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1508 (if (string-match "^!" x)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1509 (apply 'reftex-process-string
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1510 (split-string (substring x 1)))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1511 (or (getenv x) x)))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1512 ;; For consistency, the next line should look like this:
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1513 ;; (cdr (assoc type reftex-path-environment))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1514 ;; However, historically we have separate options for the
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1515 ;; environment variables, so we have to do this:
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
1516 (symbol-value (intern (concat "reftex-" type
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1517 "path-environment-variables")))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1518 path-separator))))
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1519 (put pathvar 'status 'split)
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1520 ;; Check if we have recursive elements
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1521 (let ((path (symbol-value pathvar)) dir rec)
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1522 (while (setq dir (pop path))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1523 (when (string= (substring dir -2) "//")
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1524 (if (file-name-absolute-p dir)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1525 (setq rec (or rec 'absolute))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1526 (setq rec 'relative))))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1527 (put pathvar 'rec-type rec)))
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1528
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1529 (if recurse
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1530 ;; Return the recursive expansion of the path
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1531 (cond
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1532 ((not (get pathvar 'rec-type))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1533 ;; Path does not contain recursive elements - use simple path
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1534 (symbol-value pathvar))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1535 ((or (not (get pathvar 'recursive-path))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1536 (and (eq (get pathvar 'rec-type) 'relative)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1537 (not (equal master-dir (get pathvar 'master-dir)))))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1538 ;; Either: We don't have a recursive expansion yet.
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1539 ;; or: Relative recursive path elements need to be expanded
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1540 ;; relative to new default directory
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1541 (message "Expanding search path to find %s file: %s ..." type file)
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
1542 (put pathvar 'recursive-path
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1543 (reftex-expand-path (symbol-value pathvar) master-dir))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1544 (put pathvar 'master-dir master-dir)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1545 (get pathvar 'recursive-path))
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
1546 (t
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1547 ;; Recursive path computed earlier is still OK.
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1548 (get pathvar 'recursive-path)))
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1549 ;; The simple path was requested
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1550 (symbol-value pathvar))))
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1551
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1552 (defun reftex-find-file-on-path (file path &optional def-dir)
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1553 ;; Find FILE along the directory list PATH.
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1554 ;; DEF-DIR is the default directory for expanding relative path elements.
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1555 (catch 'exit
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1556 (when (file-name-absolute-p file)
23200
4750ba95a176 (reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents: 22991
diff changeset
1557 (if (file-regular-p file)
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1558 (throw 'exit file)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1559 (throw 'exit nil)))
23707
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
1560 (let* ((thepath path) file1 dir)
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1561 (while (setq dir (pop thepath))
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1562 (when (string= (substring dir -2) "//")
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1563 (setq dir (substring dir 0 -1)))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1564 (setq file1 (expand-file-name file (expand-file-name dir def-dir)))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1565 (if (file-regular-p file1)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1566 (throw 'exit file1)))
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1567 ;; No such file
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1568 nil)))
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1569
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1570 (defun reftex-parse-colon-path (path)
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1571 ;; Like parse-colon-parse, but // or /~ are left alone.
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1572 ;; Trailing ! or !! will be converted into `//' (emTeX convention)
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1573 (mapcar
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1574 (lambda (dir)
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
1575 (if (string-match "\\(//+\\|/*!+\\)\\'" dir)
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1576 (setq dir (replace-match "//" t t dir)))
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1577 (file-name-as-directory dir))
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1578 (delete "" (split-string path (concat path-separator "+")))))
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1579
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1580 (defun reftex-expand-path (path &optional default-dir)
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1581 ;; Expand parts of path ending in `//' recursively into directory list.
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1582 ;; Relative recursive path elements are expanded relative to DEFAULT-DIR.
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1583 (let (path1 dir recursive)
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1584 (while (setq dir (pop path))
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1585 (if (setq recursive (string= (substring dir -2) "//"))
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1586 (setq dir (substring dir 0 -1)))
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1587 (if (and recursive
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1588 (not (file-name-absolute-p dir)))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1589 (setq dir (expand-file-name dir default-dir)))
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1590 (if recursive
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1591 ;; Expand recursively
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1592 (setq path1 (append (reftex-recursive-directory-list dir) path1))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1593 ;; Keep unchanged
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1594 (push dir path1)))
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1595 (nreverse path1)))
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1596
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1597 (defun reftex-recursive-directory-list (dir)
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1598 ;; Return a list of all directories below DIR, including DIR itself
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1599 (let ((path (list dir)) path1 file files)
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1600 (while (setq dir (pop path))
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1601 (when (file-directory-p dir)
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1602 (setq files (nreverse (directory-files dir t "[^.]")))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1603 (while (setq file (pop files))
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
1604 (if (file-directory-p file)
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1605 (push (file-name-as-directory file) path)))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1606 (push dir path1)))
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1607 path1))
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1608
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1609 ;;; =========================================================================
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1610 ;;;
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1611 ;;; Parser functions
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1612
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1613 (autoload 'reftex-parse-one "reftex-parse"
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1614 "Re-parse this file." t)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1615 (autoload 'reftex-parse-all "reftex-parse"
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1616 "Re-parse entire document." t)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1617 (autoload 'reftex-do-parse "reftex-parse")
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1618 (autoload 'reftex-where-am-I "reftex-parse")
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1619 (autoload 'reftex-init-section-numbers "reftex-parse")
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1620 (autoload 'reftex-section-info "reftex-parse")
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1621 (autoload 'reftex-section-number "reftex-parse")
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1622 (autoload 'reftex-what-macro "reftex-parse")
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1623 (autoload 'reftex-what-macro-safe "reftex-parse")
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1624 (autoload 'reftex-index-info "reftex-parse")
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1625 (autoload 'reftex-index-info-safe "reftex-parse")
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1626 (autoload 'reftex-short-context "reftex-parse")
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1627 (autoload 'reftex-what-environment "reftex-parse")
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1628 (autoload 'reftex-what-special-env "reftex-parse")
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1629 (autoload 'reftex-move-over-touching-args "reftex-parse")
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1630 (autoload 'reftex-notice-new "reftex-parse")
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1631 (autoload 'reftex-nth-arg "reftex-parse")
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1632 (autoload 'reftex-locate-bibliography-files "reftex-parse")
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1633 (autoload 'reftex-ensure-index-support "reftex-parse")
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1634 (autoload 'reftex-everything-regexp "reftex-parse")
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1635
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1636
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1637 ;;; =========================================================================
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1638 ;;;
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1639 ;;; Labels and References
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1640
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1641 (autoload 'reftex-label-location "reftex-ref")
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1642 (autoload 'reftex-label-info-update "reftex-ref")
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1643 (autoload 'reftex-label-info "reftex-ref")
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1644 (autoload 'reftex-label "reftex-ref"
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1645 "Insert a unique label." t)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1646 (autoload 'reftex-reference "reftex-ref"
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1647 "Make a LaTeX reference." t)
37998
706af946b1e7 * reftex-ref.el (reftex-select-label-help): Added "z" key
Carsten Dominik <dominik@science.uva.nl>
parents: 36469
diff changeset
1648 (autoload 'reftex-varioref-vref "reftex-ref"
706af946b1e7 * reftex-ref.el (reftex-select-label-help): Added "z" key
Carsten Dominik <dominik@science.uva.nl>
parents: 36469
diff changeset
1649 "Make a varioref reference." t)
706af946b1e7 * reftex-ref.el (reftex-select-label-help): Added "z" key
Carsten Dominik <dominik@science.uva.nl>
parents: 36469
diff changeset
1650 (autoload 'reftex-fancyref-fref "reftex-ref"
706af946b1e7 * reftex-ref.el (reftex-select-label-help): Added "z" key
Carsten Dominik <dominik@science.uva.nl>
parents: 36469
diff changeset
1651 "Make a fancyref \\fref reference." t)
706af946b1e7 * reftex-ref.el (reftex-select-label-help): Added "z" key
Carsten Dominik <dominik@science.uva.nl>
parents: 36469
diff changeset
1652 (autoload 'reftex-fancyref-Fref "reftex-ref"
706af946b1e7 * reftex-ref.el (reftex-select-label-help): Added "z" key
Carsten Dominik <dominik@science.uva.nl>
parents: 36469
diff changeset
1653 "Make a fancyref \\Fref reference." t)
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1654 (autoload 'reftex-show-label-location "reftex-ref")
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1655 (autoload 'reftex-query-label-type "reftex-ref")
47050
904fd28be439 Update to RefTeX 4.19
Carsten Dominik <dominik@science.uva.nl>
parents: 46973
diff changeset
1656 (autoload 'reftex-goto-label "reftex-ref"
904fd28be439 Update to RefTeX 4.19
Carsten Dominik <dominik@science.uva.nl>
parents: 46973
diff changeset
1657 "Prompt for label name and go to that location." t)
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1658
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1659 ;;; =========================================================================
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1660 ;;;
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1661 ;;; Table of contents
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1662
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1663 (autoload 'reftex-toc "reftex-toc"
47050
904fd28be439 Update to RefTeX 4.19
Carsten Dominik <dominik@science.uva.nl>
parents: 46973
diff changeset
1664 "Show the table of contents for the current document." t)
904fd28be439 Update to RefTeX 4.19
Carsten Dominik <dominik@science.uva.nl>
parents: 46973
diff changeset
1665 (autoload 'reftex-toc-recenter "reftex-toc"
904fd28be439 Update to RefTeX 4.19
Carsten Dominik <dominik@science.uva.nl>
parents: 46973
diff changeset
1666 "Display the TOC window and highlight line corresponding to current position." t)
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
1667 (autoload 'reftex-toggle-auto-toc-recenter "reftex-toc"
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1668 "Toggle automatic recentering of TOC window." t)
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1669
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1670 ;;; =========================================================================
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1671 ;;;
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1672 ;;; BibTeX citations.
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1673
29775
31536c6cf2e3 * textmodes/reftex.el (reftex-find-citation-regexp-format):
Carsten Dominik <dominik@science.uva.nl>
parents: 27601
diff changeset
1674 (autoload 'reftex-citep "reftex-cite")
31536c6cf2e3 * textmodes/reftex.el (reftex-find-citation-regexp-format):
Carsten Dominik <dominik@science.uva.nl>
parents: 27601
diff changeset
1675 (autoload 'reftex-citet "reftex-cite")
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1676 (autoload 'reftex-make-cite-echo-string "reftex-cite")
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1677 (autoload 'reftex-get-bibfile-list "reftex-cite")
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1678 (autoload 'reftex-pop-to-bibtex-entry "reftex-cite")
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1679 (autoload 'reftex-end-of-bib-entry "reftex-cite")
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1680 (autoload 'reftex-parse-bibtex-entry "reftex-cite")
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1681 (autoload 'reftex-citation "reftex-cite"
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1682 "Make a citation using BibTeX database files." t)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1683 (autoload 'reftex-default-bibliography "reftex-cite")
46973
11e08f9901ea Update to RefTeX 4.18
Carsten Dominik <dominik@science.uva.nl>
parents: 46928
diff changeset
1684 (autoload 'reftex-bib-or-thebib "reftex-cite")
59534
9bad65481674 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 52401
diff changeset
1685 (autoload 'reftex-create-bibtex-file "reftex-cite")
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1686
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1687 ;;; =========================================================================
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1688 ;;;
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1689 ;;; Selection
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1690
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1691 (autoload 'reftex-select-label-mode "reftex-sel")
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1692 (autoload 'reftex-select-bib-mode "reftex-sel")
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1693 (autoload 'reftex-find-start-point "reftex-sel")
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1694 (autoload 'reftex-insert-docstruct "reftex-sel")
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1695 (autoload 'reftex-get-offset "reftex-sel")
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1696 (autoload 'reftex-select-item "reftex-sel")
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1697
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1698
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1699 ;;; =========================================================================
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1700 ;;;
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1701 ;;; Index support
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1702
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1703 (autoload 'reftex-index "reftex-index"
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1704 "Query for an index macro and insert it along with its argments." t)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1705 (autoload 'reftex-index-selection-or-word "reftex-index"
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1706 "Put selection or the word near point into the default index macro." t)
26910
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
1707 (autoload 'reftex-index-phrase-selection-or-word "reftex-index"
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
1708 "Put selection or the word near point into Index Phrases File." t)
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1709 (autoload 'reftex-display-index "reftex-index"
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1710 "Display a buffer with an index compiled from the current document." t)
26910
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
1711 (autoload 'reftex-index-visit-phrases-buffer "reftex-index"
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
1712 "Visit the Index Phrases File." t)
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
1713 (autoload 'reftex-index-phrases-mode "reftex-index"
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
1714 "Major mode for managing the Index phrases of a LaTeX document." t)
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1715 (autoload 'reftex-index-complete-tag "reftex-index")
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1716 (autoload 'reftex-index-complete-key "reftex-index")
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1717 (autoload 'reftex-index-show-entry "reftex-index")
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1718 (autoload 'reftex-index-select-tag "reftex-index")
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1719
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1720
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1721 ;;; =========================================================================
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1722 ;;;
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1723 ;;; View cross references
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1724
27170
3cba3e588544 renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents: 27034
diff changeset
1725 (autoload 'reftex-view-crossref "reftex-dcr"
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1726 "View cross reference of \\ref or \\cite macro at point." t)
27170
3cba3e588544 renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents: 27034
diff changeset
1727 (autoload 'reftex-mouse-view-crossref "reftex-dcr"
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1728 "View cross reference of \\ref or \\cite macro where you click." t)
27170
3cba3e588544 renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents: 27034
diff changeset
1729 (autoload 'reftex-toggle-auto-view-crossref "reftex-dcr")
3cba3e588544 renamed reftex-vcr.el to reftex-dcr.el
Carsten Dominik <dominik@science.uva.nl>
parents: 27034
diff changeset
1730 (autoload 'reftex-view-crossref-from-bibtex "reftex-dcr"
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1731 "View location in a LaTeX document which cites the BibTeX entry at point." t)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1732
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1733
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1734 ;;; =========================================================================
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1735 ;;;
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1736 ;;; Operations on entire Multifile documents
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1737
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1738 (autoload 'reftex-create-tags-file "reftex-global"
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1739 "Create TAGS file by running `etags' on the current document." t)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1740 (autoload 'reftex-grep-document "reftex-global"
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1741 "Run grep query through all files related to this document." t)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1742 (autoload 'reftex-search-document "reftex-global"
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1743 "Regexp search through all files of the current TeX document." t)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1744 (autoload 'reftex-query-replace-document "reftex-global"
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1745 "Run a query-replace-regexp of FROM with TO over the entire TeX document." t)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1746 (autoload 'reftex-find-duplicate-labels "reftex-global"
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1747 "Produce a list of all duplicate labels in the document." t)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1748 (autoload 'reftex-change-label "reftex-global"
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1749 "Query replace FROM with TO in all \\label and \\ref commands." t)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1750 (autoload 'reftex-renumber-simple-labels "reftex-global"
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1751 "Renumber all simple labels in the document to make them sequentially." t)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1752 (autoload 'reftex-save-all-document-buffers "reftex-global"
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1753 "Save all documents associated with the current document." t)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1754
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1755
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1756 ;;; =========================================================================
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1757 ;;;
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1758 ;;; AUCTeX Interface
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1759
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1760 (autoload 'reftex-arg-label "reftex-auc")
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1761 (autoload 'reftex-arg-cite "reftex-auc")
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1762 (autoload 'reftex-arg-index-tag "reftex-auc")
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1763 (autoload 'reftex-arg-index "reftex-auc")
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1764 (autoload 'reftex-plug-into-AUCTeX "reftex-auc")
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1765 (autoload 'reftex-toggle-plug-into-AUCTeX "reftex-auc"
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1766 "Toggle Interface between AUCTeX and RefTeX on and off." t)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1767 (autoload 'reftex-add-label-environments "reftex-auc")
26910
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
1768 (autoload 'reftex-add-to-label-alist "reftex-auc")
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1769 (autoload 'reftex-add-section-levels "reftex-auc")
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1770 (autoload 'reftex-notice-new-section "reftex-auc")
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1771
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1772 ;;; =========================================================================
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1773 ;;;
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1774 ;;; Some generally useful functions
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1775
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1776 (defun reftex-typekey-check (typekey conf-variable &optional n)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1777 ;; Check if CONF-VARIABLE is true or contains TYPEKEY
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1778 (and n (setq conf-variable (nth n conf-variable)))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1779 (or (eq conf-variable t)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1780 (and (stringp conf-variable)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1781 (string-match (concat "[" conf-variable "]") typekey))))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1782
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1783 (defun reftex-check-recursive-edit ()
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1784 ;; Check if we are already in a recursive edit. Abort with helpful
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1785 ;; message if so.
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1786 (if (marker-position reftex-recursive-edit-marker)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1787 (error
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1788 (substitute-command-keys
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1789 "In unfinished selection process. Finish, or abort with \\[abort-recursive-edit]"))))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1790
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1791 (defun reftex-in-comment ()
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1792 (save-excursion
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1793 (skip-chars-backward "^%\n\r")
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1794 (eq (preceding-char) ?%)))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1795
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1796 (defun reftex-no-props (string)
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1797 ;; Return STRING with all text properties removed
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1798 (and (stringp string)
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1799 (set-text-properties 0 (length string) nil string))
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1800 string)
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1801
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1802 (defun reftex-match-string (n)
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1803 ;; Match string without properties
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1804 (when (match-beginning n)
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1805 (buffer-substring-no-properties (match-beginning n) (match-end n))))
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1806
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1807 (defun reftex-region-active-p ()
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1808 "Is transient-mark-mode on and the region active?
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1809 Works on both Emacs and XEmacs."
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1810 (if (featurep 'xemacs)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1811 (and zmacs-regions (region-active-p))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1812 (and transient-mark-mode mark-active)))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1813
20829
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
1814 (defun reftex-kill-buffer (buffer)
20979
38e7bcbb3595 (reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents: 20953
diff changeset
1815 ;; Kill buffer if it exists.
20829
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
1816 (and (setq buffer (get-buffer buffer))
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
1817 (kill-buffer buffer)))
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
1818
20979
38e7bcbb3595 (reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents: 20953
diff changeset
1819 (defun reftex-erase-buffer (&optional buffer)
38e7bcbb3595 (reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents: 20953
diff changeset
1820 ;; Erase BUFFER if it exists. BUFFER defaults to current buffer.
38e7bcbb3595 (reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents: 20953
diff changeset
1821 ;; This even erases read-only buffers.
38e7bcbb3595 (reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents: 20953
diff changeset
1822 (cond
38e7bcbb3595 (reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents: 20953
diff changeset
1823 ((null buffer)
38e7bcbb3595 (reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents: 20953
diff changeset
1824 ;; erase current buffer
38e7bcbb3595 (reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents: 20953
diff changeset
1825 (let ((buffer-read-only nil)) (erase-buffer)))
38e7bcbb3595 (reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents: 20953
diff changeset
1826 ((setq buffer (get-buffer buffer))
38e7bcbb3595 (reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents: 20953
diff changeset
1827 ;; buffer exists
38e7bcbb3595 (reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents: 20953
diff changeset
1828 (save-excursion
38e7bcbb3595 (reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents: 20953
diff changeset
1829 (set-buffer buffer)
38e7bcbb3595 (reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents: 20953
diff changeset
1830 (let ((buffer-read-only nil)) (erase-buffer))))))
20829
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
1831
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1832 (defun reftex-this-word (&optional class)
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1833 ;; Grab the word around point.
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1834 (setq class (or class "-a-zA-Z0-9:_/.*;|"))
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1835 (save-excursion
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1836 (buffer-substring-no-properties
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1837 (progn (skip-chars-backward class) (point))
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1838 (progn (skip-chars-forward class) (point)))))
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1839
26910
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
1840 (defun reftex-number (n unit &optional ending)
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
1841 (if (and (integerp n) (stringp unit))
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
1842 (format "%d %s%s" n unit (if (= n 1) "" (or ending "s")))
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
1843 ""))
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
1844
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1845 (defun reftex-all-assq (key list)
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1846 ;; Return a list of all associations of KEY in LIST. Comparison with eq.
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1847 (let (rtn)
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1848 (while (setq list (memq (assq key list) list))
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1849 (push (car list) rtn)
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1850 (pop list))
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1851 (nreverse rtn)))
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1852
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1853 (defun reftex-all-assoc-string (key list)
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1854 ;; Return a list of all associations of KEY in LIST. Comparison with string=.
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1855 (let (rtn)
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1856 (while list
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1857 (if (string= (car (car list)) key)
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1858 (push (car list) rtn))
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1859 (pop list))
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1860 (nreverse rtn)))
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1861
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1862 (defun reftex-last-assoc-before-elt (key elt list &optional exclusive)
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1863 ;; Find the last association of KEY in LIST before or at ELT
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1864 ;; ELT is found in LIST with equal, not eq.
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1865 ;; Returns nil when either KEY or elt are not found in LIST.
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1866 ;; When EXCLUSIVE is non-nil, ELT cannot be the return value.
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1867 ;; On success, returns the association.
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1868 (let* ((elt (car (member elt list))) (ex (not exclusive)) ass last-ass)
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1869 (while (and (setq ass (assoc key list))
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1870 (setq list (memq ass list))
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1871 (or ex (not (eq elt (car list))))
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1872 (memq elt list))
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1873 (setq last-ass ass
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1874 list (cdr list)))
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1875 last-ass))
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1876
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1877 (defun reftex-sublist-nth (list nth predicate &optional completion)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1878 ;; Make a list of the NTH elements of all members of LIST which
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1879 ;; fulfill PREDICATE.
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1880 ;; When COMPLETION is non-nil, make all elements of the resulting
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1881 ;; list also a list, so that the result can be used for completion.
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1882 (let (rtn)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1883 (while list
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1884 (if (funcall predicate (car list))
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1885 (push (if completion
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
1886 (list (nth nth (car list)))
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1887 (nth nth (car list)))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1888 rtn))
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1889 (setq list (cdr list)))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1890 (nreverse rtn)))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1891
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1892 (defun reftex-make-selection-buffer-name (type &optional index)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1893 ;; Make unique name for a selection buffer.
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1894 (format " *RefTeX[%s][%d]*"
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1895 type (or index (get reftex-docstruct-symbol :master-index) 0)))
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1896
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1897 (defun reftex-make-index-buffer-name (tag &optional cnt)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1898 ;; Make unique name for an index buffer.
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1899 (format "*Index[%s][%d]*"
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1900 tag (or cnt (get reftex-docstruct-symbol :master-index) 0)))
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1901
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1902 (defun reftex-truncate (string ncols &optional ellipses padding)
23707
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
1903 ;; Truncate STRING to NCOLS characters.
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
1904 ;; When PADDING is non-nil, and string is shorter than NCOLS, fill with
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
1905 ;; white space to NCOLS characters. When ELLIPSES is non-nil and the
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
1906 ;; string needs to be truncated, replace last 3 characters by dots.
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1907 (setq string
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1908 (if (<= (length string) ncols)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1909 string
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1910 (if ellipses
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1911 (concat (substring string 0 (- ncols 3)) "...")
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1912 (substring string 0 ncols))))
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1913 (if padding
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1914 (format (format "%%-%ds" ncols) string)
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1915 string))
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1916
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1917 (defun reftex-nearest-match (regexp &optional max-length)
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1918 ;; Find the nearest match of REGEXP. Set the match data.
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1919 ;; If POS is given, calculate distances relative to it.
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1920 ;; Return nil if there is no match.
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1921 (let ((pos (point))
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
1922 (dist (or max-length (length regexp)))
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1923 match1 match2 match)
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1924 (goto-char (min (+ pos dist) (point-max)))
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1925 (when (re-search-backward regexp nil t)
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1926 (setq match1 (match-data)))
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1927 (goto-char (max (- pos dist) (point-min)))
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1928 (when (re-search-forward regexp nil t)
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1929 (setq match2 (match-data)))
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1930 (goto-char pos)
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1931 (setq match
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1932 (cond
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1933 ((not match1) match2)
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1934 ((not match2) match1)
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1935 ((< (abs (- pos (car match1))) (abs (- pos (car match2)))) match1)
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1936 (t match2)))
21170
dbe101f49d57 (reftex-nearest-match): store-match-data => set-match-data.
Richard M. Stallman <rms@gnu.org>
parents: 21130
diff changeset
1937 (if match (progn (set-match-data match) t) nil)))
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1938
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1939 (defun reftex-auto-mode-alist ()
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1940 ;; Return an `auto-mode-alist' with only the .gz (etc) thingies.
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1941 ;; Stolen from gnus nnheader.
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1942 (let ((alist auto-mode-alist)
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1943 out)
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1944 (while alist
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1945 (when (listp (cdr (car alist)))
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1946 (push (car alist) out))
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1947 (pop alist))
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1948 (nreverse out)))
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1949
23995
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
1950 (defun reftex-window-height ()
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
1951 (if (fboundp 'window-displayed-height)
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
1952 (window-displayed-height)
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
1953 (window-height)))
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
1954
20829
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
1955 (defun reftex-enlarge-to-fit (buf2 &optional keep-current)
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1956 ;; Enlarge other window displaying buffer to show whole buffer if possible.
20829
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
1957 ;; If KEEP-CURRENT in non-nil, current buffer must remain visible.
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
1958 (let* ((win1 (selected-window))
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1959 (buf1 (current-buffer))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1960 (win2 (get-buffer-window buf2))) ;; Only on current frame.
20829
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
1961 (when win2
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
1962 (select-window win2)
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1963 (unless (and (pos-visible-in-window-p (point-min))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1964 (pos-visible-in-window-p (point-max)))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1965 (enlarge-window (1+ (- (count-lines (point-min) (point-max))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1966 (reftex-window-height))))))
20829
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
1967 (cond
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
1968 ((window-live-p win1) (select-window win1))
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
1969 (keep-current
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
1970 ;; we must have the old buffer!
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
1971 (switch-to-buffer-other-window buf1)
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
1972 (shrink-window (- (window-height) window-min-height))))))
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
1973
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1974 (defun reftex-select-with-char (prompt help-string &optional delay-time scroll)
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1975 ;; Offer to select something with PROMPT and, after DELAY-TIME seconds,
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1976 ;; also with HELP-STRING.
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1977 ;; When SCROLL is non-nil, use SPC and DEL to scroll help window.
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1978 (let ((char ?\?))
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1979 (save-window-excursion
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1980 (catch 'exit
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1981 (message (concat prompt " (?=Help)"))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1982 (when (or (sit-for (or delay-time 0))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1983 (= ?\? (setq char (read-char-exclusive))))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1984 (reftex-kill-buffer "*RefTeX Select*")
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1985 (switch-to-buffer-other-window "*RefTeX Select*")
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1986 (insert help-string)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1987 (goto-char 1)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1988 (unless (and (pos-visible-in-window-p (point-min))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1989 (pos-visible-in-window-p (point-max)))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1990 (enlarge-window (1+ (- (count-lines (point-min) (point-max))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1991 (reftex-window-height)))))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1992 (setq truncate-lines t))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1993 (if (and (pos-visible-in-window-p (point-min))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1994 (pos-visible-in-window-p (point-max)))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1995 nil
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1996 (setq prompt (concat prompt (if scroll " (SPC/DEL=Scroll)" ""))))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1997 (message prompt)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1998 (and (equal char ?\?) (setq char (read-char-exclusive)))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1999 (while t
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2000 (cond ((equal char ?\C-g) (keyboard-quit))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2001 ((equal char ?\?))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2002 ((and scroll (equal char ?\ ))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2003 (condition-case nil (scroll-up) (error nil))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2004 (message prompt))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2005 ((and scroll (equal char ?\C-? ))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2006 (condition-case nil (scroll-down) (error nil))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2007 (message prompt))
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
2008 (t (message "")
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2009 (throw 'exit char)))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2010 (setq char (read-char-exclusive)))))))
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
2011
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2012
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2013 (defun reftex-make-regexp-allow-for-ctrl-m (string)
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2014 ;; convert STRING into a regexp, allowing ^M for \n and vice versa
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2015 (let ((start -2))
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2016 (setq string (regexp-quote string))
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2017 (while (setq start (string-match "[\n\r]" string (+ 3 start)))
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2018 (setq string (replace-match "[\n\r]" nil t string)))
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2019 string))
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2020
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2021 (defun reftex-get-buffer-visiting (file)
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2022 ;; return a buffer visiting FILE
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2023 (cond
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2024 ((boundp 'find-file-compare-truenames) ; XEmacs
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2025 (let ((find-file-compare-truenames t))
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2026 (get-file-buffer file)))
20177
6ebc3e300106 The menu now used toggle and radio for some items.
Karl Heuer <kwzh@gnu.org>
parents: 20102
diff changeset
2027 ((fboundp 'find-buffer-visiting) ; Emacs
6ebc3e300106 The menu now used toggle and radio for some items.
Karl Heuer <kwzh@gnu.org>
parents: 20102
diff changeset
2028 (find-buffer-visiting file))
20829
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
2029 (t (error "This should not happen (reftex-get-buffer-visiting)"))))
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2030
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2031 ;; Define `current-message' for compatibility with XEmacs prior to 20.4
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2032 (defvar message-stack)
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2033 (if (and (featurep 'xemacs)
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2034 (not (fboundp 'current-message)))
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2035 (defun current-message (&optional frame)
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2036 (cdr (car message-stack))))
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2037
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2038 (defun reftex-visited-files (list)
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2039 ;; Takes a list of filenames and returns the buffers of those already visited
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2040 (delq nil (mapcar (lambda (x) (if (reftex-get-buffer-visiting x) x nil))
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2041 list)))
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2042
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2043 (defun reftex-get-file-buffer-force (file &optional mark-to-kill)
18321
0ed97be54a28 Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents: 18220
diff changeset
2044 ;; Return a buffer visiting file. Make one, if necessary.
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2045 ;; If neither such a buffer nor the file exist, return nil.
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2046 ;; If MARK-TO-KILL is t and there is no live buffer, visit the file with
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2047 ;; initializations according to `reftex-initialize-temporary-buffers',
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2048 ;; and mark the buffer to be killed after use.
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2049
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2050 (let ((buf (reftex-get-buffer-visiting file)))
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2051
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2052 (cond (buf
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2053 ;; We have it already as a buffer - just return it
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2054 buf)
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2055
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2056 ((file-readable-p file)
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2057 ;; At least there is such a file and we can read it.
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2058
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2059 (if (or (not mark-to-kill)
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2060 (eq t reftex-initialize-temporary-buffers))
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2061
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2062 ;; Visit the file with full magic
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2063 (setq buf (find-file-noselect file))
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2064
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2065 ;; Else: Visit the file just briefly, without or
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2066 ;; with limited Magic
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2067
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2068 ;; The magic goes away
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2069 (let ((format-alist nil)
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2070 (auto-mode-alist (reftex-auto-mode-alist))
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2071 (default-major-mode 'fundamental-mode)
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2072 (enable-local-variables nil)
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2073 (after-insert-file-functions nil))
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2074 (setq buf (find-file-noselect file)))
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2075
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2076 ;; Is there a hook to run?
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2077 (when (listp reftex-initialize-temporary-buffers)
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2078 (save-excursion
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2079 (set-buffer buf)
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2080 (run-hooks 'reftex-initialize-temporary-buffers))))
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2081
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2082 ;; Lets see if we got a license to kill :-|
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2083 (and mark-to-kill
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2084 (add-to-list 'reftex-buffers-to-kill buf))
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2085
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2086 ;; Return the new buffer
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2087 buf)
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2088
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2089 ;; If no such file exists, return nil
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2090 (t nil))))
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2091
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2092 (defun reftex-kill-temporary-buffers (&optional buffer)
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2093 ;; Kill all buffers in the list reftex-kill-temporary-buffers.
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2094 (cond
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2095 (buffer
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2096 (when (member buffer reftex-buffers-to-kill)
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2097 (kill-buffer buffer)
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2098 (setq reftex-buffers-to-kill
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2099 (delete buffer reftex-buffers-to-kill))))
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2100 (t
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2101 (while (setq buffer (pop reftex-buffers-to-kill))
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2102 (when (bufferp buffer)
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2103 (and (buffer-modified-p buffer)
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2104 (y-or-n-p (format "Save file %s? "
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2105 (buffer-file-name buffer)))
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2106 (save-excursion
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2107 (set-buffer buffer)
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2108 (save-buffer)))
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2109 (kill-buffer buffer))
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2110 (pop reftex-buffers-to-kill)))))
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2111
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2112 (defun reftex-splice-symbols-into-list (list alist)
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2113 ;; Splice the association in ALIST of any symbols in LIST into the list.
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2114 ;; Return new list.
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2115 (let (rtn tmp)
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2116 (while list
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2117 (while (and (not (null (car list))) ;; keep list elements nil
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2118 (symbolp (car list)))
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2119 (setq tmp (car list))
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2120 (cond
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2121 ((assoc tmp alist)
19660
fa3d4e7a76d9 (reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents: 18321
diff changeset
2122 (setq list (append (nth 2 (assoc tmp alist)) (cdr list))))
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2123 (t
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2124 (error "Cannot treat symbol %s in reftex-label-alist"
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2125 (symbol-name tmp)))))
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2126 (push (pop list) rtn))
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2127 (nreverse rtn)))
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2128
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2129 (defun reftex-remove-symbols-from-list (list)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2130 ;; Remove all symbols from list
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2131 (let (rtn)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2132 (while list
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2133 (unless (symbolp (car list))
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2134 (push (car list) rtn))
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2135 (setq list (cdr list)))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2136 (nreverse rtn)))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2137
25802
4c4fabd16782 Version number change
Carsten Dominik <dominik@science.uva.nl>
parents: 25279
diff changeset
2138 (defun reftex-uniquify (list)
62467
35f6599373fc * textmodes/reftex-vars.el (reftex-cite-format-builtin): Support
Carsten Dominik <dominik@science.uva.nl>
parents: 60926
diff changeset
2139 ;; Return a list of all elements in LIST, but each only once, keeping order
25802
4c4fabd16782 Version number change
Carsten Dominik <dominik@science.uva.nl>
parents: 25279
diff changeset
2140 (let (new elm)
4c4fabd16782 Version number change
Carsten Dominik <dominik@science.uva.nl>
parents: 25279
diff changeset
2141 (while list
4c4fabd16782 Version number change
Carsten Dominik <dominik@science.uva.nl>
parents: 25279
diff changeset
2142 (setq elm (pop list))
4c4fabd16782 Version number change
Carsten Dominik <dominik@science.uva.nl>
parents: 25279
diff changeset
2143 (unless (member elm new)
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2144 (push elm new)))
25802
4c4fabd16782 Version number change
Carsten Dominik <dominik@science.uva.nl>
parents: 25279
diff changeset
2145 (nreverse new)))
4c4fabd16782 Version number change
Carsten Dominik <dominik@science.uva.nl>
parents: 25279
diff changeset
2146
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2147 (defun reftex-uniquify-by-car (alist &optional keep-list)
18321
0ed97be54a28 Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents: 18220
diff changeset
2148 ;; Return a list of all elements in ALIST, but each car only once.
0ed97be54a28 Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents: 18220
diff changeset
2149 ;; Elements of KEEP-LIST are not removed even if duplicate.
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2150 (let (new elm)
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2151 (while alist
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2152 (setq elm (pop alist))
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2153 (if (or (member (car elm) keep-list)
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2154 (not (assoc (car elm) new)))
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2155 (push elm new)))
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2156 (nreverse new)))
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2157
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2158 (defun reftex-abbreviate-title (string)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2159 (reftex-convert-string string "[-~ \t\n\r,;]" nil t t
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2160 5 40 nil 1 " " (nth 5 reftex-derive-label-parameters)))
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2161
60918
58a53f588384 * textmodes/refbib.el, textmodes/refer.el, textmodes/reftex-cite.el,
Werner LEMBERG <wl@gnu.org>
parents: 59845
diff changeset
2162 (defun reftex-convert-string (string split-re invalid-re dot keep-fp
58a53f588384 * textmodes/refbib.el, textmodes/refer.el, textmodes/reftex-cite.el,
Werner LEMBERG <wl@gnu.org>
parents: 59845
diff changeset
2163 nwords maxchar invalid abbrev sep
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2164 ignore-words &optional downcase)
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2165 "Convert a string (a sentence) to something shorter.
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2166 SPLIT-RE is the regular expression used to split the string into words.
60918
58a53f588384 * textmodes/refbib.el, textmodes/refer.el, textmodes/reftex-cite.el,
Werner LEMBERG <wl@gnu.org>
parents: 59845
diff changeset
2167 INVALID-RE matches characters which are invalid in the final string.
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2168 DOT t means add dots to abbreviated words.
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2169 KEEP-FP t means to keep a final punctuation when applicable.
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2170 NWORDS Number of words to use.
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2171 MAXCHAR Maximum number of characters in the final string.
60918
58a53f588384 * textmodes/refbib.el, textmodes/refer.el, textmodes/reftex-cite.el,
Werner LEMBERG <wl@gnu.org>
parents: 59845
diff changeset
2172 INVALID nil: Throw away any words containing stuff matched with INVALID-RE.
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2173 t: Throw away only the matched part, not the whole word.
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2174 ABBREV nil: Never abbreviate words.
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2175 t: Always abbreviate words (see `reftex-abbrev-parameters').
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2176 not t and not nil: Abbreviate words if necessary to shorten
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2177 string below MAXCHAR.
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2178 SEP String separating different words in the output string.
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2179 IGNORE-WORDS List of words which should be removed from the string."
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2180
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2181 (let* ((words0 (split-string string (or split-re "[ \t\n\r]")))
60918
58a53f588384 * textmodes/refbib.el, textmodes/refer.el, textmodes/reftex-cite.el,
Werner LEMBERG <wl@gnu.org>
parents: 59845
diff changeset
2182 (reftex-label-illegal-re (or invalid-re "\000"))
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2183 (abbrev-re (concat
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2184 "\\`\\("
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2185 (make-string (nth 0 reftex-abbrev-parameters) ?.)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2186 "[" (nth 2 reftex-abbrev-parameters) "]*"
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2187 "\\)"
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2188 "[" (nth 3 reftex-abbrev-parameters) "]"
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2189 (make-string (1- (nth 1 reftex-abbrev-parameters)) ?.)))
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2190 words word)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2191
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2192 ;; Remove words from the ignore list or with funny characters
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2193 (while (setq word (pop words0))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2194 (if downcase (setq word (downcase word)))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2195 (cond
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2196 ((member (downcase word) ignore-words))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2197 ((string-match reftex-label-illegal-re word)
60918
58a53f588384 * textmodes/refbib.el, textmodes/refer.el, textmodes/reftex-cite.el,
Werner LEMBERG <wl@gnu.org>
parents: 59845
diff changeset
2198 (when invalid
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2199 (while (string-match reftex-label-illegal-re word)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2200 (setq word (replace-match "" nil nil word)))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2201 (push word words)))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2202 (t
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2203 (push word words))))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2204 (setq words (nreverse words))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2205
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2206 ;; Restrict number of words
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2207 (if (> (length words) nwords)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2208 (setcdr (nthcdr (1- nwords) words) nil))
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
2209
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2210 ;; First, try to use all words
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2211 (setq string (mapconcat 'identity words sep))
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
2212
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2213 ;; Abbreviate words if enforced by user settings or string length
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2214 (if (or (eq t abbrev)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2215 (and abbrev
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2216 (> (length string) maxchar)))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2217 (setq words
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2218 (mapcar
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2219 (lambda (w) (if (string-match abbrev-re w)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2220 (if dot
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2221 (concat (match-string 1 w) ".")
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2222 (match-string 1 w))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2223 w))
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2224 words)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2225 string (mapconcat 'identity words sep)))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2226
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2227 ;; Shorten if still to long
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2228 (setq string
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2229 (if (> (length string) maxchar)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2230 (substring string 0 maxchar)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2231 string))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2232
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2233 ;; Delete the final punctuation, if any
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2234 (if (and (not keep-fp) (string-match "\\s.+\\'" string))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2235 (setq string (replace-match "" nil nil string)))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2236 string))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2237
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2238 (defun reftex-nicify-text (text)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2239 ;; Make TEXT nice for inclusion as context into label menu.
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2240 ;; 1. remove line breaks and extra white space
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2241 (while (string-match "[\n\r\t]\\|[ \t][ \t]+" text)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2242 (setq text (replace-match " " nil t text)))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2243 ;; 2. cut before the next `\end{' or `\item' or `\\'
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2244 (if (string-match "\\(\\\\end{\\|\\\\item\\|\\\\\\\\\\).*" text)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2245 (setq text (replace-match "" nil t text)))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2246 ;; 3. kill the embedded label
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2247 (if (string-match "\\\\label{[^}]*}" text)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2248 (setq text (replace-match "" nil t text)))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2249 ;; 4. remove leading garbage
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2250 (if (string-match "\\`[ }]+" text)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2251 (setq text (replace-match "" nil t text)))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2252 ;; 5. limit length
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2253 (cond
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2254 ((> (length text) 100) (substring text 0 100))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2255 ((= (length text) 0) (make-string 1 ?\ ))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2256 (t text)))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2257
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2258 ;;; =========================================================================
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2259 ;;;
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2260 ;;; Fontification and Highlighting
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2261
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2262 (defun reftex-use-fonts ()
18321
0ed97be54a28 Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents: 18220
diff changeset
2263 ;; Return t if we can and want to use fonts.
66926
cff341e743a2 (reftex-use-fonts): removed the check for
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
2264 (and ; window-system
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2265 reftex-use-fonts
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2266 (featurep 'font-lock)))
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2267
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2268 (defun reftex-refontify ()
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2269 ;; Return t if we need to refontify context
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2270 (and (reftex-use-fonts)
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2271 (or (eq t reftex-refontify-context)
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2272 (and (eq 1 reftex-refontify-context)
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2273 ;; Test of we use the font-lock version of x-symbol
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2274 (and (featurep 'x-symbol-tex) (not (boundp 'x-symbol-mode)))))))
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2275
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2276 (defvar font-lock-defaults-computed)
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2277 (defun reftex-fontify-select-label-buffer (parent-buffer)
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2278 ;; Fontify the `*RefTeX Select*' buffer. Buffer is temporarily renamed to
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2279 ;; start with none-SPC char, beacuse Font-Lock otherwise refuses operation.
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2280 (run-hook-with-args 'reftex-pre-refontification-functions
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2281 parent-buffer 'reftex-ref)
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2282 (let* ((oldname (buffer-name))
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2283 (newname (concat "Fontify-me-" oldname)))
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2284 (unwind-protect
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2285 (progn
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2286 ;; Rename buffer temporarily to start w/o space (because of font-lock)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2287 (rename-buffer newname t)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2288 (cond
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2289 ((fboundp 'font-lock-default-fontify-region)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2290 ;; Good: we have the indirection functions
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2291 (set (make-local-variable 'font-lock-fontify-region-function)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2292 'reftex-select-font-lock-fontify-region)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2293 (let ((major-mode 'latex-mode))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2294 (font-lock-mode 1)))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2295 ((fboundp 'font-lock-set-defaults-1)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2296 ;; Looks like the XEmacs font-lock stuff.
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2297 ;; FIXME: this is still kind of a hack, but it works.
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2298 (set (make-local-variable 'font-lock-keywords) nil)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2299 (let ((major-mode 'latex-mode)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2300 (font-lock-defaults-computed nil))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2301 (font-lock-set-defaults-1)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2302 (reftex-select-font-lock-fontify-region (point-min) (point-max))))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2303 (t
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
2304 ;; Oops?
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2305 (message "Sorry: cannot refontify RefTeX Select buffer."))))
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2306 (rename-buffer oldname))))
20829
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
2307
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
2308 (defun reftex-select-font-lock-fontify-region (beg end &optional loudly)
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
2309 ;; Fontify a region, but only lines starting with a dot.
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
2310 (let ((func (if (fboundp 'font-lock-default-fontify-region)
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2311 'font-lock-default-fontify-region
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2312 'font-lock-fontify-region))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2313 beg1 end1)
20829
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
2314 (goto-char beg)
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
2315 (while (re-search-forward "^\\." end t)
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
2316 (setq beg1 (point) end1 (progn (skip-chars-forward "^\n") (point)))
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
2317 (funcall func beg1 end1 nil)
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
2318 (goto-char end1))))
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
2319
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2320 (defun reftex-select-font-lock-unfontify (&rest ignore) t)
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2321
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2322 (defun reftex-verified-face (&rest faces)
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2323 ;; Return the first valid face in FACES, or nil if none is valid.
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2324 ;; Also, when finding a nil element in FACES, return nil. This
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2325 ;; function is just a safety net to catch name changes of builtin
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2326 ;; fonts. Currently it is only used for reftex-label-face, which has
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2327 ;; as default font-lock-reference-face, which was recently renamed
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2328 ;; to font-lock-constant-face.
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2329 (let (face)
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2330 (catch 'exit
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2331 (while (setq face (pop faces))
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2332 (if (featurep 'xemacs)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2333 (if (find-face face) (throw 'exit face))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2334 (if (facep face) (throw 'exit face)))))))
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2335
62467
35f6599373fc * textmodes/reftex-vars.el (reftex-cite-format-builtin): Support
Carsten Dominik <dominik@science.uva.nl>
parents: 60926
diff changeset
2336 ;; Highlighting uses overlays. For XEmacs, we use extends.
35f6599373fc * textmodes/reftex-vars.el (reftex-cite-format-builtin): Support
Carsten Dominik <dominik@science.uva.nl>
parents: 60926
diff changeset
2337 (if (featurep 'xemacs)
35f6599373fc * textmodes/reftex-vars.el (reftex-cite-format-builtin): Support
Carsten Dominik <dominik@science.uva.nl>
parents: 60926
diff changeset
2338 (progn
35f6599373fc * textmodes/reftex-vars.el (reftex-cite-format-builtin): Support
Carsten Dominik <dominik@science.uva.nl>
parents: 60926
diff changeset
2339 (defalias 'reftex-make-overlay 'make-extent)
35f6599373fc * textmodes/reftex-vars.el (reftex-cite-format-builtin): Support
Carsten Dominik <dominik@science.uva.nl>
parents: 60926
diff changeset
2340 (defalias 'reftex-overlay-put 'set-extent-property)
35f6599373fc * textmodes/reftex-vars.el (reftex-cite-format-builtin): Support
Carsten Dominik <dominik@science.uva.nl>
parents: 60926
diff changeset
2341 (defalias 'reftex-move-overlay 'set-extent-endpoints)
35f6599373fc * textmodes/reftex-vars.el (reftex-cite-format-builtin): Support
Carsten Dominik <dominik@science.uva.nl>
parents: 60926
diff changeset
2342 (defalias 'reftex-delete-overlay 'detach-extent))
35f6599373fc * textmodes/reftex-vars.el (reftex-cite-format-builtin): Support
Carsten Dominik <dominik@science.uva.nl>
parents: 60926
diff changeset
2343 (defalias 'reftex-make-overlay 'make-overlay)
35f6599373fc * textmodes/reftex-vars.el (reftex-cite-format-builtin): Support
Carsten Dominik <dominik@science.uva.nl>
parents: 60926
diff changeset
2344 (defalias 'reftex-overlay-put 'overlay-put)
35f6599373fc * textmodes/reftex-vars.el (reftex-cite-format-builtin): Support
Carsten Dominik <dominik@science.uva.nl>
parents: 60926
diff changeset
2345 (defalias 'reftex-move-overlay 'move-overlay)
35f6599373fc * textmodes/reftex-vars.el (reftex-cite-format-builtin): Support
Carsten Dominik <dominik@science.uva.nl>
parents: 60926
diff changeset
2346 (defalias 'reftex-delete-overlay 'delete-overlay))
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2347
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2348 ;; We keep a vector with several different overlays to do our highlighting.
47050
904fd28be439 Update to RefTeX 4.19
Carsten Dominik <dominik@science.uva.nl>
parents: 46973
diff changeset
2349 (defvar reftex-highlight-overlays [nil nil nil])
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2350
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2351 ;; Initialize the overlays
62467
35f6599373fc * textmodes/reftex-vars.el (reftex-cite-format-builtin): Support
Carsten Dominik <dominik@science.uva.nl>
parents: 60926
diff changeset
2352 (aset reftex-highlight-overlays 0 (reftex-make-overlay 1 1))
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
2353 (reftex-overlay-put (aref reftex-highlight-overlays 0)
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2354 'face 'highlight)
62467
35f6599373fc * textmodes/reftex-vars.el (reftex-cite-format-builtin): Support
Carsten Dominik <dominik@science.uva.nl>
parents: 60926
diff changeset
2355 (aset reftex-highlight-overlays 1 (reftex-make-overlay 1 1))
35f6599373fc * textmodes/reftex-vars.el (reftex-cite-format-builtin): Support
Carsten Dominik <dominik@science.uva.nl>
parents: 60926
diff changeset
2356 (reftex-overlay-put (aref reftex-highlight-overlays 1)
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2357 'face reftex-cursor-selected-face)
62467
35f6599373fc * textmodes/reftex-vars.el (reftex-cite-format-builtin): Support
Carsten Dominik <dominik@science.uva.nl>
parents: 60926
diff changeset
2358 (aset reftex-highlight-overlays 2 (reftex-make-overlay 1 1))
35f6599373fc * textmodes/reftex-vars.el (reftex-cite-format-builtin): Support
Carsten Dominik <dominik@science.uva.nl>
parents: 60926
diff changeset
2359 (reftex-overlay-put (aref reftex-highlight-overlays 2)
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2360 'face reftex-cursor-selected-face)
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2361
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2362 ;; Two functions for activating and deactivation highlight overlays
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2363 (defun reftex-highlight (index begin end &optional buffer)
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2364 "Highlight a region with overlay INDEX."
62467
35f6599373fc * textmodes/reftex-vars.el (reftex-cite-format-builtin): Support
Carsten Dominik <dominik@science.uva.nl>
parents: 60926
diff changeset
2365 (reftex-move-overlay (aref reftex-highlight-overlays index)
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2366 begin end (or buffer (current-buffer))))
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2367 (defun reftex-unhighlight (index)
20829
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
2368 "Detach overlay INDEX."
62467
35f6599373fc * textmodes/reftex-vars.el (reftex-cite-format-builtin): Support
Carsten Dominik <dominik@science.uva.nl>
parents: 60926
diff changeset
2369 (reftex-delete-overlay (aref reftex-highlight-overlays index)))
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2370
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2371 (defun reftex-highlight-shall-die ()
18321
0ed97be54a28 Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents: 18220
diff changeset
2372 ;; Function used in pre-command-hook to remove highlights.
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2373 (remove-hook 'pre-command-hook 'reftex-highlight-shall-die)
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2374 (reftex-unhighlight 0))
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2375
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2376 ;;; =========================================================================
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2377 ;;;
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
2378 ;;; Keybindings
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2379
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2380 ;; The default bindings in the mode map.
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2381 (loop for x in
26910
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
2382 '(("\C-c=" . reftex-toc)
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2383 ("\C-c-" . reftex-toc-recenter)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2384 ("\C-c(" . reftex-label)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2385 ("\C-c)" . reftex-reference)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2386 ("\C-c[" . reftex-citation)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2387 ("\C-c<" . reftex-index)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2388 ("\C-c>" . reftex-display-index)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2389 ("\C-c/" . reftex-index-selection-or-word)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2390 ("\C-c\\" . reftex-index-phrase-selection-or-word)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2391 ("\C-c|" . reftex-index-visit-phrases-buffer)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2392 ("\C-c&" . reftex-view-crossref))
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2393 do (define-key reftex-mode-map (car x) (cdr x)))
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2394
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2395 ;; Bind `reftex-mouse-view-crossref' only when the key is still free
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2396 (if (featurep 'xemacs)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2397 (unless (key-binding [(shift button2)])
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
2398 (define-key reftex-mode-map [(shift button2)]
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2399 'reftex-mouse-view-crossref))
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2400 (unless (key-binding [(shift mouse-2)])
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
2401 (define-key reftex-mode-map [(shift mouse-2)]
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2402 'reftex-mouse-view-crossref)))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2403
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2404 ;; Bind `reftex-view-crossref-from-bibtex' in BibTeX mode map
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2405 (eval-after-load
23995
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
2406 "bibtex"
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
2407 '(define-key bibtex-mode-map "\C-c&" 'reftex-view-crossref-from-bibtex))
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
2408
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2409 ;; If the user requests so, she can have a few more bindings:
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2410 (when reftex-extra-bindings
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2411 (loop for x in
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2412 '(("\C-ct" . reftex-toc)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2413 ("\C-cl" . reftex-label)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2414 ("\C-cr" . reftex-reference)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2415 ("\C-cc" . reftex-citation)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2416 ("\C-cv" . reftex-view-crossref)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2417 ("\C-cg" . reftex-grep-document)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2418 ("\C-cs" . reftex-search-document))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2419 do (define-key reftex-mode-map (car x) (cdr x))))
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2420
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2421 ;;; =========================================================================
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2422 ;;;
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2423 ;;; Menu
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2424
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2425 ;; Define a menu for the menu bar if Emacs is running under X
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2426
62509
d631d0a6ba66 Moved the definition of `reftex-isearch-minor-mode' from
Carsten Dominik <dominik@science.uva.nl>
parents: 62467
diff changeset
2427 (defvar reftex-isearch-minor-mode nil)
d631d0a6ba66 Moved the definition of `reftex-isearch-minor-mode' from
Carsten Dominik <dominik@science.uva.nl>
parents: 62467
diff changeset
2428 (make-variable-buffer-local 'reftex-isearch-minor-mode)
d631d0a6ba66 Moved the definition of `reftex-isearch-minor-mode' from
Carsten Dominik <dominik@science.uva.nl>
parents: 62467
diff changeset
2429
23707
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
2430 (easy-menu-define reftex-mode-menu reftex-mode-map
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2431 "Menu used in RefTeX mode"
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2432 `("Ref"
19660
fa3d4e7a76d9 (reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents: 18321
diff changeset
2433 ["Table of Contents" reftex-toc t]
47050
904fd28be439 Update to RefTeX 4.19
Carsten Dominik <dominik@science.uva.nl>
parents: 46973
diff changeset
2434 ["Recenter TOC" reftex-toc-recenter t]
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2435 "--"
19660
fa3d4e7a76d9 (reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents: 18321
diff changeset
2436 ["\\label" reftex-label t]
fa3d4e7a76d9 (reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents: 18321
diff changeset
2437 ["\\ref" reftex-reference t]
fa3d4e7a76d9 (reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents: 18321
diff changeset
2438 ["\\cite" reftex-citation t]
26910
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
2439 ("\\index"
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
2440 ["\\index" reftex-index t]
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
2441 ["\\index{THIS}" reftex-index-selection-or-word t]
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
2442 "--"
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
2443 ["Add THIS to Index Phrases" reftex-index-phrase-selection-or-word t]
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
2444 ["Visit Phrase Buffer" reftex-index-visit-phrases-buffer t]
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
2445 ["Apply Phrases to Region" reftex-index-phrases-apply-to-region t]
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
2446 "--"
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
2447 ["Display the Index" reftex-display-index t])
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
2448 "--"
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2449 ["View Crossref" reftex-view-crossref t]
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2450 "--"
20177
6ebc3e300106 The menu now used toggle and radio for some items.
Karl Heuer <kwzh@gnu.org>
parents: 20102
diff changeset
2451 ("Parse Document"
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2452 ["One File" reftex-parse-one reftex-enable-partial-scans]
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2453 ["Entire Document" reftex-parse-all t]
20177
6ebc3e300106 The menu now used toggle and radio for some items.
Karl Heuer <kwzh@gnu.org>
parents: 20102
diff changeset
2454 ["Save to File" (reftex-access-parse-file 'write)
6ebc3e300106 The menu now used toggle and radio for some items.
Karl Heuer <kwzh@gnu.org>
parents: 20102
diff changeset
2455 (> (length (symbol-value reftex-docstruct-symbol)) 0)]
47050
904fd28be439 Update to RefTeX 4.19
Carsten Dominik <dominik@science.uva.nl>
parents: 46973
diff changeset
2456 ["Restore from File" (reftex-access-parse-file 'restore) t])
20829
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
2457 ("Global Actions"
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2458 ["Search Whole Document" reftex-search-document t]
59534
9bad65481674 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 52401
diff changeset
2459 ["Search Again" tags-loop-continue t]
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2460 ["Replace in Document" reftex-query-replace-document t]
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2461 ["Grep on Document" reftex-grep-document t]
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2462 "--"
47050
904fd28be439 Update to RefTeX 4.19
Carsten Dominik <dominik@science.uva.nl>
parents: 46973
diff changeset
2463 ["Goto Label" reftex-goto-label t]
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2464 ["Find Duplicate Labels" reftex-find-duplicate-labels t]
20829
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
2465 ["Change Label and Refs" reftex-change-label t]
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2466 ["Renumber Simple Labels" reftex-renumber-simple-labels t]
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2467 "--"
59534
9bad65481674 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 52401
diff changeset
2468 ["Create BibTeX File" reftex-create-bibtex-file t]
9bad65481674 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 52401
diff changeset
2469 "--"
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2470 ["Create TAGS File" reftex-create-tags-file t]
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2471 "--"
23707
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
2472 ["Save Document" reftex-save-all-document-buffers t])
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2473 "--"
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2474 ("Options"
23995
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
2475 "PARSER"
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
2476 ["Partial Scans"
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
2477 (setq reftex-enable-partial-scans (not reftex-enable-partial-scans))
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
2478 :style toggle :selected reftex-enable-partial-scans]
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
2479 ["Auto-Save Parse Info"
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
2480 (setq reftex-save-parse-info (not reftex-save-parse-info))
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
2481 :style toggle :selected reftex-save-parse-info]
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2482 "--"
47050
904fd28be439 Update to RefTeX 4.19
Carsten Dominik <dominik@science.uva.nl>
parents: 46973
diff changeset
2483 "TOC RECENTER"
904fd28be439 Update to RefTeX 4.19
Carsten Dominik <dominik@science.uva.nl>
parents: 46973
diff changeset
2484 ["Automatic Recenter" reftex-toggle-auto-toc-recenter
904fd28be439 Update to RefTeX 4.19
Carsten Dominik <dominik@science.uva.nl>
parents: 46973
diff changeset
2485 :style toggle :selected reftex-toc-auto-recenter-timer]
904fd28be439 Update to RefTeX 4.19
Carsten Dominik <dominik@science.uva.nl>
parents: 46973
diff changeset
2486 "--"
23995
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
2487 "CROSSREF INFO"
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
2488 ["Automatic Info" reftex-toggle-auto-view-crossref
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
2489 :style toggle :selected reftex-auto-view-crossref-timer]
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
2490 ["...in Echo Area" (setq reftex-auto-view-crossref t)
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
2491 :style radio :selected (eq reftex-auto-view-crossref t)]
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
2492 ["...in Other Window" (setq reftex-auto-view-crossref 'window)
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
2493 :style radio :selected (eq reftex-auto-view-crossref 'window)]
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2494 "--"
23995
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
2495 "MISC"
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
2496 ["AUC TeX Interface" reftex-toggle-plug-into-AUCTeX
59735
58ae6b59e2ee * textmodes/reftex.el (reftex-mode-menu): Add entry for reftex
Carsten Dominik <dominik@science.uva.nl>
parents: 59534
diff changeset
2497 :style toggle :selected reftex-plug-into-AUCTeX]
58ae6b59e2ee * textmodes/reftex.el (reftex-mode-menu): Add entry for reftex
Carsten Dominik <dominik@science.uva.nl>
parents: 59534
diff changeset
2498 ["isearch whole document" reftex-isearch-minor-mode
58ae6b59e2ee * textmodes/reftex.el (reftex-mode-menu): Add entry for reftex
Carsten Dominik <dominik@science.uva.nl>
parents: 59534
diff changeset
2499 :style toggle :selected reftex-isearch-minor-mode])
23995
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
2500 ("Reference Style"
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2501 ["Default" (setq reftex-vref-is-default nil
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2502 reftex-fref-is-default nil)
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
2503 :style radio :selected (not (or reftex-vref-is-default
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2504 reftex-fref-is-default))]
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2505 ["Varioref" (setq reftex-vref-is-default t
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2506 reftex-fref-is-default nil)
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2507 :style radio :selected reftex-vref-is-default]
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2508 ["Fancyref" (setq reftex-fref-is-default t
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2509 reftex-vref-is-default nil)
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2510 :style radio :selected reftex-fref-is-default])
23995
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
2511 ("Citation Style"
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
2512 ,@(mapcar
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2513 (lambda (x)
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2514 (vector
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2515 (capitalize (symbol-name (car x)))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2516 (list 'reftex-set-cite-format (list 'quote (car x)))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2517 :style 'radio :selected
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2518 (list 'eq (list 'reftex-get-cite-format) (list 'quote (car x)))))
23995
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
2519 reftex-cite-format-builtin)
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2520 "--"
23995
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
2521 "Sort Database Matches"
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
2522 ["Not" (setq reftex-sort-bibtex-matches nil)
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
2523 :style radio :selected (eq reftex-sort-bibtex-matches nil)]
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
2524 ["by Author" (setq reftex-sort-bibtex-matches 'author)
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
2525 :style radio :selected (eq reftex-sort-bibtex-matches 'author)]
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
2526 ["by Year" (setq reftex-sort-bibtex-matches 'year)
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
2527 :style radio :selected (eq reftex-sort-bibtex-matches 'year)]
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
2528 ["by Year, reversed" (setq reftex-sort-bibtex-matches 'reverse-year)
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
2529 :style radio :selected (eq reftex-sort-bibtex-matches 'reverse-year)])
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2530 ("Index Style"
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2531 ,@(mapcar
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2532 (lambda (x)
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2533 (vector
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2534 (capitalize (symbol-name (car x)))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2535 (list 'reftex-add-index-macros (list 'list (list 'quote (car x))))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2536 :style 'radio :selected
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2537 (list 'memq (list 'quote (car x))
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
2538 (list 'get 'reftex-docstruct-symbol
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2539 (list 'quote 'reftex-index-macros-style)))))
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2540 reftex-index-macros-builtin))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2541 "--"
47050
904fd28be439 Update to RefTeX 4.19
Carsten Dominik <dominik@science.uva.nl>
parents: 46973
diff changeset
2542 ["Reset RefTeX Mode" reftex-reset-mode t]
904fd28be439 Update to RefTeX 4.19
Carsten Dominik <dominik@science.uva.nl>
parents: 46973
diff changeset
2543 "--"
20829
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
2544 ("Customize"
23707
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
2545 ["Browse RefTeX Group" reftex-customize t]
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2546 "--"
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
2547 ["Build Full Customize Menu" reftex-create-customize-menu
20829
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
2548 (fboundp 'customize-menu-create)])
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
2549 ("Documentation"
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
2550 ["Info" reftex-info t]
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
2551 ["Commentary" reftex-show-commentary t])))
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2552
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2553 (defun reftex-customize ()
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2554 "Call the customize function with reftex as argument."
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2555 (interactive)
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2556 (customize-browse 'reftex))
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2557
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2558 (defun reftex-create-customize-menu ()
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2559 "Create a full customization menu for RefTeX, insert it into the menu."
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2560 (interactive)
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2561 (if (fboundp 'customize-menu-create)
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2562 (progn
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
2563 (easy-menu-change
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2564 '("Ref") "Customize"
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2565 `(["Browse RefTeX group" reftex-customize t]
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2566 "--"
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2567 ,(customize-menu-create 'reftex)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2568 ["Set" Custom-set t]
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2569 ["Save" Custom-save t]
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2570 ["Reset to Current" Custom-reset-current t]
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2571 ["Reset to Saved" Custom-reset-saved t]
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2572 ["Reset to Standard Settings" Custom-reset-standard t]))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2573 (message "\"Ref\"-menu now contains full customization menu"))
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2574 (error "Cannot expand menu (outdated version of cus-edit.el)")))
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2575
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2576 (defun reftex-show-commentary ()
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2577 "Use the finder to view the file documentation from `reftex.el'."
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2578 (interactive)
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2579 (require 'finder)
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2580 (finder-commentary "reftex.el"))
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2581
26910
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
2582 (defun reftex-info (&optional node)
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
2583 "Read documentation for RefTeX in the info system.
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
2584 With optional NODE, go directly to that node."
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2585 (interactive)
85500
0dcd1f3c9909 * textmodes/reftex.el: Move require easymenu before first use.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85194
diff changeset
2586 (eval-and-compile (require 'info))
26910
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
2587 (Info-goto-node (format "(reftex)%s" (or node ""))))
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2588
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2589 ;;; Install the kill-buffer and kill-emacs hooks ------------------------------
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2590
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2591 (add-hook 'kill-buffer-hook 'reftex-kill-buffer-hook)
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2592 (add-hook 'kill-emacs-hook 'reftex-kill-emacs-hook)
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2593
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2594 ;;; Run Hook ------------------------------------------------------------------
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2595
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2596 (run-hooks 'reftex-load-hook)
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2597
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2598 ;;; That's it! ----------------------------------------------------------------
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2599
21114
3e8ab19bdccb 1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents: 21075
diff changeset
2600 (setq reftex-tables-dirty t) ; in case this file is evaluated by hand
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
2601 (provide 'reftex)
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2602
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2603 ;;;============================================================================
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2604
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 52170
diff changeset
2605 ;;; arch-tag: 49e0da4e-bd5e-4cfc-a717-fb444fccb9e6
18321
0ed97be54a28 Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents: 18220
diff changeset
2606 ;;; reftex.el ends here