annotate lisp/textmodes/reftex.el @ 101372:21f52bbdeeb7

Remove file local var.
author Chong Yidong <cyd@stupidchicken.com>
date Fri, 23 Jan 2009 03:51:44 +0000
parents a9dc0e7c3f2b
children 73bff1db57b6
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,
100908
a9dc0e7c3f2b Add 2009 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 99383
diff changeset
3 ;; 2006, 2007, 2008, 2009 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
94670
f4a69fedbd46 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94384
diff changeset
12 ;; GNU Emacs is free software: you can redistribute it and/or modify
18050
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
94670
f4a69fedbd46 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94384
diff changeset
14 ;; the Free Software Foundation, either version 3 of the License, or
f4a69fedbd46 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94384
diff changeset
15 ;; (at your option) any later version.
18050
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
94670
f4a69fedbd46 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94384
diff changeset
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
24
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
25 ;;---------------------------------------------------------------------------
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 ;;; Commentary:
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
28 ;;
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
29 ;; 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
30 ;; 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
31 ;; - 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
32 ;; - Labels are created semi-automatically.
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
33 ;; - 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
34 ;; - 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
35 ;; - 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
36 ;; - The index preview buffer helps to check and edit index entries.
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
37 ;;
20829
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
38 ;;
23200
4750ba95a176 (reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents: 22991
diff changeset
39 ;; INSTALLATION
4750ba95a176 (reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents: 22991
diff changeset
40 ;; ------------
4750ba95a176 (reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents: 22991
diff changeset
41 ;;
23707
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
42 ;; - 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
43 ;; - 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
44 ;; available from the XEmacs distribution sites.
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
45 ;; - 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
46 ;; 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
47 ;;
23707
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
48 ;; 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
49 ;;
23707
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
50 ;; 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
51 ;; to your .emacs file:
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
52 ;;
23707
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
53 ;; (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
54 ;; (add-hook 'latex-mode-hook 'turn-on-reftex) ; Emacs latex mode
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
55 ;;
20829
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
56 ;;
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
57 ;; DOCUMENTATION
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 ;;
23200
4750ba95a176 (reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents: 22991
diff changeset
60 ;; 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
61 ;;
20829
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
62 ;; 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
63 ;; 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
64 ;;
23200
4750ba95a176 (reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents: 22991
diff changeset
65 ;; 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
66 ;;
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
67 ;; 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
68 ;;
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
69 ;;---------------------------------------------------------------------------
23707
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
70 ;;
26910
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
71 ;; Introduction
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
72 ;; ************
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
73 ;;
26910
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
74 ;; 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
75 ;; 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
76 ;; 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
77 ;; 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
78 ;; 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
79 ;; 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
80 ;; 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
81 ;; structure quickly.
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
82 ;;
26910
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
83 ;; *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
84 ;; reports or suggestions.
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
85 ;;
26910
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
86 ;; Environment
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
87 ;; ===========
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
88 ;;
26910
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
89 ;; 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
90 ;; 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
91 ;; `\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
92 ;; 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
93 ;; 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
94 ;; 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
95 ;; 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
96 ;; for you because it cannot find some files, read *Note Finding Files::.
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
97 ;;
26910
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
98 ;; Entering RefTeX Mode
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
99 ;; ====================
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
100 ;;
26910
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
101 ;; 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
102 ;; 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
103 ;; following lines to your `.emacs' file:
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
104 ;;
26910
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
105 ;; (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
106 ;; (add-hook 'latex-mode-hook 'turn-on-reftex) ; with Emacs latex mode
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
107 ;;
20829
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
108 ;; RefTeX in a Nutshell
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
109 ;; ====================
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
110 ;;
23707
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
111 ;; 1. Table of Contents
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
112 ;; 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
113 ;; 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
114 ;; 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
115 ;; quickly to every part of your document. Press `?' to get help.
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
116 ;;
23707
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
117 ;; 2. Labels and References
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
118 ;; 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
119 ;; 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
120 ;; 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
121 ;; 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
122 ;; environments you have defined yourself (variable
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
123 ;; `reftex-label-alist').
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
124 ;;
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
125 ;; * Creating Labels
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
126 ;; 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
127 ;; RefTeX will either
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
128 ;; - 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
129 ;; - 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
130 ;; tables) or
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
131 ;; - 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
132 ;; other environments)
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
133 ;;
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
134 ;; 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
135 ;; `reftex-insert-label-flags'.
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
136 ;;
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
137 ;; * Referencing Labels
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
138 ;; 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
139 ;; 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
140 ;; type (figure, equation,...) and some label context.
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
141 ;; 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
142 ;; original buffer.
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
143 ;;
23707
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
144 ;; 3. Citations
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
145 ;; 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
146 ;; 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
147 ;; 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
148 ;; 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
149 ;; 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
150 ;; 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
151 ;; macros).
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
152 ;;
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
153 ;; 4. Index Support
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
154 ;; 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
155 ;; 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
156 ;; 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
157 ;; 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
158 ;; 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
159 ;; are supported.
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
160 ;;
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
161 ;; * Creating Index Entries
26910
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
162 ;; 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
163 ;; `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
164 ;; `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
165 ;; 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
166 ;; the index macros and enter the arguments with completion.
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
167 ;;
26910
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
168 ;; * 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
169 ;; 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
170 ;; 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
171 ;; 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
172 ;; of these phrases and let you interactively index the matches.
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
173 ;;
26910
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
174 ;; * Displaying and Editing the Index
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
175 ;; 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
176 ;; >' (`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
177 ;; and edit all entries.
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
178 ;;
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
179 ;; 5. Viewing Cross-References
23995
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
180 ;; 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
181 ;; (`\label', `\ref', `\cite', `\bibitem', `\index', and variations)
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
182 ;; 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
183 ;; (`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
184 ;; document and associated BibTeX database files.
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
185 ;; 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
186 ;; 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
187 ;; will automatically be displayed in the echo area.
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
188 ;;
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
189 ;; 6. Multifile Documents
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
190 ;; 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
191 ;; 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
192 ;; 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
193 ;; 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
194 ;; (`xr.sty').
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
195 ;;
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
196 ;; 7. Document Parsing
23707
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
197 ;; 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
198 ;; 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
199 ;; 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
200 ;; 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
201 ;; 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
202 ;; 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
203 ;; buffer.
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
204 ;;
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
205 ;; 8. AUCTeX
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
206 ;; 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
207 ;; (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
208 ;; 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
209 ;; 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
210 ;; will be necessary.
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
211 ;;
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
212 ;; 9. Useful Settings
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
213 ;; 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
214 ;; (setq reftex-enable-partial-scans t)
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
215 ;; (setq reftex-save-parse-info t)
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
216 ;; (setq reftex-use-multiple-selection-buffers t)
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
217 ;;
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
218 ;; To integrate with AUCTeX, use
23707
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
219 ;; (setq reftex-plug-into-AUCTeX t)
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
220 ;;
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
221 ;; 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
222 ;; customize the variables
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
223 ;; `reftex-label-alist' (for label macros/environments)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
224 ;; `reftex-section-levels' (for sectioning commands)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
225 ;; `reftex-cite-format' (for `\cite'-like macros)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
226 ;; `reftex-index-macros' (for `\index'-like macros)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
227 ;; `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
228 ;; 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
229 ;; an AUCTeX style file to support them with both AUCTeX and RefTeX.
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
230 ;;
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
231 ;; 10. Where Next?
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
232 ;; 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
233 ;; 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
234 ;; 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
235 ;; 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
236 ;; 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
237 ;; 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
238 ;; reference.
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
239 ;;
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
240 ;;---------------------------------------------------------------------------
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
241 ;;
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
242 ;; AUTHOR
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
243 ;; ======
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
244 ;;
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
245 ;; Carsten Dominik <dominik@science.uva.nl>
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
246 ;;
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
247 ;; with contributions from Stephen Eglen
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
248 ;;
23707
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
249 ;; 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
250 ;; 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
251 ;; distribution at
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
252 ;;
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
253 ;; 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
254 ;;
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
255 ;; THANKS TO:
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
256 ;; ---------
20829
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
257 ;; 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
258 ;; developing it with their reports. In particular thanks to
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
259 ;;
23707
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
260 ;; 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
261 ;; 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
262 ;; 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
263 ;; 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
264 ;; 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
265 ;; Alan Williams.
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
266 ;;
20829
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
267 ;; 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
268 ;; 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
269 ;; MicroEmacs at the time).
18219
aaeaae005e98 Updated documentation at several points in the file.
Richard M. Stallman <rms@gnu.org>
parents: 18123
diff changeset
270 ;;
23200
4750ba95a176 (reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents: 22991
diff changeset
271 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
18321
0ed97be54a28 Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents: 18220
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 ;;;;;;
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
274
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
275 ;;; Code:
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
276
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
277 (eval-when-compile (require 'cl))
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
278
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
279 ;; Stuff that needs to be there when we use defcustom
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
280 (require 'custom)
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
281
85500
0dcd1f3c9909 * textmodes/reftex.el: Move require easymenu before first use.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85194
diff changeset
282 (require 'easymenu)
0dcd1f3c9909 * textmodes/reftex.el: Move require easymenu before first use.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85194
diff changeset
283
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
284 (defvar reftex-tables-dirty t
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
285 "Flag showing if tables need to be re-computed.")
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
286
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
287 (eval-and-compile
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
288 (defun reftex-set-dirty (symbol value)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
289 (setq reftex-tables-dirty t)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
290 (set symbol value)))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
291
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
292
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
293 ;;; =========================================================================
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
294 ;;;
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
295 ;;; Configuration variables
23707
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
296
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
297 (require 'reftex-vars)
21114
3e8ab19bdccb 1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents: 21075
diff changeset
298
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
299
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
300 ;;; =========================================================================
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
301 ;;;
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
302 ;;; Define the formal stuff for a minor mode named RefTeX.
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
69093
0ab6ebe82ad7 (reftex-locate-file): Search all extensions if
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
305 (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
306 "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
307
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
308 (defvar reftex-mode nil
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
309 "Determines if RefTeX mode is active.")
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
310 (make-variable-buffer-local 'reftex-mode)
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
311
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
312 (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
313 "Keymap for RefTeX mode.")
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
314
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
315 (defvar reftex-mode-menu nil)
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
316 (defvar reftex-syntax-table nil)
46612
7522419c4db0 Updated to reftex 4.17
Carsten Dominik <dominik@science.uva.nl>
parents: 38422
diff changeset
317 (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
318
46904
7af0f250bfd0 (reftex-mode): Moved creation of special syntax tables to top-level.
Carsten Dominik <dominik@science.uva.nl>
parents: 46683
diff changeset
319 (unless reftex-syntax-table
46928
cbd08432d202 * reftex.el (reftex-mode): Create special syntax tables.
Carsten Dominik <dominik@science.uva.nl>
parents: 46904
diff changeset
320 (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
321 (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
322 (modify-syntax-entry ?\) "." reftex-syntax-table))
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
323
46904
7af0f250bfd0 (reftex-mode): Moved creation of special syntax tables to top-level.
Carsten Dominik <dominik@science.uva.nl>
parents: 46683
diff changeset
324 (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
325 (setq reftex-syntax-table-for-bib
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
326 (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
327 (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
328 (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
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
47050
904fd28be439 Update to RefTeX 4.19
Carsten Dominik <dominik@science.uva.nl>
parents: 46973
diff changeset
332 ;; 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
333 ;; 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
334 (defvar reftex-auto-view-crossref-timer nil
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
335 "The timer used for auto-view-crossref.")
47050
904fd28be439 Update to RefTeX 4.19
Carsten Dominik <dominik@science.uva.nl>
parents: 46973
diff changeset
336 (defvar reftex-toc-auto-recenter-timer nil
904fd28be439 Update to RefTeX 4.19
Carsten Dominik <dominik@science.uva.nl>
parents: 46973
diff changeset
337 "The idle timer used to recenter the toc window.")
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
338
85825
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
339 ;;; =========================================================================
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
340 ;;;
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
341 ;;; Parser functions
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
342
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
343 (autoload 'reftex-parse-one "reftex-parse"
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
344 "Re-parse this file." t)
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
345 (autoload 'reftex-parse-all "reftex-parse"
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
346 "Re-parse entire document." t)
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
347 (autoload 'reftex-do-parse "reftex-parse")
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
348 (autoload 'reftex-where-am-I "reftex-parse")
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
349 (autoload 'reftex-init-section-numbers "reftex-parse")
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
350 (autoload 'reftex-section-info "reftex-parse")
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
351 (autoload 'reftex-section-number "reftex-parse")
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
352 (autoload 'reftex-what-macro "reftex-parse")
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
353 (autoload 'reftex-what-macro-safe "reftex-parse")
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
354 (autoload 'reftex-index-info "reftex-parse")
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
355 (autoload 'reftex-index-info-safe "reftex-parse")
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
356 (autoload 'reftex-short-context "reftex-parse")
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
357 (autoload 'reftex-what-environment "reftex-parse")
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
358 (autoload 'reftex-what-special-env "reftex-parse")
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
359 (autoload 'reftex-move-over-touching-args "reftex-parse")
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
360 (autoload 'reftex-notice-new "reftex-parse")
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
361 (autoload 'reftex-nth-arg "reftex-parse")
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
362 (autoload 'reftex-locate-bibliography-files "reftex-parse")
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
363 (autoload 'reftex-ensure-index-support "reftex-parse")
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
364 (autoload 'reftex-everything-regexp "reftex-parse")
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
365
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
366
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
367 ;;; =========================================================================
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
368 ;;;
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
369 ;;; Labels and References
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
370
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
371 (autoload 'reftex-label-location "reftex-ref")
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
372 (autoload 'reftex-label-info-update "reftex-ref")
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
373 (autoload 'reftex-label-info "reftex-ref")
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
374 (autoload 'reftex-label "reftex-ref"
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
375 "Insert a unique label." t)
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
376 (autoload 'reftex-reference "reftex-ref"
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
377 "Make a LaTeX reference." t)
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
378 (autoload 'reftex-varioref-vref "reftex-ref"
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
379 "Make a varioref reference." t)
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
380 (autoload 'reftex-fancyref-fref "reftex-ref"
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
381 "Make a fancyref \\fref reference." t)
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
382 (autoload 'reftex-fancyref-Fref "reftex-ref"
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
383 "Make a fancyref \\Fref reference." t)
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
384 (autoload 'reftex-show-label-location "reftex-ref")
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
385 (autoload 'reftex-query-label-type "reftex-ref")
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
386 (autoload 'reftex-goto-label "reftex-ref"
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
387 "Prompt for label name and go to that location." t)
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
388
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
389 ;;; =========================================================================
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
390 ;;;
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
391 ;;; Table of contents
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
392
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
393 (autoload 'reftex-toc "reftex-toc"
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
394 "Show the table of contents for the current document." t)
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
395 (autoload 'reftex-toc-recenter "reftex-toc"
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
396 "Display the TOC window and highlight line corresponding to current position." t)
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
397 (autoload 'reftex-toggle-auto-toc-recenter "reftex-toc"
85825
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
398 "Toggle automatic recentering of TOC window." t)
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
399
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
400 ;;; =========================================================================
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
401 ;;;
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
402 ;;; BibTeX citations.
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
403
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
404 (autoload 'reftex-citep "reftex-cite")
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
405 (autoload 'reftex-citet "reftex-cite")
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
406 (autoload 'reftex-make-cite-echo-string "reftex-cite")
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
407 (autoload 'reftex-get-bibfile-list "reftex-cite")
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
408 (autoload 'reftex-pop-to-bibtex-entry "reftex-cite")
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
409 (autoload 'reftex-end-of-bib-entry "reftex-cite")
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
410 (autoload 'reftex-parse-bibtex-entry "reftex-cite")
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
411 (autoload 'reftex-citation "reftex-cite"
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
412 "Make a citation using BibTeX database files." t)
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
413 (autoload 'reftex-default-bibliography "reftex-cite")
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
414 (autoload 'reftex-bib-or-thebib "reftex-cite")
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
415 (autoload 'reftex-create-bibtex-file "reftex-cite")
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
416
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
417 ;;; =========================================================================
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
418 ;;;
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
419 ;;; Selection
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
420
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
421 (autoload 'reftex-select-label-mode "reftex-sel")
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
422 (autoload 'reftex-select-bib-mode "reftex-sel")
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
423 (autoload 'reftex-find-start-point "reftex-sel")
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
424 (autoload 'reftex-insert-docstruct "reftex-sel")
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
425 (autoload 'reftex-get-offset "reftex-sel")
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
426 (autoload 'reftex-select-item "reftex-sel")
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
427
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
428
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
429 ;;; =========================================================================
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
430 ;;;
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
431 ;;; Index support
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
432
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
433 (autoload 'reftex-index "reftex-index"
99383
a5f24b6e48ef * international/mule-cmds.el (toggle-enable-multibyte-characters)
Juanma Barranquero <lekktu@gmail.com>
parents: 95268
diff changeset
434 "Query for an index macro and insert it along with its arguments." t)
85825
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
435 (autoload 'reftex-index-selection-or-word "reftex-index"
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
436 "Put selection or the word near point into the default index macro." t)
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
437 (autoload 'reftex-index-phrase-selection-or-word "reftex-index"
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
438 "Put selection or the word near point into Index Phrases File." t)
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
439 (autoload 'reftex-display-index "reftex-index"
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
440 "Display a buffer with an index compiled from the current document." t)
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
441 (autoload 'reftex-index-visit-phrases-buffer "reftex-index"
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
442 "Visit the Index Phrases File." t)
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
443 (autoload 'reftex-index-phrases-mode "reftex-index"
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
444 "Major mode for managing the Index phrases of a LaTeX document." t)
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
445 (autoload 'reftex-index-complete-tag "reftex-index")
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
446 (autoload 'reftex-index-complete-key "reftex-index")
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
447 (autoload 'reftex-index-show-entry "reftex-index")
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
448 (autoload 'reftex-index-select-tag "reftex-index")
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
449
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
450
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
451 ;;; =========================================================================
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
452 ;;;
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
453 ;;; View cross references
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
454
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
455 (autoload 'reftex-view-crossref "reftex-dcr"
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
456 "View cross reference of \\ref or \\cite macro at point." t)
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
457 (autoload 'reftex-mouse-view-crossref "reftex-dcr"
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
458 "View cross reference of \\ref or \\cite macro where you click." t)
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
459 (autoload 'reftex-toggle-auto-view-crossref "reftex-dcr")
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
460 (autoload 'reftex-view-crossref-from-bibtex "reftex-dcr"
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
461 "View location in a LaTeX document which cites the BibTeX entry at point." t)
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
462
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
463
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
464 ;;; =========================================================================
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
465 ;;;
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
466 ;;; Operations on entire Multifile documents
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
467
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
468 (autoload 'reftex-create-tags-file "reftex-global"
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
469 "Create TAGS file by running `etags' on the current document." t)
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
470 (autoload 'reftex-grep-document "reftex-global"
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
471 "Run grep query through all files related to this document." t)
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
472 (autoload 'reftex-search-document "reftex-global"
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
473 "Regexp search through all files of the current TeX document." t)
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
474 (autoload 'reftex-query-replace-document "reftex-global"
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
475 "Run a query-replace-regexp of FROM with TO over the entire TeX document." t)
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
476 (autoload 'reftex-find-duplicate-labels "reftex-global"
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
477 "Produce a list of all duplicate labels in the document." t)
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
478 (autoload 'reftex-change-label "reftex-global"
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
479 "Query replace FROM with TO in all \\label and \\ref commands." t)
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
480 (autoload 'reftex-renumber-simple-labels "reftex-global"
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
481 "Renumber all simple labels in the document to make them sequentially." t)
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
482 (autoload 'reftex-save-all-document-buffers "reftex-global"
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
483 "Save all documents associated with the current document." t)
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
484
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
485
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
486 ;;; =========================================================================
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
487 ;;;
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
488 ;;; AUCTeX Interface
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
489
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
490 (autoload 'reftex-arg-label "reftex-auc")
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
491 (autoload 'reftex-arg-cite "reftex-auc")
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
492 (autoload 'reftex-arg-index-tag "reftex-auc")
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
493 (autoload 'reftex-arg-index "reftex-auc")
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
494 (autoload 'reftex-plug-into-AUCTeX "reftex-auc")
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
495 (autoload 'reftex-toggle-plug-into-AUCTeX "reftex-auc"
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
496 "Toggle Interface between AUCTeX and RefTeX on and off." t)
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
497 (autoload 'reftex-add-label-environments "reftex-auc")
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
498 (autoload 'reftex-add-to-label-alist "reftex-auc")
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
499 (autoload 'reftex-add-section-levels "reftex-auc")
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
500 (autoload 'reftex-notice-new-section "reftex-auc")
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
501
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
502 ;;;###autoload
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
503 (defun turn-on-reftex ()
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
504 "Turn on RefTeX mode."
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
505 (reftex-mode t))
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
506
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
507 ;;;###autoload
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
508 (defun reftex-mode (&optional arg)
18123
7831ac89a334 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18050
diff changeset
509 "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
510
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
511 \\<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
512 capabilities is available with `\\[reftex-toc]'.
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
513
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
514 Labels can be created with `\\[reftex-label]' and referenced with `\\[reftex-reference]'.
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
515 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
516 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
517 \\ref macro.
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
518
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
519 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
520 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
521 database. The selected citation is inserted as a \\cite macro.
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
522
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
523 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
524 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
525 `\\[reftex-index]'. `\\[reftex-display-index]' displays the compiled index.
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
526
18321
0ed97be54a28 Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents: 18220
diff changeset
527 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
528 pressing `?' to any prompt mentioning this feature.
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
529
23707
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
530 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
531 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
532
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
533 \\{reftex-mode-map}
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
534 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
535 on the menu bar.
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
536
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
537 ------------------------------------------------------------------------------"
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
538
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
539 (interactive "P")
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
540 (setq reftex-mode (not (or (and (null arg) reftex-mode)
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
541 (<= (prefix-numeric-value arg) 0))))
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
542
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
543 (if reftex-mode
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
544 (progn
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
545 ;; Mode was turned on
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
546 (easy-menu-add reftex-mode-menu)
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
547 (and reftex-plug-into-AUCTeX
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
548 (reftex-plug-into-AUCTeX))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
549 (unless (get 'reftex-auto-view-crossref 'initialized)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
550 (and reftex-auto-view-crossref
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
551 (reftex-toggle-auto-view-crossref))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
552 (put 'reftex-auto-view-crossref 'initialized t))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
553 (unless (get 'reftex-auto-recenter-toc 'initialized)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
554 (and (eq reftex-auto-recenter-toc t)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
555 (reftex-toggle-auto-toc-recenter))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
556 (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
557
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
558 ;; Prepare the special syntax tables.
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
559 (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
560 (modify-syntax-entry ?\( "." reftex-syntax-table)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
561 (modify-syntax-entry ?\) "." reftex-syntax-table)
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
562
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
563 (setq reftex-syntax-table-for-bib
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
564 (copy-syntax-table reftex-syntax-table))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
565 (modify-syntax-entry ?\' "." reftex-syntax-table-for-bib)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
566 (modify-syntax-entry ?\" "." reftex-syntax-table-for-bib)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
567 (modify-syntax-entry ?\[ "." reftex-syntax-table-for-bib)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
568 (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
569
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
570 (run-hooks 'reftex-mode-hook))
23707
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
571 ;; Mode was turned off
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
572 (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
573
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
574 (if (fboundp 'add-minor-mode)
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
575 ;; 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
576 (progn
23995
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
577 (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
578 (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
579 (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
580 ;; The standard way
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
581 (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
582 (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
583 (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
584 (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
585
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
586 (defvar reftex-docstruct-symbol)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
587 (defun reftex-kill-buffer-hook ()
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
588 "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
589 ;; 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
590 ;; 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
591 ;; 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
592 (when (and (boundp 'reftex-mode) reftex-mode
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
593 (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
594 (boundp 'reftex-docstruct-symbol) reftex-docstruct-symbol
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
595 (symbol-value reftex-docstruct-symbol)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
596 (get reftex-docstruct-symbol 'modified))
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
597 ;; Write the file.
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
598 (condition-case nil
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
599 (reftex-access-parse-file 'write)
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
600 (error nil))))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
601
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
602 (defun reftex-kill-emacs-hook ()
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
603 "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
604 ;; 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
605 (save-excursion
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
606 (mapcar (lambda (buf)
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
607 (set-buffer buf)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
608 (reftex-kill-buffer-hook))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
609 (buffer-list))))
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
610
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
611 ;;; =========================================================================
18321
0ed97be54a28 Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents: 18220
diff changeset
612 ;;;
0ed97be54a28 Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents: 18220
diff changeset
613 ;;; Silence warnings about variables in other packages.
93097
bb437302d206 * textmodes/refbib.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents: 92293
diff changeset
614 (defvar TeX-master)
bb437302d206 * textmodes/refbib.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents: 92293
diff changeset
615 (defvar LaTeX-section-hook)
bb437302d206 * textmodes/refbib.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents: 92293
diff changeset
616 (defvar LaTeX-label-function)
bb437302d206 * textmodes/refbib.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents: 92293
diff changeset
617 (defvar tex-main-file)
bb437302d206 * textmodes/refbib.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents: 92293
diff changeset
618 (defvar outline-minor-mode)
bb437302d206 * textmodes/refbib.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents: 92293
diff changeset
619 (defvar font-lock-mode)
bb437302d206 * textmodes/refbib.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents: 92293
diff changeset
620 (defvar font-lock-keywords)
bb437302d206 * textmodes/refbib.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents: 92293
diff changeset
621 (defvar font-lock-fontify-region-function)
bb437302d206 * textmodes/refbib.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents: 92293
diff changeset
622 (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
623
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
624 ;;; =========================================================================
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
625 ;;;
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
626 ;;; Multibuffer Variables
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
627 ;;;
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
628 ;;; Technical notes: These work as follows: We keep just one list
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
629 ;;; 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
630 ;;; `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
631 ;;; 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
632 ;;; document. Each buffer has local variables which point to these symbols.
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
633
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
634 ;; List of variables which handle the multifile stuff.
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
635 ;; This list is used to tie, untie, and reset these symbols.
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
636 (defconst reftex-multifile-symbols
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
637 '(reftex-docstruct-symbol))
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
638
18321
0ed97be54a28 Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents: 18220
diff changeset
639 ;; Alist connecting master file names with the corresponding lisp symbols.
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
640 (defvar reftex-master-index-list nil)
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
641
18321
0ed97be54a28 Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents: 18220
diff changeset
642 ;; Last index used for a master file.
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
643 (defvar reftex-multifile-index 0)
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
644
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
645 ;; 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
646 (defvar reftex-docstruct-symbol nil)
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
647 (make-variable-buffer-local 'reftex-docstruct-symbol)
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
648
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
649 (defun reftex-next-multifile-index ()
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
650 ;; 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
651 (incf reftex-multifile-index))
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
652
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
653 (defun reftex-tie-multifile-symbols ()
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
654 ;; Tie the buffer-local symbols to globals connected with the master file.
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
655 ;; 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
656
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
657 (let* ((master (file-truename (reftex-TeX-master-file)))
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
658 (index (assoc master reftex-master-index-list))
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
659 (symlist reftex-multifile-symbols)
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
660 symbol symname newflag)
18321
0ed97be54a28 Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents: 18220
diff changeset
661 ;; Find the correct index.
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
662 (if index
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
663 ;; symbols do exist
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
664 (setq index (cdr index))
18321
0ed97be54a28 Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents: 18220
diff changeset
665 ;; Get a new index and add info to the alist.
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
666 (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
667 newflag t)
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
668 (push (cons master index) reftex-master-index-list))
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
669
18321
0ed97be54a28 Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents: 18220
diff changeset
670 ;; Get/create symbols and tie them.
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
671 (while symlist
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
672 (setq symbol (car symlist)
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
673 symlist (cdr symlist)
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
674 symname (symbol-name symbol))
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
675 (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
676 (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
677 ;; Initialize if new symbols.
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
678 (when newflag
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
679 (set (symbol-value symbol) nil)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
680 (put (symbol-value symbol) 'reftex-index-macros-style '(default))))
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
681
18321
0ed97be54a28 Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents: 18220
diff changeset
682 ;; 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
683 (not newflag)))
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
684
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
685 (defun reftex-untie-multifile-symbols ()
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
686 ;; Remove ties from multifile symbols, so that next use makes new ones.
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
687 (let ((symlist reftex-multifile-symbols)
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
688 (symbol nil))
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
689 (while symlist
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
690 (setq symbol (car symlist)
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
691 symlist (cdr symlist))
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
692 (set symbol nil))))
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
693
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
694 (defun reftex-TeX-master-file ()
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
695 ;; 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
696 ;; 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
697 ;; 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
698 ;; variable tex-main-file.
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
699 (let
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
700 ((master
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
701 (cond
18321
0ed97be54a28 Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents: 18220
diff changeset
702 ((fboundp 'TeX-master-file) ; AUCTeX is loaded. Use its mechanism.
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
703 (condition-case nil
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
704 (TeX-master-file t)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
705 (error (buffer-file-name))))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
706 ((fboundp 'tex-main-file) (tex-main-file)) ; Emacs LaTeX mode
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
707 ((boundp 'TeX-master) ; The variable is defined - lets use it.
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
708 (cond
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
709 ((eq TeX-master t)
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
710 (buffer-file-name))
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
711 ((eq TeX-master 'shared)
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
712 (setq TeX-master (read-file-name "Master file: "
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
713 nil nil t nil)))
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
714 (TeX-master)
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
715 (t
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
716 (setq TeX-master (read-file-name "Master file: "
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
717 nil nil t nil)))))
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
718 ((boundp 'tex-main-file)
18321
0ed97be54a28 Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents: 18220
diff changeset
719 ;; This is the variable from the default TeX modes.
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
720 (cond
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
721 ((stringp tex-main-file)
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
722 ;; ok, this must be it
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
723 tex-main-file)
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
724 (t
18321
0ed97be54a28 Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents: 18220
diff changeset
725 ;; In this case, the buffer is its own master.
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
726 (buffer-file-name))))
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
727 (t
18321
0ed97be54a28 Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents: 18220
diff changeset
728 ;; Know nothing about master file. Assume this is a master file.
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
729 (buffer-file-name)))))
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
730 (cond
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
731 ((null master)
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
732 (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
733 ((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
734 (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
735 ;; 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
736 (setq master (concat master ".tex")))
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
737 ((or (file-exists-p master)
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
738 (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
739 ;; 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
740 )
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
741 (t
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
742 ;; Use buffer file name.
65548
253cad16882d Little fixes to remove compiler warnings
Carsten Dominik <dominik@science.uva.nl>
parents: 65266
diff changeset
743 (setq master (buffer-file-name))))
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
744 (expand-file-name master)))
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
745
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
746 (defun reftex-is-multi ()
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
747 ;; 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
748 (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
749 (if entry
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
750 (nth 1 entry)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
751 t)))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
752
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
753 (defun reftex-set-cite-format (value)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
754 "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
755 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
756 `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
757 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
758 (unless reftex-docstruct-symbol
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
759 (reftex-tie-multifile-symbols))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
760 (when (and reftex-docstruct-symbol
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
761 (symbolp reftex-docstruct-symbol))
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
762 (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
763
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
764 (defun reftex-get-cite-format ()
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
765 ;; 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
766 ;; 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
767 (if (and reftex-docstruct-symbol
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
768 (symbolp reftex-docstruct-symbol)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
769 (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
770 (get reftex-docstruct-symbol 'reftex-cite-format)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
771 reftex-cite-format))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
772
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
773 (defun reftex-add-index-macros (entry-list)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
774 "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
775 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
776 for details.
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
777 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
778 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
779 `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
780 `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
781 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
782 (unless reftex-docstruct-symbol
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
783 (reftex-tie-multifile-symbols))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
784 (when (and reftex-docstruct-symbol
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
785 (symbolp reftex-docstruct-symbol))
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
786 (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
787 entry changed)
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
788 (while entry-list
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
789 (setq entry (pop entry-list))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
790 ;; 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
791 (and (symbolp entry)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
792 (not (memq entry list))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
793 (setq list (reftex-remove-symbols-from-list list)))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
794 ;; Add to list unless already member
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
795 (unless (member entry list)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
796 (setq reftex-tables-dirty t
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
797 changed t)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
798 (push entry list)))
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
799 (when changed
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
800 (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
801
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
802 ;;; =========================================================================
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
803 ;;;
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
804 ;;; 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
805
0ed97be54a28 Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents: 18220
diff changeset
806 ;; 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
807
20829
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
808 ;; 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
809 (defvar reftex-type-query-prompt nil)
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
810
20829
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
811 ;; Help string for label type queries.
46612
7522419c4db0 Updated to reftex 4.17
Carsten Dominik <dominik@science.uva.nl>
parents: 38422
diff changeset
812 (defvar reftex-type-query-help nil)
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
813
18321
0ed97be54a28 Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents: 18220
diff changeset
814 ;; Alist relating label type to reference format.
46612
7522419c4db0 Updated to reftex 4.17
Carsten Dominik <dominik@science.uva.nl>
parents: 38422
diff changeset
815 (defvar reftex-typekey-to-format-alist nil)
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
816
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
817 ;; Alist relating label type to label prefix.
46612
7522419c4db0 Updated to reftex 4.17
Carsten Dominik <dominik@science.uva.nl>
parents: 38422
diff changeset
818 (defvar reftex-typekey-to-prefix-alist nil)
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
819
18321
0ed97be54a28 Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents: 18220
diff changeset
820 ;; 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
821 (defvar reftex-env-or-mac-alist nil)
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
822
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
823 ;; List of special environment parser functions
46612
7522419c4db0 Updated to reftex 4.17
Carsten Dominik <dominik@science.uva.nl>
parents: 38422
diff changeset
824 (defvar reftex-special-env-parsers nil)
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
825
18321
0ed97be54a28 Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents: 18220
diff changeset
826 ;; List of macros carrying a label.
46612
7522419c4db0 Updated to reftex 4.17
Carsten Dominik <dominik@science.uva.nl>
parents: 38422
diff changeset
827 (defvar reftex-label-mac-list nil)
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
828
18321
0ed97be54a28 Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents: 18220
diff changeset
829 ;; List of environments carrying a label.
46612
7522419c4db0 Updated to reftex 4.17
Carsten Dominik <dominik@science.uva.nl>
parents: 38422
diff changeset
830 (defvar reftex-label-env-list nil)
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
831
18321
0ed97be54a28 Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents: 18220
diff changeset
832 ;; List of all typekey letters in use.
46612
7522419c4db0 Updated to reftex 4.17
Carsten Dominik <dominik@science.uva.nl>
parents: 38422
diff changeset
833 (defvar reftex-typekey-list nil)
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
834
18321
0ed97be54a28 Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents: 18220
diff changeset
835 ;; 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
836 (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
837 ;; 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
838 (defvar reftex-prefix-to-typekey-alist nil)
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
839
18321
0ed97be54a28 Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents: 18220
diff changeset
840 ;; The last list-of-labels entry used in a reference.
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
841 (defvar reftex-last-used-reference (list nil nil nil nil))
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
842
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
843 ;; Alist relating index macros to other info.
46612
7522419c4db0 Updated to reftex 4.17
Carsten Dominik <dominik@science.uva.nl>
parents: 38422
diff changeset
844 (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
845 ;; Prompt for index macro queries
46612
7522419c4db0 Updated to reftex 4.17
Carsten Dominik <dominik@science.uva.nl>
parents: 38422
diff changeset
846 (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
847 ;; Help string for index macro queries
46612
7522419c4db0 Updated to reftex 4.17
Carsten Dominik <dominik@science.uva.nl>
parents: 38422
diff changeset
848 (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
849
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
850 ;; The message when follow-mode is suspended
46612
7522419c4db0 Updated to reftex 4.17
Carsten Dominik <dominik@science.uva.nl>
parents: 38422
diff changeset
851 (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
852 "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
853 (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
854 "%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
855
18321
0ed97be54a28 Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents: 18220
diff changeset
856 ;; Global variables used for communication between functions.
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
857 (defvar reftex-default-context-position nil)
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
858 (defvar reftex-location-start nil)
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
859 (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
860 (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
861 (defvar reftex-active-toc nil)
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
862 (defvar reftex-tex-path nil)
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
863 (defvar reftex-bib-path nil)
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
864 (defvar reftex-select-marked nil)
20979
38e7bcbb3595 (reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents: 20953
diff changeset
865 (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
866 (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
867 (defvar reftex-prefix nil)
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
868 (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
869 (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
870 (defvar reftex-callback-fwd t)
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
871 (defvar reftex-last-toc-master nil
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
872 "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
873 ;; Marker for return point from recursive edit
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
874 (defvar reftex-recursive-edit-marker (make-marker))
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
875
18321
0ed97be54a28 Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents: 18220
diff changeset
876 ;; List of buffers created temporarily for lookup, which should be killed.
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
877 (defvar reftex-buffers-to-kill nil)
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
878
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
879 ;; Regexp to find anything.
19660
fa3d4e7a76d9 (reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents: 18321
diff changeset
880 (defvar reftex-section-regexp nil)
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
881 (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
882 (defvar reftex-index-macro-regexp nil)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
883 (defvar reftex-index-level-re nil)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
884 (defvar reftex-index-key-end-re nil)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
885 (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
886 (defvar reftex-everything-regexp nil)
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
887 (defvar reftex-everything-regexp-no-index nil)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
888 (defvar reftex-index-re nil)
23995
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
889 (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
890 "\\\\\\([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
891 (defvar reftex-find-reference-format
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
892 "\\\\\\(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
893 (defvar reftex-macros-with-labels nil)
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
894 (defvar reftex-macros-with-index nil)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
895 (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
896 (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
897 (defvar reftex-find-label-regexp-format2 nil)
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
898
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
899 (defvar reftex-memory nil
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
900 "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
901
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
902 ;; 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
903 ;; The cache is used to save the compiled versions of some variables.
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
904 (defconst reftex-cache-variables
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
905 '(reftex-memory ;; This MUST ALWAYS be the first!
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
906
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
907 ;; Outline
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
908 reftex-section-levels-all
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
909
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
910 ;; Labels
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
911 reftex-env-or-mac-alist
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
912 reftex-special-env-parsers
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
913 reftex-macros-with-labels
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
914 reftex-label-mac-list
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
915 reftex-label-env-list
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
916 reftex-typekey-list
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
917 reftex-typekey-to-format-alist
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
918 reftex-typekey-to-prefix-alist
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
919 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
920 reftex-prefix-to-typekey-alist
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
921 reftex-type-query-prompt
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
922 reftex-type-query-help
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
923
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
924 ;; Index
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
925 reftex-index-macro-alist
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
926 reftex-macros-with-index
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
927 reftex-query-index-macro-prompt
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
928 reftex-query-index-macro-help
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
929 reftex-key-to-index-macro-alist
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
930
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
931 ;; Regular expressions
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
932 reftex-section-regexp
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
933 reftex-section-or-include-regexp
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
934 reftex-index-re
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
935 reftex-everything-regexp
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
936 reftex-everything-regexp-no-index
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
937 reftex-find-label-regexp-format
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
938 reftex-find-label-regexp-format2
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
939 reftex-find-index-entry-regexp-format
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
940 ))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
941
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
942 (defun reftex-ensure-compiled-variables ()
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
943 ;; Recompile the label alist when necessary
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
944 (let* ((mem reftex-memory)
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
945 (cache (get reftex-docstruct-symbol 'reftex-cache))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
946 (cmem (car cache))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
947 (alist reftex-label-alist)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
948 (levels (get reftex-docstruct-symbol 'reftex-section-levels))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
949 (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
950 (default reftex-default-label-alist-entries)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
951 (index reftex-index-macros)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
952 (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
953 (cond
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
954 (reftex-tables-dirty (reftex-compile-variables))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
955 ((and (eq alist (nth 0 mem))
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
956 (eq levels (nth 1 mem))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
957 (eq style (nth 2 mem))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
958 (eq default (nth 3 mem))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
959 (eq index (nth 4 mem))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
960 (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
961 ((and (eq alist (nth 0 cmem))
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
962 (eq levels (nth 1 cmem))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
963 (eq style (nth 2 cmem))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
964 (eq default (nth 2 cmem))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
965 (eq index (nth 4 cmem))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
966 (eq istyle (nth 5 cmem)))
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
967 ;; restore the cache
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
968 (message "Restoring cache")
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
969 (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
970 (t (reftex-compile-variables)))))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
971
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
972 (defun reftex-reset-mode ()
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
973 "Reset RefTeX Mode.
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
974 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
975 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
976 on next use."
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
977 (interactive)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
978
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
979 ;; Reset the file search path variables
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
980 (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
981 (put 'reftex-tex-path prop nil)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
982 (put 'reftex-bib-path prop nil))
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
983
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
984 ;; 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
985 ;; were not cleaned up properly
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
986 (save-excursion
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
987 (let ((buffer-list '("*RefTeX Help*" "*RefTeX Select*"
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
988 "*Duplicate Labels*" "*toc*" " *RefTeX-scratch*"))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
989 buf)
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
990 (while (setq buf (pop buffer-list))
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
991 (if (get-buffer buf)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
992 (kill-buffer buf))))
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
993 (reftex-erase-all-selection-and-index-buffers))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
994
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
995 ;; 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
996 (reftex-reset-scanning-information)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
997
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
998 ;; Remove any parse info file
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
999 (reftex-access-parse-file 'kill)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1000
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1001 ;; 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
1002 (and reftex-plug-into-AUCTeX
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1003 (reftex-plug-into-AUCTeX))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1004
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1005 (reftex-compile-variables))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1006
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1007 ;;;###autoload
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1008 (defun reftex-reset-scanning-information ()
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1009 "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
1010 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
1011 (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
1012 (reftex-erase-buffer "*toc*"))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1013 (let ((symlist reftex-multifile-symbols)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1014 symbol)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1015 (while symlist
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1016 (setq symbol (car symlist)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1017 symlist (cdr symlist))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1018 (if (and (symbolp (symbol-value symbol))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1019 (not (null (symbol-value symbol))))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1020 (set (symbol-value symbol) nil)))))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1021
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1022 (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
1023 ;; 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
1024 (mapc
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1025 (lambda (type)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1026 (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
1027 reftex-typekey-list)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1028 ;; Kill all index buffers
85194
b4b8e47fe18b (reftex-erase-all-selection-and-index-buffers)
Glenn Morris <rgm@gnu.org>
parents: 82140
diff changeset
1029 (mapc
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1030 (lambda (tag)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1031 (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
1032 (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
1033
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1034 (defun reftex-compile-variables ()
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1035 ;; 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
1036
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1037 (message "Compiling label environment definitions...")
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1038
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1039 ;; Update AUCTeX style information
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1040 (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
1041 (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
1042
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1043 ;; 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
1044 (setq reftex-tables-dirty nil)
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
1045 (setq reftex-memory
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1046 (list reftex-label-alist
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1047 (get reftex-docstruct-symbol 'reftex-section-levels)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1048 (get reftex-docstruct-symbol 'reftex-label-alist-style)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1049 reftex-default-label-alist-entries
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1050 reftex-index-macros
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1051 (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
1052
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1053 ;; Compile information in reftex-label-alist
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1054 (let ((all (reftex-uniquify-by-car
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1055 (reftex-splice-symbols-into-list
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1056 (append reftex-label-alist
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1057 (get reftex-docstruct-symbol
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1058 'reftex-label-alist-style)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1059 reftex-default-label-alist-entries)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1060 reftex-label-alist-builtin)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1061 '(nil)))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1062 (all-index (reftex-uniquify-by-car
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1063 (reftex-splice-symbols-into-list
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
1064 (append reftex-index-macros
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1065 (get reftex-docstruct-symbol
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1066 'reftex-index-macros-style)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1067 '(default))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1068 reftex-index-macros-builtin)))
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1069 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
1070 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
1071 nargs nlabel opt-args cell sum i
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1072 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
1073
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1074 (setq reftex-words-to-typekey-alist nil
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
1075 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
1076 '(("sec:" . "s") ("cha:" . "s") ("chap:" . "s"))
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1077 reftex-typekey-list nil
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1078 reftex-typekey-to-format-alist nil
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1079 reftex-typekey-to-prefix-alist nil
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1080 reftex-env-or-mac-alist nil
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1081 reftex-label-env-list nil
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1082 reftex-label-mac-list nil)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1083 (while all
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1084 (catch 'next-entry
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1085 (setq entry (car all)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1086 env-or-mac (car entry)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1087 entry (cdr entry)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1088 all (cdr all))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1089 (if (null env-or-mac)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1090 (setq env-or-mac ""))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1091 (if (stringp (car entry))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1092 ;; 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
1093 ;; 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
1094 (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
1095 (cons (concat (car entry) ":")
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1096 (cdr entry)))))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1097 (setq typekeychar (nth 0 entry)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1098 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
1099 prefix (nth 1 entry)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1100 fmt (nth 2 entry)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1101 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
1102 wordlist (nth 4 entry)
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1103 toc-level (nth 5 entry))
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1104 (if (stringp wordlist)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1105 ;; 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
1106 (setq wordlist (nthcdr 4 entry)))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1107
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1108 (if (and (stringp fmt)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1109 (string-match "@" fmt))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1110 ;; Special syntax for specifying a label format
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1111 (setq fmt (split-string fmt "@+"))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1112 (setq fmt (list "\\label{%s}" fmt)))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1113 (setq labelfmt (car fmt)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1114 reffmt (nth 1 fmt))
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1115 ;; Note a new typekey
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1116 (if typekey
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1117 (add-to-list 'reftex-typekey-list typekey))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1118 (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
1119 (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
1120 (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
1121 (cons prefix typekey)))
9bad65481674 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 52401
diff changeset
1122 (if (and typekey prefix
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1123 (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
1124 (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
1125 (cons typekey prefix)))
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1126 ;; 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
1127 (cond
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1128 ((symbolp env-or-mac)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1129 ;; A special parser function
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1130 (unless (fboundp env-or-mac)
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
1131 (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
1132 env-or-mac))
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1133 (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
1134 (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
1135 (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
1136 ((string-match "\\`\\\\" env-or-mac)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1137 ;; It's a macro
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1138 (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
1139 (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
1140 nargs (second result)
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1141 nlabel (third result)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1142 opt-args (fourth result))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1143 (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
1144 (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
1145 (t
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1146 ;; It's an environment
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1147 (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
1148 (cond ((string= env-or-mac "any"))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1149 ((string= env-or-mac ""))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1150 ((string= env-or-mac "section"))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1151 (t
26910
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
1152 (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
1153 (if toc-level
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1154 (let ((string (format "begin{%s}" env-or-mac)))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1155 (or (assoc string toc-levels)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1156 (push (cons string toc-level) toc-levels))))))))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1157 ;; Translate some special context cases
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1158 (when (assq context reftex-default-context-regexps)
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
1159 (setq context
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
1160 (format
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1161 (cdr (assq context reftex-default-context-regexps))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1162 (regexp-quote env-or-mac))))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1163 ;; 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
1164 (and reffmt
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1165 (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
1166 (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
1167 ;; 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
1168 (and (not (string= env-or-mac "any"))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1169 (not (string= env-or-mac ""))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1170 (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
1171 (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
1172 nargs nlabel opt-args)
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1173 reftex-env-or-mac-alist))
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1174 ;; 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
1175 (if (eq (car wordlist) 'regexp)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1176 (setq wordlist (cdr wordlist))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1177 (setq wordlist (mapcar 'regexp-quote wordlist)))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1178 ;; 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
1179 (while (stringp (setq word (pop wordlist)))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1180 (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
1181 (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
1182 (cond
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1183 ((string= "" env-or-mac) nil)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1184 ((setq cell (assoc typekey qh-list))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1185 (push env-or-mac (cdr cell)))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1186 (typekey
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1187 (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
1188
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1189 (setq reftex-typekey-to-prefix-alist
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1190 (nreverse reftex-typekey-to-prefix-alist))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1191
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1192 ;; Prepare the typekey query prompt and help string.
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
1193 (setq qh-list
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1194 (sort qh-list
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1195 (lambda (x1 x2)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1196 (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
1197 (setq reftex-type-query-prompt
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1198 (concat "Label type: ["
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1199 (mapconcat (lambda(x) (format "%s" (car x)))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1200 qh-list "")
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1201 "]"))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1202 ;; 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
1203 (setq reftex-type-query-help
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
1204 (concat
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1205 "SELECT A LABEL TYPE:\n--------------------\n"
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1206 (mapconcat
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1207 (lambda(x)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1208 (setq sum 0)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1209 (format " [%s] %s"
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1210 (car x)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1211 (mapconcat (lambda(env)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1212 (setq sum (+ sum (length env)))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1213 (if (< sum 60)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1214 env
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1215 (setq sum 0)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1216 (concat "\n " env)))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1217 (cdr x) " ")))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1218 qh-list "\n")))
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1219
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1220 ;; 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
1221 ;; 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
1222 ;; These characters will be seen and removed.
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1223 (setq reftex-words-to-typekey-alist
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
1224 (mapcar
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1225 (lambda (x)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1226 (setq word (car x)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1227 typekey (cdr x)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1228 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
1229 (setq word (concat "\\W\\(" word "[ \t\n\r]*\\)\\("))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1230 (setq i 0)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1231 (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
1232 (< i (length fmt))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1233 (not (member (aref fmt i) '(?%))))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1234 (setq word (concat word "\\|" (regexp-quote
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1235 (substring fmt 0 (1+ i)))))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1236 (incf i))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1237 (cons (concat word "\\)\\=") typekey))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1238 (nreverse reftex-words-to-typekey-alist)))
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1239
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1240 ;; Parse the index macros
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1241 (setq reftex-index-macro-alist nil
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1242 reftex-key-to-index-macro-alist nil
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1243 reftex-macros-with-index nil)
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1244 (while all-index
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1245 (setq entry (car all-index)
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1246 macro (car entry)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1247 tag (nth 1 entry)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1248 key (nth 2 entry)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1249 prefix (or (nth 3 entry) "")
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1250 verify (nth 4 entry)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1251 ;; 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
1252 ;; 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
1253 ;; 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
1254 repeat (cond ((> (length entry) 5) (nth 5 entry))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1255 ((and (eq key (car reftex-index-default-macro))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1256 (> (length reftex-index-default-macro) 2))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1257 ;; User has old setting - respect it
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1258 (nth 2 reftex-index-default-macro))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1259 (t t))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1260 all-index (cdr all-index))
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1261 (let ((result (reftex-parse-args macro)))
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1262 (setq macro (or (first result) macro)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1263 nargs (second result)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1264 nindex (third result)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1265 opt-args (fourth result))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1266 (unless (member macro reftex-macros-with-index)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1267 ;; 0 1 2 3 4 5 6 7
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1268 (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
1269 reftex-index-macro-alist)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1270 (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
1271 (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
1272 (push macro reftex-macros-with-index))))
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1273 ;; 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
1274 (setq reftex-key-to-index-macro-alist
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1275 (sort reftex-key-to-index-macro-alist
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1276 (lambda (a b) (< (downcase (car a)) (downcase (car b))))))
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
1277 (setq reftex-query-index-macro-prompt
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1278 (concat "Index macro: ["
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1279 (mapconcat (lambda (x) (char-to-string (car x)))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1280 reftex-key-to-index-macro-alist "")
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1281 "]"))
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1282 (setq i 0
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1283 reftex-query-index-macro-help
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
1284 (concat
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1285 "SELECT A MACRO:\n---------------\n"
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1286 (mapconcat
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1287 (lambda(x)
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
1288 (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
1289 (if (= 0 (mod (incf i) 3)) "\n" "")))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1290 reftex-key-to-index-macro-alist "")))
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1291
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1292 ;; Make the full list of section levels
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1293 (setq reftex-section-levels-all
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1294 (append toc-levels
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1295 (get reftex-docstruct-symbol 'reftex-section-levels)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1296 reftex-section-levels))
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1297
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1298 ;; Calculate the regular expressions
46612
7522419c4db0 Updated to reftex 4.17
Carsten Dominik <dominik@science.uva.nl>
parents: 38422
diff changeset
1299 (let* (
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1300 ; (wbol "\\(\\`\\|[\n\r]\\)[ \t]*")
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1301 (wbol "\\(^\\)[ \t]*") ; Need to keep the empty group because
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
1302 ;;; because match number are hard coded
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1303 (label-re "\\\\label{\\([^}]*\\)}")
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
1304 (include-re (concat wbol
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1305 "\\\\\\("
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
1306 (mapconcat 'identity
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1307 reftex-include-file-commands "\\|")
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1308 "\\)[{ \t]+\\([^} \t\n\r]+\\)"))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1309 (section-re
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1310 (concat wbol "\\\\\\("
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1311 (mapconcat (lambda (x) (regexp-quote (car x)))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1312 reftex-section-levels-all "\\|")
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1313 "\\)\\*?\\(\\[[^]]*\\]\\)?[[{ \t\r\n]"))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1314 (appendix-re (concat wbol "\\(\\\\appendix\\)"))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1315 (macro-re
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1316 (if macros-with-labels
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1317 (concat "\\("
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1318 (mapconcat 'regexp-quote macros-with-labels "\\|")
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1319 "\\)[[{]")
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1320 ""))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1321 (index-re
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1322 (concat "\\("
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1323 (mapconcat 'regexp-quote reftex-macros-with-index "\\|")
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1324 "\\)[[{]"))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1325 (find-index-re-format
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1326 (concat "\\("
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1327 (mapconcat 'regexp-quote reftex-macros-with-index "\\|")
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1328 "\\)\\([[{][^]}]*[]}]\\)*[[{]\\(%s\\)[]}]"))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1329 (find-label-re-format
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1330 (concat "\\("
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1331 (mapconcat 'regexp-quote (append '("\\label")
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1332 macros-with-labels) "\\|")
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1333 "\\)\\([[{][^]}]*[]}]\\)*[[{]\\(%s\\)[]}]"))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1334 (index-level-re
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1335 (regexp-quote (nth 0 reftex-index-special-chars)))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1336 (index-key-end-re ;; ^]- not allowed
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1337 (concat "[^" (nth 3 reftex-index-special-chars) "]"
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1338 "[" (nth 1 reftex-index-special-chars)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1339 (nth 2 reftex-index-special-chars) "]"))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1340 )
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1341 (setq reftex-section-regexp section-re
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1342 reftex-section-or-include-regexp
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1343 (concat section-re "\\|" include-re)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1344 reftex-everything-regexp
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1345 (concat label-re "\\|" section-re "\\|" include-re
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1346 "\\|" appendix-re
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1347 "\\|" index-re
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1348 (if macros-with-labels "\\|" "") macro-re)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1349 reftex-everything-regexp-no-index
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1350 (concat label-re "\\|" section-re "\\|" include-re
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1351 "\\|" appendix-re
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1352 "\\|" "\\(\\\\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
1353 (if macros-with-labels "\\|" "") macro-re)
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1354 reftex-index-re index-re
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1355 reftex-index-level-re index-level-re
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1356 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
1357 reftex-macros-with-labels macros-with-labels
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1358 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
1359 reftex-find-label-regexp-format find-label-re-format
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
1360 reftex-find-label-regexp-format2
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1361 "\\([]} \t\n\r]\\)\\([[{]\\)\\(%s\\)[]}]")
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1362 (message "Compiling label environment definitions...done")))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1363 (put reftex-docstruct-symbol 'reftex-cache
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1364 (mapcar 'symbol-value reftex-cache-variables)))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1365
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1366 (defun reftex-parse-args (macro)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1367 ;; 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
1368 ;; optional argument indices.
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1369 (if (string-match "[[{]\\*?[]}]" macro)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1370 (progn
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1371 (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
1372 (args (substring macro (match-beginning 0)))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1373 opt-list nlabel (cnt 0))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1374 (while (string-match "\\`[[{]\\(\\*\\)?[]}]" args)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1375 (incf cnt)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1376 (when (eq ?\[ (string-to-char args))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1377 (push cnt opt-list))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1378 (when (and (match-end 1)
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1379 (not nlabel))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1380 (setq nlabel cnt))
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1381 (setq args (substring args (match-end 0))))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1382 (list must-match cnt nlabel opt-list)))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1383 nil))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1384
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1385 ;;; =========================================================================
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1386 ;;;
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1387 ;;; Accessing the parse information
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1388
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1389 (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
1390 "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
1391 ;; 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
1392 ;; 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
1393 ;; 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
1394 ;; 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
1395
59845
17819269525e (reftex-access-scan-info): Error out in a
Carsten Dominik <dominik@science.uva.nl>
parents: 59735
diff changeset
1396 ;; 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
1397 (if (and reftex-mode
17819269525e (reftex-access-scan-info): Error out in a
Carsten Dominik <dominik@science.uva.nl>
parents: 59735
diff changeset
1398 (not (buffer-file-name)))
63432
5c521403da03 (reftex-access-scan-info): Follow error conventions.
Juanma Barranquero <lekktu@gmail.com>
parents: 62512
diff changeset
1399 (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
1400
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1401 ;; 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
1402 (if (eq reftex-docstruct-symbol nil)
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1403 ;; 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
1404 (reftex-tie-multifile-symbols))
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1405
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1406 (reftex-ensure-compiled-variables)
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1407
20829
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
1408 (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
1409 (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
1410 ;; 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
1411 (save-excursion
23707
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
1412 (reftex-erase-buffer "*toc*")
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1413 (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
1414
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1415 (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
1416 (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
1417 reftex-save-parse-info)
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1418 ;; 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
1419 (reftex-access-parse-file 'read))
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1420
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1421 (cond
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1422 ((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
1423 ((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
1424 ;; Scan the whole document
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1425 (reftex-do-parse 1 file))
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1426 ((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
1427 ;; 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
1428 (reftex-do-parse rescan file))))
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1429
34402
5eec8d1d09f0 Update to RefTeX 4.15, see ChangeLog for details
Carsten Dominik <dominik@science.uva.nl>
parents: 29775
diff changeset
1430 (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
1431 "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
1432 (unless reftex-docstruct-symbol
5eec8d1d09f0 Update to RefTeX 4.15, see ChangeLog for details
Carsten Dominik <dominik@science.uva.nl>
parents: 29775
diff changeset
1433 (reftex-tie-multifile-symbols))
5eec8d1d09f0 Update to RefTeX 4.15, see ChangeLog for details
Carsten Dominik <dominik@science.uva.nl>
parents: 29775
diff changeset
1434 (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
1435 (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
1436 t))
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
1437
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1438 (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
1439 ;; 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
1440 (while (and list (> (decf n) -1))
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1441 (and (eq (car (car list)) 'toc)
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1442 (markerp (nth 4 (car list)))
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1443 (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
1444 (pop list)))
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1445
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1446 (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
1447 "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
1448 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
1449 (let* ((list (symbol-value reftex-docstruct-symbol))
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1450 (docstruct-symbol reftex-docstruct-symbol)
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1451 (master (reftex-TeX-master-file))
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1452 (enable-local-variables nil)
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1453 (file (if (string-match "\\.[a-zA-Z]+\\'" master)
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
1454 (concat (substring master 0 (match-beginning 0))
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1455 reftex-parse-file-extension)
27192
f70a80cecdd3 New version number.
Carsten Dominik <dominik@science.uva.nl>
parents: 27170
diff changeset
1456 (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
1457 (cond
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1458 ((eq action 'readable)
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1459 (file-readable-p file))
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1460 ((eq action 'restore)
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1461 (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
1462 (if (eq reftex-docstruct-symbol nil)
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1463 ;; 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
1464 (reftex-tie-multifile-symbols))
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1465 (if (file-exists-p file)
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1466 ;; 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
1467 (condition-case nil
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1468 (progn (load-file file) t)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1469 (error (set reftex-docstruct-symbol nil)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1470 (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
1471 ;; 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
1472 (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
1473 ((eq action 'read)
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1474 (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
1475 (if (file-exists-p file)
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1476 ;; 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
1477 (condition-case nil
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1478 (progn
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1479 (load-file file)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1480 (reftex-check-parse-consistency)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1481 t)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1482 (error (message "Error while restoring file %s" file)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1483 (set reftex-docstruct-symbol nil)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1484 nil))
20829
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
1485 ;; 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
1486 nil))
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1487 ((eq action 'kill)
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1488 ;; Remove the file
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1489 (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
1490 (message "Unlinking file %s" file)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1491 (delete-file file)))
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1492 (t
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1493 (put docstruct-symbol 'modified nil)
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1494 (save-excursion
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1495 (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
1496 (with-temp-file file
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1497 (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
1498 (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
1499 (insert (format ";; File: %s\n" master))
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1500 (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
1501 (user-login-name) (user-full-name)))
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1502 (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
1503 (let ((standard-output (current-buffer)))
85194
b4b8e47fe18b (reftex-erase-all-selection-and-index-buffers)
Glenn Morris <rgm@gnu.org>
parents: 82140
diff changeset
1504 (mapc
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1505 (lambda (x)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1506 (cond ((eq (car x) 'toc)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1507 ;; A toc entry. Do not save the marker.
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1508 ;; Save the markers position at position 8
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1509 (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
1510 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
1511 (or (and (markerp (nth 4 x))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1512 (marker-position (nth 4 x)))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1513 (nth 8 x)))))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1514 ((and (not (eq t reftex-support-index))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1515 (eq (car x) 'index))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1516 ;; Don't save index entries
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1517 )
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1518 (t (print x))))
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1519 list))
78189
253d28d87f2a (reftex-access-parse-file): Do not risk destroying an existing buffer.
Reiner Steib <Reiner.Steib@gmx.de>
parents: 78185
diff changeset
1520 (insert "))\n\n"))
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1521 (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
1522 t))))
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1523
23995
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
1524 (defun reftex-check-parse-consistency ()
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
1525 ;; 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
1526
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
1527 ;; 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
1528 (let* ((real-master (reftex-TeX-master-file))
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
1529 (parsed-master
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1530 (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
1531 (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
1532 (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
1533 parsed-master real-master)
23995
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
1534 (error "Master file name error")))
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
1535
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
1536 ;; 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
1537 ;;; (let* ((all (symbol-value reftex-docstruct-symbol)))
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
1538 ;;; (while all
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
1539 ;;; (when (and (eq (car (car all)) 'bof)
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1540 ;;; (not (file-regular-p (nth 1 (car all)))))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1541 ;;; (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
1542 ;;; (error "File not found"))
23995
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
1543 ;;; (setq all (cdr all))))
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
1544 )
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
1545
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1546 (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
1547 ;; 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
1548 (let* ((len (length xr-alist)) (highest (1- (+ ?0 len)))
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
1549 (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
1550 ?0 highest))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1551 key prefix)
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1552 (cond
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1553 ((= len 1)
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1554 (message "No external documents available")
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1555 (ding) (sit-for 1) 0)
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1556 ((= len 2)
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1557 (- 1 xr-index))
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1558 (t
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1559 (save-excursion
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
1560 (let* ((length (apply 'max (mapcar
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1561 (lambda(x) (length (car x))) xr-alist)))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1562 (fmt (format " [%%c] %%-%ds %%s\n" length))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1563 (n (1- ?0)))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1564 (setq key
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1565 (reftex-select-with-char
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1566 prompt
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1567 (concat
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1568 "SELECT EXTERNAL DOCUMENT\n------------------------\n"
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1569 (mapconcat
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
1570 (lambda (x)
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1571 (format fmt (incf n) (or (car x) "")
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1572 (abbreviate-file-name (cdr x))))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1573 xr-alist ""))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1574 nil t))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1575 (cond
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1576 ((and (>= key ?0) (<= key highest)) (- key ?0))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1577 ((= key ?\C-i)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1578 (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
1579 (- 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
1580 (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
1581
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1582 ;;; =========================================================================
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1583 ;;;
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1584 ;;; Finding files
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1585
23707
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
1586 (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
1587 "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
1588 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
1589 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
1590 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
1591 (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
1592 (extensions (cdr (assoc type reftex-file-extensions)))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1593 (def-ext (car extensions))
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
1594 (ext-re (concat "\\("
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1595 (mapconcat 'regexp-quote extensions "\\|")
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1596 "\\)\\'"))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1597 (files (if (string-match ext-re file)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1598 (cons file nil)
69093
0ab6ebe82ad7 (reftex-locate-file): Search all extensions if
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
1599 (if reftex-try-all-extensions
0ab6ebe82ad7 (reftex-locate-file): Search all extensions if
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
1600 (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
1601 extensions)
0ab6ebe82ad7 (reftex-locate-file): Search all extensions if
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
1602 (list file))
0ab6ebe82ad7 (reftex-locate-file): Search all extensions if
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
1603 (list (concat file def-ext) file))))
0ab6ebe82ad7 (reftex-locate-file): Search all extensions if
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
1604 path old-path file1 f fs)
0ab6ebe82ad7 (reftex-locate-file): Search all extensions if
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
1605 (cond
0ab6ebe82ad7 (reftex-locate-file): Search all extensions if
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
1606 ((file-name-absolute-p file)
0ab6ebe82ad7 (reftex-locate-file): Search all extensions if
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
1607 (while (setq f (pop files))
0ab6ebe82ad7 (reftex-locate-file): Search all extensions if
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
1608 (if (file-regular-p f)
0ab6ebe82ad7 (reftex-locate-file): Search all extensions if
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
1609 (setq file1 f files nil))))
0ab6ebe82ad7 (reftex-locate-file): Search all extensions if
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
1610 ((and reftex-use-external-file-finders
0ab6ebe82ad7 (reftex-locate-file): Search all extensions if
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
1611 (assoc type reftex-external-file-finders))
0ab6ebe82ad7 (reftex-locate-file): Search all extensions if
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
1612 (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
1613 (t
0ab6ebe82ad7 (reftex-locate-file): Search all extensions if
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
1614 (while (and (null file1) rec-values)
0ab6ebe82ad7 (reftex-locate-file): Search all extensions if
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
1615 (setq path (reftex-access-search-path
0ab6ebe82ad7 (reftex-locate-file): Search all extensions if
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
1616 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
1617 (setq fs files)
0ab6ebe82ad7 (reftex-locate-file): Search all extensions if
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
1618 (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
1619 (when (or (null old-path)
0ab6ebe82ad7 (reftex-locate-file): Search all extensions if
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
1620 (not (eq old-path path)))
0ab6ebe82ad7 (reftex-locate-file): Search all extensions if
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
1621 (setq old-path path
0ab6ebe82ad7 (reftex-locate-file): Search all extensions if
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
1622 path (cons master-dir path))
0ab6ebe82ad7 (reftex-locate-file): Search all extensions if
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
1623 (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
1624 (cond (file1 file1)
0ab6ebe82ad7 (reftex-locate-file): Search all extensions if
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
1625 (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
1626 (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
1627
23344
608bc56ca20e (reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents: 23200
diff changeset
1628 (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
1629 ;; Use external program to find FILE.
23707
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
1630 ;; 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
1631 ;; 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
1632 (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
1633 (prg (cdr (assoc type reftex-external-file-finders)))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1634 out)
23344
608bc56ca20e (reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents: 23200
diff changeset
1635 (if (string-match "%f" prg)
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1636 (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
1637 (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
1638 (if (string-match "[ \t\n]+\\'" out) ; chomp
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1639 (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
1640 (cond ((equal out "") nil)
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1641 ((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
1642 (t nil))))
23344
608bc56ca20e (reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents: 23200
diff changeset
1643
608bc56ca20e (reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents: 23200
diff changeset
1644 (defun reftex-process-string (program &rest args)
608bc56ca20e (reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents: 23200
diff changeset
1645 "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
1646 (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
1647 (with-output-to-string
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1648 (with-current-buffer standard-output
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1649 (let ((default-directory calling-dir)) ; set default directory
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1650 (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
1651
23707
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
1652 (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
1653 ;; 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
1654 ;; 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
1655 ;; 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
1656 ;; 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
1657 ;; 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
1658 ;; 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
1659 ;; Returns the derived path.
23707
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
1660 (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
1661 (when (null (get pathvar 'status))
23707
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
1662 ;; Get basic path
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
1663 (set pathvar
62467
35f6599373fc * textmodes/reftex-vars.el (reftex-cite-format-builtin): Support
Carsten Dominik <dominik@science.uva.nl>
parents: 60926
diff changeset
1664 (reftex-uniquify
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1665 (reftex-parse-colon-path
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1666 (mapconcat
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
1667 (lambda(x)
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1668 (if (string-match "^!" x)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1669 (apply 'reftex-process-string
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1670 (split-string (substring x 1)))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1671 (or (getenv x) x)))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1672 ;; 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
1673 ;; (cdr (assoc type reftex-path-environment))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1674 ;; However, historically we have separate options for the
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1675 ;; environment variables, so we have to do this:
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
1676 (symbol-value (intern (concat "reftex-" type
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1677 "path-environment-variables")))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1678 path-separator))))
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1679 (put pathvar 'status 'split)
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1680 ;; 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
1681 (let ((path (symbol-value pathvar)) dir rec)
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1682 (while (setq dir (pop path))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1683 (when (string= (substring dir -2) "//")
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1684 (if (file-name-absolute-p dir)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1685 (setq rec (or rec 'absolute))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1686 (setq rec 'relative))))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1687 (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
1688
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1689 (if recurse
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1690 ;; Return the recursive expansion of the path
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1691 (cond
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1692 ((not (get pathvar 'rec-type))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1693 ;; 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
1694 (symbol-value pathvar))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1695 ((or (not (get pathvar 'recursive-path))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1696 (and (eq (get pathvar 'rec-type) 'relative)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1697 (not (equal master-dir (get pathvar 'master-dir)))))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1698 ;; 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
1699 ;; 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
1700 ;; relative to new default directory
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1701 (message "Expanding search path to find %s file: %s ..." type file)
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
1702 (put pathvar 'recursive-path
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1703 (reftex-expand-path (symbol-value pathvar) master-dir))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1704 (put pathvar 'master-dir master-dir)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1705 (get pathvar 'recursive-path))
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
1706 (t
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1707 ;; Recursive path computed earlier is still OK.
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1708 (get pathvar 'recursive-path)))
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1709 ;; The simple path was requested
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1710 (symbol-value pathvar))))
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1711
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1712 (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
1713 ;; 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
1714 ;; 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
1715 (catch 'exit
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1716 (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
1717 (if (file-regular-p file)
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1718 (throw 'exit file)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1719 (throw 'exit nil)))
23707
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
1720 (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
1721 (while (setq dir (pop thepath))
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1722 (when (string= (substring dir -2) "//")
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1723 (setq dir (substring dir 0 -1)))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1724 (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
1725 (if (file-regular-p file1)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1726 (throw 'exit file1)))
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1727 ;; No such file
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1728 nil)))
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1729
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1730 (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
1731 ;; 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
1732 ;; 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
1733 (mapcar
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1734 (lambda (dir)
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
1735 (if (string-match "\\(//+\\|/*!+\\)\\'" dir)
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1736 (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
1737 (file-name-as-directory dir))
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1738 (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
1739
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1740 (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
1741 ;; 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
1742 ;; 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
1743 (let (path1 dir recursive)
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1744 (while (setq dir (pop path))
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1745 (if (setq recursive (string= (substring dir -2) "//"))
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1746 (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
1747 (if (and recursive
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1748 (not (file-name-absolute-p dir)))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1749 (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
1750 (if recursive
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1751 ;; Expand recursively
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1752 (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
1753 ;; Keep unchanged
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1754 (push dir path1)))
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1755 (nreverse path1)))
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1756
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1757 (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
1758 ;; 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
1759 (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
1760 (while (setq dir (pop path))
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1761 (when (file-directory-p dir)
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1762 (setq files (nreverse (directory-files dir t "[^.]")))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1763 (while (setq file (pop files))
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
1764 (if (file-directory-p file)
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1765 (push (file-name-as-directory file) path)))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1766 (push dir path1)))
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1767 path1))
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1768
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1769 ;;; =========================================================================
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1770 ;;;
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1771 ;;; Some generally useful functions
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1772
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1773 (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
1774 ;; 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
1775 (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
1776 (or (eq conf-variable t)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1777 (and (stringp conf-variable)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1778 (string-match (concat "[" conf-variable "]") typekey))))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1779
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1780 (defun reftex-check-recursive-edit ()
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1781 ;; 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
1782 ;; message if so.
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1783 (if (marker-position reftex-recursive-edit-marker)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1784 (error
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1785 (substitute-command-keys
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1786 "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
1787
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1788 (defun reftex-in-comment ()
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1789 (save-excursion
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1790 (skip-chars-backward "^%\n\r")
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1791 (eq (preceding-char) ?%)))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1792
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1793 (defun reftex-no-props (string)
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1794 ;; Return STRING with all text properties removed
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1795 (and (stringp string)
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1796 (set-text-properties 0 (length string) nil string))
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1797 string)
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1798
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1799 (defun reftex-match-string (n)
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1800 ;; Match string without properties
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1801 (when (match-beginning n)
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1802 (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
1803
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1804 (defun reftex-region-active-p ()
87398
5aca203bab2c (reftex-region-active-p): Use `use-region-p'.
Richard M. Stallman <rms@gnu.org>
parents: 87170
diff changeset
1805 "Should we operate on an active region?"
5aca203bab2c (reftex-region-active-p): Use `use-region-p'.
Richard M. Stallman <rms@gnu.org>
parents: 87170
diff changeset
1806 (if (fboundp 'use-region-p)
5aca203bab2c (reftex-region-active-p): Use `use-region-p'.
Richard M. Stallman <rms@gnu.org>
parents: 87170
diff changeset
1807 (use-region-p)
5aca203bab2c (reftex-region-active-p): Use `use-region-p'.
Richard M. Stallman <rms@gnu.org>
parents: 87170
diff changeset
1808 ;; For XEmacs.
5aca203bab2c (reftex-region-active-p): Use `use-region-p'.
Richard M. Stallman <rms@gnu.org>
parents: 87170
diff changeset
1809 (region-active-p)))
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1810
20829
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
1811 (defun reftex-kill-buffer (buffer)
20979
38e7bcbb3595 (reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents: 20953
diff changeset
1812 ;; 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
1813 (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
1814 (kill-buffer buffer)))
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
1815
20979
38e7bcbb3595 (reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents: 20953
diff changeset
1816 (defun reftex-erase-buffer (&optional buffer)
38e7bcbb3595 (reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents: 20953
diff changeset
1817 ;; 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
1818 ;; This even erases read-only buffers.
38e7bcbb3595 (reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents: 20953
diff changeset
1819 (cond
38e7bcbb3595 (reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents: 20953
diff changeset
1820 ((null buffer)
38e7bcbb3595 (reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents: 20953
diff changeset
1821 ;; erase current buffer
38e7bcbb3595 (reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents: 20953
diff changeset
1822 (let ((buffer-read-only nil)) (erase-buffer)))
38e7bcbb3595 (reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents: 20953
diff changeset
1823 ((setq buffer (get-buffer buffer))
38e7bcbb3595 (reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents: 20953
diff changeset
1824 ;; buffer exists
38e7bcbb3595 (reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents: 20953
diff changeset
1825 (save-excursion
38e7bcbb3595 (reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents: 20953
diff changeset
1826 (set-buffer buffer)
38e7bcbb3595 (reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents: 20953
diff changeset
1827 (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
1828
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1829 (defun reftex-this-word (&optional class)
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1830 ;; Grab the word around point.
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1831 (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
1832 (save-excursion
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1833 (buffer-substring-no-properties
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1834 (progn (skip-chars-backward class) (point))
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1835 (progn (skip-chars-forward class) (point)))))
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1836
26910
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
1837 (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
1838 (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
1839 (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
1840 ""))
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
1841
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1842 (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
1843 ;; 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
1844 (let (rtn)
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1845 (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
1846 (push (car list) rtn)
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1847 (pop list))
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1848 (nreverse rtn)))
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1849
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1850 (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
1851 ;; 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
1852 (let (rtn)
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1853 (while list
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1854 (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
1855 (push (car list) rtn))
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1856 (pop list))
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1857 (nreverse rtn)))
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1858
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1859 (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
1860 ;; 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
1861 ;; 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
1862 ;; 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
1863 ;; 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
1864 ;; On success, returns the association.
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1865 (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
1866 (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
1867 (setq list (memq ass list))
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1868 (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
1869 (memq elt list))
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1870 (setq last-ass ass
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1871 list (cdr list)))
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1872 last-ass))
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1873
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1874 (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
1875 ;; 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
1876 ;; fulfill PREDICATE.
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1877 ;; 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
1878 ;; 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
1879 (let (rtn)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1880 (while list
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1881 (if (funcall predicate (car list))
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1882 (push (if completion
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
1883 (list (nth nth (car list)))
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1884 (nth nth (car list)))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1885 rtn))
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1886 (setq list (cdr list)))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1887 (nreverse rtn)))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1888
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1889 (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
1890 ;; Make unique name for a selection buffer.
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1891 (format " *RefTeX[%s][%d]*"
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1892 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
1893
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1894 (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
1895 ;; Make unique name for an index buffer.
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1896 (format "*Index[%s][%d]*"
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1897 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
1898
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1899 (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
1900 ;; Truncate STRING to NCOLS characters.
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
1901 ;; 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
1902 ;; 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
1903 ;; 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
1904 (setq string
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1905 (if (<= (length string) ncols)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1906 string
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1907 (if ellipses
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1908 (concat (substring string 0 (- ncols 3)) "...")
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1909 (substring string 0 ncols))))
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1910 (if padding
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1911 (format (format "%%-%ds" ncols) string)
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1912 string))
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1913
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1914 (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
1915 ;; 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
1916 ;; 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
1917 ;; 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
1918 (let ((pos (point))
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
1919 (dist (or max-length (length regexp)))
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1920 match1 match2 match)
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1921 (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
1922 (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
1923 (setq match1 (match-data)))
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1924 (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
1925 (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
1926 (setq match2 (match-data)))
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
1927 (goto-char pos)
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1928 (setq match
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1929 (cond
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1930 ((not match1) match2)
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1931 ((not match2) match1)
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1932 ((< (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
1933 (t match2)))
21170
dbe101f49d57 (reftex-nearest-match): store-match-data => set-match-data.
Richard M. Stallman <rms@gnu.org>
parents: 21130
diff changeset
1934 (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
1935
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1936 (defun reftex-auto-mode-alist ()
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1937 ;; 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
1938 ;; Stolen from gnus nnheader.
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1939 (let ((alist auto-mode-alist)
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1940 out)
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1941 (while alist
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1942 (when (listp (cdr (car alist)))
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1943 (push (car alist) out))
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1944 (pop alist))
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1945 (nreverse out)))
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
1946
23995
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
1947 (defun reftex-window-height ()
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
1948 (if (fboundp 'window-displayed-height)
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
1949 (window-displayed-height)
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
1950 (window-height)))
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
1951
20829
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
1952 (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
1953 ;; 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
1954 ;; 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
1955 (let* ((win1 (selected-window))
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1956 (buf1 (current-buffer))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1957 (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
1958 (when win2
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
1959 (select-window win2)
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1960 (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
1961 (pos-visible-in-window-p (point-max)))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1962 (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
1963 (reftex-window-height))))))
20829
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
1964 (cond
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
1965 ((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
1966 (keep-current
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
1967 ;; 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
1968 (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
1969 (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
1970
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1971 (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
1972 ;; 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
1973 ;; also with HELP-STRING.
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1974 ;; 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
1975 (let ((char ?\?))
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1976 (save-window-excursion
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
1977 (catch 'exit
87170
e50a2e215441 * erc-stamp.el (erc-echo-timestamp):
David Kastrup <dak@gnu.org>
parents: 87163
diff changeset
1978 (message "%s (?=Help)" prompt)
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1979 (when (or (sit-for (or delay-time 0))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1980 (= ?\? (setq char (read-char-exclusive))))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1981 (reftex-kill-buffer "*RefTeX Select*")
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1982 (switch-to-buffer-other-window "*RefTeX Select*")
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1983 (insert help-string)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1984 (goto-char 1)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1985 (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
1986 (pos-visible-in-window-p (point-max)))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1987 (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
1988 (reftex-window-height)))))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1989 (setq truncate-lines t))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1990 (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
1991 (pos-visible-in-window-p (point-max)))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1992 nil
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1993 (setq prompt (concat prompt (if scroll " (SPC/DEL=Scroll)" ""))))
87170
e50a2e215441 * erc-stamp.el (erc-echo-timestamp):
David Kastrup <dak@gnu.org>
parents: 87163
diff changeset
1994 (message "%s" prompt)
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1995 (and (equal char ?\?) (setq char (read-char-exclusive)))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1996 (while t
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1997 (cond ((equal char ?\C-g) (keyboard-quit))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1998 ((equal char ?\?))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
1999 ((and scroll (equal char ?\ ))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2000 (condition-case nil (scroll-up) (error nil))
87170
e50a2e215441 * erc-stamp.el (erc-echo-timestamp):
David Kastrup <dak@gnu.org>
parents: 87163
diff changeset
2001 (message "%s" prompt))
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2002 ((and scroll (equal char ?\C-? ))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2003 (condition-case nil (scroll-down) (error nil))
87170
e50a2e215441 * erc-stamp.el (erc-echo-timestamp):
David Kastrup <dak@gnu.org>
parents: 87163
diff changeset
2004 (message "%s" prompt))
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
2005 (t (message "")
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2006 (throw 'exit char)))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2007 (setq char (read-char-exclusive)))))))
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
2008
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2009
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2010 (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
2011 ;; 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
2012 (let ((start -2))
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2013 (setq string (regexp-quote string))
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2014 (while (setq start (string-match "[\n\r]" string (+ 3 start)))
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2015 (setq string (replace-match "[\n\r]" nil t string)))
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2016 string))
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2017
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2018 (defun reftex-get-buffer-visiting (file)
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2019 ;; return a buffer visiting FILE
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2020 (cond
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2021 ((boundp 'find-file-compare-truenames) ; XEmacs
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2022 (let ((find-file-compare-truenames t))
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2023 (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
2024 ((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
2025 (find-buffer-visiting file))
20829
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
2026 (t (error "This should not happen (reftex-get-buffer-visiting)"))))
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2027
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2028 ;; 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
2029 (defvar message-stack)
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2030 (if (and (featurep 'xemacs)
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2031 (not (fboundp 'current-message)))
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2032 (defun current-message (&optional frame)
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2033 (cdr (car message-stack))))
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2034
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2035 (defun reftex-visited-files (list)
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2036 ;; 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
2037 (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
2038 list)))
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2039
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2040 (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
2041 ;; 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
2042 ;; 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
2043 ;; 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
2044 ;; 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
2045 ;; and mark the buffer to be killed after use.
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2046
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2047 (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
2048
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2049 (cond (buf
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2050 ;; 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
2051 buf)
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2052
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2053 ((file-readable-p file)
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2054 ;; 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
2055
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2056 (if (or (not mark-to-kill)
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2057 (eq t reftex-initialize-temporary-buffers))
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 ;; Visit the file with full magic
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2060 (setq buf (find-file-noselect file))
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 ;; 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
2063 ;; with limited Magic
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 ;; The magic goes away
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2066 (let ((format-alist nil)
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2067 (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
2068 (default-major-mode 'fundamental-mode)
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2069 (enable-local-variables nil)
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2070 (after-insert-file-functions nil))
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2071 (setq buf (find-file-noselect file)))
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2072
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2073 ;; Is there a hook to run?
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2074 (when (listp reftex-initialize-temporary-buffers)
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2075 (save-excursion
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2076 (set-buffer buf)
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2077 (run-hooks 'reftex-initialize-temporary-buffers))))
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2078
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2079 ;; 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
2080 (and mark-to-kill
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2081 (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
2082
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2083 ;; Return the new buffer
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2084 buf)
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 ;; 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
2087 (t nil))))
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2088
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2089 (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
2090 ;; 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
2091 (cond
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2092 (buffer
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2093 (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
2094 (kill-buffer buffer)
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2095 (setq reftex-buffers-to-kill
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2096 (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
2097 (t
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2098 (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
2099 (when (bufferp buffer)
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2100 (and (buffer-modified-p buffer)
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2101 (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
2102 (buffer-file-name buffer)))
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2103 (save-excursion
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2104 (set-buffer buffer)
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2105 (save-buffer)))
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2106 (kill-buffer buffer))
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2107 (pop reftex-buffers-to-kill)))))
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2108
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2109 (defun reftex-splice-symbols-into-list (list alist)
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2110 ;; 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
2111 ;; Return new list.
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2112 (let (rtn tmp)
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2113 (while list
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2114 (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
2115 (symbolp (car list)))
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2116 (setq tmp (car list))
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2117 (cond
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2118 ((assoc tmp alist)
19660
fa3d4e7a76d9 (reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents: 18321
diff changeset
2119 (setq list (append (nth 2 (assoc tmp alist)) (cdr list))))
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2120 (t
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2121 (error "Cannot treat symbol %s in reftex-label-alist"
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2122 (symbol-name tmp)))))
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2123 (push (pop list) rtn))
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2124 (nreverse rtn)))
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2125
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2126 (defun reftex-remove-symbols-from-list (list)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2127 ;; Remove all symbols from list
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2128 (let (rtn)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2129 (while list
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2130 (unless (symbolp (car list))
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2131 (push (car list) rtn))
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2132 (setq list (cdr list)))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2133 (nreverse rtn)))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2134
25802
4c4fabd16782 Version number change
Carsten Dominik <dominik@science.uva.nl>
parents: 25279
diff changeset
2135 (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
2136 ;; 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
2137 (let (new elm)
4c4fabd16782 Version number change
Carsten Dominik <dominik@science.uva.nl>
parents: 25279
diff changeset
2138 (while list
4c4fabd16782 Version number change
Carsten Dominik <dominik@science.uva.nl>
parents: 25279
diff changeset
2139 (setq elm (pop list))
4c4fabd16782 Version number change
Carsten Dominik <dominik@science.uva.nl>
parents: 25279
diff changeset
2140 (unless (member elm new)
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2141 (push elm new)))
25802
4c4fabd16782 Version number change
Carsten Dominik <dominik@science.uva.nl>
parents: 25279
diff changeset
2142 (nreverse new)))
4c4fabd16782 Version number change
Carsten Dominik <dominik@science.uva.nl>
parents: 25279
diff changeset
2143
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2144 (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
2145 ;; 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
2146 ;; Elements of KEEP-LIST are not removed even if duplicate.
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2147 (let (new elm)
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2148 (while alist
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2149 (setq elm (pop alist))
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2150 (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
2151 (not (assoc (car elm) new)))
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2152 (push elm new)))
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2153 (nreverse new)))
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2154
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2155 (defun reftex-abbreviate-title (string)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2156 (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
2157 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
2158
60918
58a53f588384 * textmodes/refbib.el, textmodes/refer.el, textmodes/reftex-cite.el,
Werner LEMBERG <wl@gnu.org>
parents: 59845
diff changeset
2159 (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
2160 nwords maxchar invalid abbrev sep
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2161 ignore-words &optional downcase)
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2162 "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
2163 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
2164 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
2165 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
2166 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
2167 NWORDS Number of words to use.
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2168 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
2169 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
2170 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
2171 ABBREV nil: Never abbreviate words.
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2172 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
2173 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
2174 string below MAXCHAR.
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2175 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
2176 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
2177
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2178 (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
2179 (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
2180 (abbrev-re (concat
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2181 "\\`\\("
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2182 (make-string (nth 0 reftex-abbrev-parameters) ?.)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2183 "[" (nth 2 reftex-abbrev-parameters) "]*"
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 "[" (nth 3 reftex-abbrev-parameters) "]"
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2186 (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
2187 words word)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2188
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2189 ;; 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
2190 (while (setq word (pop words0))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2191 (if downcase (setq word (downcase word)))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2192 (cond
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2193 ((member (downcase word) ignore-words))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2194 ((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
2195 (when invalid
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2196 (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
2197 (setq word (replace-match "" nil nil word)))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2198 (push word words)))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2199 (t
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2200 (push word words))))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2201 (setq words (nreverse words))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2202
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2203 ;; Restrict number of words
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2204 (if (> (length words) nwords)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2205 (setcdr (nthcdr (1- nwords) words) nil))
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
2206
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2207 ;; First, try to use all words
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2208 (setq string (mapconcat 'identity words sep))
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
2209
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2210 ;; 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
2211 (if (or (eq t abbrev)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2212 (and abbrev
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2213 (> (length string) maxchar)))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2214 (setq words
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2215 (mapcar
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2216 (lambda (w) (if (string-match abbrev-re w)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2217 (if dot
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2218 (concat (match-string 1 w) ".")
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2219 (match-string 1 w))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2220 w))
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2221 words)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2222 string (mapconcat 'identity words sep)))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2223
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2224 ;; Shorten if still to long
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2225 (setq string
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2226 (if (> (length string) maxchar)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2227 (substring string 0 maxchar)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2228 string))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2229
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2230 ;; Delete the final punctuation, if any
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2231 (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
2232 (setq string (replace-match "" nil nil string)))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2233 string))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2234
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2235 (defun reftex-nicify-text (text)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2236 ;; 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
2237 ;; 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
2238 (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
2239 (setq text (replace-match " " nil t text)))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2240 ;; 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
2241 (if (string-match "\\(\\\\end{\\|\\\\item\\|\\\\\\\\\\).*" 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 ;; 3. kill the embedded label
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2244 (if (string-match "\\\\label{[^}]*}" 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 ;; 4. remove leading garbage
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2247 (if (string-match "\\`[ }]+" 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 ;; 5. limit length
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2250 (cond
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2251 ((> (length text) 100) (substring text 0 100))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2252 ((= (length text) 0) (make-string 1 ?\ ))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2253 (t text)))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2254
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2255 ;;; =========================================================================
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2256 ;;;
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2257 ;;; Fontification and Highlighting
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2258
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2259 (defun reftex-use-fonts ()
18321
0ed97be54a28 Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents: 18220
diff changeset
2260 ;; 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
2261 (and ; window-system
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2262 reftex-use-fonts
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2263 (featurep 'font-lock)))
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2264
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2265 (defun reftex-refontify ()
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2266 ;; 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
2267 (and (reftex-use-fonts)
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2268 (or (eq t reftex-refontify-context)
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2269 (and (eq 1 reftex-refontify-context)
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2270 ;; 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
2271 (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
2272
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2273 (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
2274 (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
2275 ;; 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
2276 ;; 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
2277 (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
2278 parent-buffer 'reftex-ref)
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2279 (let* ((oldname (buffer-name))
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2280 (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
2281 (unwind-protect
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2282 (progn
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2283 ;; 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
2284 (rename-buffer newname t)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2285 (cond
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2286 ((fboundp 'font-lock-default-fontify-region)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2287 ;; Good: we have the indirection functions
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2288 (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
2289 'reftex-select-font-lock-fontify-region)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2290 (let ((major-mode 'latex-mode))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2291 (font-lock-mode 1)))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2292 ((fboundp 'font-lock-set-defaults-1)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2293 ;; Looks like the XEmacs font-lock stuff.
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2294 ;; 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
2295 (set (make-local-variable 'font-lock-keywords) nil)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2296 (let ((major-mode 'latex-mode)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2297 (font-lock-defaults-computed nil))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2298 (font-lock-set-defaults-1)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2299 (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
2300 (t
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
2301 ;; Oops?
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2302 (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
2303 (rename-buffer oldname))))
20829
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
2304
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
2305 (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
2306 ;; 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
2307 (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
2308 'font-lock-default-fontify-region
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2309 'font-lock-fontify-region))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2310 beg1 end1)
20829
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
2311 (goto-char beg)
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
2312 (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
2313 (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
2314 (funcall func beg1 end1 nil)
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
2315 (goto-char end1))))
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
2316
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2317 (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
2318
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2319 (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
2320 ;; 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
2321 ;; 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
2322 ;; 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
2323 ;; 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
2324 ;; 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
2325 ;; to font-lock-constant-face.
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2326 (let (face)
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2327 (catch 'exit
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2328 (while (setq face (pop faces))
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2329 (if (featurep 'xemacs)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2330 (if (find-face face) (throw 'exit face))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2331 (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
2332
62467
35f6599373fc * textmodes/reftex-vars.el (reftex-cite-format-builtin): Support
Carsten Dominik <dominik@science.uva.nl>
parents: 60926
diff changeset
2333 ;; Highlighting uses overlays. For XEmacs, we use extends.
85825
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
2334 (defalias 'reftex-make-overlay
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
2335 (if (featurep 'xemacs) 'make-extent 'make-overlay))
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
2336 (defalias 'reftex-overlay-put
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
2337 (if (featurep 'xemacs) 'set-extent-property 'overlay-put))
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
2338 (defalias 'reftex-move-overlay
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
2339 (if (featurep 'xemacs) 'set-extent-endpoints 'move-overlay))
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
2340 (defalias 'reftex-delete-overlay
13163bbed0bf * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85500
diff changeset
2341 (if (featurep 'xemacs) 'detach-extent 'delete-overlay))
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2342
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2343 ;; 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
2344 (defvar reftex-highlight-overlays [nil nil nil])
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2345
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2346 ;; Initialize the overlays
62467
35f6599373fc * textmodes/reftex-vars.el (reftex-cite-format-builtin): Support
Carsten Dominik <dominik@science.uva.nl>
parents: 60926
diff changeset
2347 (aset reftex-highlight-overlays 0 (reftex-make-overlay 1 1))
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
2348 (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
2349 'face 'highlight)
62467
35f6599373fc * textmodes/reftex-vars.el (reftex-cite-format-builtin): Support
Carsten Dominik <dominik@science.uva.nl>
parents: 60926
diff changeset
2350 (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
2351 (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
2352 '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
2353 (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
2354 (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
2355 'face reftex-cursor-selected-face)
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2356
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2357 ;; Two functions for activating and deactivation highlight overlays
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2358 (defun reftex-highlight (index begin end &optional buffer)
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2359 "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
2360 (reftex-move-overlay (aref reftex-highlight-overlays index)
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2361 begin end (or buffer (current-buffer))))
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2362 (defun reftex-unhighlight (index)
20829
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
2363 "Detach overlay INDEX."
62467
35f6599373fc * textmodes/reftex-vars.el (reftex-cite-format-builtin): Support
Carsten Dominik <dominik@science.uva.nl>
parents: 60926
diff changeset
2364 (reftex-delete-overlay (aref reftex-highlight-overlays index)))
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2365
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2366 (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
2367 ;; Function used in pre-command-hook to remove highlights.
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2368 (remove-hook 'pre-command-hook 'reftex-highlight-shall-die)
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2369 (reftex-unhighlight 0))
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2370
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2371 ;;; =========================================================================
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2372 ;;;
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
2373 ;;; Keybindings
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2374
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2375 ;; 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
2376 (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
2377 '(("\C-c=" . reftex-toc)
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2378 ("\C-c-" . reftex-toc-recenter)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2379 ("\C-c(" . reftex-label)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2380 ("\C-c)" . reftex-reference)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2381 ("\C-c[" . reftex-citation)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2382 ("\C-c<" . reftex-index)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2383 ("\C-c>" . reftex-display-index)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2384 ("\C-c/" . reftex-index-selection-or-word)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2385 ("\C-c\\" . reftex-index-phrase-selection-or-word)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2386 ("\C-c|" . reftex-index-visit-phrases-buffer)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2387 ("\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
2388 do (define-key reftex-mode-map (car x) (cdr x)))
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2389
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2390 ;; 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
2391 (if (featurep 'xemacs)
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2392 (unless (key-binding [(shift button2)])
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
2393 (define-key reftex-mode-map [(shift button2)]
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2394 'reftex-mouse-view-crossref))
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2395 (unless (key-binding [(shift mouse-2)])
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
2396 (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
2397 'reftex-mouse-view-crossref)))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2398
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2399 ;; 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
2400 (eval-after-load
23995
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
2401 "bibtex"
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
2402 '(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
2403
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2404 ;; If the user requests so, she can have a few more bindings:
94384
e1efc224c836 Ralf Angeli <angeli at caeruleus.net>
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
2405 ;; For most of these commands there are already bindings in place.
e1efc224c836 Ralf Angeli <angeli at caeruleus.net>
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
2406 ;; Setting `reftex-extra-bindings' really is only there to spare users
e1efc224c836 Ralf Angeli <angeli at caeruleus.net>
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
2407 ;; the hassle of defining bindings in the user space themselves. This
e1efc224c836 Ralf Angeli <angeli at caeruleus.net>
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
2408 ;; is why they violate the key binding recommendations.
95268
bcc553c768f9 * textmodes/reftex-vars.el (reftex-extra-bindings-prefix): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 94670
diff changeset
2409 (defvar reftex-extra-bindings-map
bcc553c768f9 * textmodes/reftex-vars.el (reftex-extra-bindings-prefix): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 94670
diff changeset
2410 (let ((map (make-sparse-keymap)))
bcc553c768f9 * textmodes/reftex-vars.el (reftex-extra-bindings-prefix): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 94670
diff changeset
2411 (define-key map "t" 'reftex-toc)
bcc553c768f9 * textmodes/reftex-vars.el (reftex-extra-bindings-prefix): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 94670
diff changeset
2412 (define-key map "l" 'reftex-label)
bcc553c768f9 * textmodes/reftex-vars.el (reftex-extra-bindings-prefix): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 94670
diff changeset
2413 (define-key map "r" 'reftex-reference)
bcc553c768f9 * textmodes/reftex-vars.el (reftex-extra-bindings-prefix): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 94670
diff changeset
2414 (define-key map "c" 'reftex-citation)
bcc553c768f9 * textmodes/reftex-vars.el (reftex-extra-bindings-prefix): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 94670
diff changeset
2415 (define-key map "v" 'reftex-view-crossref)
bcc553c768f9 * textmodes/reftex-vars.el (reftex-extra-bindings-prefix): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 94670
diff changeset
2416 (define-key map "g" 'reftex-grep-document)
bcc553c768f9 * textmodes/reftex-vars.el (reftex-extra-bindings-prefix): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 94670
diff changeset
2417 (define-key map "s" 'reftex-search-document)
bcc553c768f9 * textmodes/reftex-vars.el (reftex-extra-bindings-prefix): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 94670
diff changeset
2418 map)
bcc553c768f9 * textmodes/reftex-vars.el (reftex-extra-bindings-prefix): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 94670
diff changeset
2419 "Reftex extra bindings map")
bcc553c768f9 * textmodes/reftex-vars.el (reftex-extra-bindings-prefix): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 94670
diff changeset
2420
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2421 (when reftex-extra-bindings
95268
bcc553c768f9 * textmodes/reftex-vars.el (reftex-extra-bindings-prefix): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 94670
diff changeset
2422 (define-key reftex-mode-map
bcc553c768f9 * textmodes/reftex-vars.el (reftex-extra-bindings-prefix): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 94670
diff changeset
2423 reftex-extra-bindings-prefix
bcc553c768f9 * textmodes/reftex-vars.el (reftex-extra-bindings-prefix): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 94670
diff changeset
2424 reftex-extra-bindings-map))
bcc553c768f9 * textmodes/reftex-vars.el (reftex-extra-bindings-prefix): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 94670
diff changeset
2425
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2426
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2427 ;;; =========================================================================
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2428 ;;;
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2429 ;;; Menu
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2430
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2431 ;; 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
2432
62509
d631d0a6ba66 Moved the definition of `reftex-isearch-minor-mode' from
Carsten Dominik <dominik@science.uva.nl>
parents: 62467
diff changeset
2433 (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
2434 (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
2435
23707
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
2436 (easy-menu-define reftex-mode-menu reftex-mode-map
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2437 "Menu used in RefTeX mode"
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2438 `("Ref"
19660
fa3d4e7a76d9 (reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents: 18321
diff changeset
2439 ["Table of Contents" reftex-toc t]
47050
904fd28be439 Update to RefTeX 4.19
Carsten Dominik <dominik@science.uva.nl>
parents: 46973
diff changeset
2440 ["Recenter TOC" reftex-toc-recenter t]
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2441 "--"
19660
fa3d4e7a76d9 (reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents: 18321
diff changeset
2442 ["\\label" reftex-label t]
fa3d4e7a76d9 (reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents: 18321
diff changeset
2443 ["\\ref" reftex-reference t]
fa3d4e7a76d9 (reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents: 18321
diff changeset
2444 ["\\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
2445 ("\\index"
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
2446 ["\\index" reftex-index t]
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
2447 ["\\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
2448 "--"
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
2449 ["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
2450 ["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
2451 ["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
2452 "--"
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
2453 ["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
2454 "--"
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2455 ["View Crossref" reftex-view-crossref t]
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2456 "--"
20177
6ebc3e300106 The menu now used toggle and radio for some items.
Karl Heuer <kwzh@gnu.org>
parents: 20102
diff changeset
2457 ("Parse Document"
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2458 ["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
2459 ["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
2460 ["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
2461 (> (length (symbol-value reftex-docstruct-symbol)) 0)]
47050
904fd28be439 Update to RefTeX 4.19
Carsten Dominik <dominik@science.uva.nl>
parents: 46973
diff changeset
2462 ["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
2463 ("Global Actions"
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2464 ["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
2465 ["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
2466 ["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
2467 ["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
2468 "--"
47050
904fd28be439 Update to RefTeX 4.19
Carsten Dominik <dominik@science.uva.nl>
parents: 46973
diff changeset
2469 ["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
2470 ["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
2471 ["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
2472 ["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
2473 "--"
59534
9bad65481674 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 52401
diff changeset
2474 ["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
2475 "--"
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2476 ["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
2477 "--"
23707
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
2478 ["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
2479 "--"
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2480 ("Options"
23995
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
2481 "PARSER"
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
2482 ["Partial Scans"
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
2483 (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
2484 :style toggle :selected reftex-enable-partial-scans]
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
2485 ["Auto-Save Parse Info"
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
2486 (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
2487 :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
2488 "--"
47050
904fd28be439 Update to RefTeX 4.19
Carsten Dominik <dominik@science.uva.nl>
parents: 46973
diff changeset
2489 "TOC RECENTER"
904fd28be439 Update to RefTeX 4.19
Carsten Dominik <dominik@science.uva.nl>
parents: 46973
diff changeset
2490 ["Automatic Recenter" reftex-toggle-auto-toc-recenter
904fd28be439 Update to RefTeX 4.19
Carsten Dominik <dominik@science.uva.nl>
parents: 46973
diff changeset
2491 :style toggle :selected reftex-toc-auto-recenter-timer]
904fd28be439 Update to RefTeX 4.19
Carsten Dominik <dominik@science.uva.nl>
parents: 46973
diff changeset
2492 "--"
23995
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
2493 "CROSSREF INFO"
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
2494 ["Automatic Info" reftex-toggle-auto-view-crossref
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
2495 :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
2496 ["...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
2497 :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
2498 ["...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
2499 :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
2500 "--"
23995
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
2501 "MISC"
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
2502 ["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
2503 :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
2504 ["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
2505 :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
2506 ("Reference Style"
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2507 ["Default" (setq reftex-vref-is-default nil
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2508 reftex-fref-is-default nil)
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
2509 :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
2510 reftex-fref-is-default))]
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2511 ["Varioref" (setq reftex-vref-is-default t
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2512 reftex-fref-is-default nil)
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2513 :style radio :selected reftex-vref-is-default]
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2514 ["Fancyref" (setq reftex-fref-is-default t
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2515 reftex-vref-is-default nil)
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2516 :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
2517 ("Citation Style"
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
2518 ,@(mapcar
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2519 (lambda (x)
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2520 (vector
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2521 (capitalize (symbol-name (car x)))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2522 (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
2523 :style 'radio :selected
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2524 (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
2525 reftex-cite-format-builtin)
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2526 "--"
23995
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
2527 "Sort Database Matches"
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
2528 ["Not" (setq reftex-sort-bibtex-matches nil)
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 nil)]
a56b80c4166a (reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents: 23707
diff changeset
2530 ["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
2531 :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
2532 ["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
2533 :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
2534 ["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
2535 :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
2536 ("Index Style"
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2537 ,@(mapcar
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2538 (lambda (x)
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2539 (vector
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2540 (capitalize (symbol-name (car x)))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2541 (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
2542 :style 'radio :selected
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2543 (list 'memq (list 'quote (car x))
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
2544 (list 'get 'reftex-docstruct-symbol
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2545 (list 'quote 'reftex-index-macros-style)))))
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2546 reftex-index-macros-builtin))
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2547 "--"
47050
904fd28be439 Update to RefTeX 4.19
Carsten Dominik <dominik@science.uva.nl>
parents: 46973
diff changeset
2548 ["Reset RefTeX Mode" reftex-reset-mode t]
904fd28be439 Update to RefTeX 4.19
Carsten Dominik <dominik@science.uva.nl>
parents: 46973
diff changeset
2549 "--"
20829
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
2550 ("Customize"
23707
b0fe513da546 (reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 23344
diff changeset
2551 ["Browse RefTeX Group" reftex-customize t]
25279
03cb8fb8ab28 (reftex-pop-to-bibtex-entry): Fixed
Carsten Dominik <dominik@science.uva.nl>
parents: 24898
diff changeset
2552 "--"
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
2553 ["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
2554 (fboundp 'customize-menu-create)])
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
2555 ("Documentation"
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
2556 ["Info" reftex-info t]
f9ac469887a8 (reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents: 20177
diff changeset
2557 ["Commentary" reftex-show-commentary t])))
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2558
22991
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2559 (defun reftex-customize ()
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2560 "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
2561 (interactive)
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2562 (customize-browse 'reftex))
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2563
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2564 (defun reftex-create-customize-menu ()
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2565 "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
2566 (interactive)
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2567 (if (fboundp 'customize-menu-create)
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2568 (progn
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
2569 (easy-menu-change
52170
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2570 '("Ref") "Customize"
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2571 `(["Browse RefTeX group" reftex-customize t]
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2572 "--"
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2573 ,(customize-menu-create 'reftex)
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2574 ["Set" Custom-set t]
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2575 ["Save" Custom-save t]
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2576 ["Reset to Current" Custom-reset-current t]
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2577 ["Reset to Saved" Custom-reset-saved t]
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2578 ["Reset to Standard Settings" Custom-reset-standard t]))
27340819ef07 Updated to version 4.21
Carsten Dominik <dominik@science.uva.nl>
parents: 51850
diff changeset
2579 (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
2580 (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
2581
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2582 (defun reftex-show-commentary ()
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2583 "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
2584 (interactive)
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2585 (finder-commentary "reftex.el"))
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2586
26910
489a5439b988 * reftex.el (reftex-compile-variables): respect new structure of
Carsten Dominik <dominik@science.uva.nl>
parents: 25806
diff changeset
2587 (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
2588 "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
2589 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
2590 (interactive)
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
2591 (info (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
2592
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2593 ;;; 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
2594
313091cd2751 (reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents: 22388
diff changeset
2595 (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
2596 (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
2597
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2598 ;;; Run Hook ------------------------------------------------------------------
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2599
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2600 (run-hooks 'reftex-load-hook)
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2601
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2602 ;;; That's it! ----------------------------------------------------------------
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2603
21114
3e8ab19bdccb 1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents: 21075
diff changeset
2604 (setq reftex-tables-dirty t) ; in case this file is evaluated by hand
92293
465baef0d911 (reftex-show-commentary): Don't require finder.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
2605 (provide 'reftex)
20102
c00f010468c2 Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents: 19660
diff changeset
2606
18050
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2607 ;;;============================================================================
506b35a4537e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2608
93975
1e3a407766b9 Fix up comment convention on the arch-tag lines.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 93097
diff changeset
2609 ;; 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
2610 ;;; reftex.el ends here