annotate lisp/textmodes/reftex.el @ 46677:86e8d59e2e49

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