Mercurial > emacs
annotate lisp/textmodes/reftex.el @ 23123:a8bedd394d55
(appt-check): Start the appt-mode-string w/ space.
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Thu, 27 Aug 1998 15:16:25 +0000 |
parents | 313091cd2751 |
children | 4750ba95a176 |
rev | line source |
---|---|
22388 | 1 ;;; reftex.el --- Minor mode for doing \label, \ref and \cite in LaTeX |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
2 ;; Copyright (c) 1997, 1998 Free Software Foundation, Inc. |
18050 | 3 |
4 ;; Author: Carsten Dominik <dominik@strw.LeidenUniv.nl> | |
5 ;; Keywords: tex | |
6 | |
7 ;; This file is part of GNU Emacs. | |
8 | |
9 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
10 ;; it under the terms of the GNU General Public License as published by | |
11 ;; the Free Software Foundation; either version 2, or (at your option) | |
12 ;; any later version. | |
13 | |
14 ;; GNU Emacs is distributed in the hope that it will be useful, | |
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 ;; GNU General Public License for more details. | |
18 | |
19 ;; You should have received a copy of the GNU General Public License | |
20 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
22 ;; Boston, MA 02111-1307, USA. | |
23 | |
24 ;;--------------------------------------------------------------------------- | |
25 ;; | |
26 ;;; Commentary: | |
27 ;; | |
18123 | 28 ;; RefTeX is a minor mode with distinct support for \ref, \label and |
29 ;; \cite commands in (multi-file) LaTeX documents. | |
18050 | 30 ;; Labels are created semi-automatically. Definition context of labels is |
31 ;; provided when creating a reference. Citations are simplified with | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
32 ;; efficient database lookup. A table of contents buffer provides easy |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
33 ;; access to any part of a document. |
18050 | 34 ;; |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
35 ;; |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
36 ;; To turn RefTeX Mode on and off in a particular buffer, use |
18050 | 37 ;; `M-x reftex-mode'. |
38 ;; | |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
39 ;; To turn on RefTeX Mode for all LaTeX files, add one of the following |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
40 ;; lines to your .emacs file: |
18050 | 41 ;; |
42 ;; (add-hook 'LaTeX-mode-hook 'turn-on-reftex) ; with AUCTeX LaTeX mode | |
43 ;; (add-hook 'latex-mode-hook 'turn-on-reftex) ; with Emacs latex mode | |
44 ;; | |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
45 ;; |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
46 ;; DOCUMENTATION |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
47 ;; ------------- |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
48 ;; |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
49 ;; There is an extensive texinfo document describing RefTeX in detail. |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
50 ;; When you are getting reftex.el with the Emacs distribution, the |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
51 ;; info files should already be installed. To view this |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
52 ;; documentation, use `M-x reftex-info RET'. |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
53 ;; |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
54 ;; The documentation is also available at |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
55 ;; |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
56 ;; 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
|
57 ;; |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
58 ;;--------------------------------------------------------------------------- |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
59 ;; |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
60 ;; RefTeX in a Nutshell |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
61 ;; ==================== |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
62 ;; |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
63 ;; 1. Labels and References |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
64 ;; RefTeX distinguishes labels for different environments. It knows |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
65 ;; about all standard environments (and many others), and can be |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
66 ;; configured to recognize any additional labeled environments you |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
67 ;; have defined yourself (variable REFTEX-LABEL-ALIST(). |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
68 ;; |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
69 ;; * Creating Labels |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
70 ;; Type `C-c (' (`reftex-label') to insert a label at point. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
71 ;; RefTeX will either |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
72 ;; - derive a label from context (default for section labels) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
73 ;; - prompt for a label string (default for figures and |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
74 ;; tables) or |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
75 ;; - insert a simple label made of a prefix and a number (all |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
76 ;; other environments). |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
77 ;; Which labels are created how is configurable (variable |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
78 ;; REFTEX-INSERT-LABEL-FLAGS). |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
79 ;; |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
80 ;; * Referencing Labels |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
81 ;; In order to make a reference, type `C-c )' |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
82 ;; (`reftex-reference'). This shows an outline of the document |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
83 ;; with all labels of a certain type (figure, equation,...) and |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
84 ;; context of the label definition. Selecting a label inserts a |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
85 ;; `\ref{LABEL}' macro into the original buffer. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
86 ;; |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
87 ;; 2. Citations |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
88 ;; After typing `C-c [' (`reftex-citation'), RefTeX will let you |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
89 ;; specify a regular expression to search in current BibTeX database |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
90 ;; files (as specified in the `\bibliography' command) and pull out a |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
91 ;; list of matches for you to choose from. The list is *formatted* |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
92 ;; and sorted. The selected article is referenced as `\cite{KEY}' |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
93 ;; (customizable with variable REFTEX-CITE-FORMAT). |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
94 ;; |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
95 ;; 3. Viewing Cross References |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
96 ;; When no other message occupies the echo area and point is idle on |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
97 ;; the argument of a `\ref' or `\cite' macro, the echo area will |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
98 ;; display information about the citation/cross reference. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
99 ;; With point on or anywhere before such a macro, press `C-c &' |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
100 ;; (`reftex-view-crossref'), or click with `S-mouse-2' on the macro |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
101 ;; argument. This will display the corresponding label definition or |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
102 ;; BibTeX database entry in another window. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
103 ;; |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
104 ;; 4. Table of Contents |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
105 ;; Typing `C-c =' (`reftex-toc') will show a table of contents of the |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
106 ;; document. From that buffer, you can jump quickly to every part of |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
107 ;; your document. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
108 ;; |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
109 ;; 5. Multifile Documents |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
110 ;; Multifile Documents are fully supported. RefTeX will provide cross |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
111 ;; referencing information from all files which are part of the |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
112 ;; document, and even across document borders (`xr.sty'). |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
113 ;; |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
114 ;; 6. Document Parsing |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
115 ;; RefTeX needs to parse the document in order to find labels and |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
116 ;; other information. It does it automatically once, when you start |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
117 ;; working with a document. RefTeX updates its lists internally when |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
118 ;; you make a new label with `reftex-label'. To enforce reparsing, |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
119 ;; call any of the commands described above with a raw `C-u' prefix, |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
120 ;; or press the `r' key in the label selection buffer or the table of |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
121 ;; contents buffer. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
122 ;; |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
123 ;; 7. Speed Issues |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
124 ;; Useful settings to make RefTeX faster for large (multifile) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
125 ;; documents include: |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
126 ;; (setq reftex-enable-partial-scans t) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
127 ;; (setq reftex-save-parse-info t) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
128 ;; (setq reftex-use-multiple-selection-buffers t) |
18050 | 129 ;; |
130 ;;--------------------------------------------------------------------------- | |
131 ;; | |
132 ;; AUTHOR | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
133 ;; ====== |
18050 | 134 ;; |
135 ;; Carsten Dominik <dominik@strw.LeidenUniv.nl> | |
136 ;; | |
137 ;; with contributions from Stephen Eglen | |
138 ;; | |
139 ;; The newest version of RefTeX can be found at | |
140 ;; | |
141 ;; http://www.strw.leidenuniv.nl/~dominik/Tools/ | |
142 ;; ftp://strw.leidenuniv.nl/pub/dominik/ | |
143 ;; | |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
144 ;; At that site you can also get version 3.22 of RefTeX which is still |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
145 ;; compatible with Emacs 19. The file you are reading now as well as the |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
146 ;; ones distributed with Emacs 20 are not. |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
147 ;; |
18050 | 148 ;; THANKS TO: |
149 ;; --------- | |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
150 ;; 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
|
151 ;; developing it with their reports. In particular thanks to |
18050 | 152 ;; |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
153 ;; F. Burstall, Alastair Burt, Soren Dayton, Stephen Eglen, |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
154 ;; Karl Eichwalder, Peter Galbraith, Dieter Kraft, Adrian Lanz, |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
155 ;; Rory Molinari, Laurent Mugnier, Sudeep Kumar Palat, Daniel Polani, |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
156 ;; Robin Socha, Richard Stanton, Allan Strand, Jan Vroonhof, |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
157 ;; Christoph Wedler. |
18050 | 158 ;; |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
159 ;; Finally thanks to Uwe Bolick who first got me (some years ago) into |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
160 ;; supporting LaTeX labels and references with an Editor (which was |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
161 ;; MicroEmacs at the time). |
18219
aaeaae005e98
Updated documentation at several points in the file.
Richard M. Stallman <rms@gnu.org>
parents:
18123
diff
changeset
|
162 ;; |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
163 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
164 ;; |
18050 | 165 |
166 ;;; Code: | |
167 | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
168 (eval-when-compile (require 'cl)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
169 |
18050 | 170 ;; Stuff that needs to be there when we use defcustom |
171 (require 'custom) | |
172 | |
173 (defvar reftex-tables-dirty t | |
174 "Flag showing if tables need to be re-computed.") | |
175 | |
176 (eval-and-compile | |
177 (defun reftex-set-dirty (symbol value) | |
178 (setq reftex-tables-dirty t) | |
179 (set symbol value))) | |
180 | |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
181 ;;; ====================================================================== |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
182 ;;; |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
183 ;;; Configuration Section |
18050 | 184 |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
185 ;; Define the two constants which are needed during compilation |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
186 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
187 (eval-and-compile |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
188 (defconst reftex-label-alist-builtin |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
189 '( |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
190 ;; Some aliases, mostly for backward compatibility |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
191 (Sideways "Alias for -->rotating" (rotating)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
192 (AMSTeX "amsmath with eqref macro" |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
193 ((nil ?e nil "~\\eqref{%s}") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
194 amsmath)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
195 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
196 ;; Individual package defaults |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
197 (amsmath "AMS-LaTeX math environments" |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
198 (("align" ?e nil nil eqnarray-like) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
199 ("gather" ?e nil nil eqnarray-like) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
200 ("multline" ?e nil nil t) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
201 ("flalign" ?e nil nil eqnarray-like) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
202 ("alignat" ?e nil nil alignat-like) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
203 ("xalignat" ?e nil nil alignat-like) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
204 ("xxalignat" ?e nil nil alignat-like) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
205 ("subequations" ?e nil nil t))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
206 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
207 (endnotes "The \\endnote macro" |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
208 (("\\endnote[]{}" ?n nil nil 2 (regexp "Endnotes?")))) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
209 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
210 (fancybox "The Beqnarray environment" |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
211 (("Beqnarray" ?e nil nil eqnarray-like))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
212 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
213 (floatfig "The floatingfigure environment" |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
214 (("floatingfigure" ?f nil nil caption))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
215 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
216 (longtable "The longtable environment" |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
217 (("longtable" ?t nil nil caption))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
218 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
219 (picinpar "The figwindow and tabwindow environments" |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
220 (("figwindow" ?f nil nil 1) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
221 ("tabwindow" ?f nil nil 1))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
222 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
223 (rotating "Sidewaysfigure and table" |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
224 (("sidewaysfigure" ?f nil nil caption) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
225 ("sidewaystable" ?t nil nil caption))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
226 |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
227 (sidecap "CSfigure and SCtable" |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
228 (("SCfigure" ?f nil nil caption) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
229 ("SCtable" ?t nil nil caption))) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
230 |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
231 (subfigure "Subfigure environments/macro" |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
232 (("subfigure" ?f nil nil caption) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
233 ("subfigure*" ?f nil nil caption) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
234 ("\\subfigure[]{}" ?f nil nil 1))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
235 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
236 (supertab "Supertabular environment" |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
237 (("supertabular" ?t nil nil "\\tablecaption{"))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
238 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
239 (wrapfig "The wrapfigure environment" |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
240 (("wrapfigure" ?f nil nil caption))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
241 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
242 ;; The LaTeX core stuff |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
243 (LaTeX "LaTeX default environments" |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
244 (("section" ?s "sec:" "~\\ref{%s}" (nil . t) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
245 (regexp "parts?" "chapters?" "chap\\." "sections?" "sect?\\." |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
246 "paragraphs?" "par\\." |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
247 "\\\\S" "\247" "Teile?" "Kapitel" "Kap\\." "Abschnitte?" |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
248 "appendi\\(x\\|ces\\)" "App\\." "Anh\"?ange?" "Anh\\.")) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
249 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
250 ("enumerate" ?i "item:" "~\\ref{%s}" item |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
251 (regexp "items?" "Punkte?")) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
252 |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
253 ("equation" ?e "eq:" "~(\\ref{%s})" t |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
254 (regexp "equations?" "eqs?\\." "eqn\\." "Gleichung\\(en\\)?" "Gl\\.")) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
255 ("eqnarray" ?e "eq:" nil eqnarray-like) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
256 |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
257 ("figure" ?f "fig:" "~\\ref{%s}" caption |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
258 (regexp "figure?[sn]?" "figs?\\." "Abbildung\\(en\\)?" "Abb\\.")) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
259 ("figure*" ?f nil nil caption) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
260 |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
261 ("table" ?t "tab:" "~\\ref{%s}" caption |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
262 (regexp "tables?" "tab\\." "Tabellen?")) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
263 ("table*" ?t nil nil caption) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
264 |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
265 ("\\footnote[]{}" ?n "note:" "~\\ref{%s}" 2 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
266 (regexp "footnotes?" "notes?" "Anmerkung\\(en\\)?" "Anm\\.")) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
267 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
268 ("any" ?\ " " "~\\ref{%s}" nil) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
269 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
270 ;; The label macro is hard coded, but it *could* be defined like this: |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
271 ;;("\\label{*}" nil nil nil nil) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
272 )) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
273 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
274 ) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
275 "The default label environment descriptions. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
276 Lower-case symbols correspond to a style file of the same name in the LaTeX |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
277 distribution. Mixed-case symbols are convenience aliases.") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
278 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
279 (defconst reftex-cite-format-builtin |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
280 '( |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
281 (default "Default macro \\cite{%l}" |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
282 "\\cite{%l}") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
283 (natbib "The Natbib package" |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
284 ((?\C-m . "\\cite{%l}") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
285 (?t . "\\citet{%l}") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
286 (?T . "\\citet*{%l}") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
287 (?p . "\\citep{%l}") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
288 (?P . "\\citep*{%l}") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
289 (?e . "\\citep[e.g.][]{%l}") |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
290 (?s . "\\citep[see][]{%l}") |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
291 (?a . "\\citeauthor{%l}") |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
292 (?A . "\\citeauthor*{%l}") |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
293 (?y . "\\citeyear{%l}"))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
294 (harvard "The Harvard package" |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
295 ((?\C-m . "\\cite{%l}") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
296 (?p . "\\cite{%l}") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
297 (?t . "\\citeasnoun{%l}") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
298 (?n . "\\citeasnoun{%l}") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
299 (?s . "\\possessivecite{%l}") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
300 (?e . "\\citeaffixed{%l}{?}") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
301 (?y . "\\citeyear{%l}") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
302 (?a . "\\citename{%l}"))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
303 (chicago "The Chicago package" |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
304 ((?\C-m . "\\cite{%l}") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
305 (?t . "\\citeN{%l}") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
306 (?T . "\\shortciteN{%l}") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
307 (?p . "\\cite{%l}") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
308 (?P . "\\shortcite{%l}") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
309 (?a . "\\citeA{%l}") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
310 (?A . "\\shortciteA{%l}") |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
311 (?y . "\\citeyear{%l}"))) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
312 (astron "The Astron package" |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
313 ((?\C-m . "\\cite{%l}") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
314 (?p . "\\cite{%l}" ) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
315 (?t . "%2a (\\cite{%l})"))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
316 (author-year "Do-it-yourself Author-year" |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
317 ((?\C-m . "\\cite{%l}") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
318 (?t . "%2a (%y)\\nocite{%l}") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
319 (?p . "(%2a %y\\nocite{%l})"))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
320 (locally "Full info in parenthesis" |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
321 "(%2a %y, %j %v, %P, %e: %b, %u, %s %<)") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
322 ) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
323 "Builtin versions of the citation format. |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
324 The following conventions are valid for all alist entries: |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
325 `?\C-m' should always point to a straight \\cite{%l} macro. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
326 `?t' should point to a textual citation (citation as a noun). |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
327 `?p' should point to a parenthetical citation.") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
328 ) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
329 |
18050 | 330 ;; Configuration Variables and User Options for RefTeX ------------------ |
331 | |
332 (defgroup reftex nil | |
333 "LaTeX label and citation support." | |
334 :tag "RefTeX" | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
335 :link '(url-link :tag "Home Page" |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
336 "http://strw.leidenuniv.nl/~dominik/Tools/") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
337 :link '(emacs-commentary-link :tag "Commentary in reftex.el" "reftex.el") |
18050 | 338 :prefix "reftex-" |
339 :group 'tex) | |
340 | |
341 (defgroup reftex-label-support nil | |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
342 "Support for creation, insertion and referencing of labels in LaTeX." |
18050 | 343 :group 'reftex) |
344 | |
345 (defgroup reftex-defining-label-environments nil | |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
346 "Definition of environments and macros to do with label." |
18050 | 347 :group 'reftex-label-support) |
348 | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
349 (defcustom reftex-default-label-alist-entries |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
350 '(amsmath endnotes fancybox floatfig longtable picinpar |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
351 rotating sidecap subfigure supertab wrapfig LaTeX) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
352 "Default label alist specifications. LaTeX should be the last entry. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
353 This list describes the default label environments RefTeX should always use. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
354 It is probably a mistake to remove the LaTeX symbol from this list. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
355 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
356 The options include: |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
357 LaTeX The standard LaTeX environments. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
358 Sideways The sidewaysfigure and sidewaystable environments. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
359 AMSTeX The math environments in the AMS-LaTeX amsmath package. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
360 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
361 For the full list of options, try |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
362 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
363 M-x customize-variable RET reftex-default-label-alist-entries RET." |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
364 :group 'reftex-defining-label-environments |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
365 :set 'reftex-set-dirty |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
366 :type `(set |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
367 :indent 4 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
368 :inline t |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
369 :greedy t |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
370 ,@(mapcar |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
371 (function |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
372 (lambda (x) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
373 (list 'const ':tag (concat (symbol-name (nth 0 x)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
374 ": " (nth 1 x)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
375 (nth 0 x)))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
376 reftex-label-alist-builtin))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
377 |
18050 | 378 (defcustom reftex-label-alist nil |
18123 | 379 "Alist with information on environments for \\label-\\ref use. |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
380 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
381 This docstring is easier to understand after reading the configuration |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
382 examples in `reftex.el'. Looking at the builtin defaults in the constant |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
383 `reftex-label-alist-builtin' may also be instructive. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
384 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
385 Set this variable to define additions and changes to the default. The only |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
386 things you MUST NOT change is that `?s' is the type indicator for section |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
387 labels, and SPC for the `any' label type. These are hard-coded at other |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
388 places in the code. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
389 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
390 Each list entry describes either an environment carrying a counter for use |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
391 with \\label and \\ref, or a LaTeX macro defining a label as (or inside) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
392 one of its arguments. The elements of each list entry are: |
18050 | 393 |
394 0. Name of the environment (like \"table\") or macro (like \"\\\\myfig\"). | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
395 For macros, indicate the macro arguments for best results, as in |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
396 \"\\\\myfig[]{}{}{*}{}\". Use square brackets for optional arguments, |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
397 a star to mark the label argument, if any. The macro does not have to |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
398 have a label argument - you could also use \\label{..} inside one of |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
399 its arguments. |
18050 | 400 Special names: `section' for section labels, `any' to define a group |
401 which contains all labels. | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
402 This may also be nil if the entry is only meant to change some settings |
18050 | 403 associated with the type indicator character (see below). |
404 | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
405 1. Type indicator character, like `?t', must be a printable ASCII character. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
406 The type indicator is a single character which defines a label type. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
407 Any label inside the environment or macro is assumed to belong to this |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
408 type. The same character may occur several times in this list, to cover |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
409 cases in which different environments carry the same label type (like |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
410 `equation' and `eqnarray'). |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
411 If the type indicator is nil and the macro has a label argument {*}, |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
412 the macro defines neutral labels just like \label. In this case |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
413 the reminder of this entry is ignored. |
18050 | 414 |
415 2. Label prefix string, like \"tab:\". | |
18220
36a61aa59b9d
(tex-main-file, outline-minor-mode): Add defvars.
Richard M. Stallman <rms@gnu.org>
parents:
18219
diff
changeset
|
416 The prefix is a short string used as the start of a label. It may be the |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
417 empty string. The prefix may contain the following `%' escapes: |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
418 %f Current file name with directory and extension stripped. |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
419 %F Current file name relative to directory of master file. |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
420 %u User login name, on systems which support this. |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
421 |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
422 Example: In a file `intro.tex', \"eq:%f:\" will become \"eq:intro:\"). |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
423 |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
424 3. Format string for reference insert in buffer. `%s' will be replaced by |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
425 the label. |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
426 When the format starts with `~', the `~' will only be inserted if |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
427 there is not already a whitespace before point. |
18050 | 428 |
429 4. Indication on how to find the short context. | |
18220
36a61aa59b9d
(tex-main-file, outline-minor-mode): Add defvars.
Richard M. Stallman <rms@gnu.org>
parents:
18219
diff
changeset
|
430 - If nil, use the text following the \\label{...} macro. |
36a61aa59b9d
(tex-main-file, outline-minor-mode): Add defvars.
Richard M. Stallman <rms@gnu.org>
parents:
18219
diff
changeset
|
431 - If t, use |
18050 | 432 - the section heading for section labels. |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
433 - text following the \\begin{...} statement of environments. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
434 (not a good choice for environments like eqnarray or enumerate, |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
435 where one has several labels in a single environment). |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
436 - text after the macro name (starting with the first arg) for macros. |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
437 - If an integer, use the nth argument of the macro. As a special case, |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
438 1000 means to get text after the last macro argument. |
18220
36a61aa59b9d
(tex-main-file, outline-minor-mode): Add defvars.
Richard M. Stallman <rms@gnu.org>
parents:
18219
diff
changeset
|
439 - If a string, use as regexp to search *backward* from the label. Context |
36a61aa59b9d
(tex-main-file, outline-minor-mode): Add defvars.
Richard M. Stallman <rms@gnu.org>
parents:
18219
diff
changeset
|
440 is then the text following the end of the match. E.g. putting this to |
20177
6ebc3e300106
The menu now used toggle and radio for some items.
Karl Heuer <kwzh@gnu.org>
parents:
20102
diff
changeset
|
441 \"\\\\\\\\caption[[{]\" will use the caption in a figure or table |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
442 environment. |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
443 \"\\\\\\\\begin{eqnarray}\\\\|\\\\\\\\\\\\\\\\\" works for eqnarrays. |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
444 - If any of `caption', `item', `eqnarray-like', `alignat-like', this |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
445 symbol will internally be translated into an appropriate regexp |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
446 (see also the variable `reftex-default-context-regexps'). |
18050 | 447 - If a function, call this function with the name of the environment/macro |
18220
36a61aa59b9d
(tex-main-file, outline-minor-mode): Add defvars.
Richard M. Stallman <rms@gnu.org>
parents:
18219
diff
changeset
|
448 as argument. On call, point will be just after the \\label macro. The |
36a61aa59b9d
(tex-main-file, outline-minor-mode): Add defvars.
Richard M. Stallman <rms@gnu.org>
parents:
18219
diff
changeset
|
449 function is expected to return a suitable context string. It should |
18050 | 450 throw an exception (error) when failing to find context. |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
451 As an example, here is a function returning the 10 chars following |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
452 the label macro as context: |
18050 | 453 |
454 (defun my-context-function (env-or-mac) | |
455 (if (> (point-max) (+ 10 (point))) | |
456 (buffer-substring (point) (+ 10 (point))) | |
457 (error \"Buffer too small\"))) | |
458 | |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
459 Label context is used in two ways by RefTeX: For display in the label |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
460 menu, and to derive a label string. If you want to use a different |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
461 method for each of these, specify them as a dotted pair. |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
462 E.g. `(nil . t)' uses the text after the label (nil) for display, and |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
463 text from the default position (t) to derive a label string. This is |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
464 actually used for section labels. |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
465 |
18220
36a61aa59b9d
(tex-main-file, outline-minor-mode): Add defvars.
Richard M. Stallman <rms@gnu.org>
parents:
18219
diff
changeset
|
466 Setting the variable `reftex-use-text-after-label-as-context' to t |
36a61aa59b9d
(tex-main-file, outline-minor-mode): Add defvars.
Richard M. Stallman <rms@gnu.org>
parents:
18219
diff
changeset
|
467 overrides the setting here. |
36a61aa59b9d
(tex-main-file, outline-minor-mode): Add defvars.
Richard M. Stallman <rms@gnu.org>
parents:
18219
diff
changeset
|
468 |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
469 5. List of magic words which identify a reference to be of this type. |
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
470 If the word before point is equal to one of these words when calling |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
471 `reftex-reference', the label list offered will be automatically |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
472 restricted to labels of the correct type. |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
473 If the first element of this wordlist is the symbol `regexp', the |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
474 strings are interpreted as regular expressions. RefTeX will add |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
475 a \"\\\\W\" to the beginning and other stuff to the end of the regexp. |
18050 | 476 |
477 If the type indicator characters of two or more entries are the same, RefTeX | |
478 will use | |
479 - the first non-nil format and prefix | |
480 - the magic words of all involved entries. | |
481 | |
18220
36a61aa59b9d
(tex-main-file, outline-minor-mode): Add defvars.
Richard M. Stallman <rms@gnu.org>
parents:
18219
diff
changeset
|
482 Any list entry may also be a symbol. If that has an association in |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
483 `reftex-label-alist-builtin', the cddr of that association is spliced into the |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
484 list. However, builtin defaults should normally be set with the variable |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
485 `reftex-default-label-alist-entries." |
18050 | 486 :group 'reftex-defining-label-environments |
487 :set 'reftex-set-dirty | |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
488 :type |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
489 `(repeat |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
490 (choice :tag "Package or Detailed " |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
491 :value ("" ?a nil nil nil nil) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
492 (list :tag "Detailed Entry" |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
493 :value ("" ?a nil nil nil nil) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
494 (choice :tag "Environment or \\macro " |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
495 (const :tag "Ignore, just use typekey" nil) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
496 (string "")) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
497 (choice :tag "Type specification " |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
498 (const :tag "unspecified, like in \\label" nil) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
499 (character :tag "Char " ?a)) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
500 (choice :tag "Label prefix string " |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
501 (const :tag "Default" nil) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
502 (string :tag "String" "lab:")) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
503 (choice :tag "Label reference format" |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
504 (const :tag "Default" nil) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
505 (string :tag "String" "~\\ref{%s}")) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
506 (choice :tag "Context method " |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
507 (const :tag "Default position" t) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
508 (const :tag "After label" nil) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
509 (number :tag "Macro arg nr" 1) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
510 (regexp :tag "Regexp" "") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
511 (const :tag "Caption in float" caption) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
512 (const :tag "Item in list" item) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
513 (const :tag "Eqnarray-like" eqnarray-like) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
514 (const :tag "Alignat-like" alignat-like) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
515 (symbol :tag "Function" my-func)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
516 (repeat :tag "Magic words" :extra-offset 2 (string))) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
517 (choice |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
518 :tag "Package" |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
519 :value AMSTeX |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
520 ,@(mapcar |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
521 (function |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
522 (lambda (x) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
523 (list 'const ':tag (concat (symbol-name (nth 0 x))) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
524 (nth 0 x)))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
525 reftex-label-alist-builtin))))) |
18050 | 526 |
20177
6ebc3e300106
The menu now used toggle and radio for some items.
Karl Heuer <kwzh@gnu.org>
parents:
20102
diff
changeset
|
527 ;; LaTeX section commands and level numbers |
6ebc3e300106
The menu now used toggle and radio for some items.
Karl Heuer <kwzh@gnu.org>
parents:
20102
diff
changeset
|
528 (defcustom reftex-section-levels |
6ebc3e300106
The menu now used toggle and radio for some items.
Karl Heuer <kwzh@gnu.org>
parents:
20102
diff
changeset
|
529 '( |
6ebc3e300106
The menu now used toggle and radio for some items.
Karl Heuer <kwzh@gnu.org>
parents:
20102
diff
changeset
|
530 ("part" . 0) |
6ebc3e300106
The menu now used toggle and radio for some items.
Karl Heuer <kwzh@gnu.org>
parents:
20102
diff
changeset
|
531 ("chapter" . 1) |
6ebc3e300106
The menu now used toggle and radio for some items.
Karl Heuer <kwzh@gnu.org>
parents:
20102
diff
changeset
|
532 ("section" . 2) |
6ebc3e300106
The menu now used toggle and radio for some items.
Karl Heuer <kwzh@gnu.org>
parents:
20102
diff
changeset
|
533 ("subsection" . 3) |
6ebc3e300106
The menu now used toggle and radio for some items.
Karl Heuer <kwzh@gnu.org>
parents:
20102
diff
changeset
|
534 ("subsubsection" . 4) |
6ebc3e300106
The menu now used toggle and radio for some items.
Karl Heuer <kwzh@gnu.org>
parents:
20102
diff
changeset
|
535 ("paragraph" . 5) |
6ebc3e300106
The menu now used toggle and radio for some items.
Karl Heuer <kwzh@gnu.org>
parents:
20102
diff
changeset
|
536 ("subparagraph" . 6) |
6ebc3e300106
The menu now used toggle and radio for some items.
Karl Heuer <kwzh@gnu.org>
parents:
20102
diff
changeset
|
537 ("subsubparagraph" . 7) |
6ebc3e300106
The menu now used toggle and radio for some items.
Karl Heuer <kwzh@gnu.org>
parents:
20102
diff
changeset
|
538 ) |
6ebc3e300106
The menu now used toggle and radio for some items.
Karl Heuer <kwzh@gnu.org>
parents:
20102
diff
changeset
|
539 "Commands and levels used for defining sections in the document. |
6ebc3e300106
The menu now used toggle and radio for some items.
Karl Heuer <kwzh@gnu.org>
parents:
20102
diff
changeset
|
540 The car of each cons cell is the name of the section macro. The cdr is a |
6ebc3e300106
The menu now used toggle and radio for some items.
Karl Heuer <kwzh@gnu.org>
parents:
20102
diff
changeset
|
541 number indicating its level." |
6ebc3e300106
The menu now used toggle and radio for some items.
Karl Heuer <kwzh@gnu.org>
parents:
20102
diff
changeset
|
542 :group 'reftex-defining-label-environments |
6ebc3e300106
The menu now used toggle and radio for some items.
Karl Heuer <kwzh@gnu.org>
parents:
20102
diff
changeset
|
543 :set 'reftex-set-dirty |
6ebc3e300106
The menu now used toggle and radio for some items.
Karl Heuer <kwzh@gnu.org>
parents:
20102
diff
changeset
|
544 :type '(repeat |
6ebc3e300106
The menu now used toggle and radio for some items.
Karl Heuer <kwzh@gnu.org>
parents:
20102
diff
changeset
|
545 (cons (string :tag "sectioning macro" "") |
6ebc3e300106
The menu now used toggle and radio for some items.
Karl Heuer <kwzh@gnu.org>
parents:
20102
diff
changeset
|
546 (number :tag "level " 0)))) |
6ebc3e300106
The menu now used toggle and radio for some items.
Karl Heuer <kwzh@gnu.org>
parents:
20102
diff
changeset
|
547 |
6ebc3e300106
The menu now used toggle and radio for some items.
Karl Heuer <kwzh@gnu.org>
parents:
20102
diff
changeset
|
548 (defcustom reftex-default-context-regexps |
6ebc3e300106
The menu now used toggle and radio for some items.
Karl Heuer <kwzh@gnu.org>
parents:
20102
diff
changeset
|
549 '((caption . "\\\\\\(rot\\)?caption\\*?[[{]") |
6ebc3e300106
The menu now used toggle and radio for some items.
Karl Heuer <kwzh@gnu.org>
parents:
20102
diff
changeset
|
550 (item . "\\\\item\\(\\[[^]]*\\]\\)?") |
6ebc3e300106
The menu now used toggle and radio for some items.
Karl Heuer <kwzh@gnu.org>
parents:
20102
diff
changeset
|
551 (eqnarray-like . "\\\\begin{%s}\\|\\\\\\\\") |
6ebc3e300106
The menu now used toggle and radio for some items.
Karl Heuer <kwzh@gnu.org>
parents:
20102
diff
changeset
|
552 (alignat-like . "\\\\begin{%s}{[0-9]*}\\|\\\\\\\\")) |
6ebc3e300106
The menu now used toggle and radio for some items.
Karl Heuer <kwzh@gnu.org>
parents:
20102
diff
changeset
|
553 "Alist with default regular expressions for finding context. |
6ebc3e300106
The menu now used toggle and radio for some items.
Karl Heuer <kwzh@gnu.org>
parents:
20102
diff
changeset
|
554 The form (format regexp (regexp-quote environment)) is used to calculate |
6ebc3e300106
The menu now used toggle and radio for some items.
Karl Heuer <kwzh@gnu.org>
parents:
20102
diff
changeset
|
555 the final regular expression - so %s will be replaced with the environment |
6ebc3e300106
The menu now used toggle and radio for some items.
Karl Heuer <kwzh@gnu.org>
parents:
20102
diff
changeset
|
556 or macro." |
6ebc3e300106
The menu now used toggle and radio for some items.
Karl Heuer <kwzh@gnu.org>
parents:
20102
diff
changeset
|
557 :group 'reftex-defining-label-environments |
6ebc3e300106
The menu now used toggle and radio for some items.
Karl Heuer <kwzh@gnu.org>
parents:
20102
diff
changeset
|
558 :type '(repeat (cons (symbol) (regexp)))) |
6ebc3e300106
The menu now used toggle and radio for some items.
Karl Heuer <kwzh@gnu.org>
parents:
20102
diff
changeset
|
559 |
18050 | 560 (defcustom reftex-use-text-after-label-as-context nil |
561 "*t means, grab context from directly after the \\label{..} macro. | |
562 This is the fastest method for obtaining context of the label definition, but | |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
563 requires discipline when placing labels. Setting this variable to t takes |
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
564 precedence over the individual settings in `reftex-label-alist'. |
18050 | 565 This variable may be set to t, nil, or a string of label type letters |
566 indicating the label types for which it should be true." | |
567 :group 'reftex-defining-label-environments | |
568 :set 'reftex-set-dirty | |
569 :type '(choice | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
570 (const :tag "on" t) (const :tag "off" nil) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
571 (string :tag "Selected label types"))) |
18050 | 572 |
573 ;; Label insertion | |
574 | |
575 (defgroup reftex-making-and-inserting-labels nil | |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
576 "Options on how to create new labels." |
18050 | 577 :group 'reftex-label-support) |
578 | |
579 (defcustom reftex-insert-label-flags '("s" "sft") | |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
580 "Flags governing label insertion. First flag DERIVE, second flag PROMPT. |
18050 | 581 |
582 If DERIVE is t, RefTeX will try to derive a sensible label from context. | |
583 A section label for example will be derived from the section heading. | |
584 The conversion of the context to a legal label is governed by the | |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
585 specifications given in `reftex-derive-label-parameters'. |
18050 | 586 If RefTeX fails to derive a label, it will prompt the user. |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
587 If DERIVE is nil, the label generated will consist of the prefix and a |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
588 unique number, like `eq:23'. |
18050 | 589 |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
590 If PROMPT is t, the user will be prompted for a label string. The prompt will |
18050 | 591 already contain the prefix, and (if DERIVE is t) a default label derived from |
592 context. When PROMPT is nil, the default label will be inserted without | |
593 query. | |
594 | |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
595 So the combination of DERIVE and PROMPT controls label insertion. Here is a |
18050 | 596 table describing all four possibilities: |
597 | |
598 DERIVE PROMPT ACTION | |
599 ------------------------------------------------------------------------- | |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
600 nil nil Insert simple label, like eq:22 or sec:13. No query. |
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
601 nil t Prompt for label. |
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
602 t nil Derive a label from context and insert without query. |
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
603 t t Derive a label from context and prompt for confirmation. |
18050 | 604 |
605 Each flag may be set to t, nil, or a string of label type letters | |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
606 indicating the label types for which it should be true. The strings work |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
607 like character classes. |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
608 Thus, the combination may be set differently for each label type. The |
18050 | 609 default settings \"s\" and \"sft\" mean: Derive section labels from headings |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
610 (with confirmation). Prompt for figure and table labels. Use simple labels |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
611 without confirmation for everything else. |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
612 The available label types are: s (section), f (figure), t (table), i (item), |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
613 e (equation), n (footnote), plus any definitions in `reftex-label-alist'." |
18050 | 614 :group 'reftex-making-and-inserting-labels |
615 :type '(list (choice :tag "Derive label from context" | |
616 (const :tag "always" t) | |
617 (const :tag "never" nil) | |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
618 (string :tag "selected label types" "")) |
18050 | 619 (choice :tag "Prompt for label string " |
620 :entry-format " %b %v" | |
621 (const :tag "always" t) | |
622 (const :tag "never" nil) | |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
623 (string :tag "selected label types" "")))) |
18050 | 624 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
625 (defcustom reftex-string-to-label-function 'reftex-string-to-label |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
626 "Function to turn an arbitrary string into a legal label. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
627 RefTeX's default function uses the variable `reftex-derive-label-parameters'." |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
628 :group 'reftex-making-and-inserting-labels |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
629 :type 'symbol) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
630 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
631 (defcustom reftex-translate-to-ascii-function nil |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
632 "Filter function which will process a context string before it is used |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
633 to derive a label from it. A useful application would be to convert ISO or |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
634 Mule characters into something legal in labels. By default, RefTeX just |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
635 removes these characters. X-Symbol (>=2.6) sets this variable to |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
636 `x-symbol-translate-to-ascii'." |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
637 :group 'reftex-making-and-inserting-labels |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
638 :type 'symbol) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
639 |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
640 (defcustom reftex-derive-label-parameters '(3 20 t 1 "-" |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
641 ("the" "on" "in" "off" "a" "for" "by" "of" "and" "is" "to") t) |
18050 | 642 "Parameters for converting a string into a label. |
643 NWORDS Number of words to use. | |
644 MAXCHAR Maximum number of characters in a label string. | |
645 ILLEGAL nil: Throw away any words containing characters illegal in labels. | |
646 t: Throw away only the illegal characters, not the whole word. | |
647 ABBREV nil: Never abbreviate words. | |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
648 t: Always abbreviate words (see `reftex-abbrev-parameters'). |
18050 | 649 not t and not nil: Abbreviate words if necessary to shorten |
650 label string below MAXCHAR. | |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
651 SEPARATOR String separating different words in the label. |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
652 IGNOREWORDS List of words which should not be part of labels. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
653 DOWNCASE t: Downcase words before using them." |
18050 | 654 :group 'reftex-making-and-inserting-labels |
655 :type '(list (integer :tag "Number of words " 3) | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
656 (integer :tag "Maximum label length " 20) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
657 (choice :tag "Illegal characters in words" |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
658 (const :tag "throw away entire word" nil) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
659 (const :tag "throw away single chars" t)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
660 (choice :tag "Abbreviate words " |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
661 (const :tag "never" nil) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
662 (const :tag "always" t) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
663 (const :tag "when label is too long" 1)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
664 (string :tag "Separator between words " "-") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
665 (repeat :tag "Ignore words" |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
666 :entry-format " %i %d %v" |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
667 (string :tag "")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
668 (option (boolean :tag "Downcase words ")))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
669 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
670 ;; The following rexexp is defined negative and excludes all Mule characters. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
671 ;; A positive way to do it and to allow Mule characters at the same time |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
672 ;; vwould be this: "[][\000-\037 !\"#$%&'()*,/<=>?@\\^`{|}~\177]" |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
673 (defcustom reftex-label-illegal-re "[^-a-zA-Z0-9_+=:;,.\300-\377]" |
18050 | 674 "Regexp matching characters not legal in labels. |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
675 For historic reasons, this character class comes *with* the [] brackets. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
676 The default value allows the characters \300-\377 because these are the |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
677 european letters in ISO 8859-1." |
18050 | 678 :group 'reftex-making-and-inserting-labels |
679 :type '(regexp :tag "Character class")) | |
680 | |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
681 (defcustom reftex-abbrev-parameters '(4 2 "^aeiou" "aeiou") |
18050 | 682 "Parameters for abbreviation of words. |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
683 MIN-CHARS Minimum number of characters remaining after abbreviation. |
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
684 MIN-KILL Minimum number of characters to remove when abbreviating words. |
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
685 BEFORE Character class before abbrev point in word. |
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
686 AFTER Character class after abbrev point in word." |
18050 | 687 :group 'reftex-making-and-inserting-labels |
688 :type '(list | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
689 (integer :tag "Minimum chars per word" 4) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
690 (integer :tag "Shorten by at least " 2) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
691 (string :tag "cut before char class " "^saeiou") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
692 (string :tag "cut after char class " "aeiou"))) |
18050 | 693 |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
694 (defcustom reftex-format-label-function nil |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
695 "Function which produces the string to insert as a label definition. |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
696 Normally should be nil, unless you want to do something fancy. |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
697 The function will be called with two arguments, the LABEL and the DEFAULT |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
698 FORMAT, which usually is `\label{%s}'. The function should return the |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
699 string to insert into the buffer." |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
700 :group 'reftex-making-and-inserting-labels |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
701 :type 'function) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
702 |
18050 | 703 ;; Label referencing |
704 | |
705 (defgroup reftex-referencing-labels nil | |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
706 "Options on how to reference labels." |
18050 | 707 :group 'reftex-label-support) |
708 | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
709 (eval-and-compile |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
710 (defconst reftex-tmp |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
711 '((const :tag "on" t) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
712 (const :tag "off" nil) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
713 (string :tag "Selected label types")))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
714 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
715 (defcustom reftex-label-menu-flags '(t t nil nil nil nil t nil) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
716 "List of flags governing the label menu makeup. |
18050 | 717 The flags are: |
718 | |
719 TABLE-OF-CONTENTS Show the labels embedded in a table of context. | |
720 SECTION-NUMBERS Include section numbers (like 4.1.3) in table of contents. | |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
721 COUNTERS Show counters. This just numbers the labels in the menu. |
18050 | 722 NO-CONTEXT Non-nil means do NOT show the short context. |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
723 FOLLOW Follow full context in other window. |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
724 SHOW-COMMENTED Show labels from regions which are commented out. |
21115
fea2f6a2818d
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21114
diff
changeset
|
725 MATCH-IN-TOC Obsolete flag. |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
726 SHOW FILES Show begin and end of included files. |
18050 | 727 |
728 Each of these flags can be set to t or nil, or to a string of type letters | |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
729 indicating the label types for which it should be true. These strings work |
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
730 like character classes in regular expressions. Thus, setting one of the |
18050 | 731 flags to \"sf\" makes the flag true for section and figure labels, nil |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
732 for everything else. Setting it to \"^sf\" makes it the other way round. |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
733 The available label types are: s (section), f (figure), t (table), i (item), |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
734 e (equation), n (footnote), plus any definitions in `reftex-label-alist'. |
18050 | 735 |
736 Most options can also be switched from the label menu itself - so if you | |
737 decide here to not have a table of contents in the label menu, you can still | |
738 get one interactively during selection from the label menu." | |
739 :group 'reftex-referencing-labels | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
740 :type |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
741 `(list |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
742 (choice :tag "Embed in table of contents " ,@reftex-tmp) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
743 (choice :tag "Show section numbers " ,@reftex-tmp) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
744 (choice :tag "Show individual counters " ,@reftex-tmp) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
745 (choice :tag "Hide short context " ,@reftex-tmp) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
746 (choice :tag "Follow context in other window " ,@reftex-tmp) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
747 (choice :tag "Show commented labels " ,@reftex-tmp) |
21115
fea2f6a2818d
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21114
diff
changeset
|
748 (choice :tag "Obsolete flag, Don't use. " ,@reftex-tmp) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
749 (choice :tag "Show begin/end of included files" ,@reftex-tmp))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
750 |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
751 (defcustom reftex-vref-is-default nil |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
752 "*Non-nil means, the varioref macro \\vref is used as default. |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
753 In the selection buffer, the `v' key toggles the reference macro between |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
754 `\\ref' and `\\vref'. The value of this variable determines the default |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
755 which is active when entering the selection process. |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
756 Instead of nil or t, this may also be a string of type letters indicating |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
757 the label types for which it should be true." |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
758 :group 'reftex-referencing-labels |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
759 :type `(choice :tag "\\vref is default macro" ,@reftex-tmp)) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
760 |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
761 (defcustom reftex-level-indent 2 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
762 "*Number of spaces to be used for indentation per section level." |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
763 :group 'reftex-referencing-labels |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
764 :type 'integer) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
765 |
18050 | 766 (defcustom reftex-guess-label-type t |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
767 "*Non-nil means, `reftex-reference' will try to guess the label type. |
18050 | 768 To do that, RefTeX will look at the word before the cursor and compare it with |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
769 the words given in `reftex-label-alist'. When it finds a match, RefTeX will |
18050 | 770 immediately offer the correct label menu - otherwise it will prompt you for |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
771 a label type. If you set this variable to nil, RefTeX will always prompt." |
18050 | 772 :group 'reftex-referencing-labels |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
773 :type 'boolean) |
18050 | 774 |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
775 (defcustom reftex-format-ref-function nil |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
776 "Function which produces the string to insert as a reference. |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
777 Normally should be nil, because the format to insert a reference can |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
778 already be specified in `reftex-label-alist'. |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
779 The function will be called with two arguments, the LABEL and the DEFAULT |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
780 FORMAT, which normally is `~\ref{%s}'. The function should return the |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
781 string to insert into the buffer." |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
782 :group 'reftex-referencing-labels |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
783 :type 'function) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
784 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
785 (defcustom reftex-select-label-mode-hook nil |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
786 "Mode hook for reftex-select-label-mode." |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
787 :group 'reftex-referencing-labels |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
788 :type 'hook) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
789 |
18050 | 790 ;; BibteX citation configuration ---------------------------------------- |
791 | |
792 (defgroup reftex-citation-support nil | |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
793 "Support for referencing bibliographic data with BibTeX." |
18050 | 794 :group 'reftex) |
795 | |
796 (defcustom reftex-bibpath-environment-variables '("BIBINPUTS" "TEXBIB") | |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
797 "*List of env vars which might contain the path to BibTeX database files. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
798 Directories ending in `//' or `!!' will be expanded recursively when necessary |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
799 to find files." |
18050 | 800 :group 'reftex-citation-support |
801 :set 'reftex-set-dirty | |
802 :type '(repeat (string :tag "Environment variable"))) | |
803 | |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
804 (defvar reftex-bibfile-ignore-list nil) ; compatibility |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
805 (defcustom reftex-bibfile-ignore-regexps nil |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
806 "*List of regular expressions to exclude files in \\bibliography{..}. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
807 File names matched by these regexps will not be parsed by RefTeX. |
18050 | 808 Intended for files which contain only `@string' macro definitions and the |
809 like, which are ignored by RefTeX anyway." | |
810 :group 'reftex-citation-support | |
811 :set 'reftex-set-dirty | |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
812 :type '(repeat (regexp))) |
18050 | 813 |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
814 (defcustom reftex-default-bibliography nil |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
815 "*List of BibTeX database file which should be used if none are specified. |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
816 When `reftex-citation' is called from a document which has neither a |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
817 `\bibliography{..}' statement nor a `thebibliography' environment, |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
818 RefTeX will scan these files instead. Intended for using |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
819 `reftex-citation' in non-LaTeX files." |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
820 :group 'reftex-citation-support |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
821 :type '(repeat (file))) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
822 |
18050 | 823 (defcustom reftex-sort-bibtex-matches 'reverse-year |
824 "*Sorting of the entries found in BibTeX databases by reftex-citation. | |
825 Possible values: | |
826 nil Do not sort entries. | |
827 'author Sort entries by author name. | |
828 'year Sort entries by increasing year. | |
829 'reverse-year Sort entries by decreasing year." | |
830 :group 'reftex-citation-support | |
831 :type '(choice (const :tag "not" nil) | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
832 (const :tag "by author" author) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
833 (const :tag "by year" year) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
834 (const :tag "by year, reversed" reverse-year))) |
18050 | 835 |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
836 (defcustom reftex-cite-format 'default |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
837 "*The format of citations to be inserted into the buffer. |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
838 It can be a string or an alist. In the simplest case this is just |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
839 the string \"\\cite{%l}\", which is also the default. See the |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
840 definition of `reftex-cite-format-builtin' for more complex examples. |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
841 |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
842 If `reftex-cite-format' is a string, it will be used as the format. |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
843 In the format, the following percent escapes will be expanded. |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
844 |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
845 %l The BibTeX label of the citation. |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
846 %a List of author names, see also `reftex-cite-punctuation. |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
847 %2a Like %a, but abbreviate more than 2 authors like Jones et al. |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
848 %A First author name only. |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
849 %e Works like %a, but on list of editor names. (%2e and %E work a well) |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
850 |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
851 It is also possible to access all other BibTeX database fields: |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
852 %b booktitle %c chapter %d edition %h howpublished |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
853 %i institution %j journal %k key %m month |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
854 %n number %o organization %p pages %P first page |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
855 %r address %s school %u publisher %t title |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
856 %v volume %y year |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
857 %B booktitle, abbreviated %T title, abbreviated |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
858 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
859 Usually, only %l is needed. The other stuff is mainly for the echo area |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
860 display, and for (setq reftex-comment-citations t). |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
861 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
862 %< as a special operator kills punctuation and space around it after the |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
863 string has been formatted. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
864 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
865 Beware that all this only works with BibTeX database files. When |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
866 citations are made from the \\bibitems in an explicit thebibliography |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
867 environment, only %l is available. |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
868 |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
869 If `reftex-cite-format' is an alist of characters and strings, the user |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
870 will be prompted for a character to select one of the possible format |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
871 strings. |
18050 | 872 In order to configure this variable, you can either set |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
873 `reftex-cite-format' directly yourself or set it to the SYMBOL of one of |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
874 the predefined styles (see `reftex-cite-format-builtin'). E.g.: |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
875 (setq reftex-cite-format 'natbib)" |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
876 :group 'reftex-citation-support |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
877 :type |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
878 `(choice |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
879 :format "%{%t%}: \n%[Value Menu%] %v" |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
880 (radio :tag "Symbolic Builtins" |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
881 :indent 4 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
882 :value default |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
883 ,@(mapcar |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
884 (function |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
885 (lambda (x) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
886 (list 'const ':tag (concat (symbol-name (nth 0 x)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
887 ": " (nth 1 x)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
888 (nth 0 x)))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
889 reftex-cite-format-builtin)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
890 (string :tag "format string" "\\cite{%l}") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
891 (repeat :tag "key-ed format strings" |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
892 :value ((?\r . "\\cite{%l}") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
893 (?t . "\\cite{%l}") (?p . "\\cite{%l}")) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
894 (cons (character :tag "Key character" ?\r) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
895 (string :tag "Format string" ""))))) |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
896 |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
897 (defcustom reftex-comment-citations nil |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
898 "*Non-nil means add a comment for each citation describing the full entry. |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
899 The comment is formatted according to `reftex-cite-comment-format'." |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
900 :group 'reftex-citation-support |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
901 :type 'boolean) |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
902 |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
903 (defcustom reftex-cite-comment-format |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
904 "%% %2a %y, %j %v, %P, %b, %e, %u, %s %<\n" |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
905 "Citation format used for commented citations. Must NOT contain %l. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
906 See the variable `reftex-cite-format' for possible percent escapes." |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
907 :group 'reftex-citation-support |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
908 :type 'string) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
909 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
910 (defcustom reftex-cite-view-format |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
911 "%2a %y, %T, %B, %j %v:%P, %s %<" |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
912 "Citation format used to display citation info in the message area. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
913 Must NOT contain %l. See the variable `reftex-cite-format' for |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
914 possible percent escapes." |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
915 :group 'reftex-citation-support |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
916 :group 'reftex-viewing-cross-references-and-citations |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
917 :type 'string) |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
918 |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
919 (defcustom reftex-cite-punctuation '(", " " \\& " " {\\it et al.}") |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
920 "Punctuation for formatting of name lists in citations. |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
921 This is a list of 3 strings. |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
922 1. normal names separator, like \", \" in Jones, Brown and Miller |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
923 2. final names separator, like \" and \" in Jones, Brown and Miller |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
924 3. The \"et al\" string, like \" {\\it et al.}\" in Jones {\\it et al.}" |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
925 :group 'reftex-citation-support |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
926 :type '(list |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
927 (string :tag "Separator for names ") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
928 (string :tag "Separator for last name in list") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
929 (string :tag "string used as et al. "))) |
18050 | 930 |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
931 (defcustom reftex-format-cite-function nil |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
932 "Function which produces the string to insert as a citation. |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
933 Normally should be nil, because the format to insert a reference can |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
934 already be specified in `reftex-cite-format'. |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
935 The function will be called with two arguments, the CITATION KEY and the |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
936 DEFAULT FORMAT, which is taken from `reftex-cite-format'. The function |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
937 should return the string to insert into the buffer." |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
938 :group 'reftex-citation-support |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
939 :type 'function) |
21114
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
940 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
941 (defcustom reftex-select-bib-mode-hook nil |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
942 "Mode hook for reftex-select-bib-mode." |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
943 :group 'reftex-citation-support |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
944 :type 'hook) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
945 |
18050 | 946 ;; Table of contents configuration -------------------------------------- |
947 | |
948 (defgroup reftex-table-of-contents-browser nil | |
949 "A multifile table of contents browser." | |
950 :group 'reftex) | |
951 | |
952 (defcustom reftex-toc-follow-mode nil | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
953 "*Non-nil means, point in *toc* buffer will cause other window to follow. |
18050 | 954 The other window will show the corresponding part of the document. |
955 This flag can be toggled from within the *toc* buffer with the `f' key." | |
956 :group 'reftex-table-of-contents-browser | |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
957 :type 'boolean) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
958 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
959 (defcustom reftex-revisit-to-follow nil |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
960 "*Non-nil means, follow-mode will revisit files if necessary. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
961 When nil, follow-mode will be suspended for stuff in unvisited files." |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
962 :group 'reftex-table-of-contents-browser |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
963 :group 'reftex-referencing-labels |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
964 :type 'boolean) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
965 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
966 (defcustom reftex-toc-mode-hook nil |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
967 "Mode hook for reftex-toc-mode." |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
968 :group 'reftex-table-of-contents-browser |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
969 :type 'hook) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
970 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
971 ;; Viewing Cross References and Citations |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
972 (defgroup reftex-viewing-cross-references-and-citations nil |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
973 "Displaying cross references and citations." |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
974 :group 'reftex) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
975 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
976 (defcustom reftex-auto-view-crossref t |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
977 "*Non-nil means, initially turn automatic viewing of crossref info on. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
978 Automatic viewing of crossref info uses the echo area. Whenever point is in |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
979 the argument of a \\ref or \\cite macro, and no other message is being |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
980 displayed, the echo area will display information about that cross reference. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
981 This feature can be turned on and of from the menu |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
982 (Ref->Options->Crossref Viewing)." |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
983 :group 'reftex-viewing-cross-references-and-citations |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
984 :type 'boolean) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
985 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
986 (defcustom reftex-idle-time 1.2 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
987 "*Time (secs) Emacs has to be idle before automatic crossref display is done." |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
988 :group 'reftex-viewing-cross-references-and-citations |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
989 :type 'number) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
990 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
991 (defcustom reftex-revisit-to-echo nil |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
992 "*Non-nil means, automatic citation display will revisit files if necessary. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
993 When nil, citation display in echo area will only be active for cached |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
994 entries and for BibTeX database files with live associated buffers." |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
995 :group 'reftex-viewing-cross-references-and-citations |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
996 :type 'boolean) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
997 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
998 (defcustom reftex-cache-cite-echo t |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
999 "*Non-nil means, the information displayed in the echo area for cite macros |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1000 is cached and even saved along with the parsing information. The cache |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1001 survives document scans. In order to clear it, use M-x reftex-reset-mode." |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1002 :group 'reftex-viewing-cross-references-and-citations |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1003 :type 'boolean) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1004 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1005 (defcustom reftex-display-copied-context-hook nil |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1006 "Normal Hook which is run before context is displayed anywhere. Designed |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1007 for X-Symbol, but may have other uses as well." |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1008 :group 'reftex-viewing-cross-references-and-citations |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1009 :group 'reftex-referencing-labels |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1010 :type 'hook) |
18050 | 1011 |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1012 ;; Tuning the parser ---------------------------------------------------- |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1013 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1014 (defgroup reftex-optimizations-for-large-documents nil |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1015 "Configuration of parser speed and memory usage." |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1016 :group 'reftex) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1017 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1018 (defcustom reftex-keep-temporary-buffers 1 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1019 "*Non-nil means, keep buffers created for parsing and lookup. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1020 RefTeX sometimes needs to visit files related to the current document. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1021 We distinguish files visited for |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1022 PARSING: Parts of a multifile document loaded when (re)-parsing the document. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1023 LOOKUP: BibTeX database files and TeX files loaded to find a reference, |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1024 to display label context, etc. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1025 The created buffers can be kept for later use, or be thrown away immediately |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1026 after use, depending on the value of this variable: |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1027 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1028 nil Throw away as much as possible. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1029 t Keep everything. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1030 1 Throw away buffers created for parsing, but keep the ones created |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1031 for lookup. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1032 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1033 If a buffer is to be kept, the file is visited normally (which is potentially |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1034 slow but will happen only once). |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1035 If a buffer is to be thrown away, the initialization of the buffer depends |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1036 upon the variable `reftex-initialize-temporary-buffers'." |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1037 :group 'reftex-optimizations-for-large-documents |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1038 :type '(choice |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1039 (const :tag "Throw away everything" nil) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1040 (const :tag "Keep everything" t) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1041 (const :tag "Keep lookup buffers only" 1))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1042 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1043 (defcustom reftex-initialize-temporary-buffers nil |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1044 "*Non-nil means do initializations even when visiting file temporarily. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1045 When nil, RefTeX may turn off find-file hooks and other stuff to briefly |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1046 visit a file. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1047 When t, the full default initializations are done (find-file-hook etc.). |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1048 Instead of t or nil, this variable may also be a list of hook functions to |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1049 do a minimal initialization." |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1050 :group 'reftex-optimizations-for-large-documents |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1051 :type '(choice |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1052 (const :tag "Read files literally" nil) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1053 (const :tag "Fully initialize buffers" t) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1054 (repeat :tag "Hook functions" :value (nil) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1055 (function-item)))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1056 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1057 (defcustom reftex-no-include-regexps '("\\.pstex_t\\'") |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1058 "*List of regular expressions to exclude certain input files from parsing. |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1059 If the name of a file included via \\include or \\input is matched by any |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1060 of the regular expressions in this list, that file is not parsed by RefTeX." |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1061 :group 'reftex-optimizations-for-large-documents |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1062 :type '(repeat (regexp))) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1063 |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1064 (defcustom reftex-enable-partial-scans nil |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1065 "*Non-nil means, re-parse only 1 file when asked to re-parse. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1066 Re-parsing is normally requested with a `C-u' prefix to many RefTeX commands, |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1067 or with the `r' key in menus. When this option is t in a multifile document, |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1068 we will only parse the current buffer, or the file associated with the label |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1069 or section heading near point in a menu. Requesting re-parsing of an entire |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1070 multifile document then requires a `C-u C-u' prefix or the capital `R' key |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1071 in menus." |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1072 :group 'reftex-optimizations-for-large-documents |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1073 :type 'boolean) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1074 |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1075 (defcustom reftex-allow-automatic-rescan t |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1076 "*Non-nil means, RefTeX may rescan the document when this seems necessary. |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1077 Currently this applies only to rescanning after label insertion, when |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1078 the new label cannot be inserted correctly into the internal label |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1079 list." |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1080 :group 'reftex-optimizations-for-large-documents |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1081 :type 'boolean) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1082 |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1083 (defcustom reftex-save-parse-info nil |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1084 "*Non-nil means, save information gathered with parsing in a file. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1085 The file MASTER.rel in the same directory as MASTER.tex is used to save the |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1086 information. When this variable is t, |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1087 - accessing the parsing information for the first time in an editing session |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1088 will read that file (if available) instead of parsing the document. |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1089 - exiting Emacs or killing a buffer in reftex-mode will cause a new version |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1090 of the file to be written." |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1091 :group 'reftex-optimizations-for-large-documents |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1092 :type 'boolean) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1093 |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1094 (defcustom reftex-use-multiple-selection-buffers nil |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1095 "*Non-nil means use a separate selection buffer for each label type. |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1096 These buffers are kept from one selection to the next and need not to be |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1097 created for each use - so the menu generally comes up faster. The |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1098 selection buffers will be erased (and therefore updated) automatically |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1099 when new labels in its category are added. See the variable |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1100 `reftex-auto-update-selection-buffers'." |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1101 :group 'reftex-optimizations-for-large-documents |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1102 :group 'reftex-referencing-labels |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1103 :type 'boolean) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1104 |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1105 (defcustom reftex-auto-update-selection-buffers t |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1106 "*Non-nil means, selection buffers will be updated automatically. |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1107 When a new label is defined with `reftex-label', all selection buffers |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1108 associated with that label category are emptied, in order to force an |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1109 update upon next use. When nil, the buffers are left alone and have to be |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1110 updated by hand, with the `g' key from the label selection process. |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1111 The value of this variable will only have any effect when |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1112 `reftex-use-multiple-selection-buffers' is non-nil." |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1113 :group 'reftex-optimizations-for-large-documents |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1114 :group 'reftex-referencing-labels |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1115 :type 'boolean) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1116 |
21114
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1117 ;; Fontification and Faces ---------------------------------------------- |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1118 |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1119 (defgroup reftex-fontification-configurations nil |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1120 "Options concerning the faces used in RefTeX." |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1121 :group 'reftex) |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1122 |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1123 (defcustom reftex-use-fonts t |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1124 "*Non-nil means, use fonts in *toc* and selection buffers. |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1125 Font-lock must be loaded as well to actually get fontified display. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1126 When changing this option, a rescan may be necessary to activate the change." |
21114
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1127 :group 'reftex-fontification-configurations |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1128 :type 'boolean) |
21114
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1129 |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1130 (defcustom reftex-refontify-context 1 |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1131 "*Non-nil means, re-fontify the context in the label menu with font-lock. |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1132 This slightly slows down the creation of the label menu. It is only necessary |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1133 when you definitely want the context fontified. |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1134 |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1135 This option may have 3 different values: |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1136 nil Never refontify. |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1137 t Always refontify. |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1138 1 Refontify when absolutely necessary, e.g. when old versions of X-Symbol. |
21114
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1139 The option is ignored when `reftex-use-fonts' is nil." |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1140 :group 'reftex-fontification-configurations |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1141 :group 'reftex-referencing-labels |
21114
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1142 :type '(choice |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1143 (const :tag "Never" nil) |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1144 (const :tag "Always" t) |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1145 (const :tag "When necessary" 1))) |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1146 |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1147 (defcustom reftex-highlight-selection 'cursor |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1148 "*Non-nil mean, highlight selected text in selection and *toc* buffers. |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1149 Normally, the text near the cursor is the selected text, and it is |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1150 highlighted. This is the entry most keys in the selction and *toc* |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1151 buffers act on. However, if you mainly use the mouse to select an |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1152 item, you may find it nice to have mouse-triggered highlighting |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1153 instead or as well. The variable may have one of these values: |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1154 |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1155 nil No highlighting. |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1156 cursor Highlighting is cursor driven. |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1157 mouse Highlighting is mouse driven. |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1158 both Both cursor and mouse trigger highlighting. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1159 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1160 Changing this variable requires to rebuild the selection and *toc* buffers |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1161 to become effective (keys `g' or `r')." |
21114
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1162 :group 'reftex-fontification-configurations |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1163 :type '(choice |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1164 (const :tag "Never" nil) |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1165 (const :tag "Cursor driven" cursor) |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1166 (const :tag "Mouse driven" mouse) |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1167 (const :tag "Mouse and Cursor driven." both))) |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1168 |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1169 (defcustom reftex-cursor-selected-face 'highlight |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1170 "Face name to highlight cursor selected item in toc and selection buffers. |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1171 See also the variable `reftex-highlight-selection'." |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1172 :group 'reftex-fontification-configurations |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1173 :type 'symbol) |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1174 (defcustom reftex-mouse-selected-face 'secondary-selection |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1175 "Face name to highlight mouse selected item in toc and selection buffers. |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1176 See also the variable `reftex-highlight-selection'." |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1177 :group 'reftex-fontification-configurations |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1178 :type 'symbol) |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1179 (defcustom reftex-file-boundary-face 'font-lock-comment-face |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1180 "Face name for file boundaries in selection buffer." |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1181 :group 'reftex-fontification-configurations |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1182 :type 'symbol) |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1183 (defcustom reftex-label-face 'font-lock-constant-face |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1184 "Face name for labels in selection buffer." |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1185 :group 'reftex-fontification-configurations |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1186 :type 'symbol) |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1187 (defcustom reftex-section-heading-face 'font-lock-function-name-face |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1188 "Face name for section headings in toc and selection buffers." |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1189 :group 'reftex-fontification-configurations |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1190 :type 'symbol) |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1191 (defcustom reftex-toc-header-face 'font-lock-comment-face |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1192 "Face name for the header of a toc buffer." |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1193 :group 'reftex-fontification-configurations |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1194 :type 'symbol) |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1195 (defcustom reftex-bib-author-face 'font-lock-keyword-face |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1196 "Face name for author names in bib selection buffer." |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1197 :group 'reftex-fontification-configurations |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1198 :type 'symbol) |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1199 (defcustom reftex-bib-year-face 'font-lock-comment-face |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1200 "Face name for year in bib selection buffer." |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1201 :group 'reftex-fontification-configurations |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1202 :type 'symbol) |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1203 (defcustom reftex-bib-title-face 'font-lock-function-name-face |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1204 "Face name for article title in bib selection buffer." |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1205 :group 'reftex-fontification-configurations |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1206 :type 'symbol) |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1207 (defcustom reftex-bib-extra-face 'font-lock-comment-face |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1208 "Face name for bibliographic information in bib selection buffer." |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1209 :group 'reftex-fontification-configurations |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1210 :type 'symbol) |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1211 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1212 (defcustom reftex-pre-refontification-functions nil |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1213 "X-Symbol specific hook. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1214 Functions get two arguments, the buffer from where the command started and a |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1215 symbol indicating in what context the hook is called." |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1216 :group 'reftex-fontification-configurations |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1217 :type 'hook) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1218 |
18050 | 1219 ;; Miscellaneous configurations ----------------------------------------- |
1220 | |
1221 (defgroup reftex-miscellaneous-configurations nil | |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1222 "Collection of further configurations." |
18050 | 1223 :group 'reftex) |
1224 | |
1225 (defcustom reftex-extra-bindings nil | |
1226 "Non-nil means, make additional key bindings on startup. | |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1227 These extra bindings are located in the users `C-c letter' map." |
18050 | 1228 :group 'reftex-miscellaneous-configurations |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1229 :type 'boolean) |
18050 | 1230 |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1231 (defcustom reftex-plug-into-AUCTeX nil |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1232 "*Plug-in flags for AUCTeX interface. |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1233 This variable is a list of 4 boolean flags. When a flag is non-nil, |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1234 RefTeX will |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1235 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1236 - supply labels in new sections and environments (flag 1) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1237 - supply arguments for macros like `\\label'. (flag 2) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1238 - supply arguments for macros like `\\ref'. (flag 3) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1239 - supply arguments for macros like `\\cite'. (flag 4) |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1240 |
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1241 You may also set the variable itself to t or nil in order to turn all |
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1242 plug-ins on or off, respectively. |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1243 \\<LaTeX-mode-map>Supplying labels in new sections and environments aplies when creating |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1244 sections with \\[LaTeX-section] and environments with \\[LaTeX-environment]. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1245 Supplying macro arguments applies when you insert such a macro interactively |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1246 with \\[TeX-insert-macro]. |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1247 See the AUCTeX documentation for more information. |
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1248 RefTeX uses `fset' to take over the function calls. Changing the variable |
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1249 may require a restart of Emacs in order to become effective." |
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1250 :group 'reftex-miscellaneous-configurations |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1251 :group 'LaTeX |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1252 :type '(choice |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1253 (const :tag "No plug-ins" nil) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1254 (const :tag "All possible plug-ins" t) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1255 (list |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1256 :tag "Individual choice" |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1257 :value (t t t t) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1258 (boolean :tag "supply label in new sections and environments") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1259 (boolean :tag "supply argument for macros like `\\label' ") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1260 (boolean :tag "supply argument for macros like `\\ref' ") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1261 (boolean :tag "supply argument for macros like `\\cite' ") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1262 ))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1263 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1264 (defcustom reftex-allow-detached-macro-args nil |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1265 "*Non-nil means, allow arguments of macros to be detached by whitespace. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1266 When this is t, `aaa' will be considered as argument of \\bb in the following |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1267 construct: \\bbb [xxx] {aaa}." |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1268 :group 'texmathp |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1269 :type 'boolean) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1270 |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1271 |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1272 (defcustom reftex-load-hook nil |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1273 "Hook which is being run when loading reftex.el." |
18050 | 1274 :group 'reftex-miscellaneous-configurations |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1275 :type 'hook) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1276 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1277 (defcustom reftex-mode-hook nil |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1278 "Hook which is being run when turning on RefTeX mode." |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1279 :group 'reftex-miscellaneous-configurations |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1280 :type 'hook) |
18050 | 1281 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1282 ;;; ========================================================================= |
18050 | 1283 ;;; |
1284 ;;; Define the formal stuff for a minor mode named RefTeX. | |
1285 ;;; | |
1286 | |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1287 ;; This file corresponds to RefTeX version 3.34 |
20177
6ebc3e300106
The menu now used toggle and radio for some items.
Karl Heuer <kwzh@gnu.org>
parents:
20102
diff
changeset
|
1288 |
18050 | 1289 (defvar reftex-mode nil |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1290 "Determines if RefTeX mode is active.") |
18050 | 1291 (make-variable-buffer-local 'reftex-mode) |
1292 | |
1293 (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
|
1294 "Keymap for RefTeX mode.") |
18050 | 1295 |
1296 (defvar reftex-mode-menu nil) | |
1297 | |
1298 ;;;###autoload | |
1299 (defun turn-on-reftex () | |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1300 "Turn on RefTeX mode." |
18050 | 1301 (reftex-mode t)) |
1302 | |
1303 ;;;###autoload | |
1304 (defun reftex-mode (&optional arg) | |
18123 | 1305 "Minor mode with distinct support for \\label, \\ref and \\cite in LaTeX. |
18050 | 1306 |
1307 Labels can be created with `\\[reftex-label]' and referenced with `\\[reftex-reference]'. | |
1308 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
|
1309 context of the label definition. The selected label is inserted as a |
18123 | 1310 \\ref macro. |
18050 | 1311 |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1312 Citations can be made with `\\[reftex-citation]' which will use a regular expression |
18050 | 1313 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
|
1314 database. The selected citation is inserted as a \\cite macro. |
18050 | 1315 |
1316 A Table of Contents of the entire (multifile) document with browsing | |
1317 capabilities is available with `\\[reftex-toc]'. | |
1318 | |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1319 Most command have help available on the fly. This help is accessed by |
18050 | 1320 pressing `?' to any prompt mentioning this feature. |
1321 | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1322 Extensive documentation about RefTeX is in the file header of `reftex.el'. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1323 You can view this information with `\\[reftex-show-commentary]'. |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1324 |
18050 | 1325 \\{reftex-mode-map} |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1326 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
|
1327 on the menu bar. |
18050 | 1328 |
1329 ------------------------------------------------------------------------------" | |
1330 | |
1331 (interactive "P") | |
1332 (setq reftex-mode (not (or (and (null arg) reftex-mode) | |
1333 (<= (prefix-numeric-value arg) 0)))) | |
1334 | |
1335 ; Add or remove the menu, and run the hook | |
1336 (if reftex-mode | |
1337 (progn | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1338 (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
|
1339 (and reftex-plug-into-AUCTeX |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1340 (reftex-plug-into-AUCTeX)) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1341 (run-hooks 'reftex-mode-hook)) |
18050 | 1342 (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
|
1343 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1344 (if (fboundp 'add-minor-mode) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1345 ;; 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
|
1346 (progn |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1347 (put 'reftex-mode ':included '(memq major-mode '(latex-mode tex-mode))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1348 (put 'reftex-mode ':menu-tag "RefTeX Mode") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1349 (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
|
1350 ;; The standard way |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1351 (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
|
1352 (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
|
1353 (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
|
1354 (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
|
1355 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1356 ;;; ========================================================================= |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1357 ;;; |
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1358 ;;; Silence warnings about variables in other packages. |
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1359 (defvar TeX-master) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1360 (defvar LaTeX-section-hook) |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1361 (defvar LaTeX-label-function) |
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1362 (defvar tex-main-file) |
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1363 (defvar outline-minor-mode) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1364 (defvar font-lock-fontify-region-function) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1365 (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
|
1366 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1367 ;;; ========================================================================= |
18050 | 1368 ;;; |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1369 ;;; Multibuffer Variables |
18050 | 1370 ;;; |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1371 ;;; Technical notes: These work as follows: We keep just one list |
18050 | 1372 ;;; 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
|
1373 ;;; `reftex-master-index-list' is an alist which connects the true file name |
18050 | 1374 ;;; 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
|
1375 ;;; document. Each buffer has local variables which point to these symbols. |
18050 | 1376 |
1377 ;; List of variables which handle the multifile stuff. | |
1378 ;; This list is used to tie, untie, and reset these symbols. | |
1379 (defconst reftex-multifile-symbols | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1380 '(reftex-docstruct-symbol)) |
18050 | 1381 |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1382 ;; Alist connecting master file names with the corresponding lisp symbols. |
18050 | 1383 (defvar reftex-master-index-list nil) |
1384 | |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1385 ;; Last index used for a master file. |
18050 | 1386 (defvar reftex-multifile-index 0) |
1387 | |
1388 ;; 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
|
1389 (defvar reftex-docstruct-symbol nil) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1390 (make-variable-buffer-local 'reftex-docstruct-symbol) |
18050 | 1391 |
1392 (defun reftex-next-multifile-index () | |
1393 ;; 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
|
1394 (incf reftex-multifile-index)) |
18050 | 1395 |
1396 (defun reftex-tie-multifile-symbols () | |
1397 ;; Tie the buffer-local symbols to globals connected with the master file. | |
1398 ;; If the symbols for the current master file do not exist, they are created. | |
1399 | |
1400 (let* ((master (file-truename (reftex-TeX-master-file))) | |
1401 (index (assoc master reftex-master-index-list)) | |
1402 (symlist reftex-multifile-symbols) | |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1403 symbol symname newflag) |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1404 ;; Find the correct index. |
18050 | 1405 (if index |
1406 ;; symbols do exist | |
1407 (setq index (cdr index)) | |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1408 ;; Get a new index and add info to the alist. |
18050 | 1409 (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
|
1410 newflag t) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1411 (push (cons master index) reftex-master-index-list)) |
18050 | 1412 |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1413 ;; Get/create symbols and tie them. |
18050 | 1414 (while symlist |
1415 (setq symbol (car symlist) | |
1416 symlist (cdr symlist) | |
1417 symname (symbol-name symbol)) | |
1418 (set symbol (intern (concat symname "-" (int-to-string index)))) | |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1419 (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
|
1420 ;; Initialize if new symbols. |
18050 | 1421 (if newflag (set (symbol-value symbol) nil))) |
1422 | |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1423 ;; Return t if the symbols did already exist, nil when we've made them. |
18050 | 1424 (not newflag))) |
1425 | |
1426 (defun reftex-untie-multifile-symbols () | |
1427 ;; Remove ties from multifile symbols, so that next use makes new ones. | |
1428 (let ((symlist reftex-multifile-symbols) | |
1429 (symbol nil)) | |
1430 (while symlist | |
1431 (setq symbol (car symlist) | |
1432 symlist (cdr symlist)) | |
1433 (set symbol nil)))) | |
1434 | |
1435 (defun reftex-TeX-master-file () | |
1436 ;; Return the name of the master file associated with the current buffer. | |
1437 ;; 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
|
1438 ;; 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
|
1439 ;; variable tex-main-file. |
18050 | 1440 (let |
1441 ((master | |
1442 (cond | |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1443 ((fboundp 'TeX-master-file) ; AUCTeX is loaded. Use its mechanism. |
18050 | 1444 (TeX-master-file t)) |
1445 ((boundp 'TeX-master) ; The variable is defined - lets use it. | |
1446 (cond | |
1447 ((eq TeX-master t) | |
1448 (buffer-file-name)) | |
1449 ((eq TeX-master 'shared) | |
1450 (setq TeX-master (read-file-name "Master file: " | |
1451 nil nil t nil))) | |
1452 (TeX-master) | |
1453 (t | |
1454 (setq TeX-master (read-file-name "Master file: " | |
1455 nil nil t nil))))) | |
1456 ((boundp 'tex-main-file) | |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1457 ;; This is the variable from the default TeX modes. |
18050 | 1458 (cond |
1459 ((stringp tex-main-file) | |
1460 ;; ok, this must be it | |
1461 tex-main-file) | |
1462 (t | |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1463 ;; In this case, the buffer is its own master. |
18050 | 1464 (buffer-file-name)))) |
1465 (t | |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1466 ;; Know nothing about master file. Assume this is a master file. |
18050 | 1467 (buffer-file-name))))) |
1468 (cond | |
1469 ((null master) | |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1470 (error "Need a filename for this buffer. Please save it first.")) |
18050 | 1471 ((or (file-exists-p master) |
1472 (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
|
1473 ;; We either see the file, or have a buffer on it. OK. |
18050 | 1474 ) |
1475 ((or (file-exists-p (concat master ".tex")) | |
1476 (reftex-get-buffer-visiting (concat master ".tex"))) | |
1477 ;; Ahh, an extra .tex was missing... | |
1478 (setq master (concat master ".tex"))) | |
1479 (t | |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1480 ;; Use buffer file name. |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1481 (buffer-file-name))) |
18050 | 1482 (expand-file-name master))) |
1483 | |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1484 ;;; ========================================================================= |
18050 | 1485 ;;; |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1486 ;;; Functions to parse the buffer and to create and reference labels. |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1487 |
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1488 ;; 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
|
1489 |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1490 ;; Prompt used for label type queries directed to the user. |
18050 | 1491 (defconst reftex-type-query-prompt nil) |
1492 | |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1493 ;; Help string for label type queries. |
18050 | 1494 (defconst reftex-type-query-help nil) |
1495 | |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1496 ;; Alist relating label type to reference format. |
18050 | 1497 (defconst reftex-typekey-to-format-alist nil) |
1498 | |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1499 ;; Alist relating label type to label affix. |
18050 | 1500 (defconst reftex-typekey-to-prefix-alist nil) |
1501 | |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1502 ;; Alist relating environments or macros to label type and context regexp. |
18050 | 1503 (defconst reftex-env-or-mac-alist nil) |
1504 | |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1505 ;; List of macros carrying a label. |
18050 | 1506 (defconst reftex-label-mac-list nil) |
1507 | |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1508 ;; List of environments carrying a label. |
18050 | 1509 (defconst reftex-label-env-list nil) |
1510 | |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1511 ;; List of all typekey letters in use. |
18050 | 1512 (defconst reftex-typekey-list nil) |
1513 | |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1514 ;; Alist relating magic words to a label type. |
18050 | 1515 (defconst reftex-words-to-typekey-alist nil) |
1516 | |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1517 ;; The last list-of-labels entry used in a reference. |
18050 | 1518 (defvar reftex-last-used-reference (list nil nil nil nil)) |
1519 | |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1520 ;; The message when follow-mode is suspended |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1521 (defconst reftex-no-follow-message |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1522 "No follow-mode into unvisited file. Press SPC to visit it.") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1523 (defconst reftex-no-info-message |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1524 "%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
|
1525 |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1526 ;; The regular expression used to abbreviate words. |
18050 | 1527 (defconst reftex-abbrev-regexp |
1528 (concat | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1529 "\\`\\(" |
18050 | 1530 (make-string (nth 0 reftex-abbrev-parameters) ?.) |
1531 "[" (nth 2 reftex-abbrev-parameters) "]*" | |
1532 "\\)" | |
1533 "[" (nth 3 reftex-abbrev-parameters) "]" | |
1534 (make-string (1- (nth 1 reftex-abbrev-parameters)) ?.))) | |
1535 | |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1536 ;; Global variables used for communication between functions. |
18050 | 1537 (defvar reftex-default-context-position nil) |
1538 (defvar reftex-location-start nil) | |
1539 (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
|
1540 (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
|
1541 (defvar reftex-active-toc nil) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1542 (defvar reftex-tex-path nil) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1543 (defvar reftex-bib-path nil) |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
1544 (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
|
1545 (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
|
1546 (defvar reftex-prefix nil) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1547 (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
|
1548 (defvar reftex-buffers-with-changed-invisibility nil) |
18050 | 1549 |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1550 ;; List of buffers created temporarily for lookup, which should be killed. |
18050 | 1551 (defvar reftex-buffers-to-kill nil) |
1552 | |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1553 ;; Regexp to find anything. |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
1554 (defvar reftex-section-regexp nil) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1555 (defvar reftex-section-or-include-regexp nil) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1556 (defvar reftex-everything-regexp nil) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1557 (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
|
1558 (defvar reftex-find-label-regexp-format2 nil) |
18050 | 1559 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1560 ;;; The parser functions ----------------------------------------------------- |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1561 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1562 (defvar reftex-memory nil |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1563 "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
|
1564 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1565 (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
|
1566 "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
|
1567 ;; 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
|
1568 ;; 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
|
1569 ;; 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
|
1570 ;; 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
|
1571 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1572 ;; 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
|
1573 (if (eq reftex-docstruct-symbol nil) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1574 ;; 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
|
1575 (reftex-tie-multifile-symbols)) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1576 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1577 (reftex-ensure-compiled-variables) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1578 |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1579 (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
|
1580 (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
|
1581 ;; 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
|
1582 (save-excursion |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1583 (reftex-erase-all-selection-buffers))) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1584 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1585 (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
|
1586 (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
|
1587 reftex-save-parse-info) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1588 ;; 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
|
1589 (reftex-access-parse-file 'read)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1590 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1591 (cond |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1592 ((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
|
1593 ((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
|
1594 ;; Scan the whole document |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1595 (reftex-do-parse 1 file)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1596 ((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
|
1597 ;; 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
|
1598 (reftex-do-parse rescan file)))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1599 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1600 (defun reftex-parse-one () |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1601 "Re-parse this file." |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1602 (interactive) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1603 (let ((reftex-enable-partial-scans t)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1604 (reftex-access-scan-info '(4)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1605 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1606 (defun reftex-parse-all () |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1607 "Re-parse entire document." |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1608 (interactive) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1609 (reftex-access-scan-info '(16))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1610 |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1611 (defun reftex-do-parse (rescan &optional file) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1612 "Do a document rescan. When allowed, do only a partial scan from FILE." |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1613 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1614 ;; Normalize the rescan argument |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1615 (setq rescan (cond ((eq rescan t) t) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1616 ((eq rescan 1) 1) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1617 ((equal rescan '(4)) t) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1618 ((equal rescan '(16)) 1) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1619 (t 1))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1620 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1621 ;; Partial scans only when allowed |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1622 (unless reftex-enable-partial-scans |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1623 (setq rescan 1)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1624 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1625 ;; Do the scanning. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1626 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1627 (let* ((old-list (symbol-value reftex-docstruct-symbol)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1628 (master (reftex-TeX-master-file)) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1629 (true-master (file-truename master)) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1630 (master-dir (file-name-as-directory (file-name-directory master))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1631 (file (or file (buffer-file-name))) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1632 (true-file (file-truename file)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1633 (bibview-cache (assq 'bibview-cache old-list)) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1634 from-file appendix docstruct tmp) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1635 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1636 ;; Make sure replacement is really an option here |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1637 (when (and (eq rescan t) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1638 (not (and (member (list 'bof file) old-list) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1639 (member (list 'eof file) old-list)))) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1640 ;; Scan whole document because no such file section exists |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1641 (setq rescan 1)) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1642 (when (string= true-file true-master) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1643 ;; Scan whole document because this file is the master |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1644 (setq rescan 1)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1645 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1646 ;; From which file do we start? |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1647 (setq from-file |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1648 (cond ((eq rescan t) (or file master)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1649 ((eq rescan 1) master) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1650 (t (error "This should not happen (reftex-do-parse)")))) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1651 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1652 ;; Find active toc entry and initialize section-numbers |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1653 (setq reftex-active-toc (reftex-last-assoc-before-elt |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1654 'toc (list 'bof from-file) old-list) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1655 appendix (reftex-last-assoc-before-elt |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1656 'appendix (list 'bof from-file) old-list)) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1657 |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1658 (reftex-init-section-numbers reftex-active-toc appendix) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1659 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1660 (if (eq rescan 1) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1661 (message "Scanning entire document...") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1662 (message "Scanning document from %s..." from-file)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1663 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1664 (save-window-excursion |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1665 (save-excursion |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1666 (unwind-protect |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1667 (setq docstruct |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1668 (reftex-parse-from-file |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1669 from-file docstruct master-dir)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1670 (reftex-kill-temporary-buffers)))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1671 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1672 (message "Scanning document... done") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1673 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1674 ;; Turn the list around. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1675 (setq docstruct (nreverse docstruct)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1676 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1677 ;; Set or insert |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1678 (setq docstruct (reftex-replace-label-list-segment |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1679 old-list docstruct (eq rescan 1))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1680 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1681 ;; Add all missing information |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1682 (unless (assq 'label-numbers docstruct) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1683 (push (cons 'label-numbers nil) docstruct)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1684 (unless (assq 'master-dir docstruct) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1685 (push (cons 'master-dir master-dir) docstruct)) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1686 (unless (assq 'bibview-cache docstruct) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1687 (push (cons 'bibview-cache (cdr bibview-cache)) docstruct)) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1688 (let* ((bof1 (memq (assq 'bof docstruct) docstruct)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1689 (bof2 (assq 'bof (cdr bof1))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1690 (is-multi (not (not (and bof1 bof2)))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1691 (entry (or (assq 'is-multi docstruct) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1692 (car (push (list 'is-multi is-multi) docstruct))))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1693 (setcdr entry (cons is-multi nil))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1694 (unless (assq 'xr docstruct) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1695 (let* ((allxr (reftex-all-assq 'xr-doc docstruct)) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1696 (alist (mapcar |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1697 (function |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1698 (lambda (x) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1699 (if (setq tmp (reftex-find-tex-file (nth 2 x) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1700 master-dir)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1701 (cons (nth 1 x) tmp) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1702 (message "Can't find external document %s" |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1703 (nth 2 x)) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1704 nil))) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1705 allxr)) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1706 (alist (delq nil alist)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1707 (allprefix (delq nil (mapcar 'car alist))) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1708 (regexp (if allprefix |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1709 (concat "\\`\\(" |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1710 (mapconcat 'identity allprefix "\\|") |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1711 "\\)") |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1712 "\\\\\\\\\\\\"))) ; this will never match |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1713 (push (list 'xr alist regexp) docstruct))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1714 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1715 (set reftex-docstruct-symbol docstruct) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1716 (put reftex-docstruct-symbol 'modified t))) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1717 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1718 (defun reftex-parse-from-file (file docstruct master-dir) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1719 ;; Scan the buffer for labels and save them in a list. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1720 (let ((regexp reftex-everything-regexp) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1721 (bound 0) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1722 file-found tmp include-file |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1723 (level 1) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1724 (highest-level 100) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1725 toc-entry next-buf buf) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1726 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1727 (catch 'exit |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1728 (setq file-found (reftex-find-tex-file file master-dir)) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1729 (if (and (not file-found) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1730 (setq buf (reftex-get-buffer-visiting file))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1731 (setq file-found (buffer-file-name buf))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1732 |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1733 (unless file-found |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1734 (push (list 'file-error file) docstruct) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1735 (throw 'exit nil)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1736 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1737 (save-excursion |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1738 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1739 (message "Scanning file %s" file) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1740 (set-buffer |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1741 (setq next-buf |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1742 (reftex-get-file-buffer-force |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1743 file-found |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1744 (not (eq t reftex-keep-temporary-buffers))))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1745 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1746 ;; Begin of file mark |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1747 (setq file (buffer-file-name)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1748 (push (list 'bof file) docstruct) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1749 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1750 (save-excursion |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1751 (save-restriction |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1752 (widen) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1753 (goto-char 1) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1754 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1755 (while (re-search-forward regexp nil t) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1756 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1757 (cond |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1758 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1759 ((match-end 1) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1760 ;; It is a label |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1761 (push (reftex-label-info (reftex-match-string 1) file bound) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1762 docstruct)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1763 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1764 ((match-end 3) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1765 ;; It is a section |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1766 (setq bound (point)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1767 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1768 ;; Insert in List |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1769 (setq toc-entry (reftex-section-info file)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1770 (setq level (nth 5 toc-entry)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1771 (setq highest-level (min highest-level level)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1772 (if (= level highest-level) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1773 (message |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1774 "Scanning %s %s ..." |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1775 (car (rassoc level reftex-section-levels)) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1776 (nth 6 toc-entry))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1777 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1778 (push toc-entry docstruct) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1779 (setq reftex-active-toc toc-entry)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1780 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1781 ((match-end 7) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1782 ;; It's an include or input |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1783 (setq include-file (reftex-match-string 7)) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1784 ;; Test if this file should be ignored |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1785 (unless (delq nil (mapcar |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1786 (lambda (x) (string-match x include-file)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1787 reftex-no-include-regexps)) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1788 ;; Parse it |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1789 (setq docstruct |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1790 (reftex-parse-from-file |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1791 include-file |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1792 docstruct master-dir)))) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1793 |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1794 ((match-end 9) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1795 ;; Appendix starts here |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1796 (reftex-init-section-numbers nil t) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1797 (push (cons 'appendix t) docstruct)) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1798 |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1799 ((match-end 10) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1800 ;; A macro with label |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1801 (save-excursion |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1802 (let* ((mac (reftex-match-string 10)) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1803 (label (progn (goto-char (match-end 10)) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1804 (save-match-data |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1805 (reftex-no-props |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1806 (reftex-nth-arg-wrapper |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1807 mac))))) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1808 (typekey (nth 1 (assoc mac reftex-env-or-mac-alist))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1809 (entry (progn (if typekey |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1810 ;; A typing macro |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1811 (goto-char (match-end 0)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1812 ;; A newtral macro |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1813 (goto-char (match-end 10)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1814 (reftex-move-over-touching-args)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1815 (reftex-label-info |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1816 label file bound nil nil)))) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1817 (push entry docstruct)))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1818 (t (error "This should not happen (reftex-parse-from-file)"))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1819 ) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1820 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1821 ;; Find bibliography statement |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1822 (when (setq tmp (reftex-locate-bibliography-files master-dir)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1823 (push (cons 'bib tmp) docstruct)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1824 |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1825 (goto-char 1) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1826 (when (re-search-forward |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1827 "\\(\\`\\|[\n\r]\\)[ \t]*\\\\begin{thebibliography}" nil t) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1828 (push (cons 'thebib file) docstruct)) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1829 |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1830 ;; Find external document specifications |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1831 (goto-char 1) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1832 (while (re-search-forward "[\n\r][ \t]*\\\\externaldocument\\(\\[\\([^]]*\\)\\]\\)?{\\([^}]+\\)}" nil t) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1833 (push (list 'xr-doc (reftex-match-string 2) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1834 (reftex-match-string 3)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1835 docstruct)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1836 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1837 ;; End of file mark |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1838 (push (list 'eof file) docstruct)))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1839 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1840 ;; Kill the scanned buffer |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1841 (reftex-kill-temporary-buffers next-buf)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1842 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1843 ;; Return the list |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1844 docstruct)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1845 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1846 (defun reftex-locate-bibliography-files (master-dir) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1847 ;; Scan buffer for bibliography macro and return file list. |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1848 (let (files) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1849 (save-excursion |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1850 (goto-char (point-min)) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1851 (when (re-search-forward |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1852 "\\(\\`\\|[\n\r]\\)[ \t]*\\\\bibliography{[ \t]*\\([^}]+\\)" nil t) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1853 (setq files (split-string (reftex-match-string 2) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1854 "[ \t\n\r]*,[ \t\n\r]*")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1855 (setq files |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1856 (mapcar |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1857 (lambda (x) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1858 (if (or (member x reftex-bibfile-ignore-list) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1859 (delq nil (mapcar (lambda (re) (string-match re x)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1860 reftex-bibfile-ignore-regexps))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1861 ;; excluded file |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1862 nil |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1863 ;; find the file |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1864 (reftex-find-bib-file |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1865 (if (string-match "\\.bib\\'" x) x (concat x ".bib")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1866 master-dir))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1867 files)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1868 (delq nil files))))) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1869 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1870 (defun reftex-replace-label-list-segment (old insert &optional entirely) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1871 ;; Replace the segment in OLD which corresponds to INSERT. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1872 ;; Works with side effects, directly changes old. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1873 ;; If entirely is t, just return INSERT. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1874 ;; This function also makes sure the old toc markers do not point anywhere. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1875 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1876 (cond |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1877 (entirely |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1878 (reftex-silence-toc-markers old (length old)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1879 insert) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1880 (t (let* ((new old) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1881 (file (nth 1 (car insert))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1882 (eof-list (member (list 'eof file) old)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1883 (bof-list (member (list 'bof file) old)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1884 n) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1885 (if (not (and bof-list eof-list)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1886 (error "Cannot splice") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1887 ;; Splice |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1888 (reftex-silence-toc-markers bof-list (- (length bof-list) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1889 (length eof-list))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1890 (setq n (- (length old) (length bof-list))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1891 (setcdr (nthcdr n new) (cdr insert)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1892 (setcdr (nthcdr (1- (length new)) new) (cdr eof-list))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1893 new)))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1894 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1895 (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
|
1896 ;; 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
|
1897 (while (and list (> (decf n) -1)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1898 (and (eq (car (car list)) 'toc) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1899 (markerp (nth 4 (car list))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1900 (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
|
1901 (pop list))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1902 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1903 (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
|
1904 "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
|
1905 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
|
1906 (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
|
1907 (docstruct-symbol reftex-docstruct-symbol) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1908 (master (reftex-TeX-master-file)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1909 (enable-local-variables nil) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1910 (file (if (string-match "\\.[a-zA-Z]+\\'" master) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1911 (concat (substring master 0 (match-beginning 0)) ".rel") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1912 (concat master ".rel")))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1913 (cond |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1914 ((eq action 'readable) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1915 (file-readable-p file)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1916 ((eq action 'restore) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1917 (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
|
1918 (if (eq reftex-docstruct-symbol nil) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1919 ;; 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
|
1920 (reftex-tie-multifile-symbols)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1921 (if (file-exists-p file) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1922 ;; 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
|
1923 (condition-case nil |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1924 (progn (load-file file) t) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1925 (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
|
1926 (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
|
1927 ;; 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
|
1928 (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
|
1929 ((eq action 'read) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1930 (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
|
1931 (if (file-exists-p file) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1932 ;; 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
|
1933 (condition-case nil |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1934 (progn (load-file file) t) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1935 (error (message "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
|
1936 (set reftex-docstruct-symbol nil) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1937 nil)) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1938 ;; 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
|
1939 nil)) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1940 ((eq action 'kill) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1941 ;; Remove the file |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1942 (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
|
1943 (message "Unlinking file %s" file) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1944 (delete-file file))) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1945 (t |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1946 (put docstruct-symbol 'modified nil) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1947 (save-excursion |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1948 (if (file-writable-p file) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1949 (progn |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1950 (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
|
1951 (find-file file) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1952 (erase-buffer) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1953 (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
|
1954 (insert (format ";; File: %s\n" master)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1955 (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
|
1956 (user-login-name) (user-full-name))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1957 (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
|
1958 (let ((standard-output (current-buffer))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1959 (mapcar |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1960 (function |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1961 (lambda (x) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1962 (cond ((eq (car x) 'toc) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1963 ;; A toc entry. Do not save the marker. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1964 ;; Save the markers position at position 8 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1965 (print (list 'toc "toc" (nth 2 x) (nth 3 x) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1966 nil (nth 5 x) (nth 6 x) (nth 7 x) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1967 (or (and (markerp (nth 4 x)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1968 (marker-position (nth 4 x))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1969 (nth 8 x))))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1970 (t (print x))))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1971 list)) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1972 (insert "))\n\n") |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1973 (save-buffer 0) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1974 (kill-buffer (current-buffer))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1975 (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
|
1976 t)))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1977 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1978 (defun reftex-kill-buffer-hook () |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1979 "Save RefTeX's parse file for this buffer if the information has changed." |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1980 ;; Save the parsing information if it was modified. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1981 ;; This function should be installed in `kill-buffer-hook'. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1982 ;; We are careful to make sure nothing goes wring in this function. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1983 (when (and (boundp 'reftex-mode) reftex-mode |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1984 (boundp 'reftex-save-parse-info) reftex-save-parse-info |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1985 (boundp 'reftex-docstruct-symbol) reftex-docstruct-symbol |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1986 (symbol-value reftex-docstruct-symbol) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1987 (get reftex-docstruct-symbol 'modified)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1988 ;; Write the file. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1989 (condition-case nil |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1990 (reftex-access-parse-file 'write) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1991 (error nil)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1992 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1993 (defun reftex-kill-emacs-hook () |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1994 "Call `reftex-kill-buffer-hook' on all buffers." |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1995 ;; This function should be installed in `kill-emacs-hook'. |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1996 (save-excursion |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1997 (mapcar (lambda (buf) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1998 (set-buffer buf) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1999 (reftex-kill-buffer-hook)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2000 (buffer-list)))) |
18050 | 2001 |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2002 (defun reftex-section-info (file) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2003 ;; Return a section entry for the current match. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2004 ;; Carefull: This function expects the match-data to be still in place! |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2005 (let* ((marker (set-marker (make-marker) (1- (match-beginning 3)))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2006 (macro (reftex-match-string 3)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2007 (star (= ?* (char-after (match-end 3)))) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2008 (level (cdr (assoc macro reftex-section-levels-all))) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
2009 (section-number (reftex-section-number level star)) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2010 (text1 (save-match-data (save-excursion (reftex-context-substring)))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2011 (literal (buffer-substring-no-properties |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2012 (1- (match-beginning 3)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2013 (min (point-max) (+ (match-end 0) (length text1) 1)))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2014 ;; Literal can be too short since text1 too short. No big problem. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2015 (text (reftex-nicify-text text1))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2016 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2017 ;; Add section number and indentation |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2018 (setq text |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2019 (concat |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2020 (make-string (* reftex-level-indent level) ?\ ) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2021 (if (nth 1 reftex-label-menu-flags) ; section number flag |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2022 (concat section-number " ")) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2023 text)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2024 (list 'toc "toc" text file marker level section-number |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2025 literal (marker-position marker)))) |
18050 | 2026 |
2027 (defun reftex-label-info-update (cell) | |
2028 ;; Update information about just one label in a different file. | |
2029 ;; CELL contains the old info list | |
2030 (let* ((label (nth 0 cell)) | |
2031 (typekey (nth 1 cell)) | |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
2032 ;; (text (nth 2 cell)) |
18050 | 2033 (file (nth 3 cell)) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2034 (comment (nth 4 cell)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2035 (note (nth 5 cell)) |
18050 | 2036 (buf (reftex-get-file-buffer-force |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2037 file (not (eq t reftex-keep-temporary-buffers))))) |
18050 | 2038 (if (not buf) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2039 (list label typekey "" file comment "LOST LABEL. RESCAN TO FIX.") |
18050 | 2040 (save-excursion |
2041 (set-buffer buf) | |
2042 (save-restriction | |
2043 (widen) | |
2044 (goto-char 1) | |
2045 | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2046 (if (or (re-search-forward |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2047 (format reftex-find-label-regexp-format |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2048 (regexp-quote label)) nil t) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2049 (re-search-forward |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2050 (format reftex-find-label-regexp-format2 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2051 (regexp-quote label)) nil t)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2052 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2053 (progn |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2054 (backward-char 1) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2055 (append (reftex-label-info label file) (list note))) |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
2056 (list label typekey "" file "LOST LABEL. RESCAN TO FIX."))))))) |
18050 | 2057 |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2058 (defun reftex-label-info (label &optional file bound derive env-or-mac) |
18050 | 2059 ;; Return info list on LABEL at point. |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2060 (let* ((env-or-mac (or env-or-mac (reftex-label-location bound))) |
18050 | 2061 (typekey (nth 1 (assoc env-or-mac reftex-env-or-mac-alist))) |
2062 (file (or file (buffer-file-name))) | |
2063 (parse (if (reftex-typekey-check | |
2064 typekey reftex-use-text-after-label-as-context) | |
2065 nil | |
2066 (nth 2 (assoc env-or-mac reftex-env-or-mac-alist)))) | |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
2067 (text (reftex-short-context env-or-mac parse reftex-location-start |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2068 derive)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2069 (in-comment (reftex-in-comment))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2070 (list label typekey text file in-comment))) |
18050 | 2071 |
2072 (defun reftex-in-comment () | |
2073 (save-excursion | |
2074 (skip-chars-backward "^%\n\r") | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2075 (eq (preceding-char) ?%))) |
18050 | 2076 |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
2077 (defun reftex-short-context (env parse &optional bound derive) |
18050 | 2078 ;; Get about one line of useful context for the label definition at point. |
2079 | |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
2080 (if (consp parse) |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
2081 (setq parse (if derive (cdr parse) (car parse)))) |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
2082 |
18050 | 2083 (reftex-nicify-text |
2084 | |
2085 (cond | |
2086 | |
2087 ((null parse) | |
2088 (save-excursion | |
2089 (reftex-context-substring))) | |
2090 | |
2091 ((eq parse t) | |
2092 (if (string= env "section") | |
2093 ;; special treatment for section labels | |
2094 (save-excursion | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2095 (if (and (re-search-backward reftex-section-or-include-regexp |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2096 (point-min) t) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2097 (match-end 2)) |
18050 | 2098 (progn |
2099 (goto-char (match-end 0)) | |
2100 (reftex-context-substring)) | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2101 (if reftex-active-toc |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2102 (progn |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2103 (string-match "{\\([^}]*\\)" (nth 7 reftex-active-toc)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2104 (match-string 1 (nth 7 reftex-active-toc))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2105 "SECTION HEADING NOT FOUND"))) |
18050 | 2106 (save-excursion |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2107 (goto-char reftex-default-context-position) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2108 (unless (eq (string-to-char env) ?\\) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2109 (reftex-move-over-touching-args)) |
18050 | 2110 (reftex-context-substring)))) |
2111 | |
2112 ((stringp parse) | |
2113 (save-excursion | |
2114 (if (re-search-backward parse bound t) | |
2115 (progn | |
2116 (goto-char (match-end 0)) | |
2117 (reftex-context-substring)) | |
2118 "NO MATCH FOR CONTEXT REGEXP"))) | |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
2119 |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
2120 ((integerp parse) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2121 (or (save-excursion |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2122 (goto-char reftex-default-context-position) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2123 (reftex-nth-arg |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2124 parse |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2125 (nth 6 (assoc env reftex-env-or-mac-alist)))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2126 "")) |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
2127 |
18050 | 2128 ((fboundp parse) |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
2129 ;; A hook function. Call it. |
18050 | 2130 (save-excursion |
2131 (condition-case error-var | |
2132 (funcall parse env) | |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
2133 (error (format "HOOK ERROR: %s" (cdr error-var)))))) |
18050 | 2134 (t |
2135 "ILLEGAL VALUE OF PARSE")))) | |
2136 | |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2137 (defun reftex-nicify-text (text) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2138 ;; Make TEXT nice for inclusion as context into label menu |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2139 ;; remove line breaks and extra white space |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2140 (while (string-match "[\n\r\t]\\|[ \t][ \t]+" text) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2141 (setq text (replace-match " " nil t text))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2142 ;; cut before the next `\end{' or `\item' or `\\' |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2143 (if (string-match "\\(\\\\end{\\|\\\\item\\|\\\\\\\\\\).*" text) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2144 (setq text (replace-match "" nil t text))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2145 ;; kill the embedded label |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2146 (if (string-match "\\\\label{[^}]*}" text) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2147 (setq text (replace-match "" nil t text))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2148 ;; remove leading garbage |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2149 (if (string-match "\\`[ }]+" text) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2150 (setq text (replace-match "" nil t text))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2151 ;; limit length |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2152 (cond |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2153 ((> (length text) 100) (substring text 0 100)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2154 ((= (length text) 0) (make-string 1 ?\ )) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2155 (t text))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2156 |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2157 (defun reftex-where-am-I () |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2158 ;; Return the docstruct entry above point. Actually returns a cons |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2159 ;; cell in which the cdr is a flag indicating if the information is |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2160 ;; exact (t) or approximate (nil). |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2161 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2162 (let ((docstruct (symbol-value reftex-docstruct-symbol)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2163 (cnt 0) rtn |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2164 found) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2165 (save-excursion |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2166 (while (not rtn) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2167 (incf cnt) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2168 (setq found (re-search-backward reftex-everything-regexp nil t)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2169 (setq rtn |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2170 (cond |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2171 ((not found) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2172 ;; no match |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2173 (or |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2174 (car (member (list 'bof (buffer-file-name)) docstruct)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2175 (not (setq cnt 2)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2176 (assq 'bof docstruct) ;; for safety reasons |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2177 'corrupted)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2178 ((match-end 1) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2179 ;; Label |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2180 (assoc (reftex-match-string 1) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2181 (symbol-value reftex-docstruct-symbol))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2182 ((match-end 3) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2183 ;; Section |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2184 (goto-char (1- (match-beginning 3))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2185 (let* ((list (member (list 'bof (buffer-file-name)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2186 docstruct)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2187 (endelt (car (member (list 'eof (buffer-file-name)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2188 list))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2189 rtn1) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2190 (while (and list (not (eq endelt (car list)))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2191 (if (and (eq (car (car list)) 'toc) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2192 (string= (buffer-file-name) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2193 (nth 3 (car list)))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2194 (cond |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2195 ((equal (point) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2196 (or (and (markerp (nth 4 (car list))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2197 (marker-position (nth 4 (car list)))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2198 (nth 8 (car list)))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2199 ;; Fits with marker position or recorded position |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2200 (setq rtn1 (car list) list nil)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2201 ((looking-at (reftex-make-regexp-allow-for-ctrl-m |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2202 (nth 7 (car list)))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2203 ;; Same title |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2204 (setq rtn1 (car list) list nil cnt 2)))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2205 (pop list)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2206 rtn1)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2207 ((match-end 7) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2208 ;; Input or include... |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2209 (car |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2210 (member (list 'eof (reftex-find-tex-file |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2211 (reftex-match-string 7) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
2212 (cdr (assq 'master-dir docstruct)))) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2213 docstruct))) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
2214 ((match-end 9) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
2215 (assq 'appendix (symbol-value reftex-docstruct-symbol))) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
2216 ((match-end 10) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2217 (save-excursion |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
2218 (goto-char (match-end 10)) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2219 (assoc (reftex-no-props |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2220 (reftex-nth-arg-wrapper |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
2221 (reftex-match-string 10))) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2222 (symbol-value reftex-docstruct-symbol)))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2223 (t |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2224 (error "This should not happen (reftex-where-am-I)")))))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2225 (cons rtn (eq cnt 1)))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2226 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2227 (defun reftex-label-location (&optional bound) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2228 "Return the environment or macro which determines the label type at point. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2229 If optional BOUND is an integer, limit backward searches to that point." |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2230 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2231 (let* ((loc1 (reftex-what-macro reftex-label-mac-list bound)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2232 (loc2 (reftex-what-environment reftex-label-env-list bound)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2233 (p1 (or (cdr loc1) 0)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2234 (p2 (or (cdr loc2) 0))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2235 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2236 (setq reftex-location-start (max p1 p2)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2237 (if (>= p1 p2) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2238 (progn |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2239 (setq reftex-default-context-position (+ p1 (length (car loc1)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2240 (or (car loc1) "section")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2241 (setq reftex-default-context-position (+ p2 8 (length (car loc2)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2242 (or (car loc2) "section")))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2243 |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2244 (defun reftex-parse-args (macro) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2245 ;; Return a list of macro name, nargs, arg-nr which is label and a list of |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2246 ;; optional argument indices. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2247 (if (string-match "[[{]\\*?[]}]" macro) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2248 (progn |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2249 (let ((must-match (substring macro 0 (match-beginning 0))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2250 (args (substring macro (match-beginning 0))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2251 opt-list nlabel (cnt 0)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2252 (while (string-match "\\`[[{]\\(\\*\\)?[]}]" args) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2253 (incf cnt) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2254 (when (eq ?\[ (string-to-char args)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2255 (push cnt opt-list)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2256 (when (and (match-end 1) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2257 (not nlabel)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2258 (setq nlabel cnt)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2259 (setq args (substring args (match-end 0)))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2260 (list must-match cnt nlabel opt-list))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2261 nil)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2262 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2263 (defsubst reftex-move-to-next-arg (&optional ignore) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2264 ;; Assuming that we are at the end of a macro name or a macro argument, |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2265 ;; move forward to the opening parenthesis of the next argument. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2266 ;; This function understands the splitting of macros over several lines |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2267 ;; in TeX. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2268 (cond |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2269 ;; Just to be quick: |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2270 ((memq (following-char) '(?\[ ?\{))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2271 ;; Do a search |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2272 ((and reftex-allow-detached-macro-args |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2273 (looking-at "[ \t]*[\n\r]?\\([ \t]*%[^\n\r]*[\n\r]\\)*[ \t]*[[{]")) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2274 (goto-char (1- (match-end 0))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2275 t) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2276 (t nil))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2277 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2278 (defsubst reftex-move-to-previous-arg (&optional bound) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2279 ;; Assuming that we are in front of a macro argument, |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2280 ;; move backward to the closing parenthesis of the previous argument. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2281 ;; This function understands the splitting of macros over several lines |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2282 ;; in TeX. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2283 (cond |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2284 ;; Just to be quick: |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2285 ((memq (preceding-char) '(?\] ?\}))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2286 ;; Do a search |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2287 ((and reftex-allow-detached-macro-args |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2288 (re-search-backward |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2289 "[]}][ \t]*[\n\r]?\\([ \t]*%[^\n\r]*[\n\r]\\)*[ \t]*\\=" bound t)) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2290 (goto-char (1+ (match-beginning 0))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2291 t) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2292 (t nil))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2293 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2294 (defun reftex-nth-arg-wrapper (key) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2295 (let ((entry (assoc key reftex-env-or-mac-alist))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2296 (reftex-nth-arg (nth 5 entry) (nth 6 entry)))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2297 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2298 (defun reftex-nth-arg (n &optional opt-args) |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
2299 ;; Return the nth following {} or [] parentheses content. |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2300 ;; OPT-ARGS is a list of argument numbers which are optional. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2301 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2302 ;; If we are sitting at a macro start, skip to end of macro name. |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
2303 (and (eq (following-char) ?\\) (skip-chars-forward "a-zA-Z*\\\\")) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2304 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2305 (if (= n 1000) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2306 ;; Special case: Skip all touching arguments |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2307 (progn |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2308 (reftex-move-over-touching-args) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2309 (reftex-context-substring)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2310 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2311 ;; Do the real thing. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2312 (let ((cnt 1)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2313 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2314 (when (reftex-move-to-next-arg) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2315 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2316 (while (< cnt n) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2317 (while (and (member cnt opt-args) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2318 (eq (following-char) ?\{)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2319 (incf cnt)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2320 (when (< cnt n) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2321 (unless (and (condition-case nil |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2322 (or (forward-list 1) t) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2323 (error nil)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2324 (reftex-move-to-next-arg) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2325 (incf cnt)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2326 (setq cnt 1000)))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2327 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2328 (while (and (memq cnt opt-args) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2329 (eq (following-char) ?\{)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2330 (incf cnt))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2331 (if (and (= n cnt) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2332 (> (skip-chars-forward "{\\[") 0)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2333 (reftex-context-substring) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2334 nil)))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2335 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2336 (defun reftex-move-over-touching-args () |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2337 (condition-case nil |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2338 (while (memq (following-char) '(?\[ ?\{)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2339 (forward-list 1)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2340 (error nil))) |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
2341 |
18050 | 2342 (defun reftex-context-substring () |
2343 ;; Return up to 100 chars from point | |
2344 ;; When point is just after a { or [, limit string to matching parenthesis | |
2345 (cond | |
2346 ((or (= (preceding-char) ?\{) | |
2347 (= (preceding-char) ?\[)) | |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
2348 ;; Inside a list - get only the list. |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2349 (buffer-substring-no-properties |
18050 | 2350 (point) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2351 (min (+ (point) 150) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2352 (point-max) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2353 (condition-case nil |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2354 (progn |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2355 (up-list 1) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2356 (1- (point))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2357 (error (point-max)))))) |
18050 | 2358 (t |
2359 ;; no list - just grab 100 characters | |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2360 (buffer-substring-no-properties (point) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2361 (min (+ (point) 150) (point-max)))))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2362 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2363 ;; Variable holding the vector with section numbers |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2364 (defvar reftex-section-numbers [0 0 0 0 0 0 0 0]) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2365 |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
2366 (defun reftex-init-section-numbers (&optional toc-entry appendix) |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
2367 ;; Initialize the section numbers with zeros or with what is found |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
2368 ;; in the toc entry. |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
2369 (let* ((level (or (nth 5 toc-entry) -1)) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2370 (numbers (nreverse (split-string (or (nth 6 toc-entry) "") "\\."))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2371 (depth (1- (length reftex-section-numbers))) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
2372 (i depth) number-string) |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
2373 (while (>= i 0) |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
2374 (if (> i level) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2375 (aset reftex-section-numbers i 0) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
2376 (setq number-string (or (car numbers) "0")) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
2377 (if (string-match "\\`[A-Z]\\'" number-string) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
2378 (aset reftex-section-numbers i |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
2379 (- (string-to-char number-string) ?A -1)) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
2380 (aset reftex-section-numbers i (string-to-int number-string))) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2381 (pop numbers)) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
2382 (decf i))) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
2383 (put 'reftex-section-numbers 'appendix appendix)) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
2384 |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
2385 (defun reftex-section-number (&optional level star) |
18050 | 2386 ;; Return a string with the current section number. |
2387 ;; When LEVEL is non-nil, increase section numbers on that level. | |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
2388 (let* ((depth (1- (length reftex-section-numbers))) idx n (string "") |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
2389 (appendix (get 'reftex-section-numbers 'appendix))) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2390 (when level |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2391 (when (and (> level -1) (not star)) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
2392 (aset reftex-section-numbers |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
2393 level (1+ (aref reftex-section-numbers level)))) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2394 (setq idx (1+ level)) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2395 (when (not star) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2396 (while (<= idx depth) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2397 (aset reftex-section-numbers idx 0) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2398 (incf idx)))) |
18050 | 2399 (setq idx 0) |
2400 (while (<= idx depth) | |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
2401 (setq n (aref reftex-section-numbers idx)) |
18050 | 2402 (setq string (concat string (if (not (string= string "")) "." "") |
2403 (int-to-string n))) | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2404 (incf idx)) |
18050 | 2405 (save-match-data |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
2406 (if (string-match "\\`\\([@0]\\.\\)+" string) |
18050 | 2407 (setq string (replace-match "" nil nil string))) |
2408 (if (string-match "\\(\\.0\\)+\\'" string) | |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
2409 (setq string (replace-match "" nil nil string))) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
2410 (if (and appendix |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
2411 (string-match "\\`[0-9]+" string)) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2412 (setq string |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2413 (concat |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2414 (char-to-string |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2415 (1- (+ ?A (string-to-int (match-string 0 string))))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2416 (substring string (match-end 0)))))) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2417 (if star |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2418 (concat (make-string (1- (length string)) ?\ ) "*") |
18050 | 2419 string))) |
2420 | |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2421 (defun reftex-is-multi () |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2422 ;; Tell if this is a multifile document. When not sure, say yes. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2423 (let ((entry (assq 'is-multi (symbol-value reftex-docstruct-symbol)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2424 (if entry |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2425 (nth 1 entry) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2426 t))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2427 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2428 (defun reftex-typekey-check (typekey conf-variable &optional n) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2429 ;; Check if CONF-VARIABLE is true or contains TYPEKEY |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2430 (and n (setq conf-variable (nth n conf-variable))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2431 (or (eq conf-variable t) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2432 (and (stringp conf-variable) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2433 (string-match (concat "[" conf-variable "]") typekey)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2434 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2435 (defun reftex-all-document-files (&optional relative) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2436 "Return a list of all files belonging to the current document. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2437 When RELATIVE is non-nil, give file names relative to directory |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2438 of master file." |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2439 (let* ((all (symbol-value reftex-docstruct-symbol)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2440 (master-dir (file-name-directory (reftex-TeX-master-file))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2441 (re (concat "\\`" (regexp-quote master-dir))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2442 file-list tmp file) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2443 (while (setq tmp (assoc 'bof all)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2444 (setq file (nth 1 tmp) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2445 all (cdr (memq tmp all))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2446 (and relative |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2447 (string-match re file) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2448 (setq file (substring file (match-end 0)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2449 (push file file-list)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2450 (nreverse file-list))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2451 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2452 ;;; Creating labels --------------------------------------------------------- |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2453 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2454 (defun reftex-label (&optional environment no-insert) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2455 "Insert a unique label. Return the label. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2456 If ENVIRONMENT is given, don't bother to find out yourself. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2457 If NO-INSERT is non-nil, do not insert label into buffer. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2458 With prefix arg, force to rescan document first. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2459 When you are prompted to enter or confirm a label, and you reply with |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2460 just the prefix or an empty string, no label at all will be inserted. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2461 A new label is also recorded into the label list. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2462 This function is controlled by the settings of reftex-insert-label-flags." |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2463 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2464 (interactive) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2465 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2466 ;; Ensure access to scanning info and rescan buffer if prefix are is '(4). |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2467 (reftex-access-scan-info current-prefix-arg) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2468 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2469 ;; Find out what kind of environment this is and abort if necessary. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2470 (if (or (not environment) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2471 (not (assoc environment reftex-env-or-mac-alist))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2472 (setq environment (reftex-label-location))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2473 (unless environment |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2474 (error "Can't figure out what kind of label should be inserted")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2475 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2476 ;; Ok, go ahead. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2477 (catch 'exit |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2478 (let* ((entry (assoc environment reftex-env-or-mac-alist)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2479 (typekey (nth 1 entry)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2480 (format (nth 3 entry)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2481 (macro-cell (reftex-what-macro 1)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2482 (entry1 (assoc (car macro-cell) reftex-env-or-mac-alist)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2483 label naked prefix valid default force-prompt rescan-is-useful) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2484 (when (and (or (nth 5 entry) (nth 5 entry1)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2485 (memq (preceding-char) '(?\[ ?\{))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2486 ;; This is an argument of a label macro. Insert naked label. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2487 (setq naked t format "%s")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2488 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2489 (setq prefix (or (cdr (assoc typekey reftex-typekey-to-prefix-alist)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2490 (concat typekey "-"))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2491 ;; Replace any escapes in the prefix |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2492 (setq prefix (reftex-replace-prefix-escapes prefix)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2493 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2494 ;; Make a default label. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2495 (cond |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2496 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2497 ((reftex-typekey-check typekey (nth 0 reftex-insert-label-flags)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2498 ;; Derive a label from context. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2499 (setq reftex-active-toc (reftex-last-assoc-before-elt |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2500 'toc (car (reftex-where-am-I)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2501 (symbol-value reftex-docstruct-symbol))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2502 (setq default (reftex-no-props |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2503 (nth 2 (reftex-label-info " " nil nil t)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2504 ;; Catch the cases where the is actually no context available. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2505 (if (or (string-match "NO MATCH FOR CONTEXT REGEXP" default) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2506 (string-match "ILLEGAL VALUE OF PARSE" default) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2507 (string-match "SECTION HEADING NOT FOUND" default) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2508 (string-match "HOOK ERROR" default) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2509 (string-match "^[ \t]*$" default)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2510 (setq default prefix |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2511 force-prompt t) ; need to prompt |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2512 (setq default |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2513 (concat prefix |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2514 (funcall reftex-string-to-label-function default))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2515 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2516 ;; Make it unique. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2517 (setq default (reftex-uniquify-label default nil "-")))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2518 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2519 ((reftex-typekey-check typekey (nth 1 reftex-insert-label-flags)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2520 ;; Minimal default: the user will be prompted. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2521 (setq default prefix)) |
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 (t |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2524 ;; Make an automatic label. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2525 (setq default (reftex-uniquify-label prefix t)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2526 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2527 ;; Should we ask the user? |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2528 (if (or (reftex-typekey-check typekey |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2529 (nth 1 reftex-insert-label-flags)) ; prompt |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2530 force-prompt) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2531 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2532 (while (not valid) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2533 ;; iterate until we get a legal label |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2534 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2535 (setq label (read-string |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2536 (if naked "Naked Label: " "Label: ") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2537 default)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2538 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2539 ;; Lets make sure that this is a legal label |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2540 (cond |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2541 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2542 ((string-match (concat "\\`\\(" (regexp-quote prefix) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2543 "\\)?[ \t]*\\'") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2544 label) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2545 ;; No label at all, please |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2546 (message "No label inserted.") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2547 (throw 'exit nil)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2548 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2549 ;; Test if label contains strange characters |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2550 ((string-match reftex-label-illegal-re label) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2551 (message "Label \"%s\" contains illegal characters" label) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2552 (ding) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2553 (sit-for 2)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2554 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2555 ;; Look it up in the label list |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2556 ((setq entry (assoc label |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2557 (symbol-value reftex-docstruct-symbol))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2558 (ding) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2559 (if (y-or-n-p |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2560 (format "Label '%s' exists. Use anyway? " label)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2561 (setq valid t))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2562 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2563 ;; Label is ok |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2564 (t |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2565 (setq valid t)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2566 (setq label default)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2567 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2568 ;; Insert the label into the label list |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2569 (let* ((here-I-am-info |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2570 (save-excursion |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2571 (if (and (or naked no-insert) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2572 (integerp (cdr macro-cell))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2573 (goto-char (cdr macro-cell))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2574 (reftex-where-am-I))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2575 (here-I-am (car here-I-am-info)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2576 (note (if (cdr here-I-am-info) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2577 "" |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2578 "POSITION UNCERTAIN. RESCAN TO FIX.")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2579 (file (buffer-file-name)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2580 (text nil) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2581 (tail (memq here-I-am (symbol-value reftex-docstruct-symbol)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2582 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2583 (or (cdr here-I-am-info) (setq rescan-is-useful t)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2584 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2585 (when tail |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2586 (push (list label typekey text file nil note) (cdr tail)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2587 (put reftex-docstruct-symbol 'modified t))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2588 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2589 ;; Insert the label into the buffer |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2590 (unless no-insert |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2591 (insert |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2592 (if reftex-format-label-function |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2593 (funcall reftex-format-label-function label format) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2594 (format format label))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2595 (if (and reftex-plug-into-AUCTeX |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2596 (fboundp 'LaTeX-add-labels)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2597 ;; Tell AUCTeX about this |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2598 (LaTeX-add-labels label))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2599 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2600 ;; Delete the corresponding selection buffers to force update on next use. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2601 (when reftex-auto-update-selection-buffers |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2602 (reftex-erase-buffer (reftex-make-selection-buffer-name typekey)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2603 (reftex-erase-buffer (reftex-make-selection-buffer-name " "))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2604 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2605 (when (and rescan-is-useful reftex-allow-automatic-rescan) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2606 (reftex-parse-one)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2607 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2608 ;; return value of the function is the label |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2609 label))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2610 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2611 (defun reftex-string-to-label (string) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2612 "Convert a string (a sentence) to a label. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2613 Uses `reftex-derive-label-parameters' and `reftex-label-illegal-re'. It |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2614 also applies `reftex-translate-to-ascii-function' to the string." |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2615 (when (and reftex-translate-to-ascii-function |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2616 (fboundp reftex-translate-to-ascii-function)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2617 (setq string (funcall reftex-translate-to-ascii-function string))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2618 (apply 'reftex-convert-string string |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2619 "[-~ \t\n\r,;]+" reftex-label-illegal-re nil nil |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2620 reftex-derive-label-parameters)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2621 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2622 (defun reftex-abbreviate-title (string) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2623 (reftex-convert-string string "[-~ \t\n\r,;]" nil t t |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2624 5 40 nil 1 " " (nth 5 reftex-derive-label-parameters))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2625 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2626 (defun reftex-convert-string (string split-re illegal-re dot keep-fp |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2627 nwords maxchar illegal abbrev sep |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2628 ignore-words &optional downcase) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2629 "Convert a string (a sentence) to something shorter. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2630 SPLIT-RE is the regular expression used to split the string into words. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2631 ILLEGAL-RE matches characters which are illegal in the final string. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2632 DOT t means add dots to abbreviated words. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2633 KEEP-FP t means to keep a final punctuation when applicable. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2634 NWORDS Number of words to use. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2635 MAXCHAR Maximum number of characters in the final string. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2636 ILLEGAL nil: Throw away any words containing stuff matched with ILLEGAL-RE. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2637 t: Throw away only the matched part, not the whole word. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2638 ABBREV nil: Never abbreviate words. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2639 t: Always abbreviate words (see `reftex-abbrev-parameters'). |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2640 not t and not nil: Abbreviate words if necessary to shorten |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2641 string below MAXCHAR. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2642 SEP String separating different words in the output string. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2643 IGNORE-WORDS List of words which should be removed from the string." |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2644 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2645 (let* ((words0 (split-string string (or split-re "[ \t\n\r]"))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2646 words word) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2647 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2648 ;; Remove words from the ignore list or with funny characters |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2649 (while (setq word (pop words0)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2650 (if downcase (setq word (downcase word))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2651 (cond |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2652 ((member (downcase word) ignore-words)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2653 ((string-match (or illegal-re "\000") word) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2654 (when illegal |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2655 (while (string-match illegal-re word) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2656 (setq word (replace-match "" nil nil word))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2657 (push word words))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2658 (t |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2659 (push word words)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2660 (setq words (nreverse words)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2661 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2662 ;; Restrict number of words |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2663 (if (> (length words) nwords) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2664 (setcdr (nthcdr (1- nwords) words) nil)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2665 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2666 ;; First, try to use all words |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2667 (setq string (mapconcat 'identity words sep)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2668 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2669 ;; Abbreviate words if enforced by user settings or string length |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2670 (if (or (eq t abbrev) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2671 (and abbrev |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2672 (> (length string) maxchar))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2673 (setq words |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2674 (mapcar |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2675 (function |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2676 (lambda (w) (if (string-match reftex-abbrev-regexp w) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2677 (if dot |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2678 (concat (match-string 1 w) ".") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2679 (match-string 1 w)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2680 w))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2681 words) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2682 string (mapconcat 'identity words sep))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2683 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2684 ;; Shorten if still to long |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2685 (setq string |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2686 (if (> (length string) maxchar) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2687 (substring string 0 maxchar) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2688 string)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2689 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2690 ;; Delete the final punctuation, if any |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2691 (if (and (not keep-fp) (string-match "\\s.+\\'" string)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2692 (setq string (replace-match "" nil nil string))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2693 string)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2694 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2695 (defun reftex-replace-prefix-escapes (prefix) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2696 ;; Replace %escapes in a label prefix |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2697 (save-match-data |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2698 (let (letter (num 0) replace) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2699 (while (string-match "\\%\\([a-zA-Z]\\)" prefix num) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2700 (setq letter (match-string 1 prefix)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2701 (setq replace |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2702 (cond |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2703 ((equal letter "f") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2704 (file-name-sans-extension |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2705 (file-name-nondirectory (buffer-file-name)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2706 ((equal letter "F") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2707 (let ((masterdir (file-name-directory (reftex-TeX-master-file))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2708 (file (file-name-sans-extension (buffer-file-name)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2709 (if (string-match (concat "\\`" (regexp-quote masterdir)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2710 file) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2711 (substring file (length masterdir)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2712 file))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2713 ((equal letter "u") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2714 (or (user-login-name) "")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2715 (t ""))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2716 (setq num (1- (+ (match-beginning 1) (length replace))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2717 prefix (replace-match replace nil nil prefix))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2718 prefix))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2719 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2720 (defun reftex-uniquify-label (label &optional force separator) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2721 ;; Make label unique by appending a number. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2722 ;; Optional FORCE means, force appending a number, even if label is unique. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2723 ;; Optional SEPARATOR is a string to stick between label and number. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2724 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2725 ;; Ensure access to scanning info |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2726 (reftex-access-scan-info) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2727 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2728 (cond |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2729 ((and (not force) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2730 (not (assoc label (symbol-value reftex-docstruct-symbol)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2731 label) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2732 (t |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2733 (let* ((label-numbers (assq 'label-numbers |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2734 (symbol-value reftex-docstruct-symbol))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2735 (label-numbers-alist (cdr label-numbers)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2736 (cell (or (assoc label label-numbers-alist) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2737 (car (setcdr label-numbers |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2738 (cons (cons label 0) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2739 label-numbers-alist))))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2740 (num (1+ (cdr cell))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2741 (sep (or separator ""))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2742 (while (assoc (concat label sep (int-to-string num)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2743 (symbol-value reftex-docstruct-symbol)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2744 (incf num)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2745 (setcdr cell num) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2746 (concat label sep (int-to-string num)))))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2747 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2748 ;;; Referencing labels ------------------------------------------------------ |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2749 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2750 ;; Help string for the reference label menu |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2751 (defconst reftex-select-label-prompt |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2752 "Select: [n]ext [p]revious [r]escan [ ]context e[x]tern [q]uit RET [?]HELP+more") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2753 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2754 (defconst reftex-select-label-help |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2755 " n / p Go to next/previous label (Cursor motion works as well) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2756 C-c C-n/p Go to next/previous section heading. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2757 b / l Jump back to previous selection / Reuse last referenced label |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2758 C-s / C-r Search forward/backward. Use repeated C-s/C-r as in isearch. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2759 g / s Update menu / Switch label type |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2760 r / R Reparse document / Reparse entire document |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2761 x Switch to label menu of external document (with LaTeX package `xr') |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2762 t i c # % Toggle: [i]ncl. file borders, [t]able of contents, [c]ontext |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2763 [#] label counters, [%] labels in comments |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2764 SPC / f Show full context in other window / Toggle follow mode |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2765 v / . Toggle \\ref <-> \\vref / Show insertion point in other window |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2766 TAB Enter a label with completion |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2767 q / RET Quit without referencing / Accept current label (also on mouse-2)") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2768 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2769 (defvar reftex-select-label-map nil |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2770 "Keymap used for *RefTeX Select* buffer, when selecting a label. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2771 This keymap can be used to configure the label selection process which is |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2772 started with the command \\[reftex-reference].") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2773 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2774 (defun reftex-select-label-mode () |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2775 "Major mode for selecting a label in a LaTeX document. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2776 This buffer was created with RefTeX. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2777 It only has a meaningful keymap when you are in the middle of a |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2778 selection process. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2779 To select a label, move the cursor to it and press RET. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2780 Press `?' for a summary of important key bindings. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2781 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2782 During a selection process, these are the local bindings. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2783 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2784 \\{reftex-select-label-map}" |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2785 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2786 (interactive) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2787 (kill-all-local-variables) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2788 (make-local-hook 'pre-command-hook) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2789 (make-local-hook 'post-command-hook) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2790 (setq major-mode 'reftex-select-label-mode |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2791 mode-name "RefTeX Select Label") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2792 (when (syntax-table-p reftex-latex-syntax-table) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2793 (set-syntax-table reftex-latex-syntax-table)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2794 ;; We do not set a local map - reftex-select-item does this. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2795 (run-hooks 'reftex-select-label-mode-hook)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2796 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2797 (defun reftex-reference (&optional type no-insert cut) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2798 "Make a LaTeX reference. Look only for labels of a certain TYPE. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2799 With prefix arg, force to rescan buffer for labels. This should only be |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2800 necessary if you have recently entered labels yourself without using |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2801 reftex-label. Rescanning of the buffer can also be requested from the |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2802 label selection menu. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2803 The function returns the selected label or nil. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2804 If NO-INSERT is non-nil, do not insert \\ref command, just return label. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2805 When called with 2 C-u prefix args, disable magic word recognition." |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2806 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2807 (interactive) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2808 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2809 ;; check for active recursive edits |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2810 (reftex-check-recursive-edit) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2811 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2812 ;; Ensure access to scanning info and rescan buffer if prefix are is '(4) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2813 (reftex-access-scan-info current-prefix-arg) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2814 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2815 (unless type |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2816 ;; guess type from context |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2817 (if (and reftex-guess-label-type |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2818 (setq type (reftex-guess-label-type))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2819 (setq cut (cdr type) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2820 type (car type)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2821 (setq type (reftex-query-label-type)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2822 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2823 (let* ((varioref (if (reftex-typekey-check |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2824 type reftex-vref-is-default) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2825 "\\vref" "\\ref")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2826 (form "\\ref{%s}") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2827 label pair) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2828 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2829 ;; Have the user select a label |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2830 (set-marker reftex-select-return-marker (point)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2831 (setq pair (save-excursion |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2832 (reftex-offer-label-menu type))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2833 (reftex-ensure-compiled-variables) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2834 (set-marker reftex-select-return-marker nil) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2835 (setq label (car pair) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2836 type (cdr pair) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2837 form (or (cdr (assoc type reftex-typekey-to-format-alist)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2838 form)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2839 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2840 (if (and label |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2841 (not no-insert)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2842 (progn |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2843 (if cut (backward-delete-char cut)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2844 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2845 ;; remove ~ if we do already have a space |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2846 (when (and (= ?~ (string-to-char form)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2847 (= ?\ (preceding-char))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2848 (setq form (substring form 1))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2849 ;; do we need to switch from \ref to \vref? |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2850 (when (string= varioref "\\vref") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2851 (while (string-match "\\\\ref{" form) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2852 (setq form (replace-match "\\vref{" t t form)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2853 ;; ok, insert the reference |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2854 (insert |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2855 (if reftex-format-ref-function |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2856 (funcall reftex-format-ref-function label form) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2857 (format form label label))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2858 (message "")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2859 (message "Quit")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2860 ;; return the label |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2861 label)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2862 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2863 (defun reftex-guess-label-type () |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2864 ;; Examine context to guess what a \ref might want to reference. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2865 (let ((words reftex-words-to-typekey-alist) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2866 (case-fold-search t) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2867 (bound (max (point-min) (- (point) 35))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2868 matched cell) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2869 (save-excursion |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2870 (while (and (setq cell (pop words)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2871 (not (setq matched |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2872 (re-search-backward (car cell) bound t)))))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2873 (if matched |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2874 (cons (cdr cell) (- (match-end 0) (match-end 1))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2875 nil))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2876 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2877 (defun reftex-offer-label-menu (typekey) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2878 ;; Offer a menu with the appropriate labels. Return (label . typekey). |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2879 (let* ((buf (current-buffer)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2880 (xr-data (assq 'xr (symbol-value reftex-docstruct-symbol))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2881 (xr-alist (cons (cons "" (buffer-file-name)) (nth 1 xr-data))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2882 (xr-index 0) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2883 (here-I-am (car (reftex-where-am-I))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2884 (here-I-am1 here-I-am) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2885 (toc (reftex-typekey-check typekey reftex-label-menu-flags 0)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2886 (files (reftex-typekey-check typekey reftex-label-menu-flags 7)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2887 (context (not (reftex-typekey-check |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2888 typekey reftex-label-menu-flags 3))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2889 (counter (reftex-typekey-check |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2890 typekey reftex-label-menu-flags 2)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2891 (follow (reftex-typekey-check |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2892 typekey reftex-label-menu-flags 4)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2893 (commented (nth 5 reftex-label-menu-flags)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2894 (prefix "") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2895 selection-buffers |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2896 offset rtn key data last-data entry) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2897 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2898 (setq entry (cons nil nil)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2899 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2900 (unwind-protect |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2901 (catch 'exit |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2902 (while t |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2903 (save-window-excursion |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2904 (delete-other-windows) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2905 (setq reftex-call-back-to-this-buffer buf |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2906 reftex-latex-syntax-table (syntax-table)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2907 (let ((default-major-mode 'reftex-select-label-mode)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2908 (if reftex-use-multiple-selection-buffers |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2909 (switch-to-buffer-other-window |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2910 (save-excursion |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2911 (set-buffer buf) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2912 (reftex-make-selection-buffer-name typekey))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2913 (switch-to-buffer-other-window "*RefTeX Select*") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2914 (reftex-erase-buffer))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2915 (unless (eq major-mode 'reftex-select-label-mode) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2916 (reftex-select-label-mode)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2917 (add-to-list 'selection-buffers (current-buffer)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2918 (setq truncate-lines t) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2919 (setq mode-line-format |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2920 (list "---- " 'mode-line-buffer-identification |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2921 " " 'varioref |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2922 " " (abbreviate-file-name |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2923 (buffer-file-name buf)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2924 " -%-")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2925 (cond |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2926 ((= 0 (buffer-size)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2927 (let ((buffer-read-only nil)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2928 (setq offset (reftex-make-and-insert-label-list |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2929 typekey buf toc files context counter commented |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2930 (or here-I-am offset) prefix)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2931 (here-I-am |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2932 (setq offset (reftex-get-offset buf here-I-am typekey))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2933 (t (setq offset t))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2934 (setq buffer-read-only t) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2935 (setq offset (or offset t)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2936 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2937 (setq here-I-am nil) ; turn off determination of offset |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2938 (setq rtn |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2939 (reftex-select-item |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2940 reftex-select-label-prompt |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2941 reftex-select-label-help |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2942 reftex-select-label-map |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2943 offset |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2944 'reftex-select-label-callback follow)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2945 (setq key (car rtn) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2946 data (nth 1 rtn) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2947 last-data (nth 2 rtn) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2948 offset t) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2949 (unless key (throw 'exit nil)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2950 (cond |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2951 ((eq key ?g) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2952 ;; update buffer |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2953 (reftex-erase-buffer)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2954 ((or (eq key ?r) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2955 (eq key ?R)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2956 ;; rescan buffer |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2957 (reftex-erase-buffer) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2958 (reftex-reparse-document buf last-data key)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2959 ((eq key ?c) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2960 ;; toggle context mode |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2961 (reftex-erase-buffer) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2962 (setq context (not context))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2963 ((eq key ?s) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2964 ;; switch type |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2965 (setq here-I-am here-I-am1) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2966 (setq typekey (reftex-query-label-type))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2967 ((eq key ?t) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2968 ;; toggle table of contents display |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2969 (reftex-erase-buffer) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2970 (setq toc (not toc))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2971 ((eq key ?i) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2972 ;; toggle display of included file borders |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2973 (reftex-erase-buffer) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2974 (setq files (not files))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2975 ((eq key ?#) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2976 ;; toggle counter display |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2977 (reftex-erase-buffer) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2978 (setq counter (not counter))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2979 ((eq key ?%) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2980 ;; toggle display of commented labels |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2981 (reftex-erase-buffer) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2982 (setq commented (not commented))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2983 ((eq key ?l) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2984 ;; reuse the last referenced label again |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2985 (setq entry reftex-last-used-reference) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2986 (throw 'exit t)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2987 ((eq key ?x) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2988 ;; select an external document |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2989 (setq xr-index (reftex-select-external-document |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2990 xr-alist xr-index)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2991 (setq buf (or (reftex-get-file-buffer-force |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2992 (cdr (nth xr-index xr-alist))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2993 (error "Cannot switch document")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2994 prefix (or (car (nth xr-index xr-alist)) "")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2995 (set-buffer buf) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2996 (reftex-access-scan-info)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2997 ((stringp key) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2998 (setq entry |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2999 (or (assoc key (symbol-value reftex-docstruct-symbol)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3000 (list key typekey))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3001 (throw 'exit t)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3002 (t |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3003 (set-buffer buf) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3004 (if data |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3005 (progn |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3006 (setq entry data) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3007 (setq reftex-last-used-reference entry)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3008 (setq entry nil)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3009 (throw 'exit t)))))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3010 (save-excursion |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3011 (while reftex-buffers-with-changed-invisibility |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3012 (set-buffer (car (car reftex-buffers-with-changed-invisibility))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3013 (setq buffer-invisibility-spec |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3014 (cdr (pop reftex-buffers-with-changed-invisibility))))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3015 (mapcar (function (lambda (buf) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3016 (and (buffer-live-p buf) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3017 (bury-buffer buf)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3018 selection-buffers) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3019 (reftex-kill-temporary-buffers)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3020 (cons (if (nth 0 entry) (concat prefix (nth 0 entry)) nil) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3021 (nth 1 entry)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3022 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3023 (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
|
3024 ;; 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
|
3025 (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
|
3026 (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
|
3027 ?0 highest)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3028 key prefix) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3029 (cond |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3030 ((= len 1) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3031 (message "No external documents available") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3032 (ding) (sit-for 1) 0) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3033 ((= len 2) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3034 (- 1 xr-index)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3035 (t |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3036 (save-excursion |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3037 (let* ((length (apply 'max (mapcar |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3038 (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
|
3039 (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
|
3040 (n (1- ?0))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3041 (setq key |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3042 (reftex-select-with-char |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3043 prompt |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3044 (concat |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3045 "SELECT EXTERNAL DOCUMENT\n------------------------\n" |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3046 (mapconcat |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3047 (function |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3048 (lambda (x) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3049 (format fmt (incf n) (or (car x) "") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3050 (abbreviate-file-name (cdr x))))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3051 xr-alist "")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3052 nil t)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3053 (cond |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3054 ((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
|
3055 ((= key ?\C-i) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3056 (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
|
3057 (- 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
|
3058 (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
|
3059 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3060 (defun reftex-reparse-document (&optional buffer data key) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3061 ;; Rescan the document. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3062 (save-window-excursion |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3063 (save-excursion |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3064 (if buffer |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3065 (if (not (bufferp buffer)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3066 (error "No such buffer %s" (buffer-name buffer)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3067 (set-buffer buffer))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3068 (let ((arg (if (eq key ?R) '(16) '(4))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3069 (file (nth 3 data))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3070 (reftex-access-scan-info arg file))))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3071 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3072 (defun reftex-make-selection-buffer-name (type &optional index) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3073 ;; Make unique name for a selection buffer. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3074 (format " *RefTeX[%s][%d]*" |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3075 type (or index (get reftex-docstruct-symbol ':master-index) 0))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3076 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3077 (defun reftex-get-offset (buf here-am-I typekey) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3078 ;; Find the correct offset data, like make-and-insert would, but faster. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3079 (save-excursion |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3080 (set-buffer buf) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3081 (reftex-access-scan-info) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3082 (let* ((rest (memq here-am-I (symbol-value reftex-docstruct-symbol))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3083 entry) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3084 (while (and (setq entry (pop rest)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3085 (not (and (stringp (car entry)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3086 (equal typekey (nth 1 entry)))))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3087 entry))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3088 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3089 (defun reftex-make-and-insert-label-list |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3090 (typekey0 buf toc files context counter show-commented here-I-am xr-prefix) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3091 ;; Insert a menu of all labels in buffer BUF into current buffer. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3092 ;; Return the data property of the entry corresponding to HERE-I-AM. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3093 (let* ((font (reftex-use-fonts)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3094 (cnt 0) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3095 (index -1) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3096 (toc-indent " ") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3097 (label-indent |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3098 (concat "> " |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3099 (if toc (make-string (* 7 reftex-level-indent) ?\ ) ""))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3100 (context-indent |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3101 (concat ". " |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3102 (if toc (make-string (* 7 reftex-level-indent) ?\ ) ""))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3103 (mouse-face |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3104 (if (memq reftex-highlight-selection '(mouse both)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3105 reftex-mouse-selected-face |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3106 nil)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3107 (label-face (reftex-verified-face reftex-label-face |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3108 'font-lock-constant-face |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3109 'font-lock-reference-face)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3110 all cell text label typekey note comment master-dir-re |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3111 offset from to docstruct-symbol) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3112 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3113 (message "Creating Selection Buffer...") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3114 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3115 ;; Pop to buffer buf to get the correct buffer-local variables |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3116 (save-excursion |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3117 (set-buffer buf) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3118 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3119 ;; Ensure access to scanning info |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3120 (reftex-access-scan-info) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3121 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3122 (setq docstruct-symbol reftex-docstruct-symbol |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3123 all (symbol-value reftex-docstruct-symbol) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3124 reftex-active-toc nil |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3125 master-dir-re |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3126 (concat "\\`" (regexp-quote |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3127 (file-name-directory (reftex-TeX-master-file)))))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3128 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3129 (set (make-local-variable 'reftex-docstruct-symbol) docstruct-symbol) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3130 (set (make-local-variable 'reftex-prefix) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3131 (cdr (assoc typekey0 reftex-typekey-to-prefix-alist))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3132 (if (equal reftex-prefix " ") (setq reftex-prefix nil)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3133 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3134 ;; Walk the docstruct and insert the appropriate stuff |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3135 (while (setq cell (pop all)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3136 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3137 (incf index) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3138 (setq from (point)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3139 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3140 (if (eq cell here-I-am) (setq offset 'attention)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3141 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3142 (cond |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3143 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3144 ((memq (car cell) '(bib thebib label-numbers appendix |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3145 master-dir bibview-cache is-multi xr xr-doc))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3146 ;; These are currently ignored |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3147 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3148 ((memq (car cell) '(bof eof file-error)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3149 ;; Beginning or end of a file |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3150 (when files |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3151 (insert |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3152 " File " (if (string-match master-dir-re (nth 1 cell)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3153 (substring (nth 1 cell) (match-end 0)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3154 (nth 1 cell)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3155 (cond ((eq (car cell) 'bof) " starts here\n") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3156 ((eq (car cell) 'eof) " ends here\n") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3157 ((eq (car cell) 'file-error) " was not found\n"))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3158 (when font |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3159 (put-text-property from (point) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3160 'face reftex-file-boundary-face)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3161 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3162 ((eq (car cell) 'toc) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3163 ;; a table of contents entry |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3164 (when toc |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3165 (setq reftex-active-toc cell) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3166 (insert (concat toc-indent (nth 2 cell) "\n")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3167 (setq to (point)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3168 (when font |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3169 (put-text-property from to |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3170 'face reftex-section-heading-face)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3171 (goto-char to))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3172 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3173 ((stringp (car cell)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3174 ;; a label |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3175 (when (null (nth 2 cell)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3176 ;; No context yet. Quick update. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3177 (setcdr cell (cdr (reftex-label-info-update cell))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3178 (put docstruct-symbol 'modified t)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3179 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3180 (setq label (car cell) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3181 typekey (nth 1 cell) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3182 text (nth 2 cell) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3183 comment (nth 4 cell) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3184 note (nth 5 cell)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3185 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3186 (when (and (or (string= typekey typekey0) (string= typekey0 " ")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3187 (or show-commented (null comment))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3188 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3189 ;; Yes we want this one |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3190 (incf cnt) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3191 (if (eq offset 'attention) (setq offset cell)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3192 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3193 (setq label (concat xr-prefix label)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3194 (when comment (setq label (concat "% " label))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3195 (insert label-indent label) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3196 (when font |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3197 (setq to (point)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3198 (put-text-property |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3199 (- (point) (length label)) to |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3200 'face (if comment |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3201 'font-lock-comment-face |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3202 label-face)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3203 (goto-char to)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3204 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3205 (insert (if counter (format " (%d) " cnt) "") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3206 (if comment " LABEL IS COMMENTED OUT " "") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3207 (if (stringp note) (concat " " note) "") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3208 "\n") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3209 (setq to (point)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3210 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3211 (when context |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3212 (insert context-indent text "\n") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3213 (setq to (point))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3214 (put-text-property from to ':data cell) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3215 (when mouse-face |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3216 (put-text-property from (1- to) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3217 'mouse-face mouse-face)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3218 (goto-char to))))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3219 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3220 (when (reftex-refontify) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3221 (reftex-fontify-select-label-buffer buf)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3222 (run-hooks 'reftex-display-copied-context-hook) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3223 offset)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3224 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3225 (defun reftex-query-label-type () |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3226 ;; Ask for label type |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3227 (let ((key (reftex-select-with-char |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3228 reftex-type-query-prompt reftex-type-query-help 3))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3229 (unless (member (char-to-string key) reftex-typekey-list) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3230 (error "No such label type: %s" (char-to-string key))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3231 (char-to-string key))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3232 |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3233 (defun reftex-select-label-callback (data forward no-revisit) |
18050 | 3234 ;; Callback function called from the label selection in order to |
3235 ;; show context in another window | |
3236 (let* ((this-window (selected-window)) | |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3237 label file buffer re found) |
18050 | 3238 ;; pop to original buffer in order to get correct variables |
3239 (catch 'exit | |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3240 (setq label (nth 0 data) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3241 file (nth 3 data)) |
18050 | 3242 |
3243 ;; goto the file in another window | |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3244 (setq buffer |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3245 (if no-revisit |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3246 (reftex-get-buffer-visiting file) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3247 (reftex-get-file-buffer-force |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3248 file (not reftex-keep-temporary-buffers)))) |
18050 | 3249 (if buffer |
3250 ;; good - the file is available | |
3251 (switch-to-buffer-other-window buffer) | |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
3252 ;; we have got a problem here. The file does not exist. |
18050 | 3253 ;; Let' get out of here.. |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3254 ;; (ding) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3255 (message reftex-no-follow-message) |
18050 | 3256 (throw 'exit nil)) |
3257 | |
3258 ;; search for that label | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3259 (setq re (format reftex-find-label-regexp-format (regexp-quote label))) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3260 (setq found |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3261 (if forward |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3262 (re-search-forward re nil t) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3263 (re-search-backward re nil t))) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3264 (unless found |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3265 (goto-char (point-min)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3266 (unless (re-search-forward re nil t) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3267 ;; Ooops. Must be in a macro with distributed args. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3268 (re-search-forward (format reftex-find-label-regexp-format2 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3269 (regexp-quote label)) nil t))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3270 (when (match-end 3) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3271 (setq reftex-latex-syntax-table (syntax-table)) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3272 (reftex-highlight 0 (match-beginning 3) (match-end 3)) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3273 (reftex-show-entry (match-beginning 3) (match-end 3)) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3274 (recenter (/ (window-height) 2))) |
18050 | 3275 (select-window this-window)))) |
3276 | |
3277 (defun reftex-pop-to-label (label file-list &optional mark-to-kill highlight) | |
3278 ;; Find LABEL in any file in FILE-LIST in another window. | |
3279 ;; If mark-to-kill is non-nil, mark new buffer for killing. | |
3280 ;; If HIGHLIGHT is non-nil, highlight the label definition. | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3281 (let* ((re1 (format reftex-find-label-regexp-format (regexp-quote label))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3282 (re2 (format reftex-find-label-regexp-format2 (regexp-quote label))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3283 (re-list (list re1 re2)) re |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3284 (file-list-1 file-list) |
18050 | 3285 file buf) |
3286 (catch 'exit | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3287 (while (setq re (pop re-list)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3288 (setq file-list file-list-1) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3289 (while (setq file (pop file-list)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3290 (unless (setq buf (reftex-get-file-buffer-force file mark-to-kill)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3291 (error "No such file %s" file)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3292 (set-buffer buf) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3293 (widen) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3294 (goto-char (point-min)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3295 (when (re-search-forward re nil t) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3296 (switch-to-buffer-other-window buf) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3297 (goto-char (match-beginning 0)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3298 (recenter (/ (window-height) 2)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3299 (if highlight |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3300 (reftex-highlight 0 (match-beginning 3) (match-end 3))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3301 (throw 'exit (selected-window))))) |
18050 | 3302 (error "Label %s not found" label)))) |
3303 | |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3304 (defvar font-lock-mode) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3305 (defun reftex-show-entry (beg-hlt end-hlt) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3306 ;; Show entry if point is hidden |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3307 (let* ((n (/ (window-height) 2)) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3308 (beg (save-excursion |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3309 (re-search-backward "[\n\r]" nil 1 n) (point))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3310 (end (save-excursion |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3311 (re-search-forward "[\n\r]" nil 1 n) (point)))) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3312 (cond |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3313 ((and (boundp 'buffer-invisibility-spec) buffer-invisibility-spec |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3314 (get-char-property (1+ beg-hlt) 'invisible)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3315 ;; Invisible with text properties. That is easy to change. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3316 (push (cons (current-buffer) buffer-invisibility-spec) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3317 reftex-buffers-with-changed-invisibility) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3318 (setq buffer-invisibility-spec nil)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3319 ((string-match "\r" (buffer-substring beg end)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3320 ;; Invisible with selective display. We need to copy it. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3321 (let ((string (buffer-substring-no-properties beg end))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3322 (switch-to-buffer "*RefTeX Context Copy*") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3323 (setq buffer-read-only nil) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3324 (erase-buffer) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3325 (insert string) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3326 (subst-char-in-region (point-min) (point-max) ?\r ?\n t) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3327 (goto-char (- beg-hlt beg)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3328 (reftex-highlight 0 (1+ (- beg-hlt beg)) (1+ (- end-hlt beg))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3329 (if (reftex-refontify) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3330 (when (or (not (eq major-mode 'latex-mode)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3331 (not font-lock-mode)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3332 (latex-mode) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3333 (run-hook-with-args |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3334 'reftex-pre-refontification-functions |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3335 reftex-call-back-to-this-buffer 'reftex-hidden) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3336 (turn-on-font-lock)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3337 (when (or (not (eq major-mode 'fundamental-mode)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3338 font-lock-mode) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3339 (fundamental-mode))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3340 (run-hooks 'reftex-display-copied-context-hook) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3341 (setq buffer-read-only t)))))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3342 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3343 ;;; ========================================================================= |
18050 | 3344 ;;; |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3345 ;;; Table of contents |
18050 | 3346 |
3347 ;; We keep at most one *toc* buffer - it is easy to make them | |
3348 | |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3349 (defvar reftex-toc-map (make-sparse-keymap) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3350 "Keymap used for *toc* buffer.") |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3351 |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3352 (defun reftex-toc-mode () |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3353 "Major mode for managing Table of Contents for LaTeX files. |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3354 This buffer was created with RefTeX. |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3355 Press `?' for a summary of important key bindings. |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3356 |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3357 Here are all local bindings. |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3358 |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3359 \\{reftex-toc-map}" |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3360 (interactive) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3361 (kill-all-local-variables) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3362 (setq major-mode 'reftex-toc-mode |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3363 mode-name "RefTeX Table of Contents") |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3364 (use-local-map reftex-toc-map) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3365 (set (make-local-variable 'revert-buffer-function) 'reftex-toc-revert) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3366 (setq truncate-lines t) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3367 (make-local-hook 'post-command-hook) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3368 (make-local-hook 'pre-command-hook) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3369 (make-local-variable 'reftex-last-follow-point) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3370 (add-hook 'post-command-hook 'reftex-toc-post-command-hook nil t) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3371 (add-hook 'pre-command-hook 'reftex-toc-pre-command-hook nil t) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3372 (run-hooks 'reftex-toc-mode-hook)) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3373 |
18050 | 3374 (defvar reftex-last-toc-master nil |
3375 "Stores the name of the tex file that `reftex-toc' was last run on.") | |
3376 | |
3377 (defvar reftex-last-toc-file nil | |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
3378 "Stores the file name from which `reftex-toc' was called. For redo command.") |
18050 | 3379 |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3380 (defvar reftex-last-window-height nil) |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3381 |
18050 | 3382 (defvar reftex-toc-return-marker (make-marker) |
3383 "Marker which makes it possible to return from toc to old position.") | |
3384 | |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3385 (defconst reftex-toc-help |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3386 " AVAILABLE KEYS IN TOC BUFFER |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3387 ============================ |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3388 n / p next-line / previous-line |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3389 SPC Show the corresponding section of the LaTeX document. |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3390 TAB Goto the section. |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3391 RET Goto the section and hide the *toc* buffer (also on mouse-2). |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3392 q / Q Hide/Kill *toc* buffer, return to position of last reftex-toc command. |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3393 f / g Toggle follow mode on and off / Refresh *toc* buffer. |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3394 r / R Reparse the LaTeX document / Reparse entire LaTeX document. |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3395 . In other window, show position from where `reftex-toc' was called. |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3396 x Switch to TOC of external document (with LaTeX package `xr').") |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3397 |
18050 | 3398 (defun reftex-toc () |
3399 "Show the table of contents for the current document. | |
3400 When called with a raw C-u prefix, rescan the document first." | |
3401 | |
3402 (interactive) | |
3403 | |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3404 (if (or (not (string= reftex-last-toc-master (reftex-TeX-master-file))) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3405 current-prefix-arg) |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3406 (reftex-erase-buffer "*toc*")) |
18050 | 3407 |
3408 (setq reftex-last-toc-file (buffer-file-name)) | |
3409 (setq reftex-last-toc-master (reftex-TeX-master-file)) | |
3410 | |
3411 (set-marker reftex-toc-return-marker (point)) | |
3412 | |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3413 ;; If follow mode is active, arrange to delay it one command |
18050 | 3414 (if reftex-toc-follow-mode |
3415 (setq reftex-toc-follow-mode 1)) | |
3416 | |
3417 ;; Ensure access to scanning info and rescan buffer if prefix are is '(4) | |
3418 (reftex-access-scan-info current-prefix-arg) | |
3419 | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3420 (let* ((all (symbol-value reftex-docstruct-symbol)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3421 (xr-data (assq 'xr all)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3422 (xr-alist (cons (cons "" (buffer-file-name)) (nth 1 xr-data))) |
18050 | 3423 (where (reftex-nearest-section)) |
21114
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
3424 (mouse-face |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
3425 (if (memq reftex-highlight-selection '(mouse both)) |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
3426 reftex-mouse-selected-face |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
3427 nil)) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3428 (fontify (reftex-use-fonts)) |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3429 toc1 cell startpos) |
18050 | 3430 |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3431 (if (get-buffer-window "*toc*") |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3432 (select-window (get-buffer-window "*toc*")) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3433 (when (< (window-height) (* 2 window-min-height)) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3434 (delete-other-windows)) |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3435 (setq reftex-last-window-height (window-height)) ; remember |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3436 (split-window) |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3437 (let ((default-major-mode 'reftex-toc-mode)) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3438 (switch-to-buffer "*toc*"))) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3439 |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3440 (or (eq major-mode 'reftex-toc-mode) (reftex-toc-mode)) |
18050 | 3441 |
3442 (cond | |
3443 ;; buffer is empty - fill it with the table of contents | |
3444 ((= (buffer-size) 0) | |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3445 (message "Building *toc* buffer...") |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3446 |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3447 (setq buffer-read-only nil) |
18050 | 3448 (insert (format |
3449 "TABLE-OF-CONTENTS on %s | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3450 SPC=view TAB=goto RET=goto+hide [q]uit [r]escan [f]ollow-mode e[x]tern [?]Help |
18050 | 3451 ------------------------------------------------------------------------------- |
3452 " (abbreviate-file-name reftex-last-toc-master))) | |
3453 (setq startpos (point)) | |
3454 | |
3455 (if (reftex-use-fonts) | |
21114
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
3456 (put-text-property 1 (point) 'face reftex-toc-header-face)) |
18050 | 3457 (put-text-property 1 (point) 'intangible t) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3458 (put-text-property 1 2 'xr-alist xr-alist) |
18050 | 3459 |
3460 (while all | |
3461 (setq cell (car all) | |
3462 all (cdr all)) | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3463 (when (eq (car cell) 'toc) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3464 (setq toc1 (concat (nth 2 cell) "\n")) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3465 (put-text-property 0 (length toc1) 'toc cell toc1) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3466 (when fontify |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3467 (put-text-property 0 (length toc1) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3468 'face reftex-section-heading-face toc1)) |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3469 (when mouse-face |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3470 (put-text-property 0 (1- (length toc1)) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3471 'mouse-face mouse-face toc1)) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3472 (insert toc1))) |
18050 | 3473 |
3474 (backward-delete-char 1) | |
3475 | |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3476 (run-hooks 'reftex-display-copied-context-hook) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3477 (message "Building *toc* buffer...done.") |
18050 | 3478 (setq buffer-read-only t)) |
3479 (t | |
3480 (goto-line 3) | |
3481 (beginning-of-line) | |
3482 (setq startpos (point)))) | |
3483 | |
3484 ;; Find the correct section | |
3485 (goto-char (point-max)) | |
3486 (beginning-of-line) | |
3487 (while (and (> (point) startpos) | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3488 (not (eq (get-text-property (point) 'toc) where))) |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3489 (beginning-of-line 0)) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3490 (setq reftex-last-follow-point (point)))) |
18050 | 3491 |
3492 (defun reftex-nearest-section () | |
3493 ;; Return (file . find) of nearest section command | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3494 (let* ((here-I-am (car (reftex-where-am-I)))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3495 (reftex-last-assoc-before-elt |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3496 'toc here-I-am (symbol-value reftex-docstruct-symbol)))) |
18050 | 3497 |
3498 (defun reftex-toc-pre-command-hook () | |
3499 ;; used as pre command hook in *toc* buffer | |
3500 (reftex-unhighlight 0) | |
3501 (reftex-unhighlight 1)) | |
3502 | |
3503 (defun reftex-toc-post-command-hook () | |
3504 ;; used in the post-command-hook for the *toc* buffer | |
3505 (and (> (point) 1) | |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3506 (memq reftex-highlight-selection '(cursor both)) |
18050 | 3507 (save-excursion |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3508 (reftex-highlight 1 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3509 (progn (beginning-of-line) (point)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3510 (progn (end-of-line) (point))))) |
18050 | 3511 (cond |
3512 ((integerp reftex-toc-follow-mode) | |
3513 ;; remove delayed action | |
3514 (setq reftex-toc-follow-mode t)) | |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3515 ((and reftex-toc-follow-mode |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3516 (not (equal reftex-last-follow-point (point)))) |
18050 | 3517 ;; show context in other window |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3518 (setq reftex-last-follow-point (point)) |
18050 | 3519 (condition-case nil |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3520 (reftex-toc-visit-line nil (not reftex-revisit-to-follow)) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3521 (error t))))) |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3522 |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3523 (defun reftex-re-enlarge () |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3524 ;; Enlarge windiw to a remembered size |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3525 (enlarge-window |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3526 (max 0 (- (or reftex-last-window-height (window-height)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3527 (window-height))))) |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3528 |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3529 (defun reftex-toc-show-help () |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3530 "Show a summary of special key bindings." |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3531 (interactive) |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3532 (with-output-to-temp-buffer "*RefTeX Help*" |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3533 (princ reftex-toc-help)) |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3534 ;; If follow mode is active, arrange to delay it one command |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3535 (if reftex-toc-follow-mode |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3536 (setq reftex-toc-follow-mode 1))) |
18050 | 3537 |
3538 (defun reftex-toc-toggle-follow () | |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3539 "Toggle toc-follow mode. (It is not really a mode, just a flag)." |
18050 | 3540 (interactive) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3541 (setq reftex-last-follow-point -1) |
18050 | 3542 (setq reftex-toc-follow-mode (not reftex-toc-follow-mode))) |
3543 (defun reftex-toc-view-line () | |
3544 "View document location in other window." | |
3545 (interactive) | |
3546 (reftex-toc-visit-line)) | |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3547 (defun reftex-toc-mouse-view-line (ev) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3548 "View document location in other window." |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3549 (interactive "e") |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3550 (mouse-set-point ev) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3551 (reftex-toc-visit-line)) |
18050 | 3552 (defun reftex-toc-goto-line-and-hide () |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
3553 "Go to document location in other window. Hide the *toc* window." |
18050 | 3554 (interactive) |
3555 (reftex-toc-visit-line 'hide)) | |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3556 (defun reftex-toc-goto-line () |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3557 "Go to document location in other window. Hide the *toc* window." |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3558 (interactive) |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3559 (reftex-toc-visit-line t)) |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3560 (defun reftex-toc-mouse-goto-line-and-hide (ev) |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3561 "Go to document location in other window. Hide the *toc* window." |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3562 (interactive "e") |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3563 (mouse-set-point ev) |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3564 (reftex-toc-visit-line 'hide)) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3565 (defun reftex-toc-show-insertion-point () |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3566 (interactive) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3567 (let ((this-window (selected-window))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3568 (unwind-protect |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3569 (progn |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3570 (switch-to-buffer-other-window |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3571 (marker-buffer reftex-toc-return-marker)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3572 (goto-char (marker-position reftex-toc-return-marker)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3573 (recenter (/ (window-height) 2))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3574 (select-window this-window)))) |
18050 | 3575 (defun reftex-toc-quit () |
3576 "Hide the *toc* window and do not move point." | |
3577 (interactive) | |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3578 (or (one-window-p) (delete-window)) |
18050 | 3579 (switch-to-buffer (marker-buffer reftex-toc-return-marker)) |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3580 (reftex-re-enlarge) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3581 (goto-char (or (marker-position reftex-toc-return-marker) (point)))) |
18050 | 3582 (defun reftex-toc-quit-and-kill () |
3583 "Kill the *toc* buffer." | |
3584 (interactive) | |
3585 (kill-buffer "*toc*") | |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3586 (or (one-window-p) (delete-window)) |
18050 | 3587 (switch-to-buffer (marker-buffer reftex-toc-return-marker)) |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3588 (reftex-re-enlarge) |
18050 | 3589 (goto-char (marker-position reftex-toc-return-marker))) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3590 (defun reftex-toc-rescan (&rest ignore) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3591 "Regenerate the *toc* buffer by reparsing file of section at point." |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3592 (interactive) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3593 (if reftex-enable-partial-scans |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3594 (let ((file (nth 3 (get-text-property (point) 'toc)))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3595 (if (not file) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3596 (error "Don't know which file to rescan. Try `R'.") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3597 (switch-to-buffer-other-window |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3598 (reftex-get-file-buffer-force file)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3599 (setq current-prefix-arg '(4)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3600 (reftex-toc))) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3601 (reftex-toc-Rescan)) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3602 (reftex-kill-temporary-buffers)) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3603 (defun reftex-toc-Rescan (&rest ignore) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3604 "Regenerate the *toc* buffer by reparsing the entire document." |
18050 | 3605 (interactive) |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3606 (switch-to-buffer-other-window |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3607 (reftex-get-file-buffer-force reftex-last-toc-file)) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3608 (setq current-prefix-arg '(16)) |
18050 | 3609 (reftex-toc)) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3610 (defun reftex-toc-revert (&rest ignore) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3611 "Regenerate the *toc* from the internal lists." |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3612 (interactive) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3613 (switch-to-buffer-other-window |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3614 (reftex-get-file-buffer-force reftex-last-toc-file)) |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3615 (reftex-erase-buffer "*toc*") |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3616 (setq current-prefix-arg nil) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3617 (reftex-toc)) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3618 (defun reftex-toc-external (&rest ignore) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3619 "Switch to table of contents of an external document." |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3620 (interactive) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3621 (let* ((old-buf (current-buffer)) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3622 (xr-alist (get-text-property 1 'xr-alist)) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3623 (xr-index (reftex-select-external-document |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3624 xr-alist 0))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3625 (switch-to-buffer-other-window (or (reftex-get-file-buffer-force |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3626 (cdr (nth xr-index xr-alist))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3627 (error "Cannot switch document"))) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3628 (reftex-toc) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3629 (if (equal old-buf (current-buffer)) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3630 (message "") |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3631 (message "Switched document")))) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3632 |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3633 (defun reftex-toc-visit-line (&optional final no-revisit) |
18050 | 3634 ;; Visit the tex file corresponding to the toc entry on the current line. |
3635 ;; If FINAL is t, stay there | |
3636 ;; If FINAL is 'hide, hide the *toc* window. | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3637 ;; Otherwise, move cursor back into *toc* window. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3638 ;; This function is pretty clever about finding back a section heading, |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3639 ;; even if the buffer is not live, or things like outline, x-symbol etc. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3640 ;; have been active. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3641 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3642 (let* ((toc (get-text-property (point) 'toc)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3643 (file (nth 3 toc)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3644 (marker (nth 4 toc)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3645 (level (nth 5 toc)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3646 (literal (nth 7 toc)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3647 (emergency-point (nth 8 toc)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3648 (toc-window (selected-window)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3649 show-window show-buffer match) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3650 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3651 (unless toc (error "Don't know which toc line to visit")) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3652 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3653 (setq match |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3654 (cond |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3655 ((and (markerp marker) (marker-buffer marker)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3656 ;; Buffer is still live and we have the marker. Should be easy. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3657 (switch-to-buffer-other-window (marker-buffer marker)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3658 (goto-char (marker-position marker)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3659 (or (looking-at (regexp-quote literal)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3660 (looking-at (reftex-make-regexp-allow-for-ctrl-m literal)) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3661 (looking-at (reftex-make-desperate-section-regexp literal)) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3662 (looking-at (concat "\\\\" |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3663 (regexp-quote |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3664 (car (rassq level |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3665 reftex-section-levels-all))) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3666 "[[{]")))) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3667 ((or (not no-revisit) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3668 (reftex-get-buffer-visiting file)) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3669 ;; Marker is lost. Use the backup method. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3670 (switch-to-buffer-other-window |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3671 (reftex-get-file-buffer-force file nil)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3672 (goto-char (or emergency-point (point-min))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3673 (or (looking-at (regexp-quote literal)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3674 (let ((pos (point))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3675 (re-search-backward "\\`\\|[\r\n][ \t]*[\r\n]" nil t) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3676 (or (reftex-nearest-match (regexp-quote literal) pos) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3677 (reftex-nearest-match |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3678 (reftex-make-regexp-allow-for-ctrl-m literal) pos) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3679 (reftex-nearest-match |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3680 (reftex-make-desperate-section-regexp literal) pos))))) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3681 (t (message reftex-no-follow-message) nil) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3682 )) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3683 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3684 (setq show-window (selected-window) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3685 show-buffer (current-buffer)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3686 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3687 (unless match |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3688 (select-window toc-window) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3689 (error "Cannot find line")) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3690 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3691 (goto-char (match-beginning 0)) |
18050 | 3692 (recenter 1) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3693 (reftex-highlight 0 (match-beginning 0) (match-end 0) (current-buffer)) |
18050 | 3694 |
3695 (select-window toc-window) | |
3696 | |
3697 ;; use the `final' parameter to decide what to do next | |
3698 (cond | |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3699 ((eq final t) |
18050 | 3700 (reftex-unhighlight 0) |
3701 (select-window show-window)) | |
3702 ((eq final 'hide) | |
3703 (reftex-unhighlight 0) | |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3704 (or (one-window-p) (delete-window)) |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3705 (switch-to-buffer show-buffer) |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3706 (reftex-re-enlarge)) |
18050 | 3707 (t nil)))) |
3708 | |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3709 (defun reftex-make-desperate-section-regexp (old) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3710 ;; Return a regexp which will still match a section statement even if |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3711 ;; x-symbol or isotex or the like have been at work in the mean time. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3712 (let* ((n (1+ (string-match "[[{]" old))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3713 (new (regexp-quote (substring old 0 (1+ (string-match "[[{]" old))))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3714 (old (substring old n))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3715 (while (string-match |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3716 "\\([\r\n]\\)\\|\\(\\`\\|[ \t\n\r]\\)\\([a-zA-Z0-9]+\\)\\([ \t\n\r]\\|}\\'\\)" |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3717 old) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3718 (if (match-beginning 1) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3719 (setq new (concat new "[^\n\r]*[\n\r]")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3720 (setq new (concat new "[^\n\r]*" (match-string 3 old)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3721 (setq old (substring old (match-end 0)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3722 new)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3723 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3724 ;;; ========================================================================= |
18050 | 3725 ;;; |
3726 ;;; BibTeX citations. | |
3727 | |
3728 ;; Variables and constants | |
3729 | |
3730 ;; The history list of regular expressions used for citations | |
3731 (defvar reftex-cite-regexp-hist nil) | |
3732 | |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3733 ;; Prompt and help string for citation selection |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3734 (defconst reftex-citation-prompt |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3735 "Select: [n]ext [p]revious [r]estrict [ ]full_entry [q]uit RET [?]Help+more") |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3736 |
18050 | 3737 (defconst reftex-citation-help |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3738 " n / p Go to next/previous entry (Cursor motion works as well). |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3739 C-s / C-r Search forward/backward. Use repeated C-s/C-r as in isearch. |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3740 g / r Start over with new regexp / Refine with additional regexp. |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3741 SPC Show full database entry in other window. |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3742 f Toggle follow mode: Other window will follow with full db entry. |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3743 . Show insertion point. |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3744 q Quit without inserting \\cite macro into buffer. |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3745 TAB Enter citation key with completion. |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3746 RET Accept current entry (also on mouse-2) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3747 a / A Put all entries into single \cite / into many cite commands.") |
18050 | 3748 |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3749 (defvar reftex-select-bib-map nil |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3750 "Keymap used for *RefTeX Select* buffer, when selecting a BibTeX entry. |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3751 This keymap can be used to configure the BibTeX selection process which is |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3752 started with the command \\[reftex-citation].") |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3753 |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3754 (defun reftex-select-bib-mode () |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3755 "Major mode for selecting a citation key in a LaTeX document. |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3756 This buffer was created with RefTeX. |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3757 It only has a meaningful keymap when you are in the middle of a |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3758 selection process. |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3759 In order to select a citation, move the cursor to it and press RET. |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3760 Press `?' for a summary of important key bindings. |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3761 |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3762 During a selection process, these are the local bindings. |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3763 |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3764 \\{reftex-select-label-map}" |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3765 (interactive) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3766 (kill-all-local-variables) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3767 (make-local-hook 'pre-command-hook) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3768 (make-local-hook 'post-command-hook) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3769 (setq major-mode 'reftex-select-bib-mode |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3770 mode-name "RefTeX Select Bib") |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3771 ;; We do not set a local map - reftex-select-item does this. |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3772 (run-hooks 'reftex-select-bib-mode-hook)) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3773 |
18050 | 3774 ;; Find bibtex files |
3775 | |
3776 (defun reftex-get-bibfile-list () | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3777 ;; Return list of bibfiles for current document. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3778 ;; When using the chapterbib or bibunits package you should either |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3779 ;; use the same database files everywhere, or separate parts using |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3780 ;; different databases into different files (included into the mater file). |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3781 ;; Then this function will return the applicable database files. |
18050 | 3782 |
3783 ;; Ensure access to scanning info | |
3784 (reftex-access-scan-info) | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3785 (or |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3786 ;; Try inside this file (and its includes) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3787 (cdr (reftex-last-assoc-before-elt |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3788 'bib (list 'eof (buffer-file-name)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3789 (member (list 'bof (buffer-file-name)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3790 (symbol-value reftex-docstruct-symbol)))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3791 ;; Try after the beginning of this file |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3792 (cdr (assq 'bib (member (list 'bof (buffer-file-name)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3793 (symbol-value reftex-docstruct-symbol)))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3794 ;; Anywhere in the entire document |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3795 (cdr (assq 'bib (symbol-value reftex-docstruct-symbol))) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3796 (error "\\bibliography statement missing or .bib files not found."))) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3797 |
18050 | 3798 ;; Find a certain reference in any of the BibTeX files. |
3799 | |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3800 (defun reftex-pop-to-bibtex-entry (key file-list &optional mark-to-kill |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3801 highlight item return) |
18050 | 3802 ;; Find BibTeX KEY in any file in FILE-LIST in another window. |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3803 ;; If MARK-TO-KILL is non-nil, mark new buffer to kill. |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3804 ;; If HIGHLIGHT is non-nil, highlight the match. |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3805 ;; If ITEM in non-nil, search for bibitem instead of database entry. |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3806 ;; If ECHO is non-nil, just display short info in echo area. |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3807 |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3808 (let* ((re |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3809 (if item |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3810 (concat "\\\\bibitem\\(\\[[^]]*\\]\\)?{" (regexp-quote key) "}") |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3811 (concat "@[a-zA-Z]+[ \t\n\r]*[{(][ \t\n\r]*" (regexp-quote key) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3812 "[, \t\r\n}]"))) |
18050 | 3813 (window-conf (current-window-configuration)) |
3814 file buf) | |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3815 |
18050 | 3816 (catch 'exit |
3817 (switch-to-buffer-other-window (current-buffer)) | |
3818 (while file-list | |
3819 (setq file (car file-list) | |
3820 file-list (cdr file-list)) | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3821 (unless (setq buf (reftex-get-file-buffer-force file mark-to-kill)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3822 (error "No such file %s" file)) |
18050 | 3823 (switch-to-buffer buf) |
3824 (widen) | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3825 (goto-char (point-min)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3826 (when (re-search-forward re nil t) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3827 (goto-char (match-beginning 0)) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3828 (when return |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3829 ;; Just return the relevant entry |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3830 (setq return |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3831 (if item |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3832 (buffer-substring |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3833 (goto-char (match-end 0)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3834 (if (re-search-forward |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3835 "\\\\bibitem\\|\\\\end{thebibliography}" nil t) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3836 (match-beginning 0) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3837 (point))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3838 (buffer-substring (point) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3839 (condition-case nil |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3840 (progn (forward-list 1) (point)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3841 (error (point)))))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3842 (set-window-configuration window-conf) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3843 (throw 'exit return)) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3844 (recenter 0) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3845 (if highlight |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3846 (reftex-highlight 0 (match-beginning 0) (match-end 0))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3847 (throw 'exit (selected-window)))) |
18050 | 3848 (set-window-configuration window-conf) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3849 (if item |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3850 (error "No \\bibitem with citation key %s" key) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3851 (error "No BibTeX entry with citation key %s" key))))) |
18050 | 3852 |
3853 ;; Parse bibtex buffers | |
3854 | |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3855 (defun reftex-extract-bib-entries (buffers) |
18050 | 3856 ;; Extract bib entries which match regexps from BUFFERS. |
3857 ;; BUFFERS is a list of buffers or file names. | |
3858 ;; Return list with entries." | |
3859 (let* (re-list first-re rest-re | |
3860 (buffer-list (if (listp buffers) buffers (list buffers))) | |
3861 found-list entry buffer1 buffer alist | |
3862 key-point start-point end-point) | |
3863 | |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3864 ;; Read a regexp, completing on known citation keys. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3865 (setq re-list |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3866 (split-string |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3867 (completing-read |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3868 "RegExp [ && RegExp...]: " |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3869 (if (fboundp 'LaTeX-bibitem-list) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3870 (LaTeX-bibitem-list) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3871 (cdr (assoc 'bibview-cache |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3872 (symbol-value reftex-docstruct-symbol)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3873 nil nil nil 'reftex-cite-regexp-hist) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3874 "[ \t]*&&[ \t]*")) |
18050 | 3875 |
3876 (setq first-re (car re-list) ; We'll use the first re to find things, | |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3877 rest-re (cdr re-list)) ; the others to narrow down. |
18050 | 3878 (if (string-match "\\`[ \t]*\\'" first-re) |
3879 (error "Empty regular expression")) | |
3880 | |
3881 (save-excursion | |
3882 (save-window-excursion | |
3883 | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3884 ;; Walk through all bibtex files |
18050 | 3885 (while buffer-list |
3886 (setq buffer (car buffer-list) | |
3887 buffer-list (cdr buffer-list)) | |
3888 (if (and (bufferp buffer) | |
3889 (buffer-live-p buffer)) | |
3890 (setq buffer1 buffer) | |
3891 (setq buffer1 (reftex-get-file-buffer-force | |
3892 buffer (not reftex-keep-temporary-buffers)))) | |
3893 (if (not buffer1) | |
3894 (error "Cannot find BibTeX file %s" buffer) | |
3895 (message "Scanning bibliography database %s" buffer1)) | |
3896 | |
3897 (set-buffer buffer1) | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3898 (save-excursion |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3899 (goto-char (point-min)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3900 (while (re-search-forward first-re nil t) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3901 (catch 'search-again |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3902 (setq key-point (point)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3903 (unless (re-search-backward |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3904 "\\(\\`\\|[\n\r]\\)[ \t]*@\\([a-zA-Z]+\\)[ \t\n\r]*[{(]" nil t) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3905 (throw 'search-again nil)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3906 (setq start-point (point)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3907 (goto-char (match-end 0)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3908 (condition-case nil |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3909 (up-list 1) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3910 (error (goto-char key-point) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3911 (throw 'search-again nil))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3912 (setq end-point (point)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3913 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3914 ;; Ignore @string, @comment and @c entries or things |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3915 ;; outside entries |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3916 (when (or (string= (downcase (match-string 2)) "string") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3917 (string= (downcase (match-string 2)) "comment") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3918 (string= (downcase (match-string 2)) "c") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3919 (< (point) key-point)) ; this means match not in {} |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3920 (goto-char key-point) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3921 (throw 'search-again nil)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3922 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3923 ;; Well, we have got a match |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3924 (setq entry (concat |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3925 (buffer-substring start-point (point)) "\n")) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3926 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3927 ;; Check if other regexp match as well |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3928 (setq re-list rest-re) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3929 (while re-list |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3930 (unless (string-match (car re-list) entry) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3931 ;; nope - move on |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3932 (throw 'search-again nil)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3933 (pop re-list)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3934 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3935 (setq alist (reftex-parse-bibtex-entry |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3936 nil start-point end-point)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3937 (push (cons "&entry" entry) alist) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3938 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3939 ;; check for crossref entries |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3940 (if (assoc "crossref" alist) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3941 (setq alist |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3942 (append |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3943 alist (reftex-get-crossref-alist alist)))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3944 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3945 ;; format the entry |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3946 (push (cons "&formatted" (reftex-format-bib-entry alist)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3947 alist) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3948 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3949 ;; make key the first element |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3950 (push (reftex-get-bib-field "&key" alist) alist) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3951 |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3952 ;; add it to the list |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3953 (push alist found-list)))) |
18050 | 3954 (reftex-kill-temporary-buffers)))) |
3955 (setq found-list (nreverse found-list)) | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3956 |
18050 | 3957 ;; Sorting |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3958 (cond |
18050 | 3959 ((eq 'author reftex-sort-bibtex-matches) |
3960 (sort found-list 'reftex-bib-sort-author)) | |
3961 ((eq 'year reftex-sort-bibtex-matches) | |
3962 (sort found-list 'reftex-bib-sort-year)) | |
3963 ((eq 'reverse-year reftex-sort-bibtex-matches) | |
3964 (sort found-list 'reftex-bib-sort-year-reverse)) | |
3965 (t found-list)))) | |
3966 | |
3967 (defun reftex-bib-sort-author (e1 e2) | |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3968 (let ((al1 (reftex-get-bib-names "author" e1)) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3969 (al2 (reftex-get-bib-names "author" e2))) |
18050 | 3970 (while (and al1 al2 (string= (car al1) (car al2))) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3971 (pop al1) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3972 (pop al2)) |
18050 | 3973 (if (and (stringp (car al1)) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3974 (stringp (car al2))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3975 (string< (car al1) (car al2)) |
18050 | 3976 (not (stringp (car al1)))))) |
3977 | |
3978 (defun reftex-bib-sort-year (e1 e2) | |
3979 (< (string-to-int (cdr (assoc "year" e1))) | |
3980 (string-to-int (cdr (assoc "year" e2))))) | |
3981 | |
3982 (defun reftex-bib-sort-year-reverse (e1 e2) | |
3983 (> (string-to-int (or (cdr (assoc "year" e1)) "0")) | |
3984 (string-to-int (or (cdr (assoc "year" e2)) "0")))) | |
3985 | |
3986 (defun reftex-get-crossref-alist (entry) | |
3987 ;; return the alist from a crossref entry | |
3988 (let ((crkey (cdr (assoc "crossref" entry))) | |
3989 start) | |
3990 (save-excursion | |
3991 (save-restriction | |
3992 (widen) | |
3993 (if (re-search-forward | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3994 (concat "@\\w+[{(][ \t\n\r]*" (regexp-quote crkey) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3995 "[ \t\n\r]*,") nil t) |
18050 | 3996 (progn |
3997 (setq start (match-beginning 0)) | |
3998 (condition-case nil | |
3999 (up-list 1) | |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4000 (error nil)) |
18050 | 4001 (reftex-parse-bibtex-entry nil start (point))) |
4002 nil))))) | |
4003 | |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4004 ;; Parse the thebibliography environment |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4005 (defun reftex-extract-bib-entries-from-thebibliography (file) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4006 ;; Extract bib-entries from the \begin{thebibliography} environment. |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4007 ;; Parsing is not as good as for the BibTeX database stuff. |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4008 ;; The environment should be located in file FILE. |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4009 |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4010 (let* (start end buf entries re re-list) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4011 (unless file |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4012 (error "Need file name to find thebibliography environment")) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4013 (setq buf (reftex-get-file-buffer-force |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4014 file (not reftex-keep-temporary-buffers))) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4015 (unless buf |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4016 (error "No such file %s" file)) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4017 (message "Scanning thebibliography environment in %s" file) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4018 |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4019 (save-excursion |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4020 (set-buffer buf) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4021 (save-restriction |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4022 (widen) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4023 (goto-char (point-min)) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4024 (if (re-search-forward |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4025 "\\(\\`\\|[\n\r]\\)[ \t]*\\\\begin{thebibliography}" nil t) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4026 (progn |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4027 (beginning-of-line 2) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4028 (setq start (point)))) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4029 (if (re-search-forward |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4030 "\\(\\`\\|[\n\r]\\)[ \t]*\\\\end{thebibliography}" nil t) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4031 (progn |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4032 (beginning-of-line 1) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4033 (setq end (point)))) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4034 (when (and start end) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4035 (setq entries |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4036 (mapcar 'reftex-parse-bibitem |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4037 (delete "" |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4038 (split-string |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4039 (buffer-substring-no-properties start end) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4040 "[ \t\n\r]*\\\\bibitem\\(\\[[^]]*]\\)*"))))))) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4041 (unless entries |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4042 (error "No bibitems found")) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4043 |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4044 (setq re-list (split-string |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4045 (read-string "RegExp [ && RegExp...]: " |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4046 nil 'reftex-cite-regexp-hist) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4047 "[ \t]*&&[ \t]*")) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4048 (if (string-match "\\`[ \t]*\\'" (car re-list)) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4049 (error "Empty regular expression")) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4050 |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4051 (while (and (setq re (pop re-list)) entries) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4052 (setq entries |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4053 (delq nil (mapcar |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4054 (function |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4055 (lambda (x) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4056 (if (string-match re (cdr (assoc "&entry" x))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4057 x nil))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4058 entries)))) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4059 (setq entries |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4060 (mapcar |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4061 (lambda (x) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4062 (push (cons "&formatted" (reftex-format-bibitem x)) x) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4063 (push (reftex-get-bib-field "&key" x) x) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4064 x) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4065 entries)) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4066 |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4067 entries)) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4068 |
18050 | 4069 ;; Parse and format individual entries |
4070 | |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4071 (defun reftex-get-bib-names (field entry) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4072 ;; Return a list with the author or editor names in ENTRY |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4073 (let ((names (reftex-get-bib-field field entry))) |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4074 (if (equal "" names) |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4075 (setq names (reftex-get-bib-field "editor" entry))) |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4076 (while (string-match "\\band\\b[ \t]*" names) |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4077 (setq names (replace-match "\n" nil t names))) |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4078 (while (string-match "[\\.a-zA-Z\\-]+\\.[ \t]*\\|,.*\\|[{}]+" names) |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4079 (setq names (replace-match "" nil t names))) |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4080 (while (string-match "^[ \t]+\\|[ \t]+$" names) |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4081 (setq names (replace-match "" nil t names))) |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4082 (while (string-match "[ \t][ \t]+" names) |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4083 (setq names (replace-match " " nil t names))) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4084 (split-string names "\n"))) |
18050 | 4085 |
4086 (defun reftex-parse-bibtex-entry (entry &optional from to) | |
4087 (let (alist key start field) | |
4088 (save-excursion | |
4089 (save-restriction | |
4090 (if entry | |
4091 (progn | |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4092 (set-buffer (get-buffer-create " *RefTeX-scratch*")) |
18050 | 4093 (fundamental-mode) |
4094 (erase-buffer) | |
4095 (insert entry)) | |
4096 (widen) | |
4097 (narrow-to-region from to)) | |
4098 (goto-char (point-min)) | |
4099 | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4100 (if (re-search-forward |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
4101 "@\\(\\w+\\)[ \t\n\r]*[{(][ \t\n\r]*\\([^ \t\n\r,]+\\)" nil t) |
18050 | 4102 (setq alist |
4103 (list | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4104 (cons "&type" (downcase (reftex-match-string 1))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4105 (cons "&key" (reftex-match-string 2))))) |
18050 | 4106 (while (re-search-forward "\\(\\w+\\)[ \t\n\r]*=[ \t\n\r]*" nil t) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4107 (setq key (downcase (reftex-match-string 1))) |
18050 | 4108 (cond |
4109 ((= (following-char) ?{) | |
4110 (forward-char 1) | |
4111 (setq start (point)) | |
4112 (condition-case nil | |
4113 (up-list 1) | |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4114 (error nil))) |
18050 | 4115 ((= (following-char) ?\") |
4116 (forward-char 1) | |
4117 (setq start (point)) | |
4118 (while (and (search-forward "\"" nil t) | |
4119 (= ?\\ (char-after (- (point) 2)))))) | |
4120 (t | |
4121 (setq start (point)) | |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4122 (re-search-forward "[ \t]*[\n\r,}]" nil 1))) |
18050 | 4123 (setq field (buffer-substring-no-properties start (1- (point)))) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4124 ;; remove extra whitespace |
18050 | 4125 (while (string-match "[\n\t\r]\\|[ \t][ \t]+" field) |
4126 (setq field (replace-match " " nil t field))) | |
4127 ;; remove leading garbage | |
4128 (if (string-match "^[ \t{]+" field) | |
4129 (setq field (replace-match "" nil t field))) | |
4130 ;; remove trailing garbage | |
4131 (if (string-match "[ \t}]+$" field) | |
4132 (setq field (replace-match "" nil t field))) | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4133 (push (cons key field) alist)))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4134 alist)) |
18050 | 4135 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4136 (defun reftex-get-bib-field (fieldname entry &optional format) |
18050 | 4137 ;; Extract the field FIELDNAME from an ENTRY |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4138 (let ((cell (assoc fieldname entry))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4139 (if cell |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4140 (if format |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4141 (format format (cdr cell)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4142 (cdr cell)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4143 ""))) |
18050 | 4144 |
4145 (defun reftex-format-bib-entry (entry) | |
4146 ;; Format a BibTeX ENTRY so that it is nice to look at | |
4147 (let* | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4148 ((auth-list (reftex-get-bib-names "author" entry)) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4149 (authors (mapconcat 'identity auth-list ", ")) |
18050 | 4150 (year (reftex-get-bib-field "year" entry)) |
4151 (title (reftex-get-bib-field "title" entry)) | |
4152 (type (reftex-get-bib-field "&type" entry)) | |
4153 (key (reftex-get-bib-field "&key" entry)) | |
4154 (extra | |
4155 (cond | |
4156 ((equal type "article") | |
4157 (concat (reftex-get-bib-field "journal" entry) " " | |
4158 (reftex-get-bib-field "volume" entry) ", " | |
4159 (reftex-get-bib-field "pages" entry))) | |
4160 ((equal type "book") | |
4161 (concat "book (" (reftex-get-bib-field "publisher" entry) ")")) | |
4162 ((equal type "phdthesis") | |
4163 (concat "PhD: " (reftex-get-bib-field "school" entry))) | |
4164 ((equal type "mastersthesis") | |
4165 (concat "Master: " (reftex-get-bib-field "school" entry))) | |
4166 ((equal type "inbook") | |
4167 (concat "Chap: " (reftex-get-bib-field "chapter" entry) | |
4168 ", pp. " (reftex-get-bib-field "pages" entry))) | |
4169 ((or (equal type "conference") | |
4170 (equal type "incollection") | |
4171 (equal type "inproceedings")) | |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4172 (reftex-get-bib-field "booktitle" entry "in: %s")) |
18050 | 4173 (t "")))) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4174 (setq authors (reftex-truncate authors 30 t t)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4175 (when (reftex-use-fonts) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4176 (put-text-property 0 (length key) 'face |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4177 (reftex-verified-face reftex-label-face |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4178 'font-lock-constant-face |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4179 'font-lock-reference-face) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4180 key) |
21114
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
4181 (put-text-property 0 (length authors) 'face reftex-bib-author-face |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4182 authors) |
21114
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
4183 (put-text-property 0 (length year) 'face reftex-bib-year-face |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
4184 year) |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
4185 (put-text-property 0 (length title) 'face reftex-bib-title-face |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4186 title) |
21114
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
4187 (put-text-property 0 (length extra) 'face reftex-bib-extra-face |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4188 extra)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4189 (concat key "\n " authors " " year " " extra "\n " title "\n\n"))) |
18050 | 4190 |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4191 (defun reftex-parse-bibitem (item) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4192 ;; Parse a \bibitem entry |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4193 (let ((key "") (text "")) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4194 (when (string-match "\\`{\\([^}]+\\)}\\([\001-\255]*\\)" item) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4195 (setq key (match-string 1 item) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4196 text (match-string 2 item))) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4197 ;; Clean up the text a little bit |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4198 (while (string-match "[\n\r\t]\\|[ \t][ \t]+" text) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4199 (setq text (replace-match " " nil t text))) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4200 (if (string-match "\\`[ \t]+" text) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4201 (setq text (replace-match "" nil t text))) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4202 (list |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4203 (cons "&key" key) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4204 (cons "&text" text) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4205 (cons "&entry" (concat key " " text))))) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4206 |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4207 (defun reftex-format-bibitem (item) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4208 ;; Format a \bibitem entry so that it is (relatively) nice to look at. |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4209 (let ((text (reftex-get-bib-field "&text" item)) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4210 (key (reftex-get-bib-field "&key" item)) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4211 (lines nil)) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4212 |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4213 ;; Wrap the text into several lines. |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4214 (while (and (> (length text) 70) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4215 (string-match " " (substring text 60))) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4216 (push (substring text 0 (+ 60 (match-beginning 0))) lines) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4217 (setq text (substring text (+ 61 (match-beginning 0))))) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4218 (push text lines) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4219 (setq text (mapconcat 'identity (nreverse lines) "\n ")) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4220 |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4221 (when (reftex-use-fonts) |
21114
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
4222 (put-text-property 0 (length text) 'face reftex-bib-author-face text)) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4223 (concat key "\n " text "\n\n"))) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4224 |
18050 | 4225 ;; Make a citation |
4226 | |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4227 ;;;###autoload |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4228 (defun reftex-citation (&optional no-insert) |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
4229 "Make a citation using BibTeX database files. |
18050 | 4230 After asking for a Regular Expression, it scans the buffers with |
4231 bibtex entries (taken from the \\bibliography command) and offers the | |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
4232 matching entries for selection. The selected entry is formated according |
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
4233 to `reftex-cite-format' and inserted into the buffer. |
18050 | 4234 If NO-INSERT is non-nil, nothing is inserted, only the selected key returned. |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
4235 The regular expression uses an expanded syntax: && is interpreted as `and'. |
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
4236 Thus, `aaaa&&bbb' matches entries which contain both `aaaa' and `bbb'. |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4237 While entering the regexp, completion on knows citation keys is possible. |
18123 | 4238 When this function is called with point inside the braces of a \\cite |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
4239 command, it will add another key, ignoring the value of `reftex-cite-format'. |
18050 | 4240 When called with a numeric prefix, that many citations will be made and all |
18123 | 4241 put into the same \\cite command. |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4242 When called with just or two C-u as prefix, enforces rescan of buffer for |
18050 | 4243 bibliography statement (e.g. if it was changed)." |
4244 | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4245 (interactive) |
18050 | 4246 |
4247 ;; check for recursive edit | |
4248 (reftex-check-recursive-edit) | |
4249 | |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4250 ;; This function may also be called outside reftex-mode. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4251 ;; Thus look for the scanning info only if in reftex-mode. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4252 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4253 (when reftex-mode |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4254 (reftex-access-scan-info current-prefix-arg)) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4255 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4256 ;; Call reftex-do-citation, but protected |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4257 (unwind-protect |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4258 (reftex-do-citation current-prefix-arg no-insert) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4259 (reftex-kill-temporary-buffers))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4260 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4261 (defun reftex-do-citation (&optional arg no-insert) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4262 ;; This really does the work of reftex-citation. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4263 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4264 (let* ((format (reftex-figure-out-cite-format arg no-insert)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4265 (docstruct-symbol reftex-docstruct-symbol) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4266 (selected-entries (reftex-offer-bib-menu)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4267 (insert-entries selected-entries) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4268 entry string cite-view) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4269 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4270 (unless selected-entries (error "Quit")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4271 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4272 (if (stringp selected-entries) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4273 ;; Nonexistent entry |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4274 (setq selected-entries nil |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4275 insert-entries (list (list selected-entries |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4276 (cons "&key" selected-entries)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4277 ;; It makes sense to compute the cite-view strings. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4278 (setq cite-view t)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4279 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4280 (when (eq (car selected-entries) 'concat) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4281 ;; All keys go into a single command - we need to trick a little |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4282 (pop selected-entries) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4283 (let ((concat-keys (mapconcat 'car selected-entries ","))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4284 (setq insert-entries |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4285 (list (list concat-keys (cons "&key" concat-keys)))))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4286 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4287 (unless no-insert |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4288 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4289 ;; We shall insert this into the buffer... |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4290 (message "Formatting...") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4291 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4292 (while (setq entry (pop insert-entries)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4293 ;; Format the citation and insert it |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4294 (setq string (if reftex-format-cite-function |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4295 (funcall reftex-format-cite-function |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4296 (reftex-get-bib-field "&key" entry) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4297 format) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4298 (reftex-format-citation entry format))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4299 (insert string)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4300 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4301 ;; Reposition cursor? |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4302 (when (string-match "\\?" string) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4303 (search-backward "?") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4304 (delete-char 1)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4305 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4306 ;; Tell AUCTeX |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4307 (when (and (fboundp 'LaTeX-add-bibitems) reftex-plug-into-AUCTeX) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4308 (apply 'LaTeX-add-bibitems (mapcar 'car selected-entries))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4309 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4310 ;; Produce the cite-view strings |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4311 (when (and reftex-cache-cite-echo cite-view) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4312 (mapcar (lambda (entry) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4313 (reftex-make-cite-echo-string entry docstruct-symbol)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4314 selected-entries)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4315 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4316 (message "")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4317 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4318 (set-marker reftex-select-return-marker nil) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4319 (reftex-kill-buffer "*RefTeX Select*") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4320 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4321 ;; Check if the prefix arg was numeric, and call recursively |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4322 (when (integerp arg) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4323 (if (> arg 1) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4324 (progn |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4325 (skip-chars-backward "}") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4326 (decf arg) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4327 (reftex-do-citation arg)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4328 (forward-char 1))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4329 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4330 ;; Return the citation key |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4331 (car (car selected-entries)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4332 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4333 (defun reftex-figure-out-cite-format (arg no-insert) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4334 ;; Check if there is already a cite command at point and change cite format |
18050 | 4335 ;; in order to only add another reference in the same cite command. |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4336 (let ((macro (car (reftex-what-macro 1))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4337 (cite-format-value (reftex-get-cite-format)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4338 key format) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4339 (cond |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4340 (no-insert |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4341 ;; Format does not really matter because nothing will be inserted. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4342 (setq format "%l")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4343 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4344 ((and (stringp macro) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4345 (string-match "\\`\\\\cite\\|cite\\'" macro)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4346 ;; We are already inside a cite macro |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4347 (if (or (not arg) (not (listp arg))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4348 (setq format |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4349 (concat |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4350 (if (member (preceding-char) '(?\{ ?,)) "" ",") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4351 "%l" |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4352 (if (member (following-char) '(?\} ?,)) "" ","))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4353 (setq format "%l"))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4354 (t |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4355 ;; Figure out the correct format |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4356 (setq format |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4357 (if (and (symbolp cite-format-value) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4358 (assq cite-format-value reftex-cite-format-builtin)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4359 (nth 2 (assq cite-format-value reftex-cite-format-builtin)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4360 cite-format-value)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4361 (when (listp format) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4362 (setq key |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4363 (reftex-select-with-char |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4364 "" (concat "SELECT A CITATION FORMAT\n\n" |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4365 (mapconcat |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4366 (lambda (x) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4367 (format "[%c] %s %s" (car x) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4368 (if (> (car x) 31) " " "") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4369 (cdr x))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4370 format "\n")))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4371 (if (assq key format) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4372 (setq format (cdr (assq key format))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4373 (error "No citation format associated with key `%c'" key))))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4374 format)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4375 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4376 (defun reftex-get-cite-format () |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4377 ;; Return the current citation format. Either the document-local value in |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4378 ;; reftex-cite-format-symbol, or the global value in reftex-cite-format. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4379 (if (and reftex-docstruct-symbol |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4380 (symbolp reftex-docstruct-symbol) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4381 (get reftex-docstruct-symbol 'reftex-cite-format)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4382 (get reftex-docstruct-symbol 'reftex-cite-format) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4383 reftex-cite-format)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4384 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4385 (defun reftex-offer-bib-menu () |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4386 ;; Offer bib menu and return list of selected items |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4387 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4388 (let (found-list rtn key data selected-entries) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4389 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4390 (while |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4391 (not |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4392 (catch 'done |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4393 ;; Scan bibtex files |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4394 (setq found-list |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4395 (cond |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4396 ((assq 'bib (symbol-value reftex-docstruct-symbol)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4397 ;; using BibTeX database files. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4398 (reftex-extract-bib-entries (reftex-get-bibfile-list))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4399 ((assq 'thebib (symbol-value reftex-docstruct-symbol)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4400 ;; using thebibliography environment. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4401 (reftex-extract-bib-entries-from-thebibliography |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4402 (cdr (assq 'thebib (symbol-value reftex-docstruct-symbol))))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4403 (reftex-default-bibliography |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4404 (message "Using default bibliography") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4405 (reftex-extract-bib-entries reftex-default-bibliography)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4406 (t (error "No valid bibliography in this document, and no default available")))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4407 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4408 (unless found-list |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4409 (error "Sorry, no matches found")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4410 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4411 ;; Remember where we came from |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4412 (setq reftex-call-back-to-this-buffer (current-buffer)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4413 (set-marker reftex-select-return-marker (point)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4414 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4415 ;; Offer selection |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4416 (save-window-excursion |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4417 (delete-other-windows) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4418 (let ((default-major-mode 'reftex-select-bib-mode)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4419 (reftex-kill-buffer "*RefTeX Select*") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4420 (switch-to-buffer-other-window "*RefTeX Select*") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4421 (unless (eq major-mode 'reftex-select-bib-mode) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4422 (reftex-select-bib-mode)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4423 (let ((buffer-read-only nil)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4424 (erase-buffer) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4425 (reftex-insert-bib-matches found-list))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4426 (setq buffer-read-only t) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4427 (if (= 0 (buffer-size)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4428 (error "Sorry, no matches found")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4429 (setq truncate-lines t) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4430 (goto-char 1) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4431 (while t |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4432 (setq rtn |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4433 (reftex-select-item |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4434 reftex-citation-prompt |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4435 reftex-citation-help |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4436 reftex-select-bib-map |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4437 nil |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4438 'reftex-bibtex-selection-callback nil)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4439 (setq key (car rtn) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4440 data (nth 1 rtn)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4441 (unless key (throw 'done t)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4442 (cond |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4443 ((eq key ?g) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4444 ;; Start over |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4445 (throw 'done nil)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4446 ((eq key ?r) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4447 ;; Restrict with new regular expression |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4448 (setq found-list (reftex-restrict-bib-matches found-list)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4449 (let ((buffer-read-only nil)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4450 (erase-buffer) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4451 (reftex-insert-bib-matches found-list)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4452 (goto-char 1)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4453 ((eq key ?A) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4454 ;; Take all |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4455 (setq selected-entries found-list) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4456 (throw 'done t)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4457 ((eq key ?a) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4458 ;; Take all |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4459 (setq selected-entries (cons 'concat found-list)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4460 (throw 'done t)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4461 ((or (eq key ?\C-m) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4462 (eq key 'return)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4463 ;; Take selected |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4464 (setq selected-entries (if data (list data) nil)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4465 (throw 'done t)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4466 ((stringp key) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4467 ;; Got this one with completion |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4468 (setq selected-entries key) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4469 (throw 'done t)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4470 (t |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4471 (ding)))))))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4472 selected-entries)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4473 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4474 (defun reftex-restrict-bib-matches (found-list) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4475 ;; Limit FOUND-LIST with more regular expressions |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4476 (let ((re-list (split-string (read-string |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4477 "RegExp [ && RegExp...]: " |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4478 nil 'reftex-cite-regexp-hist) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4479 "[ \t]*&&[ \t]*")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4480 (found-list-r found-list) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4481 re) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4482 (while (setq re (pop re-list)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4483 (setq found-list-r |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4484 (delq nil |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4485 (mapcar |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4486 (lambda (x) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4487 (if (string-match |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4488 re (cdr (assoc "&entry" x))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4489 x |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4490 nil)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4491 found-list-r)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4492 (if found-list-r |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4493 found-list-r |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4494 (ding) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4495 found-list))) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4496 |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4497 (defun reftex-insert-bib-matches (list) |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4498 ;; Insert the bib matches and number them correctly |
21114
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
4499 (let ((mouse-face |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
4500 (if (memq reftex-highlight-selection '(mouse both)) |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
4501 reftex-mouse-selected-face |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
4502 nil)) |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
4503 tmp len) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4504 (mapcar |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4505 (function |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4506 (lambda (x) |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4507 (setq tmp (cdr (assoc "&formatted" x)) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4508 len (length tmp)) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4509 (put-text-property 0 len ':data x tmp) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4510 (put-text-property 0 (1- len) 'mouse-face mouse-face tmp) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4511 (insert tmp))) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4512 list)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4513 (run-hooks 'reftex-display-copied-context-hook)) |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4514 |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4515 (defun reftex-format-names (namelist n) |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4516 (let (last (len (length namelist))) |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4517 (cond |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4518 ((< len 1) "") |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4519 ((= 1 len) (car namelist)) |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4520 ((> len n) (concat (car namelist) (nth 2 reftex-cite-punctuation))) |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4521 (t |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4522 (setq n (min len n) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4523 last (nth (1- n) namelist)) |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4524 (setcdr (nthcdr (- n 2) namelist) nil) |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4525 (concat |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4526 (mapconcat 'identity namelist (nth 0 reftex-cite-punctuation)) |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4527 (nth 1 reftex-cite-punctuation) |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4528 last))))) |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4529 |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4530 (defun reftex-format-citation (entry format) |
18050 | 4531 ;; Format a citation from the info in the BibTeX ENTRY |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4532 |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4533 (unless (stringp format) (setq format "\\cite{%l}")) |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4534 |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4535 (if (and reftex-comment-citations |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4536 (string-match "%l" reftex-cite-comment-format)) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4537 (error "reftex-cite-comment-format contains illegal %%l")) |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4538 |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4539 (while (string-match |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4540 "\\(\\`\\|[^%]\\)\\(\\(%\\([0-9]*\\)\\([a-zA-Z]\\)\\)[.,;: ]*\\)" |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4541 format) |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4542 (let ((n (string-to-int (match-string 4 format))) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4543 (l (string-to-char (match-string 5 format))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4544 rpl b e) |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4545 (save-match-data |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4546 (setq rpl |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4547 (cond |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4548 ((= l ?l) (concat |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4549 (reftex-get-bib-field "&key" entry) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4550 (if reftex-comment-citations |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4551 reftex-cite-comment-format |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4552 ""))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4553 ((= l ?a) (reftex-format-names |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4554 (reftex-get-bib-names "author" entry) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4555 (or n 2))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4556 ((= l ?A) (car (reftex-get-bib-names "author" entry))) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4557 ((= l ?b) (reftex-get-bib-field "booktitle" entry "in: %s")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4558 ((= l ?B) (reftex-abbreviate-title |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4559 (reftex-get-bib-field "booktitle" entry "in: %s"))) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4560 ((= l ?c) (reftex-get-bib-field "chapter" entry)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4561 ((= l ?d) (reftex-get-bib-field "edition" entry)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4562 ((= l ?e) (reftex-format-names |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4563 (reftex-get-bib-names "editor" entry) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4564 (or n 2))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4565 ((= l ?E) (car (reftex-get-bib-names "editor" entry))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4566 ((= l ?h) (reftex-get-bib-field "howpublished" entry)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4567 ((= l ?i) (reftex-get-bib-field "institution" entry)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4568 ((= l ?j) (reftex-get-bib-field "journal" entry)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4569 ((= l ?k) (reftex-get-bib-field "key" entry)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4570 ((= l ?m) (reftex-get-bib-field "month" entry)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4571 ((= l ?n) (reftex-get-bib-field "number" entry)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4572 ((= l ?o) (reftex-get-bib-field "organization" entry)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4573 ((= l ?p) (reftex-get-bib-field "pages" entry)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4574 ((= l ?P) (car (split-string |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4575 (reftex-get-bib-field "pages" entry) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4576 "[- .]+"))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4577 ((= l ?s) (reftex-get-bib-field "school" entry)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4578 ((= l ?u) (reftex-get-bib-field "publisher" entry)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4579 ((= l ?r) (reftex-get-bib-field "address" entry)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4580 ((= l ?t) (reftex-get-bib-field "title" entry)) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4581 ((= l ?T) (reftex-abbreviate-title |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4582 (reftex-get-bib-field "title" entry))) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4583 ((= l ?v) (reftex-get-bib-field "volume" entry)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4584 ((= l ?y) (reftex-get-bib-field "year" entry))))) |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4585 |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4586 (if (string= rpl "") |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4587 (setq b (match-beginning 2) e (match-end 2)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4588 (setq b (match-beginning 3) e (match-end 3))) |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4589 (setq format (concat (substring format 0 b) rpl (substring format e))))) |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4590 (while (string-match "%%" format) |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4591 (setq format (replace-match "%" t t format))) |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4592 (while (string-match "[ ,.;:]*%<" format) |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4593 (setq format (replace-match "" t t format))) |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4594 format) |
18050 | 4595 |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4596 (defun reftex-bibtex-selection-callback (data ignore no-revisit) |
18050 | 4597 ;; Callback function to be called from the BibTeX selection, in |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
4598 ;; order to display context. This function is relatively slow and not |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4599 ;; recommended for follow mode. It works OK for individual lookups. |
18050 | 4600 (let ((win (selected-window)) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4601 (key (reftex-get-bib-field "&key" data)) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4602 bibfile-list item tmp) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4603 |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4604 (catch 'exit |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4605 (save-excursion |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4606 (set-buffer reftex-call-back-to-this-buffer) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4607 (cond |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4608 ((assq 'bib (symbol-value reftex-docstruct-symbol)) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4609 (setq bibfile-list (reftex-get-bibfile-list))) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4610 ((setq tmp (assq 'thebib (symbol-value reftex-docstruct-symbol))) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4611 (setq bibfile-list (list (cdr tmp)) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4612 item t)) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4613 (reftex-default-bibliography |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4614 (setq bibfile-list reftex-default-bibliography)) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4615 (t (ding) (throw 'exit)))) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4616 |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4617 (when no-revisit |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4618 (setq bibfile-list (reftex-visited-files bibfile-list))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4619 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4620 (condition-case nil |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4621 (reftex-pop-to-bibtex-entry |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4622 key bibfile-list (not reftex-keep-temporary-buffers) t item) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4623 (error (ding)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4624 |
18050 | 4625 (select-window win))) |
4626 | |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4627 ;;; ========================================================================= |
18050 | 4628 ;;; |
4629 ;;; Here is the routine used for selection | |
4630 | |
4631 ;; Marker for return point from recursive edit | |
4632 (defvar reftex-recursive-edit-marker (make-marker)) | |
4633 | |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4634 (defvar reftex-last-data nil) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4635 (defvar reftex-last-line nil) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4636 |
18050 | 4637 (defun reftex-check-recursive-edit () |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
4638 ;; Check if we are already in a recursive edit. Abort with helpful |
18050 | 4639 ;; message if so. |
4640 (if (marker-position reftex-recursive-edit-marker) | |
4641 (error | |
4642 (substitute-command-keys | |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4643 "In unfinished selection process. Finish, or abort with \\[abort-recursive-edit].")))) |
18050 | 4644 |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4645 (defun reftex-select-item (prompt help-string keymap |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4646 &optional offset |
21115
fea2f6a2818d
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21114
diff
changeset
|
4647 call-back cb-flag) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4648 ;; Select an item, using PROMPT. The function returns a key indicating |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4649 ;; an exit status, along with a data structure indicating which item was |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4650 ;; selected. |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4651 ;; HELP-STRING contains help. KEYMAP is a keymap with the available |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4652 ;; selection commands. |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4653 ;; OFFSET can be a label list item which will be selected at start. |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4654 ;; When it is t, point will start out at the beginning of the buffer. |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4655 ;; Any other value will cause restart where last selection left off. |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4656 ;; When CALL-BACK is given, it is a function which is called with the index |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4657 ;; of the element. |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4658 ;; CB-FLAG is the initial value of that flag. |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4659 |
21075
0c95fb73e090
1998-03-06 Carsten Dominik <cd@delysid.gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21002
diff
changeset
|
4660 (let* (ev data last-data callback-fwd (selection-buffer (current-buffer))) |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4661 |
18050 | 4662 (setq ev |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4663 (catch 'myexit |
18050 | 4664 (save-window-excursion |
4665 (setq truncate-lines t) | |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4666 |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4667 ;; Find a good starting point |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4668 (cond |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4669 (offset |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4670 (goto-char |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4671 (or (and (listp offset) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4672 (text-property-any (point-min) (point-max) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4673 ':data offset)) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4674 (and (local-variable-p 'reftex-last-data (current-buffer)) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4675 (boundp 'reftex-last-data) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4676 (listp reftex-last-data) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4677 (text-property-any (point-min) (point-max) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4678 ':data reftex-last-data)) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4679 (and (local-variable-p 'reftex-last-line (current-buffer)) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4680 (boundp 'reftex-last-line) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4681 (integerp reftex-last-line) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4682 (progn (goto-line reftex-last-line) (point))) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4683 (point-min)))) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4684 (t (goto-char (point-min)))) |
18050 | 4685 (beginning-of-line 1) |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4686 (set (make-local-variable 'reftex-last-follow-point) (point)) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4687 |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4688 (unwind-protect |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4689 (progn |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4690 (use-local-map keymap) |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4691 (add-hook 'pre-command-hook 'reftex-select-pre-command-hook nil t) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4692 (add-hook 'post-command-hook 'reftex-select-post-command-hook nil t) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4693 (princ prompt) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4694 (set-marker reftex-recursive-edit-marker (point)) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4695 ;; XEmacs does not run post-command-hook here |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4696 (and (featurep 'xemacsp) (run-hooks 'post-command-hook)) |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4697 (recursive-edit)) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4698 |
21075
0c95fb73e090
1998-03-06 Carsten Dominik <cd@delysid.gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21002
diff
changeset
|
4699 (set-marker reftex-recursive-edit-marker nil) |
0c95fb73e090
1998-03-06 Carsten Dominik <cd@delysid.gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21002
diff
changeset
|
4700 (save-excursion |
0c95fb73e090
1998-03-06 Carsten Dominik <cd@delysid.gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21002
diff
changeset
|
4701 (set-buffer selection-buffer) |
0c95fb73e090
1998-03-06 Carsten Dominik <cd@delysid.gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21002
diff
changeset
|
4702 (use-local-map nil) |
0c95fb73e090
1998-03-06 Carsten Dominik <cd@delysid.gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21002
diff
changeset
|
4703 (remove-hook 'pre-command-hook 'reftex-select-pre-command-hook t) |
0c95fb73e090
1998-03-06 Carsten Dominik <cd@delysid.gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21002
diff
changeset
|
4704 (remove-hook 'post-command-hook |
0c95fb73e090
1998-03-06 Carsten Dominik <cd@delysid.gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21002
diff
changeset
|
4705 'reftex-select-post-command-hook t)))))) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4706 |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4707 (set (make-local-variable 'reftex-last-line) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4708 (+ (count-lines (point-min) (point)) (if (bolp) 1 0))) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4709 (set (make-local-variable 'reftex-last-data) last-data) |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4710 (reftex-kill-buffer "*RefTeX Help*") |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4711 (setq callback-fwd (not callback-fwd)) ;; ;-))) |
18050 | 4712 (message "") |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4713 (list ev data last-data))) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4714 |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4715 ;; The following variables are all bound dynamically in `reftex-select-item'. |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4716 ;; The defvars are here only to silence the byte compiler. |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4717 |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4718 (defvar found-list) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4719 (defvar cb-flag) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4720 (defvar data) |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4721 (defvar prompt) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4722 (defvar last-data) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4723 (defvar call-back) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4724 (defvar help-string) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4725 (defvar callback-fwd) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4726 (defvar varioref) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4727 |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4728 ;; The selection commands |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4729 |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4730 (defun reftex-select-pre-command-hook () |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4731 (reftex-unhighlight 1) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4732 (reftex-unhighlight 0)) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4733 |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4734 (defun reftex-select-post-command-hook () |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4735 (let (b e) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4736 (setq data (get-text-property (point) ':data)) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4737 (setq last-data (or data last-data)) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4738 |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4739 (when (and data cb-flag |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4740 (not (equal reftex-last-follow-point (point)))) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4741 (setq reftex-last-follow-point (point)) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4742 (funcall call-back data callback-fwd |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4743 (not reftex-revisit-to-follow))) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4744 (if data |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4745 (setq b (or (previous-single-property-change |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4746 (1+ (point)) ':data) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4747 (point-min)) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4748 e (or (next-single-property-change |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4749 (point) ':data) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4750 (point-max))) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4751 (setq b (point) e (point))) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4752 (and (memq reftex-highlight-selection '(cursor both)) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4753 (reftex-highlight 1 b e)) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4754 (if (or (not (pos-visible-in-window-p b)) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4755 (not (pos-visible-in-window-p e))) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4756 (recenter (/ (window-height) 2))) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4757 (unless (current-message) |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4758 (princ prompt)))) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4759 |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4760 (defun reftex-select-next (&optional arg) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4761 "Move to next selectable item." |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4762 (interactive "p") |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4763 (setq callback-fwd t) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4764 (or (eobp) (forward-char 1)) |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4765 (re-search-forward "^[^. \t\n\r]" nil t arg) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4766 (beginning-of-line 1)) |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4767 (defun reftex-select-previous (&optional arg) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4768 "Move to previous selectable item." |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4769 (interactive "p") |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4770 (setq callback-fwd nil) |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4771 (re-search-backward "^[^. \t\n\r]" nil t arg)) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4772 (defun reftex-select-next-heading (&optional arg) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4773 "Move to next table of contentes line." |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4774 (interactive "p") |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4775 (end-of-line) |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4776 (re-search-forward "^ " nil t arg) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4777 (beginning-of-line)) |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4778 (defun reftex-select-previous-heading (&optional arg) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4779 "Move to previous table of contentes line." |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4780 (interactive "p") |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4781 (re-search-backward "^ " nil t arg)) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4782 (defun reftex-select-quit () |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4783 "Abort selection process." |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4784 (interactive) |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4785 (throw 'myexit nil)) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4786 (defun reftex-select-keyboard-quit () |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4787 "Abort selection process." |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4788 (interactive) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4789 (throw 'exit t)) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4790 (defun reftex-select-jump-to-previous () |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4791 "Jump back to where previous selection process left off." |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4792 (interactive) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4793 (let (pos) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4794 (cond |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4795 ((and (local-variable-p 'reftex-last-data (current-buffer)) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4796 reftex-last-data |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4797 (setq pos (text-property-any (point-min) (point-max) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4798 ':data reftex-last-data))) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4799 (goto-char pos)) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4800 ((and (local-variable-p 'reftex-last-line (current-buffer)) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4801 (integerp reftex-last-line)) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4802 (goto-line reftex-last-line)) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4803 (t (ding))))) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4804 (defun reftex-select-toggle-follow () |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4805 "Toggle follow mode: Other window follows with full context." |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4806 (interactive) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4807 (setq reftex-last-follow-point -1) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4808 (setq cb-flag (not cb-flag))) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4809 (defun reftex-select-toggle-varioref () |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4810 "Toggle the macro used for referencing the label between \\ref and \\vref." |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4811 (interactive) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4812 (if (string= varioref "\\ref") |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4813 (setq varioref "\\vref") |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4814 (setq varioref "\\ref")) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4815 (force-mode-line-update)) |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4816 (defun reftex-select-show-insertion-point () |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4817 "Show the point from where selection was started in another window." |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4818 (interactive) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4819 (let ((this-window (selected-window))) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4820 (unwind-protect |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4821 (progn |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4822 (switch-to-buffer-other-window |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4823 (marker-buffer reftex-select-return-marker)) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4824 (goto-char (marker-position reftex-select-return-marker)) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4825 (recenter (/ (window-height) 2))) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4826 (select-window this-window)))) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4827 (defun reftex-select-callback () |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4828 "Show full context in another window." |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4829 (interactive) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4830 (if data (funcall call-back data callback-fwd nil) (ding))) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4831 (defun reftex-select-accept () |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4832 "Accept the currently selected item." |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4833 (interactive) |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4834 (throw 'myexit 'return)) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4835 (defun reftex-select-mouse-accept (ev) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4836 "Accept the item at the mouse click." |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4837 (interactive "e") |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4838 (mouse-set-point ev) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4839 (setq data (get-text-property (point) ':data)) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4840 (setq last-data (or data last-data)) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4841 (throw 'myexit 'return)) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4842 (defun reftex-select-read-label () |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4843 "Use minibuffer to read a label to reference, with completion." |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4844 (interactive) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4845 (let ((label (completing-read |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4846 "Label: " (symbol-value reftex-docstruct-symbol) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4847 nil nil reftex-prefix))) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4848 (unless (or (equal label "") (equal label reftex-prefix)) |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4849 (throw 'myexit label)))) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4850 (defun reftex-select-read-cite () |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4851 "Use minibuffer to read a citation key with completion." |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4852 (interactive) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4853 (let* ((key (completing-read "Citation key: " found-list)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4854 (entry (assoc key found-list))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4855 (cond |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4856 ((or (null key) (equal key ""))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4857 (entry |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4858 (setq data entry) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4859 (setq last-data data) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4860 (throw 'myexit 'return)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4861 (t (throw 'myexit key))))) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4862 (defun reftex-select-help () |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4863 "Display a summary of the special key bindings." |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4864 (interactive) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4865 (with-output-to-temp-buffer "*RefTeX Help*" |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4866 (princ help-string)) |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4867 (reftex-enlarge-to-fit "*RefTeX Help*" t)) |
18050 | 4868 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4869 ;;; ========================================================================= |
18050 | 4870 ;;; |
4871 ;;; View cross references | |
4872 | |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4873 (defun reftex-view-crossref (&optional arg stay-put echo) |
18123 | 4874 "View cross reference of \\ref or \\cite macro at point. |
4875 If the macro at point is a \\ref, show the corresponding label definition. | |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4876 If it is a \\cite, show the BibTeX database entry or the \\bibitem. |
18050 | 4877 If there is no such macro at point, search forward to find one. |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4878 When you call this function several times in direct succession, point will |
18050 | 4879 move to view subsequent cross references further down in the buffer. |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4880 To cope with the plethora of variations in packages, this function |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4881 assumes any macro either starting with or ending in `ref' or `cite' to |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4882 contain cross references. |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4883 When the LaTeX package `xr' is being used, this command will also view |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4884 crossreferences in external documents. However, this works correctly only |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4885 when the \\externaldocument macros are used with the optional label prefix |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4886 argument. |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4887 With one or two C-u prefixes, enforce rescanning of the document. |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4888 With argument t or 1, select the window showing the cross reference. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4889 When STAY-PUT is non-nil, do not move. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4890 When ECHO is non-nil, use the echo area to display the cross reference." |
18050 | 4891 |
4892 (interactive "P") | |
4893 | |
4894 ;; See where we are. | |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4895 (let* ((re "\\\\\\([a-z]*\\(cite\\|ref\\)\\|\\(cite\\|ref\\)[a-z]*\\)\\**\\(\\[[^{}]*\\]\\)?{") |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4896 (macro (car (reftex-what-macro 1))) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4897 (this-word (reftex-this-word "*a-zA-Z\\\\")) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4898 (my-window (selected-window)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4899 pop-window cmd args point) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4900 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4901 (setq reftex-call-back-to-this-buffer (current-buffer)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4902 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4903 (catch 'exit |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4904 (if (and macro |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4905 (string-match "\\`\\\\cite\\|\\`\\\\ref\\|cite\\'\\|ref\\'" |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4906 macro)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4907 (and (setq macro (match-string 0 macro)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4908 (string-match "\\`\\\\" macro) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4909 (setq macro (substring macro 1))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4910 (setq macro nil)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4911 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4912 ;; Exit here if we have no macro and are not allowed to move. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4913 (if (and stay-put (not macro)) (throw 'exit nil)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4914 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4915 (if (and macro |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4916 (eq last-command this-command) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4917 (eq last-command 'reftex-view-crossref)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4918 (if (string= macro "cite") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4919 (progn |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4920 (skip-chars-forward "^},%") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4921 (while (and (eq (following-char) ?%) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4922 (or (beginning-of-line 2) t) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4923 (skip-chars-forward " \t\n\r"))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4924 (skip-chars-forward ",") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4925 (if (eq (following-char) ?}) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4926 (setq macro nil))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4927 (setq macro nil))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4928 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4929 (if (and (not macro) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4930 (or (not (string-match "\\`\\\\" this-word)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4931 (eq (following-char) ?\\) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4932 (search-backward "\\" nil t) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4933 t)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4934 (if (interactive-p) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4935 ;; Only move far if this function was called directly |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4936 (and (re-search-forward re nil t) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4937 (setq macro (or (match-string 2) (match-string 3)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4938 ;; The macro needs to be at point |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4939 (and (looking-at re) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4940 (setq macro (or (match-string 2) (match-string 3))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4941 (goto-char (match-end 0))))) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4942 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4943 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4944 (unless macro |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4945 (error "No cross reference to display")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4946 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4947 ;; Ensure access to scanning info |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4948 (reftex-access-scan-info (or arg current-prefix-arg)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4949 |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4950 (cond |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4951 ((reftex-in-comment) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4952 (throw 'exit nil)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4953 ((string= macro "cite") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4954 (cond |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4955 ((assq 'bib (symbol-value reftex-docstruct-symbol)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4956 (setq cmd 'reftex-pop-to-bibtex-entry |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4957 args (list |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4958 (reftex-this-word "^{},%\n\r") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4959 (reftex-get-bibfile-list) nil t nil))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4960 ((assq 'thebib (symbol-value reftex-docstruct-symbol)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4961 (setq cmd 'reftex-pop-to-bibtex-entry |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4962 args (list |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4963 (reftex-this-word "^{},%\n\r") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4964 (list (cdr (assq 'thebib |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4965 (symbol-value reftex-docstruct-symbol)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4966 nil t t))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4967 (reftex-default-bibliography |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4968 (setq cmd 'reftex-pop-to-bibtex-entry |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4969 args (list |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4970 (reftex-this-word "^{},%\n\r") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4971 reftex-default-bibliography nil t nil))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4972 (echo) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4973 (t (error "Cannot display crossref\n"))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4974 (when echo |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4975 (reftex-echo-cite args) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4976 (throw 'exit nil))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4977 ((string= macro "ref") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4978 (let* ((label (reftex-this-word "^{}%\n\r")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4979 (xr-data (assoc 'xr (symbol-value reftex-docstruct-symbol))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4980 (xr-re (nth 2 xr-data)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4981 (entry (assoc label (symbol-value reftex-docstruct-symbol)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4982 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4983 (if (and (not entry) (stringp label) xr-re (string-match xr-re label)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4984 ;; Label is defined in external document |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4985 (save-excursion |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4986 (save-match-data |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4987 (set-buffer |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4988 (or (reftex-get-file-buffer-force |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4989 (cdr (assoc (match-string 1 label) (nth 1 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4990 xr-data)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4991 (error "Problem with external label %s" label)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4992 (setq label (substring label (match-end 1))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4993 (reftex-access-scan-info) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4994 (setq entry |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4995 (assoc label (symbol-value reftex-docstruct-symbol))))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4996 (when echo |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4997 (reftex-echo-ref label entry (symbol-value reftex-docstruct-symbol)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4998 (throw 'exit t)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4999 (if entry |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5000 (setq cmd 'reftex-pop-to-label |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5001 args (list label (list (nth 3 entry)) nil t)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5002 (error "Label %s not known - reparse document might help" label)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5003 (t (error "This should not happen (reftex-view-crossref)"))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5004 (setq point (point)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5005 (apply cmd args) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5006 (setq pop-window (selected-window)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5007 (add-hook 'pre-command-hook 'reftex-highlight-shall-die) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5008 (select-window my-window) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5009 (goto-char point) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5010 (when (or (equal arg t) (equal arg 1)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5011 (select-window pop-window))))) |
18050 | 5012 |
5013 (defun reftex-mouse-view-crossref (ev) | |
18123 | 5014 "View cross reference of \\ref or \\cite macro where you click. |
5015 If the macro at point is a \\ref, show the corresponding label definition. | |
5016 If it is a \\cite, show the BibTeX database entry. | |
18050 | 5017 If there is no such macro at point, search forward to find one. |
5018 With argument, actually select the window showing the cross reference." | |
5019 (interactive "e") | |
5020 (mouse-set-point ev) | |
5021 (reftex-view-crossref current-prefix-arg)) | |
5022 | |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5023 (defvar reftex-auto-view-crossref-timer nil |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5024 "The timer used for auto-view-crossref.") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5025 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5026 (defun reftex-view-crossref-when-idle () |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5027 ;; Display info about crossref at point in echo area. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5028 ;; This function was desigend to work with an idle timer. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5029 ;; We try to get out of here as quickly as possible if the call is useless. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5030 (and reftex-mode |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5031 ;; Quick precheck if this might be a relevant spot |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5032 (save-excursion |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5033 (search-backward "\\" nil t) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5034 (looking-at "\\\\[a-zA-Z]*\\(cite\\|ref\\)")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5035 ;; Make sure message area is free |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5036 (not (current-message)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5037 (condition-case nil |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5038 (let ((current-prefix-arg nil)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5039 (reftex-view-crossref -1 t t)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5040 (error nil)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5041 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5042 (defun reftex-echo-ref (label entry docstruct) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5043 ;; Display crossref info in echo area. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5044 (cond |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5045 ((null docstruct) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5046 (message (substitute-command-keys (format reftex-no-info-message "ref")))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5047 ((null entry) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5048 (message "ref: unknown label: %s" label)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5049 (t |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5050 (when (stringp (nth 2 entry)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5051 (message "ref(%s): %s" (nth 1 entry) (nth 2 entry))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5052 (let ((buf (get-buffer " *Echo Area*"))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5053 (when buf |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5054 (save-excursion |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5055 (set-buffer buf) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5056 (run-hooks 'reftex-display-copied-context-hook))))))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5057 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5058 (defun reftex-echo-cite (args) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5059 ;; Display citation info in echo area. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5060 (let* ((key (car args)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5061 (cache (assq 'bibview-cache (symbol-value reftex-docstruct-symbol))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5062 (cache-entry (assoc key (cdr cache))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5063 (item (nth 4 args)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5064 (files (nth 1 args)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5065 entry string buf) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5066 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5067 (if (and reftex-cache-cite-echo cache-entry) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5068 ;; We can just use the cache |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5069 (setq string (cdr cache-entry)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5070 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5071 ;; Need to look in the database |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5072 (unless reftex-revisit-to-echo |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5073 (setq files (reftex-visited-files (nth 1 args)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5074 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5075 (setq entry |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5076 (condition-case nil |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5077 (save-excursion |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5078 (reftex-pop-to-bibtex-entry key files nil nil item t)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5079 (error |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5080 (if (and files (= (length (nth 1 args)) (length files))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5081 (message "cite: no such database entry: %s" key) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5082 (message (substitute-command-keys |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5083 (format reftex-no-info-message "cite")))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5084 nil))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5085 (when entry |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5086 (setq entry (if item (reftex-parse-bibitem entry) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5087 (reftex-parse-bibtex-entry entry))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5088 (setq string (reftex-make-cite-echo-string |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5089 entry reftex-docstruct-symbol)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5090 (unless (or (null string) (equal string "")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5091 (message "cite: %s" string)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5092 (when (setq buf (get-buffer " *Echo Area*")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5093 (save-excursion |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5094 (set-buffer buf) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5095 (run-hooks 'reftex-display-copied-context-hook))))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5096 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5097 (defun reftex-make-cite-echo-string (entry docstruct-symbol) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5098 ;; Format a bibtex entry for the echo area and cache the result. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5099 (let* ((key (reftex-get-bib-field "&key" entry)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5100 (string |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5101 (let* ((reftex-cite-punctuation '(" " " & " " etal."))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5102 (reftex-format-citation entry reftex-cite-view-format))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5103 (cache (assq 'bibview-cache (symbol-value docstruct-symbol))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5104 (cache-entry (assoc key (cdr cache)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5105 (unless cache |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5106 ;; This docstruct has no cache - make one. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5107 (set docstruct-symbol (cons (cons 'bibview-cache nil) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5108 (symbol-value docstruct-symbol)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5109 (when reftex-cache-cite-echo |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5110 (setq key (copy-sequence key)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5111 (set-text-properties 0 (length key) nil key) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5112 (set-text-properties 0 (length string) nil string) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5113 (if cache-entry |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5114 (unless (string= (cdr cache-entry) string) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5115 (setcdr cache-entry string) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5116 (put reftex-docstruct-symbol 'modified t)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5117 (push (cons key string) (cdr cache)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5118 (put reftex-docstruct-symbol 'modified t))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5119 string)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5120 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5121 (defvar reftex-use-itimer-in-xemacs nil |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5122 "*Non-nil means use the idle timers in XEmacs for crossref display. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5123 Currently, idle timer restart is broken and we use the post-command-hook.") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5124 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5125 (defun reftex-toggle-auto-view-crossref () |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5126 "Toggle the automatic display of crossref information in the echo area. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5127 When active, leaving point idle in the argument of a \\ref or \\cite macro |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5128 will display info in the echo area." |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5129 (interactive) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5130 (if reftex-auto-view-crossref-timer |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5131 (progn |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5132 (if (featurep 'xemacs) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5133 (if reftex-use-itimer-in-xemacs |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5134 (delete-itimer reftex-auto-view-crossref-timer) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5135 (remove-hook 'post-command-hook 'reftex-start-itimer-once)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5136 (cancel-timer reftex-auto-view-crossref-timer)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5137 (setq reftex-auto-view-crossref-timer nil) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5138 (message "Automatic display of crossref information was turned off")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5139 (setq reftex-auto-view-crossref-timer |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5140 (if (featurep 'xemacs) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5141 (if reftex-use-itimer-in-xemacs |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5142 (start-itimer "RefTeX Idle Timer" |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5143 'reftex-view-crossref-when-idle |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5144 reftex-idle-time reftex-idle-time t) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5145 (add-hook 'post-command-hook 'reftex-start-itimer-once) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5146 nil) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5147 (run-with-idle-timer |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5148 reftex-idle-time t 'reftex-view-crossref-when-idle))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5149 (message "Automatic display of crossref information was turned on"))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5150 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5151 (defun reftex-start-itimer-once () |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5152 (and reftex-mode |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5153 (not (itimer-live-p reftex-auto-view-crossref-timer)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5154 (setq reftex-auto-view-crossref-timer |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5155 (start-itimer "RefTeX Idle Timer" |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5156 'reftex-view-crossref-when-idle |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5157 reftex-idle-time nil t)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5158 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5159 ;;; ========================================================================= |
18050 | 5160 ;;; |
5161 ;;; Functions that check out the surroundings | |
5162 | |
5163 (defun reftex-what-macro (which &optional bound) | |
5164 ;; Find out if point is within the arguments of any TeX-macro. | |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
5165 ;; The return value is either ("\\macro" . (point)) or a list of them. |
18050 | 5166 |
5167 ;; If WHICH is nil, immediately return nil. | |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5168 ;; If WHICH is 1, return innermost enclosing macro. |
18050 | 5169 ;; If WHICH is t, return list of all macros enclosing point. |
5170 ;; If WHICH is a list of macros, look only for those macros and return the | |
5171 ;; name of the first macro in this list found to enclose point. | |
5172 ;; If the optional BOUND is an integer, bound backwards directed | |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
5173 ;; searches to this point. If it is nil, limit to nearest \section - |
18050 | 5174 ;; like statement. |
5175 | |
5176 ;; This function is pretty stable, but can be fooled if the text contains | |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
5177 ;; things like \macro{aa}{bb} where \macro is defined to take only one |
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
5178 ;; argument. As RefTeX cannot know this, the string "bb" would still be |
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
5179 ;; considered an argument of macro \macro. |
18050 | 5180 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5181 (unless reftex-section-regexp (reftex-compile-variables)) |
18050 | 5182 (catch 'exit |
5183 (if (null which) (throw 'exit nil)) | |
5184 (let ((bound (or bound (save-excursion (re-search-backward | |
5185 reftex-section-regexp nil 1) | |
5186 (point)))) | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5187 pos cmd-list cmd cnt cnt-opt entry) |
18050 | 5188 (save-restriction |
5189 (save-excursion | |
5190 (narrow-to-region (max 1 bound) (point-max)) | |
5191 ;; move back out of the current parenthesis | |
5192 (while (condition-case nil | |
5193 (progn (up-list -1) t) | |
5194 (error nil)) | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5195 (setq cnt 1 cnt-opt 0) |
18050 | 5196 ;; move back over any touching sexps |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5197 (while (and (reftex-move-to-previous-arg bound) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5198 (condition-case nil |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5199 (progn (backward-sexp) t) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5200 (error nil))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5201 (if (eq (following-char) ?\[) (incf cnt-opt)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5202 (incf cnt)) |
18050 | 5203 (setq pos (point)) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5204 (when (and (or (= (following-char) ?\[) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5205 (= (following-char) ?\{)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5206 (re-search-backward "\\\\[*a-zA-Z]+\\=" nil t)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5207 (setq cmd (reftex-match-string 0)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5208 (when (looking-at "\\\\begin{[^}]*}") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5209 (setq cmd (reftex-match-string 0) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5210 cnt (1- cnt))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5211 ;; This does ignore optional arguments. Very hard to fix. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5212 (when (setq entry (assoc cmd reftex-env-or-mac-alist)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5213 (if (> cnt (or (nth 4 entry) 100)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5214 (setq cmd nil))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5215 (cond |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5216 ((null cmd)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5217 ((eq t which) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5218 (push (cons cmd (point)) cmd-list)) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5219 ((or (eq 1 which) (member cmd which)) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5220 (throw 'exit (cons cmd (point)))))) |
18050 | 5221 (goto-char pos))) |
5222 (nreverse cmd-list))))) | |
5223 | |
5224 (defun reftex-what-environment (which &optional bound) | |
5225 ;; Find out if point is inside a LaTeX environment. | |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
5226 ;; The return value is (e.g.) either ("equation" . (point)) or a list of |
18050 | 5227 ;; them. |
5228 | |
5229 ;; If WHICH is nil, immediately return nil. | |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5230 ;; If WHICH is 1, return innermost enclosing environment. |
18050 | 5231 ;; If WHICH is t, return list of all environments enclosing point. |
5232 ;; If WHICH is a list of environments, look only for those environments and | |
5233 ;; return the name of the first environment in this list found to enclose | |
5234 ;; point. | |
5235 | |
5236 ;; If the optional BOUND is an integer, bound backwards directed searches to | |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
5237 ;; this point. If it is nil, limit to nearest \section - like statement. |
18050 | 5238 |
5239 (catch 'exit | |
5240 (save-excursion | |
5241 (if (null which) (throw 'exit nil)) | |
5242 (let ((bound (or bound (save-excursion (re-search-backward | |
5243 reftex-section-regexp nil 1) | |
5244 (point)))) | |
5245 env-list end-list env) | |
5246 (while (re-search-backward "\\\\\\(begin\\|end\\){\\([^}]+\\)}" | |
5247 bound t) | |
5248 (setq env (buffer-substring-no-properties | |
5249 (match-beginning 2) (match-end 2))) | |
5250 (cond | |
5251 ((string= (match-string 1) "end") | |
5252 (add-to-list 'end-list env)) | |
5253 ((member env end-list) | |
5254 (setq end-list (delete env end-list))) | |
5255 ((eq t which) | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5256 (push (cons env (point)) env-list)) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5257 ((or (eq 1 which) (member env which)) |
18050 | 5258 (throw 'exit (cons env (point)))))) |
5259 (nreverse env-list))))) | |
5260 | |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5261 ;;; ========================================================================= |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5262 ;;; |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5263 ;;; Finding files |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5264 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5265 (defun reftex-find-tex-file (file master-dir &optional die) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5266 ;; Find FILE in MASTER-DIR or on reftex-tex-path. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5267 ;; FILE may be given with or without the .tex extension. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5268 (let ((rec-values '(nil t)) path file1 old-path) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5269 (unless (and (file-name-absolute-p file) (not (file-exists-p file))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5270 (while (and (null file1) rec-values) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5271 (setq path (reftex-access-search-path |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5272 "tex" (pop rec-values) master-dir file)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5273 (if (or (null old-path) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5274 (not (eq old-path path))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5275 (setq old-path path |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5276 path (cons master-dir path) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5277 file1 (or (reftex-find-file-on-path |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5278 (concat file ".tex") path master-dir) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5279 (reftex-find-file-on-path file path master-dir)))))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5280 (cond (file1 file1) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5281 (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
|
5282 (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
|
5283 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5284 (defun reftex-find-bib-file (file master-dir &optional die) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5285 ;; Find FILE in MASTER-DIR or on reftex-bib-path |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5286 (let ((rec-values '(nil t)) path file1 old-path) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5287 (unless (and (file-name-absolute-p file) (not (file-exists-p file))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5288 (while (and (null file1) rec-values) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5289 (setq path (reftex-access-search-path |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5290 "bib" (pop rec-values) master-dir file)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5291 (if (or (null old-path) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5292 (not (eq old-path path))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5293 (setq old-path path |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5294 path (cons master-dir path) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5295 file1 (reftex-find-file-on-path file path master-dir))))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5296 (cond (file1 file1) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5297 (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
|
5298 (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
|
5299 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5300 (defun reftex-access-search-path (which &optional recurse master-dir file) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5301 ;; Access path from environment variables. WHICH is either "tex" or "bib". |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5302 ;; 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
|
5303 ;; 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
|
5304 ;; 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
|
5305 ;; 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
|
5306 ;; 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
|
5307 ;; Returns the derived path. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5308 (let* ((pathvar (intern (concat "reftex-" which "-path")))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5309 (when (null (get pathvar 'status)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5310 ;; Get basic path from environment |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5311 (let ((env-vars (if (equal which "tex") (list "TEXINPUTS") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5312 reftex-bibpath-environment-variables))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5313 (set pathvar (reftex-parse-colon-path |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5314 (mapconcat (lambda(x) (or (getenv x) "")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5315 env-vars path-separator)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5316 (put pathvar 'status 'split) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5317 ;; 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
|
5318 (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
|
5319 (while (setq dir (pop path)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5320 (when (string= (substring dir -2) "//") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5321 (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
|
5322 (setq rec (or rec 'absolute)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5323 (setq rec 'relative)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5324 (put pathvar 'rec-type rec))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5325 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5326 (if recurse |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5327 ;; 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
|
5328 (cond |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5329 ((not (get pathvar 'rec-type)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5330 ;; 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
|
5331 (symbol-value pathvar)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5332 ((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
|
5333 (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
|
5334 (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
|
5335 ;; 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
|
5336 ;; 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
|
5337 ;; relative to new default directory |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5338 (message "Expanding search path to find %s file: %s ..." which file) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5339 (put pathvar 'recursive-path |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5340 (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
|
5341 (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
|
5342 (get pathvar 'recursive-path)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5343 (t |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5344 ;; 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
|
5345 (get pathvar 'recursive-path))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5346 ;; The simple path was requested |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5347 (symbol-value pathvar)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5348 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5349 (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
|
5350 ;; 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
|
5351 ;; 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
|
5352 (catch 'exit |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5353 (when (file-name-absolute-p file) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5354 (if (and (file-exists-p file) (not (file-directory-p file))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5355 (throw 'exit file) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5356 (throw 'exit nil))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5357 (let* ((thepath path) file1 dir ) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5358 (while (setq dir (pop thepath)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5359 (when (string= (substring dir -2) "//") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5360 (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
|
5361 (setq file1 (expand-file-name file (expand-file-name dir def-dir))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5362 (if (and (file-exists-p file1) (not (file-directory-p file1))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5363 (throw 'exit file1))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5364 ;; No such file |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5365 nil))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5366 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5367 (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
|
5368 ;; 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
|
5369 ;; 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
|
5370 (mapcar |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5371 (lambda (dir) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5372 (if (string-match "\\(//+\\|/*!+\\)\\'" dir) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5373 (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
|
5374 (file-name-as-directory dir)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5375 (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
|
5376 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5377 (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
|
5378 ;; 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
|
5379 ;; 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
|
5380 (let (path1 dir recursive) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5381 (while (setq dir (pop path)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5382 (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
|
5383 (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
|
5384 (if (and recursive |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5385 (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
|
5386 (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
|
5387 (if recursive |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5388 ;; Expand recursively |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5389 (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
|
5390 ;; Keep unchanged |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5391 (push dir path1))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5392 (nreverse path1))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5393 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5394 (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
|
5395 ;; 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
|
5396 (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
|
5397 (while (setq dir (pop path)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5398 (when (file-directory-p dir) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5399 (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
|
5400 (while (setq file (pop files)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5401 (if (file-directory-p file) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5402 (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
|
5403 (push dir path1))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5404 path1)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5405 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5406 ;;; ========================================================================= |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5407 ;;; |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5408 ;;; Some generally useful functions |
18050 | 5409 |
5410 (defun reftex-no-props (string) | |
5411 ;; Return STRING with all text properties removed | |
5412 (and (stringp string) | |
5413 (set-text-properties 0 (length string) nil string)) | |
5414 string) | |
5415 | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5416 (defun reftex-match-string (n) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5417 ;; Match string without properties |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5418 (when (match-beginning n) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5419 (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
|
5420 |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
5421 (defun reftex-kill-buffer (buffer) |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5422 ;; 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
|
5423 (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
|
5424 (kill-buffer buffer))) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
5425 |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5426 (defun reftex-erase-buffer (&optional buffer) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5427 ;; 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
|
5428 ;; This even erases read-only buffers. |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5429 (cond |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5430 ((null buffer) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5431 ;; erase current buffer |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5432 (let ((buffer-read-only nil)) (erase-buffer))) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5433 ((setq buffer (get-buffer buffer)) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5434 ;; buffer exists |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5435 (save-excursion |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5436 (set-buffer buffer) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5437 (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
|
5438 |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5439 (defun reftex-this-word (&optional class) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5440 ;; Grab the word around point. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5441 (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
|
5442 (save-excursion |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5443 (buffer-substring-no-properties |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5444 (progn (skip-chars-backward class) (point)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5445 (progn (skip-chars-forward class) (point))))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5446 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5447 (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
|
5448 ;; 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
|
5449 (let (rtn) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5450 (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
|
5451 (push (car list) rtn) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5452 (pop list)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5453 (nreverse rtn))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5454 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5455 (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
|
5456 ;; 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
|
5457 (let (rtn) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5458 (while list |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5459 (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
|
5460 (push (car list) rtn)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5461 (pop list)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5462 (nreverse rtn))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5463 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5464 (defun reftex-last-assoc-before-elt (key elt list) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5465 ;; 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
|
5466 ;; 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
|
5467 ;; Returns nil when either KEY or elt are not found in LIST. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5468 ;; On success, returns the association. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5469 (let* ((elt (car (member elt list))) ass last-ass) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5470 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5471 (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
|
5472 (setq list (memq ass list)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5473 (memq elt list)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5474 (setq last-ass ass |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5475 list (cdr list))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5476 last-ass)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5477 |
20177
6ebc3e300106
The menu now used toggle and radio for some items.
Karl Heuer <kwzh@gnu.org>
parents:
20102
diff
changeset
|
5478 (defvar enable-multibyte-characters) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5479 (defun reftex-truncate (string ncols &optional ellipses padding) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5480 ;; Truncate a string to NCHAR characters. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5481 ;; Works fast with ASCII and correctly with Mule characters. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5482 ;; When ELLIPSES is non-nil, put three dots at the end of the string. |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5483 ;; When padding is non-nil, fills with white space to NCOLS characters. |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5484 (setq string |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5485 (cond |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5486 ((and (boundp 'enable-multibyte-characters) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5487 enable-multibyte-characters |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5488 (fboundp 'truncate-string-to-width)) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5489 (if (<= (string-width string) ncols) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5490 string |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5491 (if ellipses |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5492 (concat (truncate-string-to-width string (- ncols 3)) "...") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5493 (truncate-string-to-width string ncols)))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5494 (t |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5495 (if (<= (length string) ncols) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5496 string |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5497 (if ellipses |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5498 (concat (substring string 0 (- ncols 3)) "...") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5499 (substring string 0 ncols)))))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5500 (if padding |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5501 (format (format "%%-%ds" ncols) string) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5502 string)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5503 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5504 (defun reftex-nearest-match (regexp &optional pos) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5505 ;; 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
|
5506 ;; 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
|
5507 ;; Return nil if there is no match. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5508 (let ((start (point)) (pos (or pos (point))) match1 match2 match) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5509 (goto-char start) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5510 (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
|
5511 (setq match1 (match-data))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5512 (goto-char start) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5513 (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
|
5514 (setq match2 (match-data))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5515 (goto-char start) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5516 (setq match |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5517 (cond |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5518 ((not match1) match2) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5519 ((not match2) match1) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5520 ((< (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
|
5521 (t match2))) |
21170
dbe101f49d57
(reftex-nearest-match): store-match-data => set-match-data.
Richard M. Stallman <rms@gnu.org>
parents:
21130
diff
changeset
|
5522 (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
|
5523 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5524 (defun reftex-auto-mode-alist () |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5525 ;; 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
|
5526 ;; Stolen from gnus nnheader. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5527 (let ((alist auto-mode-alist) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5528 out) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5529 (while alist |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5530 (when (listp (cdr (car alist))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5531 (push (car alist) out)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5532 (pop alist)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5533 (nreverse out))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5534 |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
5535 (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
|
5536 ;; 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
|
5537 ;; 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
|
5538 (let* ((win1 (selected-window)) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
5539 (buf1 (current-buffer)) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
5540 (win2 (get-buffer-window buf2))) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
5541 (when win2 |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
5542 (select-window win2) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
5543 (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
|
5544 (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
|
5545 (enlarge-window (1+ (- (count-lines 1 (point-max)) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
5546 (window-height)))))) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
5547 (cond |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
5548 ((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
|
5549 (keep-current |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
5550 ;; 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
|
5551 (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
|
5552 (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
|
5553 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5554 (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
|
5555 ;; 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
|
5556 ;; also with HELP-STRING. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5557 ;; 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
|
5558 (let ((char ?\?)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5559 (save-window-excursion |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5560 (catch 'exit |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5561 (message (concat prompt " (?=Help)")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5562 (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
|
5563 (= ?\? (setq char (read-char-exclusive)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5564 (with-output-to-temp-buffer " *RefTeX Help*" |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5565 (princ help-string)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5566 (reftex-enlarge-to-fit " *RefTeX Help*") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5567 (select-window (get-buffer-window " *RefTeX Help*")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5568 (setq truncate-lines t)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5569 (setq prompt (concat prompt (if scroll " (SPC/DEL=Scroll)" ""))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5570 (message prompt) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5571 (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
|
5572 (while t |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5573 (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
|
5574 ((equal char ?\?)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5575 ((and scroll (equal char ?\ )) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5576 (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
|
5577 (message prompt)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5578 ((and scroll (equal char ?\C-? )) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5579 (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
|
5580 (message prompt)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5581 (t (throw 'exit char))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5582 (setq char (read-char-exclusive))))))) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5583 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5584 (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
|
5585 ;; convert STRING into a regexp, allowing ^M for \n and vice versa |
18050 | 5586 (let ((start -2)) |
5587 (setq string (regexp-quote string)) | |
5588 (while (setq start (string-match "[\n\r]" string (+ 3 start))) | |
5589 (setq string (replace-match "[\n\r]" nil t string))) | |
5590 string)) | |
5591 | |
5592 (defun reftex-get-buffer-visiting (file) | |
5593 ;; return a buffer visiting FILE | |
5594 (cond | |
5595 ((boundp 'find-file-compare-truenames) ; XEmacs | |
5596 (let ((find-file-compare-truenames t)) | |
5597 (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
|
5598 ((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
|
5599 (find-buffer-visiting file)) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
5600 (t (error "This should not happen (reftex-get-buffer-visiting)")))) |
18050 | 5601 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5602 ;; 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
|
5603 (defvar message-stack) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5604 (if (and (featurep 'xemacs) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5605 (not (fboundp 'current-message))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5606 (defun current-message (&optional frame) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5607 (cdr (car message-stack)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5608 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5609 (defun reftex-visited-files (list) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5610 ;; 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
|
5611 (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
|
5612 list))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5613 |
18050 | 5614 (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
|
5615 ;; 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
|
5616 ;; 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
|
5617 ;; 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
|
5618 ;; 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
|
5619 ;; and mark the buffer to be killed after use. |
18050 | 5620 |
5621 (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
|
5622 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5623 (cond (buf |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5624 ;; 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
|
5625 buf) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5626 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5627 ((file-readable-p file) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5628 ;; 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
|
5629 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5630 (if (or (not mark-to-kill) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5631 (eq t reftex-initialize-temporary-buffers)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5632 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5633 ;; Visit the file with full magic |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5634 (setq buf (find-file-noselect file)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5635 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5636 ;; 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
|
5637 ;; with limited Magic |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5638 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5639 ;; The magic goes away |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5640 (let ((format-alist nil) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5641 (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
|
5642 (default-major-mode 'fundamental-mode) |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5643 (enable-local-variables nil) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5644 (after-insert-file-functions nil)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5645 (setq buf (find-file-noselect file))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5646 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5647 ;; Is there a hook to run? |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5648 (when (listp reftex-initialize-temporary-buffers) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5649 (save-excursion |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5650 (set-buffer buf) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5651 (run-hooks 'reftex-initialize-temporary-buffers)))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5652 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5653 ;; 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
|
5654 (and mark-to-kill |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5655 (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
|
5656 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5657 ;; Return the new buffer |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5658 buf) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5659 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5660 ;; 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
|
5661 (t nil)))) |
18050 | 5662 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5663 (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
|
5664 ;; 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
|
5665 (cond |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5666 (buffer |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5667 (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
|
5668 (kill-buffer buffer) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5669 (setq reftex-buffers-to-kill |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5670 (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
|
5671 (t |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5672 (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
|
5673 (when (bufferp buffer) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5674 (and (buffer-modified-p buffer) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5675 (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
|
5676 (buffer-file-name buffer))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5677 (save-excursion |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5678 (set-buffer buffer) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5679 (save-buffer))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5680 (kill-buffer buffer)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5681 (pop reftex-buffers-to-kill))))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5682 |
18050 | 5683 (defun reftex-splice-symbols-into-list (list alist) |
5684 ;; Splice the association in ALIST of any symbols in LIST into the list. | |
5685 ;; Return new list. | |
5686 (let (rtn tmp) | |
5687 (while list | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5688 (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
|
5689 (symbolp (car list))) |
18050 | 5690 (setq tmp (car list)) |
5691 (cond | |
5692 ((assoc tmp alist) | |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
5693 (setq list (append (nth 2 (assoc tmp alist)) (cdr list)))) |
18050 | 5694 (t |
5695 (error "Cannot treat symbol %s in reftex-label-alist" | |
5696 (symbol-name tmp))))) | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5697 (push (pop list) rtn)) |
18050 | 5698 (nreverse rtn))) |
5699 | |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5700 (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
|
5701 ;; 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
|
5702 ;; Elements of KEEP-LIST are not removed even if duplicate. |
18050 | 5703 (let (new elm) |
5704 (while alist | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5705 (setq elm (pop alist)) |
18050 | 5706 (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
|
5707 (not (assoc (car elm) new))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5708 (push elm new))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5709 (nreverse new))) |
18050 | 5710 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5711 ;;; ========================================================================= |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5712 ;;; |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5713 ;;; Fontification and Highlighting |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5714 |
18050 | 5715 (defun reftex-use-fonts () |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
5716 ;; Return t if we can and want to use fonts. |
18050 | 5717 (and window-system |
5718 reftex-use-fonts | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5719 (featurep 'font-lock))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5720 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5721 (defun reftex-refontify () |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5722 ;; 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
|
5723 (and (reftex-use-fonts) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5724 (or (eq t reftex-refontify-context) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5725 (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
|
5726 ;; 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
|
5727 (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
|
5728 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5729 (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
|
5730 ;; 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
|
5731 ;; 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
|
5732 (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
|
5733 parent-buffer 'reftex-ref) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5734 (let* ((oldname (buffer-name)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5735 (newname (concat "Fontify-me-" oldname))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5736 (unwind-protect |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5737 (progn |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5738 ;; 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
|
5739 (rename-buffer newname t) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5740 (cond |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5741 ((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
|
5742 ;; 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
|
5743 (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
|
5744 '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
|
5745 (let ((major-mode 'latex-mode)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5746 (font-lock-mode 1))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5747 ((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
|
5748 ;; Looks like the XEmacs font-lock stuff. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5749 ;; FIXME: this is still kind of a hack. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5750 (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
|
5751 (let ((major-mode 'latex-mode) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5752 (font-lock-defaults-computed nil)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5753 (font-lock-set-defaults-1) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5754 (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
|
5755 (t |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5756 ;; Oops? |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5757 (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
|
5758 (rename-buffer oldname)))) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
5759 |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
5760 (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
|
5761 ;; 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
|
5762 (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
|
5763 'font-lock-default-fontify-region |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
5764 'font-lock-fontify-region)) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
5765 beg1 end1) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
5766 (goto-char beg) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
5767 (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
|
5768 (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
|
5769 (funcall func beg1 end1 nil) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
5770 (goto-char end1)))) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
5771 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5772 (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
|
5773 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5774 (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
|
5775 ;; 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
|
5776 ;; 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
|
5777 ;; 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
|
5778 ;; 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
|
5779 ;; 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
|
5780 ;; to font-lock-constant-face. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5781 (let (face) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5782 (catch 'exit |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5783 (while (setq face (pop faces)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5784 (if (featurep 'xemacs) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5785 (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
|
5786 (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
|
5787 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5788 ;; 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
|
5789 (if (featurep 'xemacs) (require 'overlay)) |
18050 | 5790 |
5791 ;; 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
|
5792 (defvar reftex-highlight-overlays [nil nil]) |
18050 | 5793 |
5794 ;; Initialize the overlays | |
5795 (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
|
5796 (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
|
5797 'face 'highlight) |
18050 | 5798 (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
|
5799 (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
|
5800 'face reftex-cursor-selected-face) |
18050 | 5801 |
5802 ;; Two functions for activating and deactivation highlight overlays | |
5803 (defun reftex-highlight (index begin end &optional buffer) | |
5804 "Highlight a region with overlay INDEX." | |
5805 (move-overlay (aref reftex-highlight-overlays index) | |
5806 begin end (or buffer (current-buffer)))) | |
5807 (defun reftex-unhighlight (index) | |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
5808 "Detach overlay INDEX." |
18050 | 5809 (delete-overlay (aref reftex-highlight-overlays index))) |
5810 | |
5811 (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
|
5812 ;; Function used in pre-command-hook to remove highlights. |
18050 | 5813 (remove-hook 'pre-command-hook 'reftex-highlight-shall-die) |
5814 (reftex-unhighlight 0)) | |
5815 | |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5816 ;;; ========================================================================= |
18050 | 5817 ;;; |
5818 ;;; Functions to compile the tables, reset the mode etc. | |
5819 | |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5820 ;; A list of all variables in the cache. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5821 ;; The cache is used to save the compiled versions of some variables. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5822 (defconst reftex-cache-variables |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5823 '(reftex-memory ;; This MUST ALWAYS be the first! |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5824 reftex-env-or-mac-alist reftex-everything-regexp |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5825 reftex-find-label-regexp-format reftex-find-label-regexp-format2 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5826 reftex-label-env-list reftex-label-mac-list |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5827 reftex-section-or-include-regexp reftex-section-levels-all |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5828 reftex-section-regexp reftex-type-query-help |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5829 reftex-type-query-prompt reftex-typekey-list |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5830 reftex-typekey-to-format-alist reftex-typekey-to-prefix-alist |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5831 reftex-words-to-typekey-alist)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5832 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5833 (defun reftex-ensure-compiled-variables () |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5834 ;; Recompile the label alist when necessary |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5835 (let* ((mem reftex-memory) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5836 (cache (get reftex-docstruct-symbol 'reftex-cache)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5837 (cmem (car cache)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5838 (alist reftex-label-alist) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5839 (levels (get reftex-docstruct-symbol 'reftex-section-levels)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5840 (style (get reftex-docstruct-symbol 'reftex-label-alist-style)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5841 (default reftex-default-label-alist-entries)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5842 (cond |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5843 (reftex-tables-dirty (reftex-compile-variables)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5844 ((and (eq alist (nth 0 mem)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5845 (eq levels (nth 1 mem)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5846 (eq style (nth 2 mem)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5847 (eq default (nth 3 mem)))) ;; everything is OK |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5848 ((and (eq alist (nth 0 cmem)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5849 (eq levels (nth 1 cmem)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5850 (eq style (nth 2 cmem)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5851 (eq default (nth 2 cmem))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5852 ;; restore the cache |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5853 (message "Restoring cache") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5854 (mapcar (lambda (sym) (set sym (pop cache))) reftex-cache-variables)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5855 (t (reftex-compile-variables))))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5856 |
18050 | 5857 (defun reftex-reset-mode () |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5858 "Reset RefTeX Mode. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5859 This will re-compile the configuration information and remove all |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5860 current scanning information and the parse file to enforce a rescan |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5861 on next use." |
18050 | 5862 (interactive) |
5863 | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5864 ;; Reset the file search path variables |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5865 (loop for prop in '(status master-dir recursive-path rec-type) do |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5866 (put 'reftex-tex-path prop nil) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5867 (put 'reftex-bib-path prop nil)) |
18050 | 5868 |
18219
aaeaae005e98
Updated documentation at several points in the file.
Richard M. Stallman <rms@gnu.org>
parents:
18123
diff
changeset
|
5869 ;; Kill temporary buffers associated with RefTeX - just in case they |
aaeaae005e98
Updated documentation at several points in the file.
Richard M. Stallman <rms@gnu.org>
parents:
18123
diff
changeset
|
5870 ;; were not cleaned up properly |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
5871 (save-excursion |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
5872 (let ((buffer-list '("*RefTeX Help*" "*RefTeX Select*" |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5873 "*Duplicate Labels*" "*toc*" " *RefTeX-scratch*")) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
5874 buf) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
5875 (while (setq buf (pop buffer-list)) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
5876 (if (get-buffer buf) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
5877 (kill-buffer buf)))) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
5878 (reftex-erase-all-selection-buffers)) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5879 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5880 ;; Make sure the current document will be rescanned soon. |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
5881 (reftex-reset-scanning-information) |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
5882 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5883 ;; Remove any parse info file |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5884 (reftex-access-parse-file 'kill) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5885 |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5886 ;; Plug functions into AUCTeX if the user option says so. |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5887 (and reftex-plug-into-AUCTeX |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5888 (reftex-plug-into-AUCTeX)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5889 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5890 (reftex-compile-variables)) |
18050 | 5891 |
5892 (defun reftex-reset-scanning-information () | |
5893 "Reset the symbols containing information from buffer scanning. | |
5894 This enforces rescanning the buffer on next use." | |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
5895 (if (string= reftex-last-toc-master (reftex-TeX-master-file)) |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5896 (reftex-erase-buffer "*toc*")) |
18050 | 5897 (let ((symlist reftex-multifile-symbols) |
5898 symbol) | |
5899 (while symlist | |
5900 (setq symbol (car symlist) | |
5901 symlist (cdr symlist)) | |
5902 (if (and (symbolp (symbol-value symbol)) | |
5903 (not (null (symbol-value symbol)))) | |
5904 (set (symbol-value symbol) nil))))) | |
5905 | |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
5906 (defun reftex-erase-all-selection-buffers () |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
5907 ;; Remove all selection buffers associated with current document. |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5908 (mapcar |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5909 (lambda (type) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5910 (reftex-erase-buffer (reftex-make-selection-buffer-name type))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5911 reftex-typekey-list)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5912 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5913 (defun reftex-compile-variables () |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5914 ;; Compile the information in reftex-label-alist & Co. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5915 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5916 (message "Compiling label environment definitions...") |
18050 | 5917 |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
5918 ;; Update AUCTeX style information |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
5919 (when (and (featurep 'tex-site) (fboundp 'TeX-update-style)) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
5920 (condition-case nil (TeX-update-style) (error nil))) |
18050 | 5921 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5922 ;; Record that we have done this, and what we have used. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5923 (setq reftex-tables-dirty nil) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5924 (setq reftex-memory |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5925 (list reftex-label-alist |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5926 (get reftex-docstruct-symbol 'reftex-section-levels) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5927 (get reftex-docstruct-symbol 'reftex-label-alist-style) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5928 reftex-default-label-alist-entries)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5929 |
18050 | 5930 ;; Compile information in reftex-label-alist |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5931 (let ((all (reftex-uniquify-by-car |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5932 (reftex-splice-symbols-into-list |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5933 (append reftex-label-alist |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5934 (get reftex-docstruct-symbol 'reftex-label-alist-style) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5935 reftex-default-label-alist-entries) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5936 reftex-label-alist-builtin) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5937 '(nil))) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5938 entry env-or-mac typekeychar typekey prefix context word |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5939 fmt reffmt labelfmt wordlist qh-list macros-with-labels |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5940 nargs nlabel opt-args cell sum i) |
18050 | 5941 |
5942 (setq reftex-words-to-typekey-alist nil | |
5943 reftex-typekey-list nil | |
5944 reftex-typekey-to-format-alist nil | |
5945 reftex-typekey-to-prefix-alist nil | |
5946 reftex-env-or-mac-alist nil | |
5947 reftex-label-env-list nil | |
5948 reftex-label-mac-list nil) | |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5949 (while all |
18050 | 5950 (catch 'next-entry |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5951 (setq entry (car all) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5952 env-or-mac (car entry) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5953 entry (cdr entry) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5954 all (cdr all)) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5955 (if (null env-or-mac) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5956 (setq env-or-mac "")) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5957 (if (stringp (car entry)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5958 ;; This is before version 2.00 - convert entry to new format |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5959 ;; This is just to keep old users happy |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5960 (setq entry (cons (string-to-char (car entry)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5961 (cons (concat (car entry) ":") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5962 (cdr entry))))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5963 (setq typekeychar (nth 0 entry) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5964 typekey (if typekeychar (char-to-string typekeychar) nil) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5965 prefix (nth 1 entry) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5966 fmt (nth 2 entry) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5967 context (nth 3 entry) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5968 wordlist (nth 4 entry)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5969 (if (stringp wordlist) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5970 ;; This is before version 2.04 - convert to new format |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5971 (setq wordlist (nthcdr 4 entry))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5972 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5973 (if (and (stringp fmt) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5974 (string-match "@" fmt)) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5975 ;; Special syntax for specifying a label format |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5976 (setq fmt (split-string fmt "@+")) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5977 (setq fmt (list "\\label{%s}" fmt))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5978 (setq labelfmt (car fmt) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5979 reffmt (nth 1 fmt)) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5980 ;; Note a new typekey |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5981 (if typekey |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5982 (add-to-list 'reftex-typekey-list typekey)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5983 (if (and typekey prefix |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5984 (not (assoc typekey reftex-typekey-to-prefix-alist))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5985 (add-to-list 'reftex-typekey-to-prefix-alist |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5986 (cons typekey prefix))) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5987 ;; Check if this is a macro or environment |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5988 (cond |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5989 ((string-match "\\`\\\\" env-or-mac) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5990 ;; It's a macro |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5991 (let ((result (reftex-parse-args env-or-mac))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5992 (setq env-or-mac (or (first result) env-or-mac) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5993 nargs (second result) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5994 nlabel (third result) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5995 opt-args (fourth result)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5996 (if nlabel (add-to-list 'macros-with-labels env-or-mac))) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5997 (if typekey (add-to-list 'reftex-label-mac-list env-or-mac))) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5998 (t |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5999 ;; It's an environment |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6000 (setq nargs nil nlabel nil opt-args nil) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6001 (cond ((string= env-or-mac "any")) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6002 ((string= env-or-mac "")) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6003 ((string= env-or-mac "section")) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6004 (t |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6005 (add-to-list 'reftex-label-env-list env-or-mac))))) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6006 ;; Translate some special context cases |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6007 (when (assq context reftex-default-context-regexps) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6008 (setq context |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6009 (format |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6010 (cdr (assq context reftex-default-context-regexps)) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6011 (regexp-quote env-or-mac)))) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6012 ;; See if this is the first format for this typekey |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6013 (and reffmt |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6014 (not (assoc typekey reftex-typekey-to-format-alist)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6015 (push (cons typekey reffmt) reftex-typekey-to-format-alist)) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6016 ;; See if this is the first definition for this env-or-mac |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6017 (and (not (string= env-or-mac "any")) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6018 (not (string= env-or-mac "")) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6019 (not (assoc env-or-mac reftex-env-or-mac-alist)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6020 (push (list env-or-mac typekey context labelfmt |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6021 nargs nlabel opt-args) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6022 reftex-env-or-mac-alist)) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6023 ;; Are the magic words regular expressions? Quote normal words. |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6024 (if (eq (car wordlist) 'regexp) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6025 (setq wordlist (cdr wordlist)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6026 (setq wordlist (mapcar 'regexp-quote wordlist))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6027 ;; Remember the first association of each word. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6028 (while (stringp (setq word (pop wordlist))) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6029 (or (assoc word reftex-words-to-typekey-alist) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6030 (push (cons word typekey) reftex-words-to-typekey-alist))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6031 (cond |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6032 ((string= "" env-or-mac) nil) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6033 ((setq cell (assoc typekey qh-list)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6034 (push env-or-mac (cdr cell))) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6035 (typekey |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6036 (push (list typekey env-or-mac) qh-list))))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6037 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6038 (setq reftex-typekey-to-prefix-alist |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6039 (nreverse reftex-typekey-to-prefix-alist)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6040 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6041 ;; Prepare the typekey query prompt and help string. |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6042 (setq qh-list |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6043 (sort qh-list (function |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6044 (lambda (x1 x2) (string< (car x1) (car x2)))))) |
18050 | 6045 (setq reftex-type-query-prompt |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6046 (concat "Label type: [" |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6047 (mapconcat (function (lambda(x) (format "%s" (car x)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6048 qh-list "") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6049 "]")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6050 ;; In the help string, we need to wrap lines... |
18050 | 6051 (setq reftex-type-query-help |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6052 (concat |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6053 "SELECT A LABEL TYPE:\n--------------------\n" |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6054 (mapconcat |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6055 (lambda(x) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6056 (setq sum 0) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6057 (format " [%s] %s" |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6058 (car x) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6059 (mapconcat (lambda(env) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6060 (setq sum (+ sum (length env))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6061 (if (< sum 60) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6062 env |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6063 (setq sum 0) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6064 (concat "\n " env))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6065 (cdr x) " "))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6066 qh-list "\n"))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6067 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6068 ;; Convert magic words to regular expressions. We make regular expressions |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6069 ;; which allow for some chars from the ref format to be in the buffer. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6070 ;; These characters will be seen and removed. |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6071 (setq reftex-words-to-typekey-alist |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6072 (mapcar |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6073 (lambda (x) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6074 (setq word (car x) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6075 typekey (cdr x) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6076 fmt (cdr (assoc typekey reftex-typekey-to-format-alist))) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6077 (setq word (concat "\\W\\(" word "[ \t\n\r]*\\)\\(")) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6078 (setq i 0) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6079 (while (and (< i 10) ; maximum number of format chars allowed |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6080 (< i (length fmt)) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6081 (not (member (aref fmt i) '(?%)))) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6082 (setq word (concat word "\\|" (regexp-quote |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6083 (substring fmt 0 (1+ i))))) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6084 (incf i)) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6085 (cons (concat word "\\)\\=") typekey)) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6086 (nreverse reftex-words-to-typekey-alist))) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6087 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6088 ;; Make the full list of section levels |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6089 (setq reftex-section-levels-all |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6090 (append (get reftex-docstruct-symbol 'reftex-section-levels) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6091 reftex-section-levels)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6092 |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6093 ;; Calculate the regular expressions |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6094 (let* ((wbol "\\(\\`\\|[\n\r]\\)[ \t]*") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6095 (label-re "\\\\label{\\([^}]*\\)}") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6096 (include-re (concat wbol "\\\\\\(include\\|input\\)[{ \t]+\\([^} \t\n\r]+\\)")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6097 (section-re |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6098 (concat wbol "\\\\\\(" |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6099 (mapconcat 'car reftex-section-levels-all "\\|") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6100 "\\)\\*?\\(\\[[^]]*\\]\\)?{")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6101 (appendix-re (concat wbol "\\(\\\\appendix\\)")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6102 (macro-re |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6103 (if macros-with-labels |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6104 (concat "\\(" |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6105 (mapconcat 'regexp-quote macros-with-labels "\\|") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6106 "\\)[[{]") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6107 "")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6108 (find-label-re-format |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6109 (concat "\\(" |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6110 (mapconcat 'regexp-quote (append '("\\label") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6111 macros-with-labels) "\\|") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6112 "\\)\\([[{][^]}]*[]}]\\)*[[{]\\(%s\\)[]}]"))) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6113 (setq reftex-section-regexp section-re |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6114 reftex-section-or-include-regexp |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6115 (concat section-re "\\|" include-re) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6116 reftex-everything-regexp |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6117 (concat label-re "\\|" section-re "\\|" include-re |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6118 "\\|" appendix-re |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6119 (if macros-with-labels "\\|" "") macro-re) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6120 reftex-find-label-regexp-format find-label-re-format |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6121 reftex-find-label-regexp-format2 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6122 "\\([]} \t\n\r]\\)\\([[{]\\)\\(%s\\)[]}]") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6123 (message "Compiling label environment definitions...done"))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6124 (put reftex-docstruct-symbol 'reftex-cache |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6125 (mapcar 'symbol-value reftex-cache-variables))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6126 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6127 ;;; ========================================================================= |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6128 ;;; |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6129 ;;; Operations on entire Multifile documents |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6130 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6131 (defun reftex-create-tags-file () |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6132 "Create TAGS file by running `etags' on the current document. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6133 The TAGS file is also immediately visited with `visit-tags-table'." |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6134 (interactive) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6135 (reftex-access-scan-info current-prefix-arg) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6136 (let* ((master (reftex-TeX-master-file)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6137 (files (reftex-all-document-files)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6138 (cmd (format "etags %s" (mapconcat 'identity files " ")))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6139 (save-excursion |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6140 (set-buffer (reftex-get-buffer-visiting master)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6141 (message "Running etags to create TAGS file...") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6142 (shell-command cmd) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6143 (visit-tags-table "TAGS")))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6144 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6145 ;; History of grep commands. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6146 (defvar reftex-grep-history nil) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6147 (defvar reftex-grep-command "grep -n " |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6148 "Last grep command used in \\[reftex-grep-document]; default for next grep.") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6149 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6150 (defun reftex-grep-document (grep-cmd) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6151 "Run grep query through all files related to this document. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6152 With prefix arg, force to rescan document. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6153 This works also without an active TAGS table." |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6154 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6155 (interactive |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6156 (list (read-from-minibuffer "Run grep on document (like this): " |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6157 reftex-grep-command nil nil |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6158 'reftex-grep-history))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6159 (reftex-access-scan-info current-prefix-arg) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6160 (let* ((files (reftex-all-document-files t)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6161 (cmd (format |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6162 "%s %s" grep-cmd |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6163 (mapconcat 'identity files " ")))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6164 (grep cmd))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6165 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6166 (defun reftex-search-document (&optional regexp) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6167 "Regexp search through all files of the current TeX document. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6168 Starts always in the master file. Stops when a match is found. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6169 To continue searching for next match, use command \\[tags-loop-continue]. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6170 This works also without an active TAGS table." |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6171 (interactive) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6172 (let ((default (reftex-this-word))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6173 (unless regexp |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6174 (setq regexp (read-string (format "Search regexp in document [%s]: " |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6175 default)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6176 (if (string= regexp "") (setq regexp (regexp-quote default))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6177 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6178 (reftex-access-scan-info current-prefix-arg) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6179 (tags-search regexp (list 'reftex-all-document-files)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6180 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6181 (defun reftex-query-replace-document (&optional from to delimited) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6182 "Run a query-replace-regexp of FROM with TO over the entire TeX document. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6183 Third arg DELIMITED (prefix arg) means replace only word-delimited matches. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6184 If you exit (\\[keyboard-quit] or ESC), you can resume the query replace |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6185 with the command \\[tags-loop-continue]. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6186 This works also without an active TAGS table." |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6187 (interactive) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6188 (let ((default (reftex-this-word))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6189 (unless from |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6190 (setq from (read-string (format "Replace regexp in document [%s]: " |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6191 default))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6192 (if (string= from "") (setq from (regexp-quote default)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6193 (unless to |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6194 (setq to (read-string (format "Replace regexp %s with: " from)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6195 (reftex-access-scan-info current-prefix-arg) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6196 (tags-query-replace from to (or delimited current-prefix-arg) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6197 (list 'reftex-all-document-files)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6198 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6199 (defun reftex-find-duplicate-labels () |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6200 "Produce a list of all duplicate labels in the document." |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6201 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6202 (interactive) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6203 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6204 ;; Rescan the document to make sure |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6205 (reftex-access-scan-info t) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6206 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6207 (let ((master (reftex-TeX-master-file)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6208 (cnt 0) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6209 (dlist |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6210 (mapcar |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6211 (function |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6212 (lambda (x) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6213 (let (x1) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6214 (cond |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6215 ((memq (car x) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6216 '(toc bof eof bib thebib label-numbers xr xr-doc |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6217 master-dir file-error bibview-cache appendix |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6218 is-multi)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6219 nil) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6220 (t |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6221 (setq x1 (reftex-all-assoc-string |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6222 (car x) (symbol-value reftex-docstruct-symbol))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6223 (if (< 1 (length x1)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6224 (append (list (car x)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6225 (mapcar (function |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6226 (lambda(x) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6227 (abbreviate-file-name (nth 3 x)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6228 x1)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6229 (list nil))))))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6230 (reftex-uniquify-by-car (symbol-value reftex-docstruct-symbol))))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6231 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6232 (setq dlist (reftex-uniquify-by-car dlist)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6233 (if (null dlist) (error "No duplicate labels in document")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6234 (switch-to-buffer-other-window "*Duplicate Labels*") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6235 (make-local-variable 'TeX-master) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6236 (setq TeX-master master) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6237 (erase-buffer) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6238 (insert " MULTIPLE LABELS IN CURRENT DOCUMENT:\n") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6239 (insert |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6240 " Move point to label and type `r' to run a query-replace on the label\n" |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6241 " and its references. Type `q' to exit this buffer.\n\n") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6242 (insert " LABEL FILE\n") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6243 (insert " -------------------------------------------------------------\n") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6244 (use-local-map (make-sparse-keymap)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6245 (local-set-key [?q] (function |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6246 (lambda () "Kill this buffer." (interactive) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6247 (kill-buffer (current-buffer)) (delete-window)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6248 (local-set-key [?r] 'reftex-change-label) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6249 (while dlist |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6250 (when (and (car (car dlist)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6251 (cdr (car dlist))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6252 (incf cnt) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6253 (insert (mapconcat 'identity (car dlist) "\n ") "\n")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6254 (pop dlist)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6255 (goto-char (point-min)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6256 (when (= cnt 0) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6257 (kill-buffer (current-buffer)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6258 (delete-window) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6259 (message "Document does not contain duplicate labels.")))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6260 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6261 (defun reftex-change-label (&optional from to) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6262 "Query replace FROM with TO in all \\label and \\ref commands. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6263 Works on the entire multifile document. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6264 If you exit (\\[keyboard-quit] or ESC), you can resume the query replace |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6265 with the command \\[tags-loop-continue]. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6266 This works also without an active TAGS table." |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6267 (interactive) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6268 (let ((default (reftex-this-word "-a-zA-Z0-9_*.:"))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6269 (unless from |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6270 (setq from (read-string (format "Replace label globally [%s]: " |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6271 default)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6272 (if (string= from "") (setq from default)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6273 (unless to |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6274 (setq to (read-string (format "Replace label %s with: " |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6275 from)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6276 (reftex-query-replace-document |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6277 (concat "\\\\\\(label\\|[a-z]*ref\\){" (regexp-quote from) "}") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6278 (format "\\\\\\1{%s}" to)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6279 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6280 (defun reftex-renumber-simple-labels () |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6281 "Renumber all simple labels in the document to make them sequentially. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6282 Simple labels are the ones created by RefTeX, consisting only of the |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6283 prefix and a number. After the command completes, all these labels will |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6284 have sequential numbers throughout the document. Any references to |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6285 the labels will be changed as well. For this, RefTeX looks at the |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6286 arguments of any macros which either start or end in the string `ref'. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6287 This command should be used with care, in particular in multifile |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6288 documents. You should not use it if another document refers to this |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6289 one with the `xr' package." |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6290 (interactive) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6291 ;; Resan the entire document |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6292 (reftex-access-scan-info 1) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6293 ;; Get some insurance |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6294 (if (and (reftex-is-multi) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6295 (not (yes-or-no-p "Replacing all simple labels in multiple files is risky. Continue? "))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6296 (error "Abort")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6297 ;; Make the translation list |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6298 (let* ((re-core (concat "\\(" |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6299 (mapconcat 'cdr reftex-typekey-to-prefix-alist "\\|") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6300 "\\)")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6301 (label-re (concat "\\`" re-core "\\([0-9]+\\)\\'")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6302 (search-re (concat "{\\(" re-core "\\([0-9]+\\)\\)}")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6303 (error-fmt "Undefined label or reference %s. Ignore and continue? ") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6304 (label-numbers-alist (mapcar (lambda (x) (cons (cdr x) 0)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6305 reftex-typekey-to-prefix-alist)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6306 (files (reftex-all-document-files)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6307 (list (symbol-value reftex-docstruct-symbol)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6308 translate-alist n entry label new-label nr-cell changed-sequence) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6309 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6310 (while (setq entry (pop list)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6311 (when (and (stringp (car entry)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6312 (string-match label-re (car entry))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6313 (setq label (car entry) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6314 nr-cell (assoc (match-string 1 (car entry)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6315 label-numbers-alist)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6316 (if (assoc label translate-alist) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6317 (error "Duplicate label %s" label)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6318 (setq new-label (concat (match-string 1 (car entry)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6319 (incf (cdr nr-cell)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6320 (push (cons label new-label) translate-alist) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6321 (or (string= label new-label) (setq changed-sequence t)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6322 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6323 (unless changed-sequence |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6324 (error "Simple labels are already in correct sequence")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6325 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6326 ;; Save all document buffers before this operation |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6327 (reftex-save-all-document-buffers) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6328 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6329 ;; First test to check for erros |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6330 (setq n (reftex-translate |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6331 files search-re translate-alist error-fmt 'test)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6332 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6333 ;; Now the real thing. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6334 (if (yes-or-no-p |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6335 (format "Replace %d items at %d places in %d files? " |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6336 (length translate-alist) n (length files))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6337 (progn |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6338 (let ((inhibit-quit t)) ;; Do not disturb... |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6339 (reftex-translate |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6340 files search-re translate-alist error-fmt nil) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6341 (setq quit-flag nil)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6342 (if (and (reftex-is-multi) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6343 (yes-or-no-p "Save entire document? ")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6344 (reftex-save-all-document-buffers)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6345 ;; Rescan again... |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6346 (reftex-access-scan-info 1) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6347 (message "Done replacing simple labels.")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6348 (message "No replacements done")))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6349 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6350 (defun reftex-translate (files search-re translate-alist error-fmt test) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6351 ;; In FILES, look for SEARCH-RE and replace match 1 of it with |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6352 ;; its association in TRANSLATE-ALSIT. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6353 ;; If we do not find an association and TEST is non-nil, query |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6354 ;; to ignore the problematic string. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6355 ;; If TEST is nil, it is ignored without query. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6356 ;; Return the number of replacements. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6357 (let ((n 0) file label match-data buf macro pos cell) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6358 (while (setq file (pop files)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6359 (setq buf (reftex-get-file-buffer-force file)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6360 (unless buf |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6361 (error "No such file %s" file)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6362 (set-buffer buf) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6363 (save-excursion |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6364 (save-restriction |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6365 (widen) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6366 (goto-char (point-min)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6367 (while (re-search-forward search-re nil t) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6368 (save-excursion |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6369 (backward-char) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6370 (setq label (reftex-match-string 1) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6371 cell (assoc label translate-alist) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6372 match-data (match-data) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6373 macro (reftex-what-macro 1) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6374 pos (cdr macro)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6375 (goto-char (or pos (point))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6376 (when (and macro |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6377 (or (looking-at "\\\\ref") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6378 (looking-at "\\\\[a-zA-Z]*ref[^a-zA-Z]") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6379 (looking-at "\\\\ref[a-zA-Z]*[^a-zA-Z]") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6380 (looking-at (format |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6381 reftex-find-label-regexp-format |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6382 (regexp-quote label))))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6383 ;; OK, we should replace it. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6384 (set-match-data match-data) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6385 (cond |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6386 ((and test (not cell)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6387 ;; We've got a problem |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6388 (unwind-protect |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6389 (progn |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6390 (reftex-highlight 1 (match-beginning 0) (match-end 0)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6391 (ding) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6392 (or (y-or-n-p (format error-fmt label)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6393 (error "Abort"))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6394 (reftex-unhighlight 1))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6395 ((and test cell) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6396 (incf n)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6397 ((and (not test) cell) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6398 ;; Replace |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6399 (goto-char (match-beginning 1)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6400 (delete-region (match-beginning 1) (match-end 1)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6401 (insert (cdr cell))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6402 (t nil)))))))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6403 n)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6404 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6405 (defun reftex-save-all-document-buffers () |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6406 "Save all documents associated with the current document. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6407 The function is useful after a global action like replacing or renumbering |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6408 labels." |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6409 (interactive) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6410 (let ((files (reftex-all-document-files)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6411 file buffer) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6412 (save-excursion |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6413 (while (setq file (pop files)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6414 (setq buffer (reftex-get-buffer-visiting file)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6415 (when buffer |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6416 (set-buffer buffer) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6417 (save-buffer)))))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6418 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6419 ;;; ========================================================================= |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6420 ;;; |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6421 ;;; AUCTeX Interface |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6422 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6423 (defun reftex-plug-flag (which) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6424 ;; Tell if a certain flag is set in reftex-plug-into-AUCTeX |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6425 (or (eq t reftex-plug-into-AUCTeX) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6426 (and (listp reftex-plug-into-AUCTeX) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6427 (nth which reftex-plug-into-AUCTeX)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6428 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6429 (defun reftex-arg-label (optional &optional prompt definition) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6430 "Use `reftex-label', `reftex-reference' or AUCTeX's code to insert label arg. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6431 What is being used depends upon `reftex-plug-into-AUCTeX'." |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6432 (let (label) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6433 (cond |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6434 ((and definition (reftex-plug-flag 1)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6435 ;; Create a new label, with a temporary brace for `reftex-what-macro' |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6436 (unwind-protect |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6437 (progn (insert "{") (setq label (or (reftex-label nil t) ""))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6438 (delete-backward-char 1))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6439 ((and (not definition) (reftex-plug-flag 2)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6440 ;; Reference a label with RefTeX |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6441 (setq label (reftex-reference nil t))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6442 (t |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6443 ;; AUCTeX's default mechanism |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6444 (setq label (completing-read (TeX-argument-prompt optional prompt "Key") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6445 (LaTeX-label-list))))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6446 (if (and definition (not (string-equal "" label))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6447 (LaTeX-add-labels label)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6448 (TeX-argument-insert label optional optional))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6449 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6450 (defun reftex-arg-cite (optional &optional prompt definition) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6451 "Use `reftex-citation' or AUCTeX's code to insert a cite-key macro argument. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6452 What is being used depends upon `reftex-plug-into-AUCTeX'." |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6453 (let (items) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6454 (cond |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6455 ((and (not definition) (reftex-plug-flag 3)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6456 (setq items (list (or (reftex-citation t) "")))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6457 (t |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6458 (setq prompt (concat (if optional "(Optional) " "") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6459 (if prompt prompt "Add key") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6460 ": (default none) ")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6461 (setq items (multi-prompt "," t prompt (LaTeX-bibitem-list))))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6462 (apply 'LaTeX-add-bibitems items) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6463 (TeX-argument-insert (mapconcat 'identity items ",") optional optional))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6464 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6465 (defun reftex-plug-into-AUCTeX () |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6466 ;; Replace AUCTeX functions with RefTeX functions. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6467 ;; Which functions are replaced is controlled by the variable |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6468 ;; `reftex-plug-into-AUCTeX'. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6469 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6470 (if (reftex-plug-flag 0) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6471 (setq LaTeX-label-function 'reftex-label) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6472 (setq LaTeX-label-function nil)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6473 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6474 (if (and (or (reftex-plug-flag 1) (reftex-plug-flag 2)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6475 (fboundp 'TeX-arg-label)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6476 (fset 'TeX-arg-label 'reftex-arg-label)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6477 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6478 (if (and (reftex-plug-flag 3) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6479 (fboundp 'TeX-arg-cite)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6480 (fset 'TeX-arg-cite 'reftex-arg-cite))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6481 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6482 (defun reftex-toggle-plug-into-AUCTeX () |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6483 "Toggle Interface between AUCTeX and RefTeX on and off." |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6484 (interactive) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6485 (unless (and (featurep 'tex-site) (featurep 'latex)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6486 (error "AUCTeX's LaTeX mode does not seem to be loaded.")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6487 (setq reftex-plug-into-AUCTeX (not reftex-plug-into-AUCTeX)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6488 (reftex-plug-into-AUCTeX) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6489 (if reftex-plug-into-AUCTeX |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6490 (message "RefTeX has been plugged into AUCTeX.") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6491 (message "RefTeX no longer interacts with AUCTeX."))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6492 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6493 (defun reftex-add-label-environments (entry-list) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6494 "Add label environment descriptions to `reftex-label-alist-style'. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6495 The format of ENTRY-LIST is exactly like `reftex-label-alist'. See there |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6496 for details. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6497 This function makes it possible to support RefTeX from AUCTeX style files. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6498 The entries in ENTRY-LIST will be processed after the user settings in |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6499 `reftex-label-alist', and before the defaults (specified in |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6500 `reftex-default-label-alist-entries'). Any changes made to |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6501 `reftex-label-alist-style' will raise a flag to the effect that |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6502 the label information is recompiled on next use." |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6503 (unless reftex-docstruct-symbol |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6504 (reftex-tie-multifile-symbols)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6505 (when (and reftex-docstruct-symbol |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6506 (symbolp reftex-docstruct-symbol)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6507 (let ((list (get reftex-docstruct-symbol 'reftex-label-alist-style)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6508 entry changed) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6509 (while entry-list |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6510 (setq entry (pop entry-list)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6511 (unless (member entry list) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6512 (setq reftex-tables-dirty t |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6513 changed t) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6514 (push entry list))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6515 (when changed |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6516 (put reftex-docstruct-symbol 'reftex-label-alist-style list))))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6517 (defalias 'reftex-add-to-label-alist 'reftex-add-label-environments) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6518 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6519 (defun reftex-add-section-levels (entry-list) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6520 "Add entries to the value of `reftex-section-levels'. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6521 The added values are kept local to the current document. The format |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6522 of ENTRY-LIST is a list of cons cells (\"MACRONAME\" . LEVEL). See |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6523 `reftex-section-levels' for an example." |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6524 (unless reftex-docstruct-symbol |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6525 (reftex-tie-multifile-symbols)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6526 (when (and reftex-docstruct-symbol |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6527 (symbolp reftex-docstruct-symbol)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6528 (let ((list (get reftex-docstruct-symbol 'reftex-section-levels)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6529 entry changed) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6530 (while entry-list |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6531 (setq entry (pop entry-list)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6532 (unless (member entry list) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6533 (setq reftex-tables-dirty t |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6534 changed t) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6535 (push entry list))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6536 (when changed |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6537 (put reftex-docstruct-symbol 'reftex-section-levels list))))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6538 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6539 (defun reftex-set-cite-format (value) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6540 "Set the document-local value of `reftex-cite-format'. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6541 When such a value exists, it overwrites the setting given with |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6542 `reftex-cite-format'. See the documentation of `reftex-cite-format' |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6543 for possible values. This function should be used from AUCTeX style files." |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6544 (unless reftex-docstruct-symbol |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6545 (reftex-tie-multifile-symbols)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6546 (when (and reftex-docstruct-symbol |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6547 (symbolp reftex-docstruct-symbol)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6548 (put reftex-docstruct-symbol 'reftex-cite-format value))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6549 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6550 (defun reftex-notice-new-section () |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6551 "Hook to handshake with RefTeX after a new section has been inserted." |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6552 ;; Add a new section to the docstruct list and renumber the |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6553 ;; following sections. This hook has to be called immediately after |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6554 ;; the new section was inserted into the buffer, and before the |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6555 ;; section label is created. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6556 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6557 (condition-case nil |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6558 (catch 'exit |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6559 (unless reftex-mode (throw 'exit nil)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6560 (reftex-access-scan-info) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6561 (let* ((docstruct (symbol-value reftex-docstruct-symbol)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6562 here-am-I appendix tail toc-entry star level |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6563 section-number context) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6564 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6565 (save-excursion |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6566 (when (re-search-backward reftex-section-regexp nil t) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6567 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6568 ;; Find where we are |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6569 (setq here-am-I (reftex-where-am-I)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6570 (unless (cdr here-am-I) (throw 'exit nil)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6571 (setq reftex-active-toc (reftex-last-assoc-before-elt |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6572 'toc (car here-am-I) docstruct) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6573 appendix (reftex-last-assoc-before-elt |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6574 'appendix (car here-am-I) docstruct)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6575 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6576 ;; Initialize section numbers |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6577 (if (eq (car (car here-am-I)) 'appendix) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6578 (reftex-init-section-numbers nil t) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6579 (reftex-init-section-numbers reftex-active-toc appendix)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6580 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6581 ;; Match the section command |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6582 (when (and (re-search-forward reftex-everything-regexp nil t) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6583 (match-end 3)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6584 (setq star (= ?* (char-after (match-end 3))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6585 toc-entry (reftex-section-info (buffer-file-name)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6586 level (nth 5 toc-entry) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6587 tail (memq (car here-am-I) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6588 (symbol-value reftex-docstruct-symbol))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6589 (if tail |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6590 ;; Insert the section info |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6591 (push toc-entry (cdr tail)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6592 (throw 'exit nil)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6593 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6594 ;; We are done unless we use section numbers |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6595 (unless (nth 1 reftex-label-menu-flags) (throw 'exit nil)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6596 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6597 ;; Update the remaining toc items |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6598 (setq tail (cdr tail)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6599 (while (and (setq tail (memq (assq 'toc (cdr tail)) tail)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6600 (setq toc-entry (car tail)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6601 (>= (nth 5 toc-entry) level)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6602 (setq section-number |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6603 (reftex-section-number (nth 5 toc-entry) star) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6604 context (nth 2 toc-entry)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6605 (when (string-match "\\`\\([ \t]*\\)\\([.0-9A-Z]+\\)\\(.*\\)" |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6606 context) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6607 (when (and (not appendix) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6608 (>= (string-to-char (match-string 2)) ?A)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6609 ;; Just entered the appendex. Get out. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6610 (throw 'exit nil)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6611 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6612 ;; Change the section number. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6613 (setf (nth 2 toc-entry) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6614 (concat (match-string 1 context) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6615 section-number |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6616 (match-string 3 context)))))))))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6617 (error nil)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6618 ) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6619 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6620 ;;; ========================================================================= |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6621 ;;; |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6622 ;;; Keybindings |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6623 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6624 ;; 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
|
6625 (loop for x in |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6626 '(("\C-c=" . reftex-toc) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6627 ("\C-c(" . reftex-label) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6628 ("\C-c)" . reftex-reference) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6629 ("\C-c[" . reftex-citation) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6630 ("\C-c&" . reftex-view-crossref)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6631 do (define-key reftex-mode-map (car x) (cdr x))) |
18050 | 6632 |
21130
60e882bbb28b
Added keybinding for `reftex-mouse-view-crossref' to S-mouse-2.
Carsten Dominik <dominik@science.uva.nl>
parents:
21124
diff
changeset
|
6633 ;; Bind `reftex-mouse-view-crossref' only when the key is still free |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6634 (if (featurep 'xemacs) |
21130
60e882bbb28b
Added keybinding for `reftex-mouse-view-crossref' to S-mouse-2.
Carsten Dominik <dominik@science.uva.nl>
parents:
21124
diff
changeset
|
6635 (unless (key-binding [(shift button2)]) |
60e882bbb28b
Added keybinding for `reftex-mouse-view-crossref' to S-mouse-2.
Carsten Dominik <dominik@science.uva.nl>
parents:
21124
diff
changeset
|
6636 (define-key reftex-mode-map [(shift button2)] |
60e882bbb28b
Added keybinding for `reftex-mouse-view-crossref' to S-mouse-2.
Carsten Dominik <dominik@science.uva.nl>
parents:
21124
diff
changeset
|
6637 'reftex-mouse-view-crossref)) |
60e882bbb28b
Added keybinding for `reftex-mouse-view-crossref' to S-mouse-2.
Carsten Dominik <dominik@science.uva.nl>
parents:
21124
diff
changeset
|
6638 (unless (key-binding [(shift mouse-2)]) |
60e882bbb28b
Added keybinding for `reftex-mouse-view-crossref' to S-mouse-2.
Carsten Dominik <dominik@science.uva.nl>
parents:
21124
diff
changeset
|
6639 (define-key reftex-mode-map [(shift mouse-2)] |
60e882bbb28b
Added keybinding for `reftex-mouse-view-crossref' to S-mouse-2.
Carsten Dominik <dominik@science.uva.nl>
parents:
21124
diff
changeset
|
6640 'reftex-mouse-view-crossref))) |
60e882bbb28b
Added keybinding for `reftex-mouse-view-crossref' to S-mouse-2.
Carsten Dominik <dominik@science.uva.nl>
parents:
21124
diff
changeset
|
6641 |
18050 | 6642 ;; 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
|
6643 (when reftex-extra-bindings |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6644 (loop for x in |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6645 '(("\C-ct" . reftex-toc) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6646 ("\C-cl" . reftex-label) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6647 ("\C-cr" . reftex-reference) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6648 ("\C-cc" . reftex-citation) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6649 ("\C-cv" . reftex-view-crossref) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6650 ("\C-cg" . reftex-grep-document) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6651 ("\C-cs" . reftex-search-document)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6652 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
|
6653 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6654 ;; Common bindings in reftex-select-label-map and reftex-select-bib-map |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6655 (let ((map (make-sparse-keymap))) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6656 (substitute-key-definition |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6657 'next-line 'reftex-select-next map global-map) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6658 (substitute-key-definition |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6659 'previous-line 'reftex-select-previous map global-map) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6660 (substitute-key-definition |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
6661 'keyboard-quit 'reftex-select-keyboard-quit map global-map) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6662 (substitute-key-definition |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6663 'newline 'reftex-select-accept map global-map) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6664 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6665 (loop for x in |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6666 '((" " . reftex-select-callback) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6667 ("n" . reftex-select-next) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6668 ([(down)] . reftex-select-next) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6669 ("p" . reftex-select-previous) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6670 ([(up)] . reftex-select-previous) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6671 ("f" . reftex-select-toggle-follow) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6672 ("\C-m" . reftex-select-accept) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6673 ([(return)] . reftex-select-accept) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6674 ("q" . reftex-select-quit) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6675 ("." . reftex-select-show-insertion-point) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6676 ("?" . reftex-select-help)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6677 do (define-key map (car x) (cdr x))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6678 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6679 ;; The mouse-2 binding |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6680 (if (featurep 'xemacs) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6681 (define-key map [(button2)] 'reftex-select-mouse-accept) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6682 (define-key map [(mouse-2)] 'reftex-select-mouse-accept)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6683 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6684 ;; Digit arguments |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
6685 (loop for key across "0123456789" do |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
6686 (define-key map (vector (list key)) 'digit-argument)) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
6687 (define-key map "-" 'negative-argument) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6688 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6689 ;; Make two maps |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6690 (setq reftex-select-label-map map) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6691 (setq reftex-select-bib-map (copy-keymap map))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6692 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6693 ;; Specific bindings in reftex-select-label-map |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6694 (loop for key across "cgilrRstx#%" do |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6695 (define-key reftex-select-label-map (vector (list key)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6696 (list 'lambda '() |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6697 "Press `?' during selection to find out about this key." |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6698 '(interactive) (list 'throw '(quote myexit) key)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6699 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6700 (loop for x in |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6701 '(("b" . reftex-select-jump-to-previous) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6702 ("v" . reftex-select-toggle-varioref) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6703 ([(tab)] . reftex-select-read-label) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6704 ("\C-i" . reftex-select-read-label) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6705 ("\C-c\C-n" . reftex-select-next-heading) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6706 ("\C-c\C-p" . reftex-select-previous-heading)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6707 do |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6708 (define-key reftex-select-label-map (car x) (cdr x))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6709 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6710 ;; Specific bindings in reftex-select-bib-map |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6711 (loop for key across "grRaA" do |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6712 (define-key reftex-select-bib-map (vector (list key)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6713 (list 'lambda '() |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6714 "Press `?' during selection to find out about this key." |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6715 '(interactive) (list 'throw '(quote myexit) key)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6716 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6717 (loop for x in |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6718 '(("\C-i" . reftex-select-read-cite) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6719 ([(tab)] . reftex-select-read-cite)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6720 do (define-key reftex-select-bib-map (car x) (cdr x))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6721 |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6722 ;; Table of Contents map |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6723 (if (featurep 'xemacs) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6724 (define-key reftex-toc-map [(button2)] 'reftex-toc-mouse-goto-line-and-hide) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6725 (define-key reftex-toc-map [(mouse-2)] 'reftex-toc-mouse-goto-line-and-hide)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6726 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6727 (loop for x in |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6728 '(("n" . next-line) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6729 ("p" . previous-line) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6730 ("?" . reftex-toc-show-help) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6731 (" " . reftex-toc-view-line) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6732 ("\C-m" . reftex-toc-goto-line-and-hide) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6733 ("\C-i" . reftex-toc-goto-line) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6734 ("r" . reftex-toc-rescan) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6735 ("R" . reftex-toc-Rescan) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6736 ("g" . revert-buffer) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6737 ("q" . reftex-toc-quit) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6738 ("Q" . reftex-toc-quit-and-kill) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6739 ("f" . reftex-toc-toggle-follow) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6740 ("x" . reftex-toc-external) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6741 ("." . reftex-toc-show-insertion-point)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6742 do (define-key reftex-toc-map (car x) (cdr x))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6743 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6744 (loop for key across "0123456789" do |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6745 (define-key reftex-toc-map (vector (list key)) 'digit-argument)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6746 (define-key reftex-toc-map "-" 'negative-argument) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6747 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6748 ;;; ========================================================================= |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6749 ;;; |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6750 ;;; Menu |
18050 | 6751 |
6752 ;; Define a menu for the menu bar if Emacs is running under X | |
6753 | |
6754 (require 'easymenu) | |
6755 | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6756 (easy-menu-define |
18050 | 6757 reftex-mode-menu reftex-mode-map |
6758 "Menu used in RefTeX mode" | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6759 `("Ref" |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
6760 ["Table of Contents" reftex-toc t] |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6761 "---" |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
6762 ["\\label" reftex-label t] |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
6763 ["\\ref" reftex-reference t] |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
6764 ["\\cite" reftex-citation t] |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6765 ["View Crossref" reftex-view-crossref t] |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6766 "---" |
20177
6ebc3e300106
The menu now used toggle and radio for some items.
Karl Heuer <kwzh@gnu.org>
parents:
20102
diff
changeset
|
6767 ("Parse Document" |
6ebc3e300106
The menu now used toggle and radio for some items.
Karl Heuer <kwzh@gnu.org>
parents:
20102
diff
changeset
|
6768 ["Only this File" reftex-parse-one t] |
6ebc3e300106
The menu now used toggle and radio for some items.
Karl Heuer <kwzh@gnu.org>
parents:
20102
diff
changeset
|
6769 ["Entire Document" reftex-parse-all (reftex-is-multi)] |
6ebc3e300106
The menu now used toggle and radio for some items.
Karl Heuer <kwzh@gnu.org>
parents:
20102
diff
changeset
|
6770 ["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
|
6771 (> (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
|
6772 ["Restore from File" (reftex-access-parse-file 'restore) t] |
20177
6ebc3e300106
The menu now used toggle and radio for some items.
Karl Heuer <kwzh@gnu.org>
parents:
20102
diff
changeset
|
6773 "---" |
6ebc3e300106
The menu now used toggle and radio for some items.
Karl Heuer <kwzh@gnu.org>
parents:
20102
diff
changeset
|
6774 ["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
|
6775 ("Global Actions" |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6776 ["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
|
6777 ["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
|
6778 ["Grep on Document" reftex-grep-document t] |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6779 "---" |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6780 ["Create TAGS File" reftex-create-tags-file t] |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6781 "---" |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6782 ["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
|
6783 ["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
|
6784 ["Renumber Simple Labels" reftex-renumber-simple-labels t] |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6785 "---" |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6786 ["Save document" reftex-save-all-document-buffers t]) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6787 "---" |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6788 ("Options" |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6789 ("Table of Contents" |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6790 ["Follow Mode" (setq reftex-toc-follow-mode (not reftex-toc-follow-mode)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6791 :style toggle :selected reftex-toc-follow-mode] |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6792 ["Follow Mode may visit files" |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6793 (setq reftex-revisit-to-follow (not reftex-revisit-to-follow)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6794 :style toggle :selected reftex-revisit-to-follow]) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6795 ("References" |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6796 ["Guess Label Type" |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6797 (setq reftex-guess-label-type (not reftex-guess-label-type)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6798 :style toggle :selected reftex-guess-label-type] |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6799 ["Use `\\vref' by Default" |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6800 (setq reftex-vref-is-default (not reftex-vref-is-default)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6801 :style toggle :selected reftex-vref-is-default] |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6802 "---" |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6803 "Selection Buffers" |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6804 ["Use Multiple Buffers" |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6805 (setq reftex-use-multiple-selection-buffers |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6806 (not reftex-use-multiple-selection-buffers)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6807 :style toggle :selected reftex-use-multiple-selection-buffers] |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6808 ["Auto Update Buffers" |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6809 (setq reftex-auto-update-selection-buffers |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6810 (not reftex-auto-update-selection-buffers)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6811 :style toggle :selected reftex-auto-update-selection-buffers]) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6812 ("Citations" |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6813 "Citation Style" |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6814 ,@(mapcar |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6815 (function |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6816 (lambda (x) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6817 (vector |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6818 (capitalize (symbol-name (car x))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6819 (list 'reftex-set-cite-format (list 'quote (car x))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6820 ':style 'radio ':selected |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6821 (list 'eq (list 'reftex-get-cite-format) (list 'quote (car x)))))) |
20177
6ebc3e300106
The menu now used toggle and radio for some items.
Karl Heuer <kwzh@gnu.org>
parents:
20102
diff
changeset
|
6822 reftex-cite-format-builtin) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6823 "---" |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6824 "Bibinfo in Comments" |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6825 ["Attach Comments" |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6826 (setq reftex-comment-citations (not reftex-comment-citations)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6827 :style toggle :selected reftex-comment-citations] |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6828 "---" |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6829 "Sort Database Matches" |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6830 ["by Author" (setq reftex-sort-bibtex-matches 'author) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6831 :style radio :selected (eq reftex-sort-bibtex-matches 'author)] |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6832 ["by Year" (setq reftex-sort-bibtex-matches 'year) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6833 :style radio :selected (eq reftex-sort-bibtex-matches 'year)] |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6834 ["by Year, reversed" (setq reftex-sort-bibtex-matches 'reverse-year) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6835 :style radio :selected (eq reftex-sort-bibtex-matches 'reverse-year)] |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6836 ["Not" (setq reftex-sort-bibtex-matches nil) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6837 :style radio :selected (eq reftex-sort-bibtex-matches nil)]) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6838 ("Crossref Viewing" |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6839 ["Automatic Info in Echo Area" reftex-toggle-auto-view-crossref |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6840 :style toggle :selected reftex-auto-view-crossref-timer] |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6841 ["Crossref Echo may visit files" |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6842 (setq reftex-revisit-to-echo (not reftex-revisit-to-echo)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6843 :style toggle :selected reftex-revisit-to-echo] |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6844 ["Cache Echo strings for \cite" |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6845 (setq reftex-cache-cite-echo (not reftex-cache-cite-echo)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6846 :style toggle :selected reftex-cache-cite-echo]) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6847 ("Parser" |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6848 "Document Scans" |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6849 ["Partial Scans" |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6850 (setq reftex-enable-partial-scans (not reftex-enable-partial-scans)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6851 :style toggle :selected reftex-enable-partial-scans] |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6852 ["Auto-Save Parse Info" |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6853 (setq reftex-save-parse-info (not reftex-save-parse-info)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6854 :style toggle :selected reftex-save-parse-info] |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6855 ["Automatic Rescans" |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6856 (setq reftex-allow-automatic-rescan (not reftex-allow-automatic-rescan)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6857 :style toggle :selected reftex-allow-automatic-rescan] |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6858 "---" |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6859 "Temporary Buffers" |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6860 ["Keep Buffers" |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6861 (setq reftex-keep-temporary-buffers (not reftex-keep-temporary-buffers)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6862 :style toggle :selected reftex-keep-temporary-buffers] |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6863 ["Initialize when Visiting" |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6864 (setq reftex-initialize-temporary-buffers |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6865 (not reftex-initialize-temporary-buffers)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6866 :style toggle :selected reftex-initialize-temporary-buffers]) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6867 ("AUC TeX" |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6868 ["Plug into AUC TeX" reftex-toggle-plug-into-AUCTeX |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6869 :style toggle :selected reftex-plug-into-AUCTeX]) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6870 ("Fontification" |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6871 ["Use Fontification" (setq reftex-use-fonts (not reftex-use-fonts)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6872 :style toggle :selected reftex-use-fonts] |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6873 ["Fontify Context Display" (setq reftex-refontify-context |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6874 (not (reftex-refontify))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6875 :style toggle :selected (reftex-refontify)])) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6876 ;;"---" |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6877 ("Customize" |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6878 ["Browse RefTeX group" reftex-customize t] |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6879 "---" |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6880 ["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
|
6881 (fboundp 'customize-menu-create)]) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6882 "---" |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6883 ("Documentation" |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6884 ["Info" reftex-info t] |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6885 ["Commentary" reftex-show-commentary t]))) |
18050 | 6886 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6887 (defun reftex-customize () |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6888 "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
|
6889 (interactive) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6890 (customize-browse 'reftex)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6891 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6892 (defun reftex-create-customize-menu () |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6893 "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
|
6894 (interactive) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6895 (if (fboundp 'customize-menu-create) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6896 (progn |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6897 (easy-menu-change |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6898 '("Ref") "Customize" |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6899 `(["Browse RefTeX group" reftex-customize t] |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6900 "---" |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6901 ,(customize-menu-create 'reftex) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6902 ["Set" Custom-set t] |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6903 ["Save" Custom-save t] |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6904 ["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
|
6905 ["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
|
6906 ["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
|
6907 (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
|
6908 (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
|
6909 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6910 (defun reftex-show-commentary () |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6911 "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
|
6912 (interactive) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6913 (require 'finder) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6914 (finder-commentary "reftex.el")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6915 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6916 (defun reftex-info () |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6917 "Read documentation for RefTeX in the info system." |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6918 (interactive) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6919 (require 'info) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6920 (Info-goto-node "(reftex)")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6921 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6922 ;; Support for \label and \ref -------------------------------------- |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6923 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6924 ;;; 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
|
6925 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6926 (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
|
6927 (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
|
6928 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6929 ;;; Install the idle timer if requested --------------------------------------- |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6930 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6931 (and reftex-auto-view-crossref |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6932 (not reftex-auto-view-crossref-timer) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6933 (reftex-toggle-auto-view-crossref)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6934 |
18050 | 6935 ;;; Run Hook ------------------------------------------------------------------ |
6936 | |
6937 (run-hooks 'reftex-load-hook) | |
6938 | |
6939 ;;; That's it! ---------------------------------------------------------------- | |
6940 | |
21114
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
6941 (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
|
6942 (provide 'reftex) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6943 |
18050 | 6944 ;;;============================================================================ |
6945 | |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
6946 ;;; reftex.el ends here |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6947 |