Mercurial > emacs
annotate lisp/textmodes/reftex.el @ 24784:8c5bc687c346
(dired-insert-subdir-doinsert): Check that the
headerline does not exist already.
author | Andreas Schwab <schwab@suse.de> |
---|---|
date | Thu, 27 May 1999 09:34:36 +0000 |
parents | 8de7eb6fef39 |
children | bd105cd3c084 |
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 ;; | |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
28 ;; RefTeX is a minor mode with distinct support for \ref, \label, and \cite |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
29 ;; commands in (multi-file) LaTeX documents. |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
30 ;; - A table of contents provides easy access to any part of a document. |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
31 ;; - Labels are created semi-automatically. |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
32 ;; - Definition context of labels is provided when creating a reference. |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
33 ;; - Citations are simplified with efficient database lookup. |
18050 | 34 ;; |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
35 ;; |
23200
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
36 ;; INSTALLATION |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
37 ;; ------------ |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
38 ;; |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
39 ;; - If this file is part of an X/Emacs distribution, it is installed. |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
40 ;; - For XEmacs 21.x, you need to install the RefTeX plug-in package |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
41 ;; available from the XEmacs distribution sites. |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
42 ;; - If you have downloaded this file from the maintainers webpage, follow |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
43 ;; the instructions in the INSTALL file of the distrubution. |
23200
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
44 ;; |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
45 ;; To turn RefTeX Mode on and off in a buffer, use `M-x reftex-mode'. |
18050 | 46 ;; |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
47 ;; To turn on RefTeX Mode for all LaTeX files, add the following lines |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
48 ;; to your .emacs file: |
18050 | 49 ;; |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
50 ;; (add-hook 'LaTeX-mode-hook 'turn-on-reftex) ; AUCTeX LaTeX mode |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
51 ;; (add-hook 'latex-mode-hook 'turn-on-reftex) ; Emacs latex mode |
18050 | 52 ;; |
20829
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 ;; DOCUMENTATION |
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 ;; |
23200
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
57 ;; See below for a short summary of how to use RefTeX. |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
58 ;; |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
59 ;; There is an extensive texinfo document describing RefTeX in detail. |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
60 ;; One way to view this documentation is `M-x reftex-info RET'. |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
61 ;; |
23200
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
62 ;; The documentation in various formats is also available at |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
63 ;; |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
64 ;; 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
|
65 ;; |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
66 ;;--------------------------------------------------------------------------- |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
67 ;; |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
68 ;; RefTeX in a Nutshell |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
69 ;; ==================== |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
70 ;; |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
71 ;; 1. Table of Contents |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
72 ;; Typing `C-c =' (`reftex-toc') will show a table of contents of the |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
73 ;; document. From that buffer, you can jump quickly to every part of |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
74 ;; your document. Press `?' to get help. |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
75 ;; |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
76 ;; 2. Labels and References |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
77 ;; RefTeX distinguishes labels for different environments. It knows |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
78 ;; about all standard environments (and many others), and can be |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
79 ;; configured to recognize any additional labeled environments you |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
80 ;; have defined yourself (variable `reftex-label-alist'). |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
81 ;; |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
82 ;; Creating Labels |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
83 ;; Type `C-c (' (`reftex-label') to insert a label at point. RefTeX |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
84 ;; will either |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
85 ;; - derive a label from context (default for section labels) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
86 ;; - prompt for a label string (default for figures and tables) or |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
87 ;; - insert a simple label made of a prefix and a number (all other |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
88 ;; environments) |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
89 ;; This is configurable with the variable `reftex-insert-label-flags'. |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
90 ;; |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
91 ;; Referencing Labels |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
92 ;; To make a reference, type `C-c )' (`reftex-reference'). This |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
93 ;; shows an outline of the document with all labels of a certain type |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
94 ;; (figure, equation,...) and some label context. Selecting a label |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
95 ;; inserts a `\ref{LABEL}' macro into the original buffer. |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
96 ;; |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
97 ;; 3. Citations |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
98 ;; Typing `C-c [' (`reftex-citation') will let you specify a regular |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
99 ;; expression to search in current BibTeX database files (as |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
100 ;; specified in the `\bibliography' command) and pull out a list of |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
101 ;; matches for you to choose from. The list is *formatted* and |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
102 ;; sorted. The selected article is referenced as `\cite{KEY}' (see |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
103 ;; variable `reftex-cite-format'). |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
104 ;; |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
105 ;; 4. Viewing Cross-References |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
106 ;; When point is on the KEY argument of a cross-referencing macro |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
107 ;; (`\label', `\ref', `\cite', `\bibitem', `\index', and variations) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
108 ;; or inside a BibTeX database entry, you can press `C-c &' |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
109 ;; (`reftex-view-crossref') to display corresponding locations in the |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
110 ;; document and associated BibTeX database files. |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
111 ;; When the enclosing macro is `\cite' or `\ref' and no other message |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
112 ;; occupies the echo area, information about the citation or label |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
113 ;; will automatically be displayed. |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
114 ;; |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
115 ;; 5. Multifile Documents |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
116 ;; Multifile Documents are fully supported. RefTeX provides |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
117 ;; cross-referencing information from all parts of the document, and |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
118 ;; across document borders (`xr.sty'). |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
119 ;; |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
120 ;; 6. Document Parsing |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
121 ;; RefTeX needs to parse the document in order to find labels and |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
122 ;; other information. It does it automatically once and updates its |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
123 ;; list internally when `reftex-label' is used. To enforce |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
124 ;; reparsing, call any of the commands described above with a raw |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
125 ;; `C-u' prefix, or press the `r' key in the label selection buffer |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
126 ;; or the table of contents buffer. |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
127 ;; |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
128 ;; 7. Useful Settings |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
129 ;; To make RefTeX faster for large documents, and to integrate with |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
130 ;; AUCTeX, try these: |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
131 ;; (setq reftex-enable-partial-scans t) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
132 ;; (setq reftex-save-parse-info t) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
133 ;; (setq reftex-use-multiple-selection-buffers t) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
134 ;; (setq reftex-plug-into-AUCTeX t) |
18050 | 135 ;; |
136 ;;--------------------------------------------------------------------------- | |
137 ;; | |
138 ;; AUTHOR | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
139 ;; ====== |
18050 | 140 ;; |
141 ;; Carsten Dominik <dominik@strw.LeidenUniv.nl> | |
142 ;; | |
143 ;; with contributions from Stephen Eglen | |
144 ;; | |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
145 ;; RefTeX is bundled with Emacs and available as a plug-in package for |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
146 ;; XEmacs 21.x. If you need to install it yourself, you can find a |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
147 ;; distribution at |
18050 | 148 ;; |
149 ;; http://www.strw.leidenuniv.nl/~dominik/Tools/ | |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
150 ;; |
18050 | 151 ;; THANKS TO: |
152 ;; --------- | |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
153 ;; 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
|
154 ;; developing it with their reports. In particular thanks to |
18050 | 155 ;; |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
156 ;; Fran Burstall, Alastair Burt, Soren Dayton, Stephen Eglen, |
23344
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
157 ;; Karl Eichwalder, Peter Galbraith, Dieter Kraft, Kai Grossjohann, |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
158 ;; Adrian Lanz, Rory Molinari, Laurent Mugnier, Sudeep Kumar Palat, |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
159 ;; Daniel Polani, Robin Socha, Richard Stanton, Allan Strand, |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
160 ;; Jan Vroonhof, Christoph Wedler, Alan Williams. |
18050 | 161 ;; |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
162 ;; Finally thanks to Uwe Bolick who first got me (some years ago) into |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
163 ;; supporting LaTeX labels and references with an editor (which was |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
164 ;; MicroEmacs at the time). |
18219
aaeaae005e98
Updated documentation at several points in the file.
Richard M. Stallman <rms@gnu.org>
parents:
18123
diff
changeset
|
165 ;; |
23200
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
166 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
167 ;; |
23200
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
168 ;;;;;; |
18050 | 169 |
170 ;;; Code: | |
171 | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
172 (eval-when-compile (require 'cl)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
173 |
18050 | 174 ;; Stuff that needs to be there when we use defcustom |
175 (require 'custom) | |
176 | |
177 (defvar reftex-tables-dirty t | |
178 "Flag showing if tables need to be re-computed.") | |
179 | |
180 (eval-and-compile | |
181 (defun reftex-set-dirty (symbol value) | |
182 (setq reftex-tables-dirty t) | |
183 (set symbol value))) | |
184 | |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
185 ;;; ====================================================================== |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
186 ;;; |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
187 ;;; Configuration Section |
18050 | 188 |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
189 ;; 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
|
190 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
191 (eval-and-compile |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
192 (defconst reftex-label-alist-builtin |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
193 '( |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
194 ;; Some aliases, mostly for backward compatibility |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
195 (Sideways "Alias for -->rotating" (rotating)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
196 (AMSTeX "amsmath with eqref macro" |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
197 ((nil ?e nil "~\\eqref{%s}") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
198 amsmath)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
199 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
200 ;; Individual package defaults |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
201 (amsmath "AMS-LaTeX math environments" |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
202 (("align" ?e nil nil eqnarray-like) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
203 ("gather" ?e nil nil eqnarray-like) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
204 ("multline" ?e nil nil t) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
205 ("flalign" ?e nil nil eqnarray-like) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
206 ("alignat" ?e nil nil alignat-like) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
207 ("xalignat" ?e nil nil alignat-like) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
208 ("xxalignat" ?e nil nil alignat-like) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
209 ("subequations" ?e nil nil t))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
210 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
211 (endnotes "The \\endnote macro" |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
212 (("\\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
|
213 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
214 (fancybox "The Beqnarray environment" |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
215 (("Beqnarray" ?e nil nil eqnarray-like))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
216 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
217 (floatfig "The floatingfigure environment" |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
218 (("floatingfigure" ?f nil nil caption))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
219 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
220 (longtable "The longtable environment" |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
221 (("longtable" ?t nil nil caption))) |
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 (picinpar "The figwindow and tabwindow environments" |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
224 (("figwindow" ?f nil nil 1) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
225 ("tabwindow" ?f nil nil 1))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
226 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
227 (rotating "Sidewaysfigure and table" |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
228 (("sidewaysfigure" ?f nil nil caption) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
229 ("sidewaystable" ?t nil nil caption))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
230 |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
231 (sidecap "CSfigure and SCtable" |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
232 (("SCfigure" ?f nil nil caption) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
233 ("SCtable" ?t nil nil caption))) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
234 |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
235 (subfigure "Subfigure environments/macro" |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
236 (("subfigure" ?f nil nil caption) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
237 ("subfigure*" ?f nil nil caption) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
238 ("\\subfigure[]{}" ?f nil nil 1))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
239 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
240 (supertab "Supertabular environment" |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
241 (("supertabular" ?t nil nil "\\tablecaption{"))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
242 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
243 (wrapfig "The wrapfigure environment" |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
244 (("wrapfigure" ?f nil nil caption))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
245 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
246 ;; The LaTeX core stuff |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
247 (LaTeX "LaTeX default environments" |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
248 (("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
|
249 (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
|
250 "paragraphs?" "par\\." |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
251 "\\\\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
|
252 "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
|
253 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
254 ("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
|
255 (regexp "items?" "Punkte?")) |
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 ("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
|
258 (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
|
259 ("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
|
260 |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
261 ("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
|
262 (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
|
263 ("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
|
264 |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
265 ("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
|
266 (regexp "tables?" "tab\\." "Tabellen?")) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
267 ("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
|
268 |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
269 ("\\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
|
270 (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
|
271 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
272 ("any" ?\ " " "~\\ref{%s}" nil) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
273 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
274 ;; 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
|
275 ;;("\\label{*}" nil nil nil nil) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
276 )) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
277 |
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 "The default label environment descriptions. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
280 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
|
281 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
|
282 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
283 (defconst reftex-cite-format-builtin |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
284 '((default "Default macro \\cite{%l}" |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
285 "\\cite{%l}") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
286 (natbib "The Natbib package" |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
287 ((?\C-m . "\\cite{%l}") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
288 (?t . "\\citet{%l}") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
289 (?T . "\\citet*{%l}") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
290 (?p . "\\citep{%l}") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
291 (?P . "\\citep*{%l}") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
292 (?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
|
293 (?s . "\\citep[see][]{%l}") |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
294 (?a . "\\citeauthor{%l}") |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
295 (?A . "\\citeauthor*{%l}") |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
296 (?y . "\\citeyear{%l}"))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
297 (harvard "The Harvard package" |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
298 ((?\C-m . "\\cite{%l}") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
299 (?p . "\\cite{%l}") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
300 (?t . "\\citeasnoun{%l}") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
301 (?n . "\\citeasnoun{%l}") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
302 (?s . "\\possessivecite{%l}") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
303 (?e . "\\citeaffixed{%l}{?}") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
304 (?y . "\\citeyear{%l}") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
305 (?a . "\\citename{%l}"))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
306 (chicago "The Chicago package" |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
307 ((?\C-m . "\\cite{%l}") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
308 (?t . "\\citeN{%l}") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
309 (?T . "\\shortciteN{%l}") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
310 (?p . "\\cite{%l}") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
311 (?P . "\\shortcite{%l}") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
312 (?a . "\\citeA{%l}") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
313 (?A . "\\shortciteA{%l}") |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
314 (?y . "\\citeyear{%l}"))) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
315 (astron "The Astron package" |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
316 ((?\C-m . "\\cite{%l}") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
317 (?p . "\\cite{%l}" ) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
318 (?t . "%2a (\\cite{%l})"))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
319 (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
|
320 ((?\C-m . "\\cite{%l}") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
321 (?t . "%2a (%y)\\nocite{%l}") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
322 (?p . "(%2a %y\\nocite{%l})"))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
323 (locally "Full info in parenthesis" |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
324 "(%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
|
325 ) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
326 "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
|
327 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
|
328 `?\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
|
329 `?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
|
330 `?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
|
331 ) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
332 |
18050 | 333 ;; Configuration Variables and User Options for RefTeX ------------------ |
334 | |
335 (defgroup reftex nil | |
336 "LaTeX label and citation support." | |
337 :tag "RefTeX" | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
338 :link '(url-link :tag "Home Page" |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
339 "http://strw.leidenuniv.nl/~dominik/Tools/") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
340 :link '(emacs-commentary-link :tag "Commentary in reftex.el" "reftex.el") |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
341 :link '(custom-manual "(reftex)Top") |
18050 | 342 :prefix "reftex-" |
343 :group 'tex) | |
344 | |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
345 ;; Table of contents configuration -------------------------------------- |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
346 |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
347 (defgroup reftex-table-of-contents-browser nil |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
348 "A multifile table of contents browser." |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
349 :group 'reftex) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
350 |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
351 (defcustom reftex-toc-keep-other-windows t |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
352 "*Non-nil means, split the selected window to display the *toc* buffer. |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
353 This helps to keep the window configuration, but makes the *toc* small. |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
354 When nil, all other windows except the selected one will be deleted, so |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
355 that the *toc* window fills half the frame." |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
356 :group 'reftex-table-of-contents-browser |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
357 :type 'boolean) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
358 |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
359 (defcustom reftex-toc-include-labels nil |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
360 "*Non-nil means, include labels in *toc* buffer. |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
361 This flag can be toggled from within the *toc* buffer with the `l' key." |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
362 :group 'reftex-table-of-contents-browser |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
363 :type 'boolean) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
364 |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
365 (defcustom reftex-toc-include-context nil |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
366 "*Non-nil means, include context with labels in the *toc* buffer. |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
367 Context will only be shown when labels are visible as well. |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
368 This flag can be toggled from within the *toc* buffer with the `c' key." |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
369 :group 'reftex-table-of-contents-browser |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
370 :type 'boolean) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
371 |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
372 (defcustom reftex-toc-include-file-boundaries nil |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
373 "*Non-nil means, include file boundaries in *toc* buffer. |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
374 This flag can be toggled from within the *toc* buffer with the `i' key." |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
375 :group 'reftex-table-of-contents-browser |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
376 :type 'boolean) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
377 |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
378 (defcustom reftex-toc-follow-mode nil |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
379 "*Non-nil means, point in *toc* buffer will cause other window to follow. |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
380 The other window will show the corresponding part of the document. |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
381 This flag can be toggled from within the *toc* buffer with the `f' key." |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
382 :group 'reftex-table-of-contents-browser |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
383 :type 'boolean) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
384 |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
385 (defcustom reftex-revisit-to-follow nil |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
386 "*Non-nil means, follow-mode will revisit files if necessary. |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
387 When nil, follow-mode will be suspended for stuff in unvisited files." |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
388 :group 'reftex-table-of-contents-browser |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
389 :group 'reftex-referencing-labels |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
390 :type 'boolean) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
391 |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
392 (defcustom reftex-toc-mode-hook nil |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
393 "Mode hook for reftex-toc-mode." |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
394 :group 'reftex-table-of-contents-browser |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
395 :type 'hook) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
396 |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
397 ;; Label configuration ----------------------------------------------------- |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
398 |
18050 | 399 (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
|
400 "Support for creation, insertion and referencing of labels in LaTeX." |
18050 | 401 :group 'reftex) |
402 | |
403 (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
|
404 "Definition of environments and macros to do with label." |
18050 | 405 :group 'reftex-label-support) |
406 | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
407 (defcustom reftex-default-label-alist-entries |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
408 '(amsmath endnotes fancybox floatfig longtable picinpar |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
409 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
|
410 "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
|
411 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
|
412 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
|
413 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
414 The options include: |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
415 LaTeX The standard LaTeX environments. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
416 Sideways The sidewaysfigure and sidewaystable environments. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
417 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
|
418 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
419 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
|
420 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
421 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
|
422 :group 'reftex-defining-label-environments |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
423 :set 'reftex-set-dirty |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
424 :type `(set |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
425 :indent 4 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
426 :inline t |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
427 :greedy t |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
428 ,@(mapcar |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
429 (function |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
430 (lambda (x) |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
431 (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
|
432 ": " (nth 1 x)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
433 (nth 0 x)))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
434 reftex-label-alist-builtin))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
435 |
18050 | 436 (defcustom reftex-label-alist nil |
18123 | 437 "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
|
438 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
439 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
|
440 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
|
441 `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
|
442 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
443 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
|
444 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
|
445 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
|
446 places in the code. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
447 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
448 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
|
449 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
|
450 one of its arguments. The elements of each list entry are: |
18050 | 451 |
452 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
|
453 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
|
454 \"\\\\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
|
455 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
|
456 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
|
457 its arguments. |
18050 | 458 Special names: `section' for section labels, `any' to define a group |
459 which contains all labels. | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
460 This may also be nil if the entry is only meant to change some settings |
18050 | 461 associated with the type indicator character (see below). |
462 | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
463 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
|
464 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
|
465 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
|
466 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
|
467 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
|
468 `equation' and `eqnarray'). |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
469 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
|
470 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
|
471 the reminder of this entry is ignored. |
18050 | 472 |
473 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
|
474 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
|
475 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
|
476 %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
|
477 %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
|
478 %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
|
479 |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
480 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
|
481 |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
482 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
|
483 the label. |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
484 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
|
485 there is not already a whitespace before point. |
18050 | 486 |
487 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
|
488 - 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
|
489 - If t, use |
18050 | 490 - 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
|
491 - 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
|
492 (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
|
493 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
|
494 - 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
|
495 - 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
|
496 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
|
497 - 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
|
498 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
|
499 \"\\\\\\\\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
|
500 environment. |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
501 \"\\\\\\\\begin{eqnarray}\\\\|\\\\\\\\\\\\\\\\\" works for eqnarrays. |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
502 - 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
|
503 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
|
504 (see also the variable `reftex-default-context-regexps'). |
18050 | 505 - 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
|
506 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
|
507 function is expected to return a suitable context string. It should |
18050 | 508 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
|
509 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
|
510 the label macro as context: |
18050 | 511 |
512 (defun my-context-function (env-or-mac) | |
513 (if (> (point-max) (+ 10 (point))) | |
514 (buffer-substring (point) (+ 10 (point))) | |
515 (error \"Buffer too small\"))) | |
516 | |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
517 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
|
518 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
|
519 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
|
520 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
|
521 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
|
522 actually used for section labels. |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
523 |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
524 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
|
525 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
|
526 `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
|
527 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
|
528 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
|
529 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
|
530 a \"\\\\W\" to the beginning and other stuff to the end of the regexp. |
18050 | 531 |
532 If the type indicator characters of two or more entries are the same, RefTeX | |
533 will use | |
534 - the first non-nil format and prefix | |
535 - the magic words of all involved entries. | |
536 | |
18220
36a61aa59b9d
(tex-main-file, outline-minor-mode): Add defvars.
Richard M. Stallman <rms@gnu.org>
parents:
18219
diff
changeset
|
537 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
|
538 `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
|
539 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
|
540 `reftex-default-label-alist-entries." |
18050 | 541 :group 'reftex-defining-label-environments |
542 :set 'reftex-set-dirty | |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
543 :type |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
544 `(repeat |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
545 (choice :tag "Package or Detailed " |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
546 :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
|
547 (list :tag "Detailed Entry" |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
548 :value ("" ?a nil nil nil nil) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
549 (choice :tag "Environment or \\macro " |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
550 (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
|
551 (string "")) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
552 (choice :tag "Type specification " |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
553 (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
|
554 (character :tag "Char " ?a)) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
555 (choice :tag "Label prefix string " |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
556 (const :tag "Default" nil) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
557 (string :tag "String" "lab:")) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
558 (choice :tag "Label reference format" |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
559 (const :tag "Default" nil) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
560 (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
|
561 (choice :tag "Context method " |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
562 (const :tag "Default position" t) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
563 (const :tag "After label" nil) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
564 (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
|
565 (regexp :tag "Regexp" "") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
566 (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
|
567 (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
|
568 (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
|
569 (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
|
570 (symbol :tag "Function" my-func)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
571 (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
|
572 (choice |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
573 :tag "Package" |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
574 :value AMSTeX |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
575 ,@(mapcar |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
576 (function |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
577 (lambda (x) |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
578 (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
|
579 (nth 0 x)))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
580 reftex-label-alist-builtin))))) |
18050 | 581 |
20177
6ebc3e300106
The menu now used toggle and radio for some items.
Karl Heuer <kwzh@gnu.org>
parents:
20102
diff
changeset
|
582 ;; 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
|
583 (defcustom reftex-section-levels |
6ebc3e300106
The menu now used toggle and radio for some items.
Karl Heuer <kwzh@gnu.org>
parents:
20102
diff
changeset
|
584 '( |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
585 ("part" . 0) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
586 ("chapter" . 1) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
587 ("section" . 2) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
588 ("subsection" . 3) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
589 ("subsubsection" . 4) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
590 ("paragraph" . 5) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
591 ("subparagraph" . 6) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
592 ("subsubparagraph" . 7) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
593 ("addchap" . -1) ; KOMA-Script |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
594 ("addsec" . -2) ; KOMA-Script |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
595 ;;; ("minisec" . -7) ; KOMA-Script |
20177
6ebc3e300106
The menu now used toggle and radio for some items.
Karl Heuer <kwzh@gnu.org>
parents:
20102
diff
changeset
|
596 ) |
6ebc3e300106
The menu now used toggle and radio for some items.
Karl Heuer <kwzh@gnu.org>
parents:
20102
diff
changeset
|
597 "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
|
598 The car of each cons cell is the name of the section macro. The cdr is a |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
599 number indicating its level. A negative level means the same as the |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
600 positive value, but the section will never get a number." |
20177
6ebc3e300106
The menu now used toggle and radio for some items.
Karl Heuer <kwzh@gnu.org>
parents:
20102
diff
changeset
|
601 :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
|
602 :set 'reftex-set-dirty |
6ebc3e300106
The menu now used toggle and radio for some items.
Karl Heuer <kwzh@gnu.org>
parents:
20102
diff
changeset
|
603 :type '(repeat |
6ebc3e300106
The menu now used toggle and radio for some items.
Karl Heuer <kwzh@gnu.org>
parents:
20102
diff
changeset
|
604 (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
|
605 (number :tag "level " 0)))) |
6ebc3e300106
The menu now used toggle and radio for some items.
Karl Heuer <kwzh@gnu.org>
parents:
20102
diff
changeset
|
606 |
6ebc3e300106
The menu now used toggle and radio for some items.
Karl Heuer <kwzh@gnu.org>
parents:
20102
diff
changeset
|
607 (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
|
608 '((caption . "\\\\\\(rot\\)?caption\\*?[[{]") |
6ebc3e300106
The menu now used toggle and radio for some items.
Karl Heuer <kwzh@gnu.org>
parents:
20102
diff
changeset
|
609 (item . "\\\\item\\(\\[[^]]*\\]\\)?") |
6ebc3e300106
The menu now used toggle and radio for some items.
Karl Heuer <kwzh@gnu.org>
parents:
20102
diff
changeset
|
610 (eqnarray-like . "\\\\begin{%s}\\|\\\\\\\\") |
6ebc3e300106
The menu now used toggle and radio for some items.
Karl Heuer <kwzh@gnu.org>
parents:
20102
diff
changeset
|
611 (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
|
612 "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
|
613 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
|
614 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
|
615 or macro." |
6ebc3e300106
The menu now used toggle and radio for some items.
Karl Heuer <kwzh@gnu.org>
parents:
20102
diff
changeset
|
616 :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
|
617 :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
|
618 |
18050 | 619 ;; Label insertion |
620 | |
621 (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
|
622 "Options on how to create new labels." |
18050 | 623 :group 'reftex-label-support) |
624 | |
625 (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
|
626 "Flags governing label insertion. First flag DERIVE, second flag PROMPT. |
18050 | 627 |
628 If DERIVE is t, RefTeX will try to derive a sensible label from context. | |
629 A section label for example will be derived from the section heading. | |
630 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
|
631 specifications given in `reftex-derive-label-parameters'. |
18050 | 632 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
|
633 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
|
634 unique number, like `eq:23'. |
18050 | 635 |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
636 If PROMPT is t, the user will be prompted for a label string. The prompt will |
18050 | 637 already contain the prefix, and (if DERIVE is t) a default label derived from |
638 context. When PROMPT is nil, the default label will be inserted without | |
639 query. | |
640 | |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
641 So the combination of DERIVE and PROMPT controls label insertion. Here is a |
18050 | 642 table describing all four possibilities: |
643 | |
644 DERIVE PROMPT ACTION | |
645 ------------------------------------------------------------------------- | |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
646 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
|
647 nil t Prompt for label. |
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
648 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
|
649 t t Derive a label from context and prompt for confirmation. |
18050 | 650 |
651 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
|
652 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
|
653 like character classes. |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
654 Thus, the combination may be set differently for each label type. The |
18050 | 655 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
|
656 (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
|
657 without confirmation for everything else. |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
658 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
|
659 e (equation), n (footnote), plus any definitions in `reftex-label-alist'." |
18050 | 660 :group 'reftex-making-and-inserting-labels |
661 :type '(list (choice :tag "Derive label from context" | |
662 (const :tag "always" t) | |
663 (const :tag "never" nil) | |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
664 (string :tag "selected label types" "")) |
18050 | 665 (choice :tag "Prompt for label string " |
666 :entry-format " %b %v" | |
667 (const :tag "always" t) | |
668 (const :tag "never" nil) | |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
669 (string :tag "selected label types" "")))) |
18050 | 670 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
671 (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
|
672 "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
|
673 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
|
674 :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
|
675 :type 'symbol) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
676 |
23200
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
677 (defcustom reftex-translate-to-ascii-function 'reftex-latin1-to-ascii |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
678 "Filter function which will process a context string before it is used |
23200
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
679 to derive a label from it. The intended application is to convert ISO or |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
680 Mule characters into something legal in labels. The default function |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
681 removes the accents from Latin-1 characters. X-Symbol (>=2.6) sets this |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
682 variable to the much more general `x-symbol-translate-to-ascii'." |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
683 :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
|
684 :type 'symbol) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
685 |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
686 (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
|
687 ("the" "on" "in" "off" "a" "for" "by" "of" "and" "is" "to") t) |
18050 | 688 "Parameters for converting a string into a label. |
689 NWORDS Number of words to use. | |
690 MAXCHAR Maximum number of characters in a label string. | |
691 ILLEGAL nil: Throw away any words containing characters illegal in labels. | |
692 t: Throw away only the illegal characters, not the whole word. | |
693 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
|
694 t: Always abbreviate words (see `reftex-abbrev-parameters'). |
18050 | 695 not t and not nil: Abbreviate words if necessary to shorten |
696 label string below MAXCHAR. | |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
697 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
|
698 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
|
699 DOWNCASE t: Downcase words before using them." |
18050 | 700 :group 'reftex-making-and-inserting-labels |
701 :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
|
702 (integer :tag "Maximum label length " 20) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
703 (choice :tag "Illegal characters in words" |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
704 (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
|
705 (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
|
706 (choice :tag "Abbreviate words " |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
707 (const :tag "never" nil) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
708 (const :tag "always" t) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
709 (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
|
710 (string :tag "Separator between words " "-") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
711 (repeat :tag "Ignore words" |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
712 :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
|
713 (string :tag "")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
714 (option (boolean :tag "Downcase words ")))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
715 |
23200
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
716 (defcustom reftex-label-illegal-re "[^-a-zA-Z0-9_+=:;,.]" |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
717 "Regexp matching characters not legal in labels." |
18050 | 718 :group 'reftex-making-and-inserting-labels |
23200
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
719 :type '(regexp :tag "Regular Expression")) |
18050 | 720 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
721 (defcustom reftex-abbrev-parameters '(4 2 "^aeiou" "aeiou") |
18050 | 722 "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
|
723 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
|
724 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
|
725 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
|
726 AFTER Character class after abbrev point in word." |
18050 | 727 :group 'reftex-making-and-inserting-labels |
728 :type '(list | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
729 (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
|
730 (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
|
731 (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
|
732 (string :tag "cut after char class " "aeiou"))) |
18050 | 733 |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
734 (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
|
735 "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
|
736 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
|
737 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
|
738 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
|
739 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
|
740 :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
|
741 :type 'function) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
742 |
18050 | 743 ;; Label referencing |
744 | |
745 (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
|
746 "Options on how to reference labels." |
18050 | 747 :group 'reftex-label-support) |
748 | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
749 (eval-and-compile |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
750 (defconst reftex-tmp |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
751 '((const :tag "on" t) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
752 (const :tag "off" nil) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
753 (string :tag "Selected label types")))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
754 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
755 (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
|
756 "List of flags governing the label menu makeup. |
18050 | 757 The flags are: |
758 | |
759 TABLE-OF-CONTENTS Show the labels embedded in a table of context. | |
760 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
|
761 COUNTERS Show counters. This just numbers the labels in the menu. |
18050 | 762 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
|
763 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
|
764 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
|
765 MATCH-IN-TOC Obsolete flag. |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
766 SHOW FILES Show begin and end of included files. |
18050 | 767 |
768 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
|
769 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
|
770 like character classes in regular expressions. Thus, setting one of the |
18050 | 771 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
|
772 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
|
773 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
|
774 e (equation), n (footnote), plus any definitions in `reftex-label-alist'. |
18050 | 775 |
776 Most options can also be switched from the label menu itself - so if you | |
777 decide here to not have a table of contents in the label menu, you can still | |
778 get one interactively during selection from the label menu." | |
779 :group 'reftex-referencing-labels | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
780 :type |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
781 `(list |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
782 (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
|
783 (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
|
784 (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
|
785 (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
|
786 (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
|
787 (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
|
788 (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
|
789 (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
|
790 |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
791 (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
|
792 "*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
|
793 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
|
794 `\\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
|
795 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
|
796 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
|
797 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
|
798 :group 'reftex-referencing-labels |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
799 :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
|
800 |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
801 (defcustom reftex-level-indent 2 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
802 "*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
|
803 :group 'reftex-referencing-labels |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
804 :type 'integer) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
805 |
18050 | 806 (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
|
807 "*Non-nil means, `reftex-reference' will try to guess the label type. |
18050 | 808 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
|
809 the words given in `reftex-label-alist'. When it finds a match, RefTeX will |
18050 | 810 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
|
811 a label type. If you set this variable to nil, RefTeX will always prompt." |
18050 | 812 :group 'reftex-referencing-labels |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
813 :type 'boolean) |
18050 | 814 |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
815 (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
|
816 "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
|
817 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
|
818 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
|
819 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
|
820 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
|
821 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
|
822 :group 'reftex-referencing-labels |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
823 :type 'function) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
824 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
825 (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
|
826 "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
|
827 :group 'reftex-referencing-labels |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
828 :type 'hook) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
829 |
18050 | 830 ;; BibteX citation configuration ---------------------------------------- |
831 | |
832 (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
|
833 "Support for referencing bibliographic data with BibTeX." |
18050 | 834 :group 'reftex) |
835 | |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
836 (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
|
837 (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
|
838 "*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
|
839 File names matched by these regexps will not be parsed by RefTeX. |
18050 | 840 Intended for files which contain only `@string' macro definitions and the |
841 like, which are ignored by RefTeX anyway." | |
842 :group 'reftex-citation-support | |
843 :set 'reftex-set-dirty | |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
844 :type '(repeat (regexp))) |
18050 | 845 |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
846 (defcustom reftex-default-bibliography nil |
23200
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
847 "*List of BibTeX database files which should be used if none are specified. |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
848 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
|
849 `\bibliography{..}' statement nor a `thebibliography' environment, |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
850 RefTeX will scan these files instead. Intended for using `reftex-citation' |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
851 in non-LaTeX files. The files will be searched along the BIBINPUTS or TEXBIB |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
852 path." |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
853 :group 'reftex-citation-support |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
854 :type '(repeat (file))) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
855 |
18050 | 856 (defcustom reftex-sort-bibtex-matches 'reverse-year |
857 "*Sorting of the entries found in BibTeX databases by reftex-citation. | |
858 Possible values: | |
859 nil Do not sort entries. | |
860 'author Sort entries by author name. | |
861 'year Sort entries by increasing year. | |
862 'reverse-year Sort entries by decreasing year." | |
863 :group 'reftex-citation-support | |
864 :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
|
865 (const :tag "by author" author) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
866 (const :tag "by year" year) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
867 (const :tag "by year, reversed" reverse-year))) |
18050 | 868 |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
869 (defcustom reftex-cite-format 'default |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
870 "*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
|
871 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
|
872 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
|
873 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
|
874 |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
875 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
|
876 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
|
877 |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
878 %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
|
879 %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
|
880 %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
|
881 %A First author name only. |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
882 %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
|
883 |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
884 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
|
885 %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
|
886 %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
|
887 %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
|
888 %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
|
889 %v volume %y year |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
890 %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
|
891 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
892 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
|
893 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
|
894 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
895 %< 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
|
896 string has been formatted. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
897 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
898 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
|
899 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
|
900 environment, only %l is available. |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
901 |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
902 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
|
903 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
|
904 strings. |
18050 | 905 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
|
906 `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
|
907 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
|
908 (setq reftex-cite-format 'natbib)" |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
909 :group 'reftex-citation-support |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
910 :type |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
911 `(choice |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
912 :format "%{%t%}: \n%[Value Menu%] %v" |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
913 (radio :tag "Symbolic Builtins" |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
914 :indent 4 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
915 :value default |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
916 ,@(mapcar |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
917 (function |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
918 (lambda (x) |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
919 (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
|
920 ": " (nth 1 x)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
921 (nth 0 x)))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
922 reftex-cite-format-builtin)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
923 (string :tag "format string" "\\cite{%l}") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
924 (repeat :tag "key-ed format strings" |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
925 :value ((?\r . "\\cite{%l}") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
926 (?t . "\\cite{%l}") (?p . "\\cite{%l}")) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
927 (cons (character :tag "Key character" ?\r) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
928 (string :tag "Format string" ""))))) |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
929 |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
930 (defcustom reftex-comment-citations nil |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
931 "*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
|
932 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
|
933 :group 'reftex-citation-support |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
934 :type 'boolean) |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
935 |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
936 (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
|
937 "%% %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
|
938 "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
|
939 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
|
940 :group 'reftex-citation-support |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
941 :type 'string) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
942 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
943 (defcustom reftex-cite-view-format |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
944 "%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
|
945 "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
|
946 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
|
947 possible percent escapes." |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
948 :group 'reftex-citation-support |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
949 :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
|
950 :type 'string) |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
951 |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
952 (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
|
953 "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
|
954 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
|
955 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
|
956 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
|
957 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
|
958 :group 'reftex-citation-support |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
959 :type '(list |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
960 (string :tag "Separator for names ") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
961 (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
|
962 (string :tag "string used as et al. "))) |
18050 | 963 |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
964 (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
|
965 "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
|
966 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
|
967 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
|
968 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
|
969 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
|
970 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
|
971 :group 'reftex-citation-support |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
972 :type 'function) |
21114
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
973 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
974 (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
|
975 "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
|
976 :group 'reftex-citation-support |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
977 :type 'hook) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
978 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
979 ;; Viewing Cross References and Citations |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
980 (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
|
981 "Displaying cross references and citations." |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
982 :group 'reftex) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
983 |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
984 (defcustom reftex-view-crossref-extra |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
985 '(("index\\|idx" "\\\\[a-zA-Z]*\\(index\\|idx\\)[a-zA-Z]*\\*?\\(\\[[^]]*\\]\\|{[^}]*}\\)*{\\(%s\\)}" 3)) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
986 "Macros which can be used for the display of cross references. |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
987 This is used when `reftex-view-crossref' is called with point in an |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
988 argument of a macro. Note that crossref viewing for citations and |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
989 references (both ways) is hard-coded. This variable is only to |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
990 configure additional structures for which crossreference viewing |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
991 can be useful. Each entry has the structure |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
992 |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
993 (MACRO-RE SEARCH-RE HIGHLIGHT). |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
994 |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
995 MACRO-RE is matched against the macro. SEARCH-RE is the regexp used |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
996 to search for cross references. `%s' in this regexp is replaced with |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
997 with the macro argument at point. HIGHLIGHT is an integer indicating |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
998 which subgroup of the match should be highlighted." |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
999 :group 'reftex-viewing-cross-references-and-citations |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
1000 :type '(repeat (group (regexp :tag "Macro Regexp ") |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
1001 (string :tag "Search Regexp ") |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
1002 (integer :tag "Highlight Group")))) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
1003 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1004 (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
|
1005 "*Non-nil means, initially turn automatic viewing of crossref info on. |
23200
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
1006 Automatic viewing of crossref info normally uses the echo area. |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
1007 Whenever point is on the argument of a \\ref or \\cite macro, and no |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
1008 other message is being displayed, the echo area will display |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
1009 information about that cross reference. You can also set the variable |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
1010 to the symbol `window'. In this case a small temporary window is |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
1011 used for the display. |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1012 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
|
1013 (Ref->Options->Crossref Viewing)." |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1014 :group 'reftex-viewing-cross-references-and-citations |
23200
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
1015 :type '(choice (const :tag "off" nil) |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
1016 (const :tag "in Echo Area" t) |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
1017 (const :tag "in Other Window" window))) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1018 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1019 (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
|
1020 "*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
|
1021 :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
|
1022 :type 'number) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1023 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1024 (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
|
1025 "*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
|
1026 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
|
1027 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
|
1028 :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
|
1029 :type 'boolean) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1030 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1031 (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
|
1032 "*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
|
1033 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
|
1034 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
|
1035 :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
|
1036 :type 'boolean) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1037 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1038 (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
|
1039 "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
|
1040 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
|
1041 :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
|
1042 :group 'reftex-referencing-labels |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1043 :type 'hook) |
18050 | 1044 |
23344
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
1045 ;; Finding Files -------------------------------------------------------- |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
1046 |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
1047 (defgroup reftex-finding-files nil |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
1048 "Finding files on search paths." |
23344
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
1049 :group 'reftex) |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
1050 |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
1051 (defcustom reftex-texpath-environment-variables '("TEXINPUTS") |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
1052 "*List of specifications how to retrieve the search path for TeX files. |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
1053 Several entries are possible. |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
1054 - If an element is the name of an environment variable, its content is used. |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
1055 - If an element starts with an exclamation mark, it is used as a command |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
1056 to retrieve the path. A typical command with the kpathsearch library would |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
1057 be `!kpsewhich -show-path=.tex'. |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
1058 - Otherwise the element itself is interpreted as a path. |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
1059 Multiple directories can be separated by the system dependent `path-separator'. |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
1060 Directories ending in `//' or `!!' will be expanded recursively. |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
1061 See also `reftex-use-external-file-finders'." |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
1062 :group 'reftex-finding-files |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
1063 :set 'reftex-set-dirty |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
1064 :type '(repeat (string :tag "Specification"))) |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
1065 |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
1066 (defcustom reftex-bibpath-environment-variables '("BIBINPUTS" "TEXBIB") |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
1067 "*List of specifications how to retrieve search path for .bib database files. |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
1068 Several entries are possible. |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
1069 - If an element is the name of an environment variable, its content is used. |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
1070 - If an element starts with an exclamation mark, it is used as a command |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
1071 to retrieve the path. A typical command with the kpathsearch library would |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
1072 be `!kpsewhich -show-path=.bib'. |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
1073 - Otherwise the element itself is interpreted as a path. |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
1074 Multiple directories can be separated by the system dependent `path-separator'. |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
1075 Directories ending in `//' or `!!' will be expanded recursively. |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
1076 See also `reftex-use-external-file-finders'." |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
1077 :group 'reftex-citation-support |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
1078 :group 'reftex-finding-files |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
1079 :set 'reftex-set-dirty |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
1080 :type '(repeat (string :tag "Specification"))) |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
1081 |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
1082 (defcustom reftex-file-extensions '(("tex" . (".tex" ".ltx")) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
1083 ("bib" . (".bib"))) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
1084 "*Association list with file extensions for different file types. |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
1085 This is a list of items, each item is like: (TYPE . (DEF-EXT OTHER-EXT ...)) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
1086 |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
1087 TYPE: File type like \"bib\" or \"tex\". |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
1088 DEF-EXT: The default extension for that file type, like \".tex\" or \".bib\". |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
1089 OTHER-EXT: Any number of other legal extensions for this file type. |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
1090 |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
1091 When a files is searched and it does not have any of the legal extensions, |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
1092 we try the default extension first, and then the naked file name." |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
1093 :group 'reftex-finding-files |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
1094 :type '(repeat (cons (string :tag "File type") |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
1095 (repeat (string :tag "Extension"))))) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
1096 |
23344
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
1097 (defcustom reftex-search-unrecursed-path-first t |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
1098 "*Non-nil means, search all specified directories before trying recursion. |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
1099 Thus, in a path \".//:/tex/\", search first \"./\", then \"/tex/\" and then |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
1100 all subdirectories of \"./\". If this option is nil, the subdirectories of |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
1101 \"./\" are searched before \"/tex/\". This is mainly for speed - most of the |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
1102 time the recursive path is for the system files and not for the user files. |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
1103 Set this to nil if the default makes RefTeX finding files with equal names |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
1104 in wrong sequence." |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
1105 :group 'reftex-finding-files |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
1106 :type 'boolean) |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
1107 |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
1108 (defcustom reftex-use-external-file-finders nil |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
1109 "*Non-nil means, use external programs to find files. |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
1110 Normally, RefTeX searches the paths given in the environment variables |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
1111 TEXINPUTS and BIBINPUTS to find TeX files and BibTeX database files. |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
1112 With this option turned on, it calls an external program specified in the |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
1113 option `reftex-external-file-finders' instead. As a side effect, |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
1114 the variables `reftex-texpath-environment-variables' and |
23344
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
1115 `reftex-bibpath-environment-variables' will be ignored." |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
1116 :group 'reftex-finding-files |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
1117 :type 'boolean) |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
1118 |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
1119 (defcustom reftex-external-file-finders '(("tex" . "kpsewhich -format=.tex %f") |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
1120 ("bib" . "kpsewhich -format=.bib %f")) |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
1121 "*Association list with external programs to call for finding files. |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
1122 Each entry is a cons cell (TYPE . PROGRAM). |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
1123 TYPE is either \"tex\" or \"bib\". PROGRAM is the external program to use with |
23344
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
1124 any arguments. %f will be replaced by the name of the file to be found. |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
1125 Note that these commands will be executed directly, not via a shell. |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
1126 Only relevant when `reftex-use-external-file-finders' is non-nil." |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
1127 :group 'reftex-finding-files |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
1128 :type '(repeat (cons (string :tag "File type") |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
1129 (string :tag "Program ")))) |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
1130 |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1131 ;; Tuning the parser ---------------------------------------------------- |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1132 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1133 (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
|
1134 "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
|
1135 :group 'reftex) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1136 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1137 (defcustom reftex-keep-temporary-buffers 1 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1138 "*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
|
1139 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
|
1140 We distinguish files visited for |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1141 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
|
1142 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
|
1143 to display label context, etc. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1144 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
|
1145 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
|
1146 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1147 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
|
1148 t Keep everything. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1149 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
|
1150 for lookup. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1151 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1152 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
|
1153 slow but will happen only once). |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1154 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
|
1155 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
|
1156 :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
|
1157 :type '(choice |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1158 (const :tag "Throw away everything" nil) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1159 (const :tag "Keep everything" t) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1160 (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
|
1161 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1162 (defcustom reftex-initialize-temporary-buffers nil |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1163 "*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
|
1164 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
|
1165 visit a file. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1166 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
|
1167 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
|
1168 do a minimal initialization." |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1169 :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
|
1170 :type '(choice |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1171 (const :tag "Read files literally" nil) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1172 (const :tag "Fully initialize buffers" t) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1173 (repeat :tag "Hook functions" :value (nil) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1174 (function-item)))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1175 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1176 (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
|
1177 "*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
|
1178 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
|
1179 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
|
1180 :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
|
1181 :type '(repeat (regexp))) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1182 |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1183 (defcustom reftex-enable-partial-scans nil |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1184 "*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
|
1185 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
|
1186 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
|
1187 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
|
1188 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
|
1189 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
|
1190 in menus." |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1191 :group 'reftex-optimizations-for-large-documents |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1192 :type 'boolean) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1193 |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1194 (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
|
1195 "*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
|
1196 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
|
1197 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
|
1198 list." |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1199 :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
|
1200 :type 'boolean) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1201 |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1202 (defcustom reftex-save-parse-info nil |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1203 "*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
|
1204 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
|
1205 information. When this variable is t, |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1206 - 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
|
1207 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
|
1208 - 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
|
1209 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
|
1210 :group 'reftex-optimizations-for-large-documents |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1211 :type 'boolean) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1212 |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1213 (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
|
1214 "*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
|
1215 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
|
1216 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
|
1217 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
|
1218 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
|
1219 `reftex-auto-update-selection-buffers'." |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1220 :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
|
1221 :group 'reftex-referencing-labels |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1222 :type 'boolean) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1223 |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1224 (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
|
1225 "*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
|
1226 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
|
1227 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
|
1228 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
|
1229 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
|
1230 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
|
1231 `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
|
1232 :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
|
1233 :group 'reftex-referencing-labels |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1234 :type 'boolean) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1235 |
21114
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1236 ;; Fontification and Faces ---------------------------------------------- |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1237 |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1238 (defgroup reftex-fontification-configurations nil |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1239 "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
|
1240 :group 'reftex) |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1241 |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1242 (defcustom reftex-use-fonts t |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1243 "*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
|
1244 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
|
1245 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
|
1246 :group 'reftex-fontification-configurations |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1247 :type 'boolean) |
21114
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1248 |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1249 (defcustom reftex-refontify-context 1 |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1250 "*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
|
1251 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
|
1252 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
|
1253 |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1254 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
|
1255 nil Never refontify. |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1256 t Always refontify. |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1257 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
|
1258 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
|
1259 :group 'reftex-fontification-configurations |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1260 :group 'reftex-referencing-labels |
21114
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1261 :type '(choice |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1262 (const :tag "Never" nil) |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1263 (const :tag "Always" t) |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1264 (const :tag "When necessary" 1))) |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1265 |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1266 (defcustom reftex-highlight-selection 'cursor |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1267 "*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
|
1268 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
|
1269 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
|
1270 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
|
1271 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
|
1272 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
|
1273 |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1274 nil No highlighting. |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1275 cursor Highlighting is cursor driven. |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1276 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
|
1277 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
|
1278 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1279 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
|
1280 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
|
1281 :group 'reftex-fontification-configurations |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1282 :type '(choice |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1283 (const :tag "Never" nil) |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1284 (const :tag "Cursor driven" cursor) |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1285 (const :tag "Mouse driven" mouse) |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1286 (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
|
1287 |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1288 (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
|
1289 "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
|
1290 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
|
1291 :group 'reftex-fontification-configurations |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1292 :type 'symbol) |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1293 (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
|
1294 "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
|
1295 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
|
1296 :group 'reftex-fontification-configurations |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1297 :type 'symbol) |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1298 (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
|
1299 "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
|
1300 :group 'reftex-fontification-configurations |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1301 :type 'symbol) |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1302 (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
|
1303 "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
|
1304 :group 'reftex-fontification-configurations |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1305 :type 'symbol) |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1306 (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
|
1307 "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
|
1308 :group 'reftex-fontification-configurations |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1309 :type 'symbol) |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1310 (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
|
1311 "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
|
1312 :group 'reftex-fontification-configurations |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1313 :type 'symbol) |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1314 (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
|
1315 "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
|
1316 :group 'reftex-fontification-configurations |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1317 :type 'symbol) |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1318 (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
|
1319 "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
|
1320 :group 'reftex-fontification-configurations |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1321 :type 'symbol) |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1322 (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
|
1323 "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
|
1324 :group 'reftex-fontification-configurations |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1325 :type 'symbol) |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1326 (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
|
1327 "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
|
1328 :group 'reftex-fontification-configurations |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1329 :type 'symbol) |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
1330 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1331 (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
|
1332 "X-Symbol specific hook. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1333 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
|
1334 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
|
1335 :group 'reftex-fontification-configurations |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1336 :type 'hook) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1337 |
18050 | 1338 ;; Miscellaneous configurations ----------------------------------------- |
1339 | |
1340 (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
|
1341 "Collection of further configurations." |
18050 | 1342 :group 'reftex) |
1343 | |
1344 (defcustom reftex-extra-bindings nil | |
1345 "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
|
1346 These extra bindings are located in the users `C-c letter' map." |
18050 | 1347 :group 'reftex-miscellaneous-configurations |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1348 :type 'boolean) |
18050 | 1349 |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1350 (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
|
1351 "*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
|
1352 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
|
1353 RefTeX will |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1354 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1355 - 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
|
1356 - 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
|
1357 - 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
|
1358 - 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
|
1359 |
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1360 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
|
1361 plug-ins on or off, respectively. |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
1362 \\<LaTeX-mode-map>Supplying labels in new sections and environments applies when creating |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1363 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
|
1364 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
|
1365 with \\[TeX-insert-macro]. |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1366 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
|
1367 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
|
1368 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
|
1369 :group 'reftex-miscellaneous-configurations |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1370 :group 'LaTeX |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1371 :type '(choice |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1372 (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
|
1373 (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
|
1374 (list |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1375 :tag "Individual choice" |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1376 :value (t t t t) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1377 (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
|
1378 (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
|
1379 (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
|
1380 (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
|
1381 ))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1382 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1383 (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
|
1384 "*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
|
1385 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
|
1386 construct: \\bbb [xxx] {aaa}." |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1387 :group 'texmathp |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1388 :type 'boolean) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1389 |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1390 |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1391 (defcustom reftex-load-hook nil |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1392 "Hook which is being run when loading reftex.el." |
18050 | 1393 :group 'reftex-miscellaneous-configurations |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1394 :type 'hook) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1395 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1396 (defcustom reftex-mode-hook nil |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1397 "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
|
1398 :group 'reftex-miscellaneous-configurations |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1399 :type 'hook) |
18050 | 1400 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1401 ;;; ========================================================================= |
18050 | 1402 ;;; |
1403 ;;; Define the formal stuff for a minor mode named RefTeX. | |
1404 ;;; | |
1405 | |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
1406 (defconst reftex-version "RefTeX version 3.43" |
23200
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
1407 "Version string for RefTeX.") |
20177
6ebc3e300106
The menu now used toggle and radio for some items.
Karl Heuer <kwzh@gnu.org>
parents:
20102
diff
changeset
|
1408 |
18050 | 1409 (defvar reftex-mode nil |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1410 "Determines if RefTeX mode is active.") |
18050 | 1411 (make-variable-buffer-local 'reftex-mode) |
1412 | |
1413 (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
|
1414 "Keymap for RefTeX mode.") |
18050 | 1415 |
1416 (defvar reftex-mode-menu nil) | |
1417 | |
1418 ;;;###autoload | |
1419 (defun turn-on-reftex () | |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1420 "Turn on RefTeX mode." |
18050 | 1421 (reftex-mode t)) |
1422 | |
1423 ;;;###autoload | |
1424 (defun reftex-mode (&optional arg) | |
18123 | 1425 "Minor mode with distinct support for \\label, \\ref and \\cite in LaTeX. |
18050 | 1426 |
1427 Labels can be created with `\\[reftex-label]' and referenced with `\\[reftex-reference]'. | |
1428 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
|
1429 context of the label definition. The selected label is inserted as a |
18123 | 1430 \\ref macro. |
18050 | 1431 |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1432 Citations can be made with `\\[reftex-citation]' which will use a regular expression |
18050 | 1433 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
|
1434 database. The selected citation is inserted as a \\cite macro. |
18050 | 1435 |
1436 A Table of Contents of the entire (multifile) document with browsing | |
1437 capabilities is available with `\\[reftex-toc]'. | |
1438 | |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1439 Most command have help available on the fly. This help is accessed by |
18050 | 1440 pressing `?' to any prompt mentioning this feature. |
1441 | |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
1442 Extensive documentation about RefTeX is available in Info format. |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
1443 You can view this information with `\\[reftex-info]'. |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1444 |
18050 | 1445 \\{reftex-mode-map} |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1446 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
|
1447 on the menu bar. |
18050 | 1448 |
1449 ------------------------------------------------------------------------------" | |
1450 | |
1451 (interactive "P") | |
1452 (setq reftex-mode (not (or (and (null arg) reftex-mode) | |
1453 (<= (prefix-numeric-value arg) 0)))) | |
1454 | |
1455 (if reftex-mode | |
1456 (progn | |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
1457 ;; Mode was turned on |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1458 (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
|
1459 (and reftex-plug-into-AUCTeX |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1460 (reftex-plug-into-AUCTeX)) |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
1461 (unless (get 'reftex-auto-view-crossref 'initialized) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
1462 (and reftex-auto-view-crossref |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
1463 (reftex-toggle-auto-view-crossref)) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
1464 (put 'reftex-auto-view-crossref 'initialized t)) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1465 (run-hooks 'reftex-mode-hook)) |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
1466 ;; Mode was turned off |
18050 | 1467 (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
|
1468 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1469 (if (fboundp 'add-minor-mode) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1470 ;; 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
|
1471 (progn |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
1472 (put 'reftex-mode :included '(memq major-mode '(latex-mode tex-mode))) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
1473 (put 'reftex-mode :menu-tag "RefTeX Mode") |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1474 (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
|
1475 ;; The standard way |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1476 (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
|
1477 (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
|
1478 (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
|
1479 (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
|
1480 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1481 ;;; ========================================================================= |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1482 ;;; |
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1483 ;;; 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
|
1484 (defvar TeX-master) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1485 (defvar LaTeX-section-hook) |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1486 (defvar LaTeX-label-function) |
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1487 (defvar tex-main-file) |
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1488 (defvar outline-minor-mode) |
23200
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
1489 (defvar font-lock-mode) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1490 (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
|
1491 (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
|
1492 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1493 ;;; ========================================================================= |
18050 | 1494 ;;; |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1495 ;;; Multibuffer Variables |
18050 | 1496 ;;; |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1497 ;;; Technical notes: These work as follows: We keep just one list |
18050 | 1498 ;;; 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
|
1499 ;;; `reftex-master-index-list' is an alist which connects the true file name |
18050 | 1500 ;;; 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
|
1501 ;;; document. Each buffer has local variables which point to these symbols. |
18050 | 1502 |
1503 ;; List of variables which handle the multifile stuff. | |
1504 ;; This list is used to tie, untie, and reset these symbols. | |
1505 (defconst reftex-multifile-symbols | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1506 '(reftex-docstruct-symbol)) |
18050 | 1507 |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1508 ;; Alist connecting master file names with the corresponding lisp symbols. |
18050 | 1509 (defvar reftex-master-index-list nil) |
1510 | |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1511 ;; Last index used for a master file. |
18050 | 1512 (defvar reftex-multifile-index 0) |
1513 | |
1514 ;; 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
|
1515 (defvar reftex-docstruct-symbol nil) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1516 (make-variable-buffer-local 'reftex-docstruct-symbol) |
18050 | 1517 |
1518 (defun reftex-next-multifile-index () | |
1519 ;; 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
|
1520 (incf reftex-multifile-index)) |
18050 | 1521 |
1522 (defun reftex-tie-multifile-symbols () | |
1523 ;; Tie the buffer-local symbols to globals connected with the master file. | |
1524 ;; If the symbols for the current master file do not exist, they are created. | |
1525 | |
1526 (let* ((master (file-truename (reftex-TeX-master-file))) | |
1527 (index (assoc master reftex-master-index-list)) | |
1528 (symlist reftex-multifile-symbols) | |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1529 symbol symname newflag) |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1530 ;; Find the correct index. |
18050 | 1531 (if index |
1532 ;; symbols do exist | |
1533 (setq index (cdr index)) | |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1534 ;; Get a new index and add info to the alist. |
18050 | 1535 (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
|
1536 newflag t) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1537 (push (cons master index) reftex-master-index-list)) |
18050 | 1538 |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1539 ;; Get/create symbols and tie them. |
18050 | 1540 (while symlist |
1541 (setq symbol (car symlist) | |
1542 symlist (cdr symlist) | |
1543 symname (symbol-name symbol)) | |
1544 (set symbol (intern (concat symname "-" (int-to-string index)))) | |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
1545 (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
|
1546 ;; Initialize if new symbols. |
18050 | 1547 (if newflag (set (symbol-value symbol) nil))) |
1548 | |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1549 ;; Return t if the symbols did already exist, nil when we've made them. |
18050 | 1550 (not newflag))) |
1551 | |
1552 (defun reftex-untie-multifile-symbols () | |
1553 ;; Remove ties from multifile symbols, so that next use makes new ones. | |
1554 (let ((symlist reftex-multifile-symbols) | |
1555 (symbol nil)) | |
1556 (while symlist | |
1557 (setq symbol (car symlist) | |
1558 symlist (cdr symlist)) | |
1559 (set symbol nil)))) | |
1560 | |
1561 (defun reftex-TeX-master-file () | |
1562 ;; Return the name of the master file associated with the current buffer. | |
24389 | 1563 ;; When AUCTeX is loaded, we will use its more sophisticated method. |
18219
aaeaae005e98
Updated documentation at several points in the file.
Richard M. Stallman <rms@gnu.org>
parents:
18123
diff
changeset
|
1564 ;; 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
|
1565 ;; variable tex-main-file. |
18050 | 1566 (let |
1567 ((master | |
1568 (cond | |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1569 ((fboundp 'TeX-master-file) ; AUCTeX is loaded. Use its mechanism. |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
1570 (condition-case nil |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
1571 (TeX-master-file t) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
1572 (error (buffer-file-name)))) |
18050 | 1573 ((boundp 'TeX-master) ; The variable is defined - lets use it. |
1574 (cond | |
1575 ((eq TeX-master t) | |
1576 (buffer-file-name)) | |
1577 ((eq TeX-master 'shared) | |
1578 (setq TeX-master (read-file-name "Master file: " | |
1579 nil nil t nil))) | |
1580 (TeX-master) | |
1581 (t | |
1582 (setq TeX-master (read-file-name "Master file: " | |
1583 nil nil t nil))))) | |
1584 ((boundp 'tex-main-file) | |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1585 ;; This is the variable from the default TeX modes. |
18050 | 1586 (cond |
1587 ((stringp tex-main-file) | |
1588 ;; ok, this must be it | |
1589 tex-main-file) | |
1590 (t | |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1591 ;; In this case, the buffer is its own master. |
18050 | 1592 (buffer-file-name)))) |
1593 (t | |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1594 ;; Know nothing about master file. Assume this is a master file. |
18050 | 1595 (buffer-file-name))))) |
1596 (cond | |
1597 ((null master) | |
23200
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
1598 (error "Need a filename for this buffer, please save it first")) |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
1599 ((or (file-exists-p (concat master ".tex")) |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
1600 (reftex-get-buffer-visiting (concat master ".tex"))) |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
1601 ;; Ahh, an extra .tex was missing... |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
1602 (setq master (concat master ".tex"))) |
18050 | 1603 ((or (file-exists-p master) |
1604 (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
|
1605 ;; We either see the file, or have a buffer on it. OK. |
18050 | 1606 ) |
1607 (t | |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1608 ;; Use buffer file name. |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1609 (buffer-file-name))) |
18050 | 1610 (expand-file-name master))) |
1611 | |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1612 ;;; ========================================================================= |
18050 | 1613 ;;; |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1614 ;;; 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
|
1615 |
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1616 ;; 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
|
1617 |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1618 ;; Prompt used for label type queries directed to the user. |
18050 | 1619 (defconst reftex-type-query-prompt nil) |
1620 | |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1621 ;; Help string for label type queries. |
18050 | 1622 (defconst reftex-type-query-help nil) |
1623 | |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1624 ;; Alist relating label type to reference format. |
18050 | 1625 (defconst reftex-typekey-to-format-alist nil) |
1626 | |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1627 ;; Alist relating label type to label affix. |
18050 | 1628 (defconst reftex-typekey-to-prefix-alist nil) |
1629 | |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1630 ;; Alist relating environments or macros to label type and context regexp. |
18050 | 1631 (defconst reftex-env-or-mac-alist nil) |
1632 | |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1633 ;; List of macros carrying a label. |
18050 | 1634 (defconst reftex-label-mac-list nil) |
1635 | |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1636 ;; List of environments carrying a label. |
18050 | 1637 (defconst reftex-label-env-list nil) |
1638 | |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1639 ;; List of all typekey letters in use. |
18050 | 1640 (defconst reftex-typekey-list nil) |
1641 | |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1642 ;; Alist relating magic words to a label type. |
18050 | 1643 (defconst reftex-words-to-typekey-alist nil) |
1644 | |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1645 ;; The last list-of-labels entry used in a reference. |
18050 | 1646 (defvar reftex-last-used-reference (list nil nil nil nil)) |
1647 | |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1648 ;; 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
|
1649 (defconst reftex-no-follow-message |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1650 "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
|
1651 (defconst reftex-no-info-message |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1652 "%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
|
1653 |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1654 ;; Global variables used for communication between functions. |
18050 | 1655 (defvar reftex-default-context-position nil) |
1656 (defvar reftex-location-start nil) | |
1657 (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
|
1658 (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
|
1659 (defvar reftex-active-toc nil) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1660 (defvar reftex-tex-path nil) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1661 (defvar reftex-bib-path nil) |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
1662 (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
|
1663 (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
|
1664 (defvar reftex-prefix nil) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1665 (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
|
1666 (defvar reftex-buffers-with-changed-invisibility nil) |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
1667 (defvar reftex-callback-fwd t) |
18050 | 1668 |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
1669 ;; List of buffers created temporarily for lookup, which should be killed. |
18050 | 1670 (defvar reftex-buffers-to-kill nil) |
1671 | |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1672 ;; Regexp to find anything. |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
1673 (defvar reftex-section-regexp nil) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1674 (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
|
1675 (defvar reftex-everything-regexp nil) |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
1676 (defvar reftex-find-citation-regexp-format |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
1677 "\\\\[a-zA-Z]*cite[*a-zA-Z]*\\*?\\(\\[[^]]*\\]\\|{[^}]*}\\)*{\\([^}]*,\\)?\\(%s\\)[},]") |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
1678 (defvar reftex-find-reference-format |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
1679 "\\\\\\(ref[a-zA-Z]*\\|[a-zA-Z]*ref\\)\\*?\\(\\[[^]]*\\]\\|{[^}]*}\\)*{\\(%s\\)}") |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
1680 (defvar reftex-macros-with-labels nil) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1681 (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
|
1682 (defvar reftex-find-label-regexp-format2 nil) |
18050 | 1683 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1684 ;;; The parser functions ----------------------------------------------------- |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1685 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1686 (defvar reftex-memory nil |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1687 "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
|
1688 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1689 (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
|
1690 "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
|
1691 ;; 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
|
1692 ;; 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
|
1693 ;; 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
|
1694 ;; 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
|
1695 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1696 ;; 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
|
1697 (if (eq reftex-docstruct-symbol nil) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1698 ;; 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
|
1699 (reftex-tie-multifile-symbols)) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1700 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1701 (reftex-ensure-compiled-variables) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1702 |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1703 (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
|
1704 (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
|
1705 ;; 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
|
1706 (save-excursion |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
1707 (reftex-erase-buffer "*toc*") |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1708 (reftex-erase-all-selection-buffers))) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1709 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1710 (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
|
1711 (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
|
1712 reftex-save-parse-info) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1713 ;; 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
|
1714 (reftex-access-parse-file 'read)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1715 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1716 (cond |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1717 ((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
|
1718 ((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
|
1719 ;; Scan the whole document |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1720 (reftex-do-parse 1 file)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1721 ((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
|
1722 ;; 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
|
1723 (reftex-do-parse rescan file)))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1724 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1725 (defun reftex-parse-one () |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1726 "Re-parse this file." |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1727 (interactive) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1728 (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
|
1729 (reftex-access-scan-info '(4)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1730 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1731 (defun reftex-parse-all () |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1732 "Re-parse entire document." |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1733 (interactive) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1734 (reftex-access-scan-info '(16))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1735 |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1736 (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
|
1737 "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
|
1738 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1739 ;; Normalize the rescan argument |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1740 (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
|
1741 ((eq rescan 1) 1) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1742 ((equal rescan '(4)) t) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1743 ((equal rescan '(16)) 1) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1744 (t 1))) |
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 ;; Partial scans only when allowed |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1747 (unless reftex-enable-partial-scans |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1748 (setq rescan 1)) |
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 ;; Do the scanning. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1751 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1752 (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
|
1753 (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
|
1754 (true-master (file-truename master)) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1755 (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
|
1756 (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
|
1757 (true-file (file-truename file)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1758 (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
|
1759 from-file appendix docstruct tmp) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1760 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1761 ;; 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
|
1762 (when (and (eq rescan t) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1763 (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
|
1764 (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
|
1765 ;; 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
|
1766 (setq rescan 1)) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1767 (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
|
1768 ;; 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
|
1769 (setq rescan 1)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1770 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1771 ;; From which file do we start? |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1772 (setq from-file |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1773 (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
|
1774 ((eq rescan 1) master) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1775 (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
|
1776 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1777 ;; 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
|
1778 (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
|
1779 '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
|
1780 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
|
1781 '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
|
1782 |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1783 (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
|
1784 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1785 (if (eq rescan 1) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1786 (message "Scanning entire document...") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1787 (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
|
1788 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1789 (save-window-excursion |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1790 (save-excursion |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1791 (unwind-protect |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1792 (setq docstruct |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1793 (reftex-parse-from-file |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1794 from-file docstruct master-dir)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1795 (reftex-kill-temporary-buffers)))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1796 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1797 (message "Scanning document... done") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1798 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1799 ;; Turn the list around. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1800 (setq docstruct (nreverse docstruct)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1801 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1802 ;; Set or insert |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1803 (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
|
1804 old-list docstruct (eq rescan 1))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1805 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1806 ;; Add all missing information |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1807 (unless (assq 'label-numbers docstruct) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1808 (push (cons 'label-numbers nil) docstruct)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1809 (unless (assq 'master-dir docstruct) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1810 (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
|
1811 (unless (assq 'bibview-cache docstruct) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1812 (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
|
1813 (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
|
1814 (bof2 (assq 'bof (cdr bof1))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1815 (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
|
1816 (entry (or (assq 'is-multi docstruct) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1817 (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
|
1818 (setcdr entry (cons is-multi nil))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1819 (unless (assq 'xr docstruct) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1820 (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
|
1821 (alist (mapcar |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1822 (function |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1823 (lambda (x) |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
1824 (if (setq tmp (reftex-locate-file (nth 2 x) "tex" |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
1825 master-dir)) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1826 (cons (nth 1 x) tmp) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1827 (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
|
1828 (nth 2 x)) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1829 nil))) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1830 allxr)) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1831 (alist (delq nil alist)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1832 (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
|
1833 (regexp (if allprefix |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1834 (concat "\\`\\(" |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1835 (mapconcat 'identity allprefix "\\|") |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1836 "\\)") |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1837 "\\\\\\\\\\\\"))) ; this will never match |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1838 (push (list 'xr alist regexp) 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 (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
|
1841 (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
|
1842 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1843 (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
|
1844 ;; 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
|
1845 (let ((regexp reftex-everything-regexp) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1846 (bound 0) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1847 file-found tmp include-file |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1848 (level 1) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1849 (highest-level 100) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1850 toc-entry next-buf buf) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1851 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1852 (catch 'exit |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
1853 (setq file-found (reftex-locate-file file "tex" master-dir)) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1854 (if (and (not file-found) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1855 (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
|
1856 (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
|
1857 |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1858 (unless file-found |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1859 (push (list 'file-error file) docstruct) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1860 (throw 'exit nil)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1861 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1862 (save-excursion |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1863 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1864 (message "Scanning file %s" file) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1865 (set-buffer |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1866 (setq next-buf |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1867 (reftex-get-file-buffer-force |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1868 file-found |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1869 (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
|
1870 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1871 ;; Begin of file mark |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1872 (setq file (buffer-file-name)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1873 (push (list 'bof file) docstruct) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1874 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1875 (save-excursion |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1876 (save-restriction |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1877 (widen) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1878 (goto-char 1) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1879 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1880 (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
|
1881 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1882 (cond |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1883 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1884 ((match-end 1) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1885 ;; It is a label |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1886 (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
|
1887 docstruct)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1888 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1889 ((match-end 3) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1890 ;; It is a section |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1891 (setq bound (point)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1892 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1893 ;; Insert in List |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1894 (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
|
1895 (setq level (nth 5 toc-entry)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1896 (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
|
1897 (if (= level highest-level) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1898 (message |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1899 "Scanning %s %s ..." |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1900 (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
|
1901 (nth 6 toc-entry))) |
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 (push toc-entry docstruct) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1904 (setq reftex-active-toc toc-entry)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1905 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1906 ((match-end 7) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1907 ;; 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
|
1908 (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
|
1909 ;; 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
|
1910 (unless (delq nil (mapcar |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1911 (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
|
1912 reftex-no-include-regexps)) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1913 ;; Parse it |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1914 (setq docstruct |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1915 (reftex-parse-from-file |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1916 include-file |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1917 docstruct master-dir)))) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1918 |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1919 ((match-end 9) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1920 ;; Appendix starts here |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1921 (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
|
1922 (push (cons 'appendix t) docstruct)) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1923 |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1924 ((match-end 10) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1925 ;; A macro with label |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1926 (save-excursion |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1927 (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
|
1928 (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
|
1929 (save-match-data |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1930 (reftex-no-props |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1931 (reftex-nth-arg-wrapper |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1932 mac))))) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1933 (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
|
1934 (entry (progn (if typekey |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1935 ;; A typing macro |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1936 (goto-char (match-end 0)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1937 ;; A newtral macro |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1938 (goto-char (match-end 10)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1939 (reftex-move-over-touching-args)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1940 (reftex-label-info |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
1941 label file bound nil nil)))) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1942 (push entry docstruct)))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1943 (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
|
1944 ) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1945 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1946 ;; Find bibliography statement |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1947 (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
|
1948 (push (cons 'bib tmp) docstruct)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1949 |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1950 (goto-char 1) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1951 (when (re-search-forward |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1952 "\\(\\`\\|[\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
|
1953 (push (cons 'thebib file) docstruct)) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1954 |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1955 ;; Find external document specifications |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1956 (goto-char 1) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1957 (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
|
1958 (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
|
1959 (reftex-match-string 3)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1960 docstruct)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1961 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1962 ;; End of file mark |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1963 (push (list 'eof file) docstruct)))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1964 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1965 ;; Kill the scanned buffer |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1966 (reftex-kill-temporary-buffers next-buf)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1967 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1968 ;; Return the list |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1969 docstruct)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1970 |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
1971 (defun reftex-locate-bibliography-files (master-dir &optional files) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
1972 ;; Scan buffer for bibliography macro and return file list. |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
1973 |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
1974 (unless files |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1975 (save-excursion |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
1976 (goto-char (point-min)) |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
1977 (if (re-search-forward |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
1978 "\\(\\`\\|[\n\r]\\)[ \t]*\\\\bibliography{[ \t]*\\([^}]+\\)" nil t) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
1979 (setq files |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
1980 (split-string (reftex-match-string 2) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
1981 "[ \t\n\r]*,[ \t\n\r]*"))))) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
1982 (when files |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
1983 (setq files |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
1984 (mapcar |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
1985 (lambda (x) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
1986 (if (or (member x reftex-bibfile-ignore-list) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
1987 (delq nil (mapcar (lambda (re) (string-match re x)) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
1988 reftex-bibfile-ignore-regexps))) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
1989 ;; excluded file |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
1990 nil |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
1991 ;; find the file |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
1992 (reftex-locate-file x "bib" master-dir))) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
1993 files)) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
1994 (delq nil files))) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
1995 |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
1996 (defun reftex-default-bibliography () |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
1997 ;; Return the expanded value of `reftex-default-bibliography'. |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
1998 ;; The expanded value is cached. |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
1999 (unless (eq (get 'reftex-default-bibliography :reftex-raw) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
2000 reftex-default-bibliography) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
2001 (put 'reftex-default-bibliography :reftex-expanded |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
2002 (reftex-locate-bibliography-files |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
2003 default-directory reftex-default-bibliography)) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
2004 (put 'reftex-default-bibliography :reftex-raw |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
2005 reftex-default-bibliography)) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
2006 (get 'reftex-default-bibliography :reftex-expanded)) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2007 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2008 (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
|
2009 ;; 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
|
2010 ;; 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
|
2011 ;; 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
|
2012 ;; 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
|
2013 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2014 (cond |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2015 (entirely |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2016 (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
|
2017 insert) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2018 (t (let* ((new old) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2019 (file (nth 1 (car insert))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2020 (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
|
2021 (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
|
2022 n) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2023 (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
|
2024 (error "Cannot splice") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2025 ;; Splice |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2026 (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
|
2027 (length eof-list))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2028 (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
|
2029 (setcdr (nthcdr n new) (cdr insert)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2030 (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
|
2031 new)))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2032 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2033 (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
|
2034 ;; 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
|
2035 (while (and list (> (decf n) -1)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2036 (and (eq (car (car list)) 'toc) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2037 (markerp (nth 4 (car list))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2038 (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
|
2039 (pop list))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2040 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2041 (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
|
2042 "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
|
2043 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
|
2044 (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
|
2045 (docstruct-symbol reftex-docstruct-symbol) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2046 (master (reftex-TeX-master-file)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2047 (enable-local-variables nil) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2048 (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
|
2049 (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
|
2050 (concat master ".rel")))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2051 (cond |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2052 ((eq action 'readable) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2053 (file-readable-p file)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2054 ((eq action 'restore) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2055 (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
|
2056 (if (eq reftex-docstruct-symbol nil) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2057 ;; 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
|
2058 (reftex-tie-multifile-symbols)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2059 (if (file-exists-p file) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2060 ;; 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
|
2061 (condition-case nil |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2062 (progn (load-file file) t) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2063 (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
|
2064 (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
|
2065 ;; 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
|
2066 (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
|
2067 ((eq action 'read) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2068 (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
|
2069 (if (file-exists-p file) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2070 ;; 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
|
2071 (condition-case nil |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
2072 (progn |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
2073 (load-file file) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
2074 (reftex-check-parse-consistency) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
2075 t) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
2076 (error (message "Error while restoring file %s" file) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2077 (set reftex-docstruct-symbol nil) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2078 nil)) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
2079 ;; 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
|
2080 nil)) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2081 ((eq action 'kill) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2082 ;; Remove the file |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2083 (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
|
2084 (message "Unlinking file %s" file) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2085 (delete-file file))) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2086 (t |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2087 (put docstruct-symbol 'modified nil) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2088 (save-excursion |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2089 (if (file-writable-p file) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2090 (progn |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2091 (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
|
2092 (find-file file) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2093 (erase-buffer) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2094 (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
|
2095 (insert (format ";; File: %s\n" master)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2096 (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
|
2097 (user-login-name) (user-full-name))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2098 (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
|
2099 (let ((standard-output (current-buffer))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2100 (mapcar |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2101 (function |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2102 (lambda (x) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2103 (cond ((eq (car x) 'toc) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2104 ;; 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
|
2105 ;; 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
|
2106 (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
|
2107 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
|
2108 (or (and (markerp (nth 4 x)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2109 (marker-position (nth 4 x))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2110 (nth 8 x))))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2111 (t (print x))))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2112 list)) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2113 (insert "))\n\n") |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2114 (save-buffer 0) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2115 (kill-buffer (current-buffer))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2116 (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
|
2117 t)))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2118 |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
2119 (defun reftex-check-parse-consistency () |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
2120 ;; Check if parse file is consistent, throw an error if not. |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
2121 |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
2122 ;; Check if the master is the same: when moving a document, this will see it. |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
2123 (let* ((real-master (reftex-TeX-master-file)) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
2124 (parsed-master |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
2125 (nth 1 (assq 'bof (symbol-value reftex-docstruct-symbol))))) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
2126 (unless (string= (file-truename real-master) (file-truename parsed-master)) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
2127 (message "Master file name in load file is different: %s versus %s" |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
2128 parsed-master real-master) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
2129 (error "Master file name error"))) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
2130 |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
2131 ;; Check for the existence of all document files |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
2132 ;;; (let* ((all (symbol-value reftex-docstruct-symbol))) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
2133 ;;; (while all |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
2134 ;;; (when (and (eq (car (car all)) 'bof) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
2135 ;;; (not (file-regular-p (nth 1 (car all))))) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
2136 ;;; (message "File %s in saved parse info not avalable" (cdr (car all))) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
2137 ;;; (error "File not found")) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
2138 ;;; (setq all (cdr all)))) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
2139 ) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
2140 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2141 (defun reftex-kill-buffer-hook () |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2142 "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
|
2143 ;; 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
|
2144 ;; 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
|
2145 ;; 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
|
2146 (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
|
2147 (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
|
2148 (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
|
2149 (symbol-value reftex-docstruct-symbol) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2150 (get reftex-docstruct-symbol 'modified)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2151 ;; Write the file. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2152 (condition-case nil |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2153 (reftex-access-parse-file 'write) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2154 (error nil)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2155 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2156 (defun reftex-kill-emacs-hook () |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2157 "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
|
2158 ;; 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
|
2159 (save-excursion |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2160 (mapcar (lambda (buf) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2161 (set-buffer buf) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2162 (reftex-kill-buffer-hook)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2163 (buffer-list)))) |
18050 | 2164 |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2165 (defun reftex-section-info (file) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2166 ;; 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
|
2167 ;; 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
|
2168 (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
|
2169 (macro (reftex-match-string 3)) |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
2170 (level (cdr (assoc macro reftex-section-levels-all))) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2171 (star (= ?* (char-after (match-end 3)))) |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
2172 (unnumbered (or star (< level 0))) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
2173 (level (abs level)) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
2174 (section-number (reftex-section-number level unnumbered)) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2175 (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
|
2176 (literal (buffer-substring-no-properties |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2177 (1- (match-beginning 3)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2178 (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
|
2179 ;; 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
|
2180 (text (reftex-nicify-text text1))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2181 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2182 ;; Add section number and indentation |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2183 (setq text |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2184 (concat |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2185 (make-string (* reftex-level-indent level) ?\ ) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2186 (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
|
2187 (concat section-number " ")) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2188 text)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2189 (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
|
2190 literal (marker-position marker)))) |
18050 | 2191 |
2192 (defun reftex-label-info-update (cell) | |
2193 ;; Update information about just one label in a different file. | |
2194 ;; CELL contains the old info list | |
2195 (let* ((label (nth 0 cell)) | |
2196 (typekey (nth 1 cell)) | |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
2197 ;; (text (nth 2 cell)) |
18050 | 2198 (file (nth 3 cell)) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2199 (comment (nth 4 cell)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2200 (note (nth 5 cell)) |
18050 | 2201 (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
|
2202 file (not (eq t reftex-keep-temporary-buffers))))) |
18050 | 2203 (if (not buf) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2204 (list label typekey "" file comment "LOST LABEL. RESCAN TO FIX.") |
18050 | 2205 (save-excursion |
2206 (set-buffer buf) | |
2207 (save-restriction | |
2208 (widen) | |
2209 (goto-char 1) | |
2210 | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2211 (if (or (re-search-forward |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2212 (format reftex-find-label-regexp-format |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2213 (regexp-quote label)) nil t) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2214 (re-search-forward |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2215 (format reftex-find-label-regexp-format2 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2216 (regexp-quote label)) nil t)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2217 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2218 (progn |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2219 (backward-char 1) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2220 (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
|
2221 (list label typekey "" file "LOST LABEL. RESCAN TO FIX."))))))) |
18050 | 2222 |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2223 (defun reftex-label-info (label &optional file bound derive env-or-mac) |
18050 | 2224 ;; 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
|
2225 (let* ((env-or-mac (or env-or-mac (reftex-label-location bound))) |
18050 | 2226 (typekey (nth 1 (assoc env-or-mac reftex-env-or-mac-alist))) |
2227 (file (or file (buffer-file-name))) | |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
2228 (parse (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
|
2229 (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
|
2230 derive)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2231 (in-comment (reftex-in-comment))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2232 (list label typekey text file in-comment))) |
18050 | 2233 |
2234 (defun reftex-in-comment () | |
2235 (save-excursion | |
2236 (skip-chars-backward "^%\n\r") | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2237 (eq (preceding-char) ?%))) |
18050 | 2238 |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
2239 (defun reftex-short-context (env parse &optional bound derive) |
18050 | 2240 ;; Get about one line of useful context for the label definition at point. |
2241 | |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
2242 (if (consp parse) |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
2243 (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
|
2244 |
18050 | 2245 (reftex-nicify-text |
2246 | |
2247 (cond | |
2248 | |
2249 ((null parse) | |
2250 (save-excursion | |
2251 (reftex-context-substring))) | |
2252 | |
2253 ((eq parse t) | |
2254 (if (string= env "section") | |
2255 ;; special treatment for section labels | |
2256 (save-excursion | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2257 (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
|
2258 (point-min) t) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2259 (match-end 2)) |
18050 | 2260 (progn |
2261 (goto-char (match-end 0)) | |
2262 (reftex-context-substring)) | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2263 (if reftex-active-toc |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2264 (progn |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2265 (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
|
2266 (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
|
2267 "SECTION HEADING NOT FOUND"))) |
18050 | 2268 (save-excursion |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2269 (goto-char reftex-default-context-position) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2270 (unless (eq (string-to-char env) ?\\) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2271 (reftex-move-over-touching-args)) |
18050 | 2272 (reftex-context-substring)))) |
2273 | |
2274 ((stringp parse) | |
2275 (save-excursion | |
2276 (if (re-search-backward parse bound t) | |
2277 (progn | |
2278 (goto-char (match-end 0)) | |
2279 (reftex-context-substring)) | |
2280 "NO MATCH FOR CONTEXT REGEXP"))) | |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
2281 |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
2282 ((integerp parse) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2283 (or (save-excursion |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2284 (goto-char reftex-default-context-position) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2285 (reftex-nth-arg |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2286 parse |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2287 (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
|
2288 "")) |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
2289 |
18050 | 2290 ((fboundp parse) |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
2291 ;; A hook function. Call it. |
18050 | 2292 (save-excursion |
2293 (condition-case error-var | |
2294 (funcall parse env) | |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
2295 (error (format "HOOK ERROR: %s" (cdr error-var)))))) |
18050 | 2296 (t |
2297 "ILLEGAL VALUE OF PARSE")))) | |
2298 | |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2299 (defun reftex-nicify-text (text) |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
2300 ;; Make TEXT nice for inclusion as context into label menu. |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
2301 ;; 1. remove line breaks and extra white space |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2302 (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
|
2303 (setq text (replace-match " " nil t text))) |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
2304 ;; 2. cut before the next `\end{' or `\item' or `\\' |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2305 (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
|
2306 (setq text (replace-match "" nil t text))) |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
2307 ;; 3. kill the embedded label |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2308 (if (string-match "\\\\label{[^}]*}" text) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2309 (setq text (replace-match "" nil t text))) |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
2310 ;; 4. remove leading garbage |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2311 (if (string-match "\\`[ }]+" text) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2312 (setq text (replace-match "" nil t text))) |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
2313 ;; 5. limit length |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2314 (cond |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2315 ((> (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
|
2316 ((= (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
|
2317 (t text))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2318 |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2319 (defun reftex-where-am-I () |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2320 ;; 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
|
2321 ;; 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
|
2322 ;; exact (t) or approximate (nil). |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2323 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2324 (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
|
2325 (cnt 0) rtn |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2326 found) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2327 (save-excursion |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2328 (while (not rtn) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2329 (incf cnt) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2330 (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
|
2331 (setq rtn |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2332 (cond |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2333 ((not found) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2334 ;; no match |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2335 (or |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2336 (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
|
2337 (not (setq cnt 2)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2338 (assq 'bof docstruct) ;; for safety reasons |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2339 'corrupted)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2340 ((match-end 1) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2341 ;; Label |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2342 (assoc (reftex-match-string 1) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2343 (symbol-value reftex-docstruct-symbol))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2344 ((match-end 3) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2345 ;; Section |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2346 (goto-char (1- (match-beginning 3))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2347 (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
|
2348 docstruct)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2349 (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
|
2350 list))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2351 rtn1) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2352 (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
|
2353 (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
|
2354 (string= (buffer-file-name) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2355 (nth 3 (car list)))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2356 (cond |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2357 ((equal (point) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2358 (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
|
2359 (marker-position (nth 4 (car list)))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2360 (nth 8 (car list)))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2361 ;; 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
|
2362 (setq rtn1 (car list) list nil)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2363 ((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
|
2364 (nth 7 (car list)))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2365 ;; Same title |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2366 (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
|
2367 (pop list)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2368 rtn1)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2369 ((match-end 7) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2370 ;; Input or include... |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2371 (car |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
2372 (member (list 'eof (reftex-locate-file |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
2373 (reftex-match-string 7) "tex" |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
2374 (cdr (assq 'master-dir docstruct)))) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2375 docstruct))) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
2376 ((match-end 9) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
2377 (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
|
2378 ((match-end 10) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2379 (save-excursion |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
2380 (goto-char (match-end 10)) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2381 (assoc (reftex-no-props |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2382 (reftex-nth-arg-wrapper |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
2383 (reftex-match-string 10))) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2384 (symbol-value reftex-docstruct-symbol)))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2385 (t |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2386 (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
|
2387 (cons rtn (eq cnt 1)))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2388 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2389 (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
|
2390 "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
|
2391 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
|
2392 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2393 (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
|
2394 (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
|
2395 (p1 (or (cdr loc1) 0)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2396 (p2 (or (cdr loc2) 0))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2397 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2398 (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
|
2399 (if (>= p1 p2) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2400 (progn |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2401 (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
|
2402 (or (car loc1) "section")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2403 (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
|
2404 (or (car loc2) "section")))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2405 |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2406 (defun reftex-parse-args (macro) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2407 ;; 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
|
2408 ;; optional argument indices. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2409 (if (string-match "[[{]\\*?[]}]" macro) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2410 (progn |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2411 (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
|
2412 (args (substring macro (match-beginning 0))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2413 opt-list nlabel (cnt 0)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2414 (while (string-match "\\`[[{]\\(\\*\\)?[]}]" args) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2415 (incf cnt) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2416 (when (eq ?\[ (string-to-char args)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2417 (push cnt opt-list)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2418 (when (and (match-end 1) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2419 (not nlabel)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2420 (setq nlabel cnt)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2421 (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
|
2422 (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
|
2423 nil)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2424 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2425 (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
|
2426 ;; 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
|
2427 ;; 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
|
2428 ;; 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
|
2429 ;; in TeX. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2430 (cond |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2431 ;; Just to be quick: |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2432 ((memq (following-char) '(?\[ ?\{))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2433 ;; Do a search |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2434 ((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
|
2435 (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
|
2436 (goto-char (1- (match-end 0))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2437 t) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2438 (t nil))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2439 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2440 (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
|
2441 ;; 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
|
2442 ;; 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
|
2443 ;; 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
|
2444 ;; in TeX. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2445 (cond |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2446 ;; Just to be quick: |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2447 ((memq (preceding-char) '(?\] ?\}))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2448 ;; Do a search |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2449 ((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
|
2450 (re-search-backward |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2451 "[]}][ \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
|
2452 (goto-char (1+ (match-beginning 0))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2453 t) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2454 (t nil))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2455 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2456 (defun reftex-nth-arg-wrapper (key) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2457 (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
|
2458 (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
|
2459 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2460 (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
|
2461 ;; 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
|
2462 ;; 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
|
2463 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2464 ;; 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
|
2465 (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
|
2466 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2467 (if (= n 1000) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2468 ;; Special case: Skip all touching arguments |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2469 (progn |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2470 (reftex-move-over-touching-args) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2471 (reftex-context-substring)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2472 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2473 ;; Do the real thing. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2474 (let ((cnt 1)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2475 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2476 (when (reftex-move-to-next-arg) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2477 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2478 (while (< cnt n) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2479 (while (and (member cnt opt-args) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2480 (eq (following-char) ?\{)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2481 (incf cnt)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2482 (when (< cnt n) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2483 (unless (and (condition-case nil |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2484 (or (forward-list 1) t) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2485 (error nil)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2486 (reftex-move-to-next-arg) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2487 (incf cnt)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2488 (setq cnt 1000)))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2489 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2490 (while (and (memq cnt opt-args) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2491 (eq (following-char) ?\{)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2492 (incf cnt))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2493 (if (and (= n cnt) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2494 (> (skip-chars-forward "{\\[") 0)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2495 (reftex-context-substring) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2496 nil)))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2497 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2498 (defun reftex-move-over-touching-args () |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2499 (condition-case nil |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2500 (while (memq (following-char) '(?\[ ?\{)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2501 (forward-list 1)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2502 (error nil))) |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
2503 |
18050 | 2504 (defun reftex-context-substring () |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
2505 ;; Return up to 150 chars from point |
18050 | 2506 ;; When point is just after a { or [, limit string to matching parenthesis |
2507 (cond | |
2508 ((or (= (preceding-char) ?\{) | |
2509 (= (preceding-char) ?\[)) | |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
2510 ;; 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
|
2511 (buffer-substring-no-properties |
18050 | 2512 (point) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2513 (min (+ (point) 150) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2514 (point-max) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2515 (condition-case nil |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2516 (progn |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2517 (up-list 1) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2518 (1- (point))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2519 (error (point-max)))))) |
18050 | 2520 (t |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
2521 ;; no list - just grab 150 characters |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2522 (buffer-substring-no-properties (point) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2523 (min (+ (point) 150) (point-max)))))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2524 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2525 ;; 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
|
2526 (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
|
2527 |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
2528 (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
|
2529 ;; 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
|
2530 ;; in the toc entry. |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
2531 (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
|
2532 (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
|
2533 (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
|
2534 (i depth) number-string) |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
2535 (while (>= i 0) |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
2536 (if (> i level) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2537 (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
|
2538 (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
|
2539 (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
|
2540 (aset reftex-section-numbers i |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
2541 (- (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
|
2542 (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
|
2543 (pop numbers)) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
2544 (decf i))) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
2545 (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
|
2546 |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
2547 (defun reftex-section-number (&optional level star) |
18050 | 2548 ;; Return a string with the current section number. |
2549 ;; 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
|
2550 (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
|
2551 (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
|
2552 (when level |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2553 (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
|
2554 (aset reftex-section-numbers |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
2555 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
|
2556 (setq idx (1+ level)) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2557 (when (not star) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2558 (while (<= idx depth) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2559 (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
|
2560 (incf idx)))) |
18050 | 2561 (setq idx 0) |
2562 (while (<= idx depth) | |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
2563 (setq n (aref reftex-section-numbers idx)) |
18050 | 2564 (setq string (concat string (if (not (string= string "")) "." "") |
2565 (int-to-string n))) | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2566 (incf idx)) |
18050 | 2567 (save-match-data |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
2568 (if (string-match "\\`\\([@0]\\.\\)+" string) |
18050 | 2569 (setq string (replace-match "" nil nil string))) |
2570 (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
|
2571 (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
|
2572 (if (and appendix |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
2573 (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
|
2574 (setq string |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2575 (concat |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2576 (char-to-string |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2577 (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
|
2578 (substring string (match-end 0)))))) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2579 (if star |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
2580 (concat (make-string (1- (length string)) ?\ ) "*") |
18050 | 2581 string))) |
2582 | |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2583 (defun reftex-is-multi () |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2584 ;; 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
|
2585 (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
|
2586 (if entry |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2587 (nth 1 entry) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2588 t))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2589 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2590 (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
|
2591 ;; 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
|
2592 (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
|
2593 (or (eq conf-variable t) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2594 (and (stringp conf-variable) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2595 (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
|
2596 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2597 (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
|
2598 "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
|
2599 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
|
2600 of master file." |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2601 (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
|
2602 (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
|
2603 (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
|
2604 file-list tmp file) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2605 (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
|
2606 (setq file (nth 1 tmp) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2607 all (cdr (memq tmp all))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2608 (and relative |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2609 (string-match re file) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2610 (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
|
2611 (push file file-list)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2612 (nreverse file-list))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2613 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2614 ;;; Creating labels --------------------------------------------------------- |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2615 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2616 (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
|
2617 "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
|
2618 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
|
2619 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
|
2620 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
|
2621 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
|
2622 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
|
2623 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
|
2624 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
|
2625 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2626 (interactive) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2627 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2628 ;; 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
|
2629 (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
|
2630 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2631 ;; 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
|
2632 (if (or (not environment) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2633 (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
|
2634 (setq environment (reftex-label-location))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2635 (unless environment |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2636 (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
|
2637 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2638 ;; Ok, go ahead. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2639 (catch 'exit |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2640 (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
|
2641 (typekey (nth 1 entry)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2642 (format (nth 3 entry)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2643 (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
|
2644 (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
|
2645 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
|
2646 (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
|
2647 (memq (preceding-char) '(?\[ ?\{))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2648 ;; 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
|
2649 (setq naked t format "%s")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2650 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2651 (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
|
2652 (concat typekey "-"))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2653 ;; 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
|
2654 (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
|
2655 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2656 ;; Make a default label. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2657 (cond |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2658 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2659 ((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
|
2660 ;; Derive a label from context. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2661 (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
|
2662 '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
|
2663 (symbol-value reftex-docstruct-symbol))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2664 (setq default (reftex-no-props |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2665 (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
|
2666 ;; 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
|
2667 (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
|
2668 (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
|
2669 (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
|
2670 (string-match "HOOK ERROR" default) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2671 (string-match "^[ \t]*$" default)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2672 (setq default prefix |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2673 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
|
2674 (setq default |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2675 (concat prefix |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2676 (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
|
2677 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2678 ;; Make it unique. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2679 (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
|
2680 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2681 ((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
|
2682 ;; 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
|
2683 (setq default prefix)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2684 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2685 (t |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2686 ;; Make an automatic label. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2687 (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
|
2688 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2689 ;; Should we ask the user? |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2690 (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
|
2691 (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
|
2692 force-prompt) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2693 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2694 (while (not valid) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2695 ;; 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
|
2696 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2697 (setq label (read-string |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2698 (if naked "Naked Label: " "Label: ") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2699 default)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2700 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2701 ;; 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
|
2702 (cond |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2703 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2704 ((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
|
2705 "\\)?[ \t]*\\'") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2706 label) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2707 ;; No label at all, please |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2708 (message "No label inserted.") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2709 (throw 'exit nil)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2710 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2711 ;; 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
|
2712 ((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
|
2713 (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
|
2714 (ding) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2715 (sit-for 2)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2716 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2717 ;; 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
|
2718 ((setq entry (assoc label |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2719 (symbol-value reftex-docstruct-symbol))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2720 (ding) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2721 (if (y-or-n-p |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2722 (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
|
2723 (setq valid t))) |
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 ;; Label is ok |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2726 (t |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2727 (setq valid t)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2728 (setq label default)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2729 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2730 ;; 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
|
2731 (let* ((here-I-am-info |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2732 (save-excursion |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2733 (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
|
2734 (integerp (cdr macro-cell))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2735 (goto-char (cdr macro-cell))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2736 (reftex-where-am-I))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2737 (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
|
2738 (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
|
2739 "" |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2740 "POSITION UNCERTAIN. RESCAN TO FIX.")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2741 (file (buffer-file-name)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2742 (text nil) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2743 (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
|
2744 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2745 (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
|
2746 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2747 (when tail |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2748 (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
|
2749 (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
|
2750 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2751 ;; 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
|
2752 (unless no-insert |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2753 (insert |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2754 (if reftex-format-label-function |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2755 (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
|
2756 (format format label))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2757 (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
|
2758 (fboundp 'LaTeX-add-labels)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2759 ;; Tell AUCTeX about this |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2760 (LaTeX-add-labels label))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2761 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2762 ;; 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
|
2763 (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
|
2764 (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
|
2765 (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
|
2766 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2767 (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
|
2768 (reftex-parse-one)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2769 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2770 ;; 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
|
2771 label))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2772 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2773 (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
|
2774 "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
|
2775 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
|
2776 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
|
2777 (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
|
2778 (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
|
2779 (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
|
2780 (apply 'reftex-convert-string string |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2781 "[-~ \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
|
2782 reftex-derive-label-parameters)) |
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 (defun reftex-abbreviate-title (string) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2785 (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
|
2786 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
|
2787 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2788 (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
|
2789 nwords maxchar illegal abbrev sep |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2790 ignore-words &optional downcase) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2791 "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
|
2792 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
|
2793 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
|
2794 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
|
2795 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
|
2796 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
|
2797 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
|
2798 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
|
2799 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
|
2800 ABBREV nil: Never abbreviate words. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2801 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
|
2802 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
|
2803 string below MAXCHAR. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2804 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
|
2805 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
|
2806 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2807 (let* ((words0 (split-string string (or split-re "[ \t\n\r]"))) |
23200
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
2808 (reftex-label-illegal-re (or illegal-re "\000")) |
23344
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
2809 (abbrev-re (concat |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
2810 "\\`\\(" |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
2811 (make-string (nth 0 reftex-abbrev-parameters) ?.) |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
2812 "[" (nth 2 reftex-abbrev-parameters) "]*" |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
2813 "\\)" |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
2814 "[" (nth 3 reftex-abbrev-parameters) "]" |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
2815 (make-string (1- (nth 1 reftex-abbrev-parameters)) ?.))) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2816 words word) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2817 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2818 ;; 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
|
2819 (while (setq word (pop words0)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2820 (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
|
2821 (cond |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2822 ((member (downcase word) ignore-words)) |
23200
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
2823 ((string-match reftex-label-illegal-re word) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2824 (when illegal |
23200
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
2825 (while (string-match reftex-label-illegal-re word) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2826 (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
|
2827 (push word words))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2828 (t |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2829 (push word words)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2830 (setq words (nreverse words)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2831 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2832 ;; Restrict number of words |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2833 (if (> (length words) nwords) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2834 (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
|
2835 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2836 ;; 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
|
2837 (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
|
2838 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2839 ;; 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
|
2840 (if (or (eq t abbrev) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2841 (and abbrev |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2842 (> (length string) maxchar))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2843 (setq words |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2844 (mapcar |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2845 (function |
23344
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
2846 (lambda (w) (if (string-match abbrev-re w) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2847 (if dot |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2848 (concat (match-string 1 w) ".") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2849 (match-string 1 w)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2850 w))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2851 words) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2852 string (mapconcat 'identity words sep))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2853 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2854 ;; Shorten if still to long |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2855 (setq string |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2856 (if (> (length string) maxchar) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2857 (substring string 0 maxchar) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2858 string)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2859 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2860 ;; 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
|
2861 (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
|
2862 (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
|
2863 string)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2864 |
23200
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
2865 (defun reftex-latin1-to-ascii (string) |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
2866 ;; Translate the upper 128 chars in the Latin-1 charset to ASCII equivalents |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
2867 (let ((tab "@@@@@@@@@@@@@@@@@@'@@@@@@@@@@@@@ icLxY|S\"ca<--R-o|23'uq..1o>423?AAAAAAACEEEEIIIIDNOOOOOXOUUUUYP3aaaaaaaceeeeiiiidnooooo:ouuuuypy") |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
2868 (emacsp (not (featurep 'xemacs)))) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
2869 (mapconcat |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
2870 (lambda (c) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
2871 (cond ((and (> c 127) (< c 256)) ; 8 bit Latin-1 |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
2872 (char-to-string (aref tab (- c 128)))) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
2873 ((and emacsp ; Not for XEmacs |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
2874 (> c 2175) (< c 2304)) ; Mule Latin-1 |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
2875 (char-to-string (aref tab (- c 2176)))) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
2876 (t (char-to-string c)))) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
2877 string ""))) |
23200
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
2878 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2879 (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
|
2880 ;; 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
|
2881 (save-match-data |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2882 (let (letter (num 0) replace) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2883 (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
|
2884 (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
|
2885 (setq replace |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2886 (cond |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2887 ((equal letter "f") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2888 (file-name-sans-extension |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2889 (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
|
2890 ((equal letter "F") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2891 (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
|
2892 (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
|
2893 (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
|
2894 file) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2895 (substring file (length masterdir)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2896 file))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2897 ((equal letter "u") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2898 (or (user-login-name) "")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2899 (t ""))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2900 (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
|
2901 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
|
2902 prefix))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2903 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2904 (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
|
2905 ;; 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
|
2906 ;; 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
|
2907 ;; 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
|
2908 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2909 ;; Ensure access to scanning info |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2910 (reftex-access-scan-info) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2911 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2912 (cond |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2913 ((and (not force) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2914 (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
|
2915 label) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2916 (t |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2917 (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
|
2918 (symbol-value reftex-docstruct-symbol))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2919 (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
|
2920 (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
|
2921 (car (setcdr label-numbers |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2922 (cons (cons label 0) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2923 label-numbers-alist))))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2924 (num (1+ (cdr cell))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2925 (sep (or separator ""))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2926 (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
|
2927 (symbol-value reftex-docstruct-symbol)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2928 (incf num)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2929 (setcdr cell num) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2930 (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
|
2931 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2932 ;;; Referencing labels ------------------------------------------------------ |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2933 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2934 ;; 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
|
2935 (defconst reftex-select-label-prompt |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2936 "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
|
2937 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2938 (defconst reftex-select-label-help |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2939 " 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
|
2940 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
|
2941 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
|
2942 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
|
2943 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
|
2944 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
|
2945 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
|
2946 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
|
2947 [#] label counters, [%] labels in comments |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2948 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
|
2949 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
|
2950 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
|
2951 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
|
2952 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2953 (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
|
2954 "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
|
2955 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
|
2956 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
|
2957 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2958 (defun reftex-select-label-mode () |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2959 "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
|
2960 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
|
2961 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
|
2962 selection process. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2963 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
|
2964 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
|
2965 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2966 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
|
2967 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2968 \\{reftex-select-label-map}" |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2969 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2970 (interactive) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2971 (kill-all-local-variables) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2972 (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
|
2973 (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
|
2974 (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
|
2975 mode-name "RefTeX Select Label") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2976 (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
|
2977 (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
|
2978 ;; 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
|
2979 (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
|
2980 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2981 (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
|
2982 "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
|
2983 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
|
2984 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
|
2985 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
|
2986 label selection menu. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2987 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
|
2988 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
|
2989 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
|
2990 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2991 (interactive) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2992 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2993 ;; check for active recursive edits |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2994 (reftex-check-recursive-edit) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2995 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2996 ;; 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
|
2997 (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
|
2998 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
2999 (unless type |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3000 ;; guess type from context |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3001 (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
|
3002 (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
|
3003 (setq cut (cdr type) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3004 type (car type)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3005 (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
|
3006 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3007 (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
|
3008 type reftex-vref-is-default) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3009 "\\vref" "\\ref")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3010 (form "\\ref{%s}") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3011 label pair) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3012 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3013 ;; 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
|
3014 (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
|
3015 (setq pair (save-excursion |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3016 (reftex-offer-label-menu type))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3017 (reftex-ensure-compiled-variables) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3018 (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
|
3019 (setq label (car pair) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3020 type (cdr pair) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3021 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
|
3022 form)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3023 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3024 (if (and label |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3025 (not no-insert)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3026 (progn |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3027 (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
|
3028 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3029 ;; 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
|
3030 (when (and (= ?~ (string-to-char form)) |
23200
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
3031 (member (preceding-char) '(?\ ?\t ?\n))) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3032 (setq form (substring form 1))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3033 ;; 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
|
3034 (when (string= varioref "\\vref") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3035 (while (string-match "\\\\ref{" form) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3036 (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
|
3037 ;; ok, insert the reference |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3038 (insert |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3039 (if reftex-format-ref-function |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3040 (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
|
3041 (format form label label))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3042 (message "")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3043 (message "Quit")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3044 ;; return the label |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3045 label)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3046 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3047 (defun reftex-guess-label-type () |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3048 ;; 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
|
3049 (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
|
3050 (case-fold-search t) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3051 (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
|
3052 matched cell) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3053 (save-excursion |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3054 (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
|
3055 (not (setq matched |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3056 (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
|
3057 (if matched |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3058 (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
|
3059 nil))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3060 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3061 (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
|
3062 ;; 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
|
3063 (let* ((buf (current-buffer)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3064 (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
|
3065 (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
|
3066 (xr-index 0) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3067 (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
|
3068 (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
|
3069 (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
|
3070 (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
|
3071 (context (not (reftex-typekey-check |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3072 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
|
3073 (counter (reftex-typekey-check |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3074 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
|
3075 (follow (reftex-typekey-check |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3076 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
|
3077 (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
|
3078 (prefix "") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3079 selection-buffers |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3080 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
|
3081 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3082 (setq entry (cons nil nil)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3083 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3084 (unwind-protect |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3085 (catch 'exit |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3086 (while t |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3087 (save-window-excursion |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3088 (delete-other-windows) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3089 (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
|
3090 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
|
3091 (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
|
3092 (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
|
3093 (switch-to-buffer-other-window |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3094 (save-excursion |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3095 (set-buffer buf) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3096 (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
|
3097 (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
|
3098 (reftex-erase-buffer))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3099 (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
|
3100 (reftex-select-label-mode)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3101 (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
|
3102 (setq truncate-lines t) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3103 (setq mode-line-format |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3104 (list "---- " 'mode-line-buffer-identification |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3105 " " 'varioref |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3106 " " (abbreviate-file-name |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3107 (buffer-file-name buf)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3108 " -%-")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3109 (cond |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3110 ((= 0 (buffer-size)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3111 (let ((buffer-read-only nil)) |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3112 (message "Creating Selection Buffer...") |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3113 (setq offset (reftex-insert-docstruct |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3114 typekey buf toc t files context counter |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3115 commented |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3116 (or here-I-am offset) prefix nil)))) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3117 (here-I-am |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3118 (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
|
3119 (t (setq offset t))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3120 (setq buffer-read-only t) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3121 (setq offset (or offset t)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3122 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3123 (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
|
3124 (setq rtn |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3125 (reftex-select-item |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3126 reftex-select-label-prompt |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3127 reftex-select-label-help |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3128 reftex-select-label-map |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3129 offset |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3130 'reftex-show-label-location follow)) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3131 (setq key (car rtn) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3132 data (nth 1 rtn) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3133 last-data (nth 2 rtn) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3134 offset t) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3135 (unless key (throw 'exit nil)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3136 (cond |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3137 ((eq key ?g) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3138 ;; update buffer |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3139 (reftex-erase-buffer)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3140 ((or (eq key ?r) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3141 (eq key ?R)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3142 ;; rescan buffer |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3143 (reftex-erase-buffer) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3144 (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
|
3145 ((eq key ?c) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3146 ;; toggle context mode |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3147 (reftex-erase-buffer) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3148 (setq context (not context))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3149 ((eq key ?s) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3150 ;; switch type |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3151 (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
|
3152 (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
|
3153 ((eq key ?t) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3154 ;; toggle table of contents display |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3155 (reftex-erase-buffer) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3156 (setq toc (not toc))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3157 ((eq key ?i) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3158 ;; 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
|
3159 (reftex-erase-buffer) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3160 (setq files (not files))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3161 ((eq key ?#) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3162 ;; toggle counter display |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3163 (reftex-erase-buffer) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3164 (setq counter (not counter))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3165 ((eq key ?%) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3166 ;; toggle display of commented labels |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3167 (reftex-erase-buffer) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3168 (setq commented (not commented))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3169 ((eq key ?l) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3170 ;; 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
|
3171 (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
|
3172 (throw 'exit t)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3173 ((eq key ?x) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3174 ;; select an external document |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3175 (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
|
3176 xr-alist xr-index)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3177 (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
|
3178 (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
|
3179 (error "Cannot switch document")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3180 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
|
3181 (set-buffer buf) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3182 (reftex-access-scan-info)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3183 ((stringp key) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3184 (setq entry |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3185 (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
|
3186 (list key typekey))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3187 (throw 'exit t)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3188 (t |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3189 (set-buffer buf) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3190 (if data |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3191 (progn |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3192 (setq entry data) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3193 (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
|
3194 (setq entry nil)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3195 (throw 'exit t)))))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3196 (save-excursion |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3197 (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
|
3198 (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
|
3199 (setq buffer-invisibility-spec |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3200 (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
|
3201 (mapcar (function (lambda (buf) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3202 (and (buffer-live-p buf) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3203 (bury-buffer buf)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3204 selection-buffers) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3205 (reftex-kill-temporary-buffers)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3206 (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
|
3207 (nth 1 entry)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3208 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3209 (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
|
3210 ;; 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
|
3211 (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
|
3212 (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
|
3213 ?0 highest)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3214 key prefix) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3215 (cond |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3216 ((= len 1) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3217 (message "No external documents available") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3218 (ding) (sit-for 1) 0) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3219 ((= len 2) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3220 (- 1 xr-index)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3221 (t |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3222 (save-excursion |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3223 (let* ((length (apply 'max (mapcar |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3224 (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
|
3225 (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
|
3226 (n (1- ?0))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3227 (setq key |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3228 (reftex-select-with-char |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3229 prompt |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3230 (concat |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3231 "SELECT EXTERNAL DOCUMENT\n------------------------\n" |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3232 (mapconcat |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3233 (function |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3234 (lambda (x) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3235 (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
|
3236 (abbreviate-file-name (cdr x))))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3237 xr-alist "")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3238 nil t)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3239 (cond |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3240 ((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
|
3241 ((= key ?\C-i) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3242 (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
|
3243 (- 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
|
3244 (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
|
3245 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3246 (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
|
3247 ;; Rescan the document. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3248 (save-window-excursion |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3249 (save-excursion |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3250 (if buffer |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3251 (if (not (bufferp buffer)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3252 (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
|
3253 (set-buffer buffer))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3254 (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
|
3255 (file (nth 3 data))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3256 (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
|
3257 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3258 (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
|
3259 ;; 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
|
3260 (format " *RefTeX[%s][%d]*" |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
3261 type (or index (get reftex-docstruct-symbol :master-index) 0))) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3262 |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3263 (defun reftex-get-offset (buf here-am-I &optional typekey toc file) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3264 ;; Find the correct offset data, like insert-docstruct would, but faster. |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3265 ;; Buffer BUF knows the correct docstruct to use. |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3266 ;; Basically this finds the first docstruct entry after HERE-I-AM which |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3267 ;; is of allowed type. The optional arguments specify what is allowed. |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3268 (catch 'exit |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3269 (save-excursion |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3270 (set-buffer buf) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3271 (reftex-access-scan-info) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3272 (let* ((rest (memq here-am-I (symbol-value reftex-docstruct-symbol))) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3273 entry) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3274 (while (setq entry (pop rest)) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3275 (if (or (and typekey |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3276 (stringp (car entry)) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3277 (or (equal typekey " ") |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3278 (equal typekey (nth 1 entry)))) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3279 (and toc (eq (car entry) 'toc)) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3280 (and file |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3281 (memq (car entry) '(bof eof file-error)))) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3282 (throw 'exit entry))) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3283 nil)))) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3284 |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3285 (defun reftex-insert-docstruct |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3286 (typekey0 buf toc labels files context counter show-commented |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3287 here-I-am xr-prefix toc-buffer) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3288 ;; Insert an excerpt of the docstruct list. |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3289 ;; Return the data property of the entry corresponding to HERE-I-AM. |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3290 ;; TYPEKEY0 indicated which labels to put into the list. |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3291 ;; BUF is the buffer which has the correct docstruct-symbol. |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3292 ;; LABELS non-nil meand to include labels into the list. |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3293 ;; FILES non-nil menas to display file boundaries. |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3294 ;; CONTEXT non-nil meand to include label context. |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3295 ;; COUNTER means to count the labels. |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3296 ;; SHOW-COMMENTED meand to include also labels which are commented out. |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3297 ;; HERE-I-AM is a member of the docstruct list. The function will return |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3298 ;; a used member near to this one, as a possible starting point. |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3299 ;; XR-PREFIX is the prefix to put in front of labels. |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3300 ;; TOC-BUFFER means this is to fill the toc buffer. |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3301 (let* ((font (reftex-use-fonts)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3302 (cnt 0) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3303 (index -1) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3304 (toc-indent " ") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3305 (label-indent |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3306 (concat "> " |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3307 (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
|
3308 (context-indent |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3309 (concat ". " |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3310 (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
|
3311 (mouse-face |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3312 (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
|
3313 reftex-mouse-selected-face |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3314 nil)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3315 (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
|
3316 'font-lock-constant-face |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3317 'font-lock-reference-face)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3318 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
|
3319 offset from to docstruct-symbol) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3320 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3321 ;; 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
|
3322 (save-excursion |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3323 (set-buffer buf) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3324 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3325 ;; Ensure access to scanning info |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3326 (reftex-access-scan-info) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3327 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3328 (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
|
3329 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
|
3330 reftex-active-toc nil |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3331 master-dir-re |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3332 (concat "\\`" (regexp-quote |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3333 (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
|
3334 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3335 (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
|
3336 (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
|
3337 (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
|
3338 (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
|
3339 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3340 ;; 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
|
3341 (while (setq cell (pop all)) |
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 (incf index) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3344 (setq from (point)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3345 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3346 (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
|
3347 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3348 (cond |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3349 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3350 ((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
|
3351 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
|
3352 ;; These are currently ignored |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3353 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3354 ((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
|
3355 ;; 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
|
3356 (when files |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3357 (if (eq offset 'attention) (setq offset cell)) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3358 (insert |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3359 " 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
|
3360 (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
|
3361 (nth 1 cell)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3362 (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
|
3363 ((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
|
3364 ((eq (car cell) 'file-error) " was not found\n"))) |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3365 (setq to (point)) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3366 (when font |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3367 (put-text-property from to |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3368 'face reftex-file-boundary-face)) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3369 (when toc-buffer |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3370 (if mouse-face |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3371 (put-text-property from (1- to) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3372 'mouse-face mouse-face)) |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
3373 (put-text-property from to :data cell)))) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3374 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3375 ((eq (car cell) 'toc) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3376 ;; a table of contents entry |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3377 (when toc |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3378 (if (eq offset 'attention) (setq offset cell)) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3379 (setq reftex-active-toc cell) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3380 (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
|
3381 (setq to (point)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3382 (when font |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3383 (put-text-property from to |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3384 'face reftex-section-heading-face)) |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3385 (when toc-buffer |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3386 (if mouse-face |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3387 (put-text-property from (1- to) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3388 'mouse-face mouse-face)) |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
3389 (put-text-property from to :data cell)) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3390 (goto-char to))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3391 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3392 ((stringp (car cell)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3393 ;; a label |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3394 (when (null (nth 2 cell)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3395 ;; No context yet. Quick update. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3396 (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
|
3397 (put docstruct-symbol 'modified t)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3398 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3399 (setq label (car cell) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3400 typekey (nth 1 cell) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3401 text (nth 2 cell) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3402 comment (nth 4 cell) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3403 note (nth 5 cell)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3404 |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3405 (when (and labels |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3406 (or (string= typekey typekey0) (string= typekey0 " ")) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3407 (or show-commented (null comment))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3408 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3409 ;; Yes we want this one |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3410 (incf cnt) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3411 (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
|
3412 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3413 (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
|
3414 (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
|
3415 (insert label-indent label) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3416 (when font |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3417 (setq to (point)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3418 (put-text-property |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3419 (- (point) (length label)) to |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3420 'face (if comment |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3421 'font-lock-comment-face |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3422 label-face)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3423 (goto-char to)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3424 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3425 (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
|
3426 (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
|
3427 (if (stringp note) (concat " " note) "") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3428 "\n") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3429 (setq to (point)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3430 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3431 (when context |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3432 (insert context-indent text "\n") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3433 (setq to (point))) |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
3434 (put-text-property from to :data cell) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3435 (when mouse-face |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3436 (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
|
3437 'mouse-face mouse-face)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3438 (goto-char to))))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3439 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3440 (when (reftex-refontify) |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3441 ;; we need to fontify the buffer |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3442 (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
|
3443 (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
|
3444 offset)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3445 |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3446 (defun reftex-find-start-point (fallback &rest locations) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3447 ;; Set point to the first available LOCATION. When a LOCATION is a list, |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
3448 ;; search for such a :data text property. When it is an integer, |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3449 ;; use is as line number. FALLBACK is a buffer position used if everything |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3450 ;; else fails. |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3451 (catch 'exit |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3452 (goto-char (point-min)) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3453 (let (loc pos) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3454 (while locations |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3455 (setq loc (pop locations)) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3456 (cond |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3457 ((null loc)) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3458 ((listp loc) |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
3459 (setq pos (text-property-any (point-min) (point-max) :data loc)) |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3460 (when pos |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3461 (goto-char pos) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3462 (throw 'exit t))) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3463 ((integerp loc) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3464 (when (<= loc (count-lines (point-min) (point-max))) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3465 (goto-line loc) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3466 (throw 'exit t))))) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3467 (goto-char fallback)))) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3468 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3469 (defun reftex-query-label-type () |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3470 ;; Ask for label type |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3471 (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
|
3472 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
|
3473 (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
|
3474 (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
|
3475 (char-to-string key))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3476 |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3477 (defun reftex-show-label-location (data forward no-revisit |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3478 &optional stay error) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3479 ;; View the definition site of a label in another window. |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3480 ;; DATA is an entry from the docstruct list. |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3481 ;; FORWARD indicates if the label is likely forward from current point. |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3482 ;; NO-REVISIT means do not load a file to show this label. |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3483 ;; STAY means leave the new window selected. |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3484 ;; ERROR means throw an error exception when the label cannot be found. |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3485 ;; If ERROR is nil, the return value of this function indicates success. |
18050 | 3486 (let* ((this-window (selected-window)) |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3487 (errorf (if error 'error 'message)) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3488 label file buffer re found) |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3489 |
18050 | 3490 (catch 'exit |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3491 (setq label (nth 0 data) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3492 file (nth 3 data)) |
18050 | 3493 |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3494 (unless file |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3495 (funcall errorf "Unknown label - reparse might help") |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3496 (throw 'exit nil)) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3497 |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3498 ;; 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
|
3499 (setq buffer |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3500 (if no-revisit |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3501 (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
|
3502 (reftex-get-file-buffer-force |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3503 file (not reftex-keep-temporary-buffers)))) |
18050 | 3504 (if buffer |
3505 ;; good - the file is available | |
3506 (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
|
3507 ;; we have got a problem here. The file does not exist. |
18050 | 3508 ;; Let' get out of here.. |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3509 (funcall errorf "Label %s not found" label) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3510 (throw 'exit nil)) |
18050 | 3511 |
3512 ;; search for that label | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3513 (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
|
3514 (setq found |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3515 (if forward |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3516 (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
|
3517 (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
|
3518 (unless found |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3519 (goto-char (point-min)) |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3520 (unless (setq found (re-search-forward re nil t)) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3521 ;; Ooops. Must be in a macro with distributed args. |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3522 (setq found |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3523 (re-search-forward |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3524 (format reftex-find-label-regexp-format2 |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3525 (regexp-quote label)) nil t)))) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3526 (if (match-end 3) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3527 (progn |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3528 (reftex-highlight 0 (match-beginning 3) (match-end 3)) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3529 (reftex-show-entry (match-beginning 3) (match-end 3)) |
23200
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
3530 (recenter '(4)) |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3531 (unless stay (select-window this-window))) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3532 (select-window this-window) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3533 (funcall errorf "Label %s not found" label)) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3534 found))) |
18050 | 3535 |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3536 (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
|
3537 ;; Show entry if point is hidden |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
3538 (let* ((n (/ (reftex-window-height) 2)) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3539 (beg (save-excursion |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3540 (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
|
3541 (end (save-excursion |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3542 (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
|
3543 (cond |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3544 ((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
|
3545 (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
|
3546 ;; 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
|
3547 (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
|
3548 reftex-buffers-with-changed-invisibility) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3549 (setq buffer-invisibility-spec nil)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3550 ((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
|
3551 ;; 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
|
3552 (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
|
3553 (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
|
3554 (setq buffer-read-only nil) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3555 (erase-buffer) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3556 (insert string) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3557 (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
|
3558 (goto-char (- beg-hlt beg)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3559 (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
|
3560 (if (reftex-refontify) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3561 (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
|
3562 (not font-lock-mode)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3563 (latex-mode) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3564 (run-hook-with-args |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3565 'reftex-pre-refontification-functions |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3566 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
|
3567 (turn-on-font-lock)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3568 (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
|
3569 font-lock-mode) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3570 (fundamental-mode))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3571 (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
|
3572 (setq buffer-read-only t)))))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3573 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3574 ;;; ========================================================================= |
18050 | 3575 ;;; |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3576 ;;; Table of contents |
18050 | 3577 |
3578 ;; We keep at most one *toc* buffer - it is easy to make them | |
3579 | |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3580 (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
|
3581 "Keymap used for *toc* buffer.") |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3582 |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3583 (defun reftex-toc-mode () |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3584 "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
|
3585 This buffer was created with RefTeX. |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3586 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
|
3587 |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3588 Here are all local bindings. |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3589 |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3590 \\{reftex-toc-map}" |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3591 (interactive) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3592 (kill-all-local-variables) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3593 (setq major-mode 'reftex-toc-mode |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3594 mode-name "RefTeX Table of Contents") |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3595 (use-local-map reftex-toc-map) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3596 (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
|
3597 (setq truncate-lines t) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3598 (make-local-hook 'post-command-hook) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3599 (make-local-hook 'pre-command-hook) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3600 (make-local-variable 'reftex-last-follow-point) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3601 (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
|
3602 (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
|
3603 (run-hooks 'reftex-toc-mode-hook)) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3604 |
18050 | 3605 (defvar reftex-last-toc-master nil |
3606 "Stores the name of the tex file that `reftex-toc' was last run on.") | |
3607 | |
3608 (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
|
3609 "Stores the file name from which `reftex-toc' was called. For redo command.") |
18050 | 3610 |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3611 (defvar reftex-last-window-height nil) |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3612 |
18050 | 3613 (defvar reftex-toc-return-marker (make-marker) |
3614 "Marker which makes it possible to return from toc to old position.") | |
3615 | |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3616 (defconst reftex-toc-help |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3617 " AVAILABLE KEYS IN TOC BUFFER |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3618 ============================ |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3619 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
|
3620 SPC Show the corresponding section of the LaTeX document. |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3621 TAB Goto the section and keep the *toc* window. |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3622 RET Goto the section and hide the *toc* window (also on mouse-2). |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3623 q / Q Hide/Kill *toc* buffer, return to position of last reftex-toc command. |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3624 l c i Toggle display of [l]abels, [c]ontext, [i]nclude file borders. |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3625 f / g Toggle follow mode on and off / Refresh *toc* buffer. |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3626 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
|
3627 . 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
|
3628 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
|
3629 |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3630 (defun reftex-toc (&optional rebuild) |
18050 | 3631 "Show the table of contents for the current document. |
3632 When called with a raw C-u prefix, rescan the document first." | |
3633 | |
3634 (interactive) | |
3635 | |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3636 (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
|
3637 current-prefix-arg) |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3638 (reftex-erase-buffer "*toc*")) |
18050 | 3639 |
3640 (setq reftex-last-toc-file (buffer-file-name)) | |
3641 (setq reftex-last-toc-master (reftex-TeX-master-file)) | |
3642 | |
3643 (set-marker reftex-toc-return-marker (point)) | |
3644 | |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3645 ;; If follow mode is active, arrange to delay it one command |
18050 | 3646 (if reftex-toc-follow-mode |
3647 (setq reftex-toc-follow-mode 1)) | |
3648 | |
3649 ;; Ensure access to scanning info and rescan buffer if prefix are is '(4) | |
3650 (reftex-access-scan-info current-prefix-arg) | |
3651 | |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3652 (let* ((this-buf (current-buffer)) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3653 (xr-data (assq 'xr (symbol-value reftex-docstruct-symbol))) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3654 (xr-alist (cons (cons "" (buffer-file-name)) (nth 1 xr-data))) |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3655 (here-I-am (if rebuild |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
3656 (get 'reftex-toc :reftex-data) |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3657 (car (reftex-where-am-I)))) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3658 offset) |
18050 | 3659 |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3660 (if (get-buffer-window "*toc*") |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3661 (select-window (get-buffer-window "*toc*")) |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3662 (when (or (not reftex-toc-keep-other-windows) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3663 (< (window-height) (* 2 window-min-height))) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3664 (delete-other-windows)) |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3665 (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
|
3666 (split-window) |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3667 (let ((default-major-mode 'reftex-toc-mode)) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3668 (switch-to-buffer "*toc*"))) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3669 |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3670 (or (eq major-mode 'reftex-toc-mode) (reftex-toc-mode)) |
18050 | 3671 |
3672 (cond | |
3673 ((= (buffer-size) 0) | |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3674 ;; buffer is empty - fill it with the table of contents |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3675 (message "Building *toc* buffer...") |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3676 |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3677 (setq buffer-read-only nil) |
18050 | 3678 (insert (format |
3679 "TABLE-OF-CONTENTS on %s | |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3680 SPC=view TAB=goto RET=goto+hide [q]uit [r]escan [l]abels [f]ollow [x]r [?]Help |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3681 ------------------------------------------------------------------------------ |
18050 | 3682 " (abbreviate-file-name reftex-last-toc-master))) |
3683 | |
3684 (if (reftex-use-fonts) | |
21114
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
3685 (put-text-property 1 (point) 'face reftex-toc-header-face)) |
18050 | 3686 (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
|
3687 (put-text-property 1 2 'xr-alist xr-alist) |
18050 | 3688 |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3689 (setq offset |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3690 (reftex-insert-docstruct |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3691 " " |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3692 this-buf |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3693 t ; toc |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3694 reftex-toc-include-labels |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3695 reftex-toc-include-file-boundaries |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3696 reftex-toc-include-context |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3697 nil ; counter |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3698 nil ; commented |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3699 here-I-am "" t)) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3700 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3701 (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
|
3702 (message "Building *toc* buffer...done.") |
18050 | 3703 (setq buffer-read-only t)) |
3704 (t | |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3705 ;; Only compute the offset |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3706 (setq offset |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3707 (or (reftex-get-offset this-buf here-I-am |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3708 (if reftex-toc-include-labels " " nil) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3709 t |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3710 reftex-toc-include-file-boundaries) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3711 (reftex-last-assoc-before-elt |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3712 'toc here-I-am |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3713 (symbol-value reftex-docstruct-symbol)))) |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
3714 (put 'reftex-toc :reftex-line 3) |
18050 | 3715 (goto-line 3) |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3716 (beginning-of-line))) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3717 |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3718 ;; Find the correct starting point |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
3719 (reftex-find-start-point (point) offset (get 'reftex-toc :reftex-line)) |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3720 (setq reftex-last-follow-point (point)))) |
18050 | 3721 |
3722 (defun reftex-toc-pre-command-hook () | |
3723 ;; used as pre command hook in *toc* buffer | |
3724 (reftex-unhighlight 0) | |
3725 (reftex-unhighlight 1)) | |
3726 | |
3727 (defun reftex-toc-post-command-hook () | |
3728 ;; used in the post-command-hook for the *toc* buffer | |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
3729 (when (get-text-property (point) :data) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
3730 (put 'reftex-toc :reftex-data (get-text-property (point) :data)) |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3731 (and (> (point) 1) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3732 (not (get-text-property (point) 'intangible)) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3733 (memq reftex-highlight-selection '(cursor both)) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3734 (reftex-highlight 1 |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
3735 (or (previous-single-property-change (1+ (point)) :data) |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3736 (point-min)) |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
3737 (or (next-single-property-change (point) :data) |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3738 (point-max))))) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3739 (if (integerp reftex-toc-follow-mode) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3740 ;; remove delayed action |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3741 (setq reftex-toc-follow-mode t) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3742 (and reftex-toc-follow-mode |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3743 (not (equal reftex-last-follow-point (point))) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3744 ;; show context in other window |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3745 (setq reftex-last-follow-point (point)) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3746 (condition-case nil |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3747 (reftex-toc-visit-location nil (not reftex-revisit-to-follow)) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3748 (error t))))) |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3749 |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3750 (defun reftex-re-enlarge () |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3751 ;; 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
|
3752 (enlarge-window |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3753 (max 0 (- (or reftex-last-window-height (window-height)) |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3754 (window-height))))) |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3755 |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3756 (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
|
3757 "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
|
3758 (interactive) |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3759 (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
|
3760 (princ reftex-toc-help)) |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3761 ;; 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
|
3762 (if reftex-toc-follow-mode |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3763 (setq reftex-toc-follow-mode 1))) |
18050 | 3764 |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3765 (defun reftex-toc-next (&optional arg) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3766 "Move to next selectable item." |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3767 (interactive "p") |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3768 (setq reftex-callback-fwd t) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3769 (or (eobp) (forward-char 1)) |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
3770 (goto-char (or (next-single-property-change (point) :data) |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3771 (point)))) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3772 (defun reftex-toc-previous (&optional arg) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3773 "Move to previous selectable item." |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3774 (interactive "p") |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3775 (setq reftex-callback-fwd nil) |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
3776 (goto-char (or (previous-single-property-change (point) :data) |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3777 (point)))) |
18050 | 3778 (defun reftex-toc-toggle-follow () |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3779 "Toggle follow (other window follows with context)." |
18050 | 3780 (interactive) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3781 (setq reftex-last-follow-point -1) |
18050 | 3782 (setq reftex-toc-follow-mode (not reftex-toc-follow-mode))) |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3783 (defun reftex-toc-toggle-file-boundary () |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3784 "Toggle inclusion of file boundaries in *toc* buffer." |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3785 (interactive) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3786 (setq reftex-toc-include-file-boundaries |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3787 (not reftex-toc-include-file-boundaries)) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3788 (reftex-toc-revert)) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3789 (defun reftex-toc-toggle-labels () |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3790 "Toggle inclusion of labels in *toc* buffer." |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3791 (interactive) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3792 (setq reftex-toc-include-labels (not reftex-toc-include-labels)) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3793 (reftex-toc-revert)) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3794 (defun reftex-toc-toggle-context () |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3795 "Toggle inclusion of label context in *toc* buffer. |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3796 Label context is only displayed when the labels are there as well." |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3797 (interactive) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3798 (setq reftex-toc-include-context (not reftex-toc-include-context)) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3799 (reftex-toc-revert)) |
18050 | 3800 (defun reftex-toc-view-line () |
3801 "View document location in other window." | |
3802 (interactive) | |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3803 (reftex-toc-visit-location)) |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3804 (defun reftex-toc-mouse-view-line (ev) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3805 "View document location in other window." |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3806 (interactive "e") |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
3807 (mouse-set-point ev) |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3808 (reftex-toc-visit-location)) |
18050 | 3809 (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
|
3810 "Go to document location in other window. Hide the *toc* window." |
18050 | 3811 (interactive) |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3812 (reftex-toc-visit-location 'hide)) |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3813 (defun reftex-toc-goto-line () |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3814 "Go to document location in other window. *toc* window stays." |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3815 (interactive) |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3816 (reftex-toc-visit-location t)) |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3817 (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
|
3818 "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
|
3819 (interactive "e") |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3820 (mouse-set-point ev) |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3821 (reftex-toc-visit-location 'hide)) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3822 (defun reftex-toc-show-calling-point () |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3823 "Show point where reftex-toc was called from." |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3824 (interactive) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3825 (let ((this-window (selected-window))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3826 (unwind-protect |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3827 (progn |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3828 (switch-to-buffer-other-window |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3829 (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
|
3830 (goto-char (marker-position reftex-toc-return-marker)) |
23200
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
3831 (recenter '(4))) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3832 (select-window this-window)))) |
18050 | 3833 (defun reftex-toc-quit () |
3834 "Hide the *toc* window and do not move point." | |
3835 (interactive) | |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3836 (or (one-window-p) (delete-window)) |
18050 | 3837 (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
|
3838 (reftex-re-enlarge) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3839 (goto-char (or (marker-position reftex-toc-return-marker) (point)))) |
18050 | 3840 (defun reftex-toc-quit-and-kill () |
3841 "Kill the *toc* buffer." | |
3842 (interactive) | |
3843 (kill-buffer "*toc*") | |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3844 (or (one-window-p) (delete-window)) |
18050 | 3845 (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
|
3846 (reftex-re-enlarge) |
18050 | 3847 (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
|
3848 (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
|
3849 "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
|
3850 (interactive) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3851 (if reftex-enable-partial-scans |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
3852 (let* ((data (get-text-property (point) :data)) |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3853 (what (car data)) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3854 (file (cond ((eq what 'toc) (nth 3 data)) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3855 ((memq what '(eof bof file-error)) (nth 1 data)) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3856 ((stringp what) (nth 3 data)))) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3857 (line (+ (count-lines (point-min) (point)) (if (bolp) 1 0)))) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3858 (if (not file) |
23200
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
3859 (error "Don't know which file to rescan. Try `R'") |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
3860 (put 'reftex-toc :reftex-line line) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3861 (switch-to-buffer-other-window |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3862 (reftex-get-file-buffer-force file)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3863 (setq current-prefix-arg '(4)) |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3864 (reftex-toc t))) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3865 (reftex-toc-Rescan)) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3866 (reftex-kill-temporary-buffers)) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3867 (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
|
3868 "Regenerate the *toc* buffer by reparsing the entire document." |
18050 | 3869 (interactive) |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3870 (switch-to-buffer-other-window |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3871 (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
|
3872 (setq current-prefix-arg '(16)) |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3873 (reftex-toc t)) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3874 (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
|
3875 "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
|
3876 (interactive) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3877 (switch-to-buffer-other-window |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3878 (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
|
3879 (reftex-erase-buffer "*toc*") |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3880 (setq current-prefix-arg nil) |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3881 (reftex-toc t)) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3882 (defun reftex-toc-external (&rest ignore) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3883 "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
|
3884 (interactive) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3885 (let* ((old-buf (current-buffer)) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3886 (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
|
3887 (xr-index (reftex-select-external-document |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3888 xr-alist 0))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3889 (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
|
3890 (cdr (nth xr-index xr-alist))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3891 (error "Cannot switch document"))) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3892 (reftex-toc) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3893 (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
|
3894 (message "") |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3895 (message "Switched document")))) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
3896 |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3897 (defun reftex-toc-visit-location (&optional final no-revisit) |
18050 | 3898 ;; Visit the tex file corresponding to the toc entry on the current line. |
3899 ;; If FINAL is t, stay there | |
3900 ;; 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
|
3901 ;; Otherwise, move cursor back into *toc* window. |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3902 ;; NO-REVISIT means don't visit files, just use live biffers. |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3903 ;; 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
|
3904 ;; 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
|
3905 ;; have been active. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3906 |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
3907 (let* ((toc (get-text-property (point) :data)) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3908 (toc-window (selected-window)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3909 show-window show-buffer match) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3910 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3911 (unless toc (error "Don't know which toc line to visit")) |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3912 |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3913 (cond |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3914 |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3915 ((eq (car toc) 'toc) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3916 ;; a toc entry |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3917 (setq match (reftex-toc-find-section toc no-revisit))) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3918 |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3919 ((memq (car toc) '(bof eof)) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3920 ;; A file entry |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3921 (setq match |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3922 (let ((where (car toc)) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3923 (file (nth 1 toc))) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3924 (if (or (not no-revisit) (reftex-get-buffer-visiting file)) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3925 (progn |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3926 (switch-to-buffer-other-window |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3927 (reftex-get-file-buffer-force file nil)) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3928 (goto-char (if (eq where 'bof) (point-min) (point-max)))) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3929 (message reftex-no-follow-message) nil)))) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3930 |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3931 ((stringp (car toc)) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3932 ;; a label |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3933 (setq match (reftex-show-label-location toc reftex-callback-fwd |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3934 no-revisit t)))) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3935 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3936 (setq show-window (selected-window) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3937 show-buffer (current-buffer)) |
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 (unless match |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
3940 (select-window toc-window) |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3941 (error "Cannot find location")) |
18050 | 3942 |
3943 (select-window toc-window) | |
3944 | |
3945 ;; use the `final' parameter to decide what to do next | |
3946 (cond | |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3947 ((eq final t) |
18050 | 3948 (reftex-unhighlight 0) |
3949 (select-window show-window)) | |
3950 ((eq final 'hide) | |
3951 (reftex-unhighlight 0) | |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3952 (or (one-window-p) (delete-window)) |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3953 (switch-to-buffer show-buffer) |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
3954 (reftex-re-enlarge)) |
18050 | 3955 (t nil)))) |
3956 | |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3957 (defun reftex-toc-find-section (toc &optional no-revisit) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3958 (let* ((file (nth 3 toc)) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3959 (marker (nth 4 toc)) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3960 (level (nth 5 toc)) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3961 (literal (nth 7 toc)) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3962 (emergency-point (nth 8 toc)) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3963 (match |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3964 (cond |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3965 ((and (markerp marker) (marker-buffer marker)) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3966 ;; Buffer is still live and we have the marker. Should be easy. |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3967 (switch-to-buffer-other-window (marker-buffer marker)) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3968 (goto-char (marker-position marker)) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3969 (or (looking-at (regexp-quote literal)) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3970 (looking-at (reftex-make-regexp-allow-for-ctrl-m literal)) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3971 (looking-at (reftex-make-desperate-section-regexp literal)) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3972 (looking-at (concat "\\\\" |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3973 (regexp-quote |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3974 (car |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3975 (rassq level |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3976 reftex-section-levels-all))) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3977 "[[{]")))) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3978 ((or (not no-revisit) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3979 (reftex-get-buffer-visiting file)) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3980 ;; Marker is lost. Use the backup method. |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3981 (switch-to-buffer-other-window |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3982 (reftex-get-file-buffer-force file nil)) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3983 (goto-char (or emergency-point (point-min))) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3984 (or (looking-at (regexp-quote literal)) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3985 (let ((pos (point))) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3986 (re-search-backward "\\`\\|[\r\n][ \t]*[\r\n]" nil t) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3987 (or (reftex-nearest-match (regexp-quote literal) pos) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3988 (reftex-nearest-match |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3989 (reftex-make-regexp-allow-for-ctrl-m literal) pos) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3990 (reftex-nearest-match |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3991 (reftex-make-desperate-section-regexp literal) pos))))) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3992 (t (message reftex-no-follow-message) nil)))) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3993 (when match |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3994 (goto-char (match-beginning 0)) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3995 (if (not (= (point) (point-max))) (recenter 1)) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3996 (reftex-highlight 0 (match-beginning 0) (match-end 0) (current-buffer))) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3997 match)) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
3998 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
3999 (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
|
4000 ;; 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
|
4001 ;; 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
|
4002 (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
|
4003 (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
|
4004 (old (substring old n))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4005 (while (string-match |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4006 "\\([\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
|
4007 old) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4008 (if (match-beginning 1) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4009 (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
|
4010 (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
|
4011 (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
|
4012 new)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4013 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4014 ;;; ========================================================================= |
18050 | 4015 ;;; |
4016 ;;; BibTeX citations. | |
4017 | |
4018 ;; Variables and constants | |
4019 | |
4020 ;; The history list of regular expressions used for citations | |
4021 (defvar reftex-cite-regexp-hist nil) | |
4022 | |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4023 ;; 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
|
4024 (defconst reftex-citation-prompt |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4025 "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
|
4026 |
18050 | 4027 (defconst reftex-citation-help |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4028 " 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
|
4029 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
|
4030 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
|
4031 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
|
4032 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
|
4033 . Show insertion point. |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4034 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
|
4035 TAB Enter citation key with completion. |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4036 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
|
4037 a / A Put all entries into single \cite / into many cite commands.") |
18050 | 4038 |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4039 (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
|
4040 "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
|
4041 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
|
4042 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
|
4043 |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4044 (defun reftex-select-bib-mode () |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4045 "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
|
4046 This buffer was created with RefTeX. |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4047 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
|
4048 selection process. |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4049 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
|
4050 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
|
4051 |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4052 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
|
4053 |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4054 \\{reftex-select-label-map}" |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4055 (interactive) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4056 (kill-all-local-variables) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4057 (make-local-hook 'pre-command-hook) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4058 (make-local-hook 'post-command-hook) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4059 (setq major-mode 'reftex-select-bib-mode |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4060 mode-name "RefTeX Select Bib") |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4061 ;; 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
|
4062 (run-hooks 'reftex-select-bib-mode-hook)) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4063 |
18050 | 4064 ;; Find bibtex files |
4065 | |
4066 (defun reftex-get-bibfile-list () | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4067 ;; 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
|
4068 ;; 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
|
4069 ;; 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
|
4070 ;; 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
|
4071 ;; Then this function will return the applicable database files. |
18050 | 4072 |
4073 ;; Ensure access to scanning info | |
4074 (reftex-access-scan-info) | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4075 (or |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4076 ;; 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
|
4077 (cdr (reftex-last-assoc-before-elt |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4078 'bib (list 'eof (buffer-file-name)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4079 (member (list 'bof (buffer-file-name)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4080 (symbol-value reftex-docstruct-symbol)))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4081 ;; 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
|
4082 (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
|
4083 (symbol-value reftex-docstruct-symbol)))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4084 ;; Anywhere in the entire document |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4085 (cdr (assq 'bib (symbol-value reftex-docstruct-symbol))) |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
4086 (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
|
4087 |
18050 | 4088 ;; Find a certain reference in any of the BibTeX files. |
4089 | |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4090 (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
|
4091 highlight item return) |
18050 | 4092 ;; 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
|
4093 ;; 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
|
4094 ;; 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
|
4095 ;; If ITEM in non-nil, search for bibitem instead of database entry. |
23200
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
4096 ;; If RETURN is non-nil, just return the entry. |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4097 |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4098 (let* ((re |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4099 (if item |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4100 (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
|
4101 (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
|
4102 "[, \t\r\n}]"))) |
18050 | 4103 (window-conf (current-window-configuration)) |
4104 file buf) | |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4105 |
18050 | 4106 (catch 'exit |
4107 (switch-to-buffer-other-window (current-buffer)) | |
4108 (while file-list | |
4109 (setq file (car file-list) | |
4110 file-list (cdr file-list)) | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4111 (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
|
4112 (error "No such file %s" file)) |
18050 | 4113 (switch-to-buffer buf) |
4114 (widen) | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4115 (goto-char (point-min)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4116 (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
|
4117 (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
|
4118 (when return |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4119 ;; Just return the relevant entry |
23200
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
4120 (if item (goto-char (match-end 0))) |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
4121 (setq return (buffer-substring |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
4122 (point) (reftex-end-of-bib-entry item))) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4123 (set-window-configuration window-conf) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4124 (throw 'exit return)) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4125 (recenter 0) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4126 (if highlight |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4127 (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
|
4128 (throw 'exit (selected-window)))) |
18050 | 4129 (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
|
4130 (if item |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4131 (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
|
4132 (error "No BibTeX entry with citation key %s" key))))) |
18050 | 4133 |
23200
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
4134 (defun reftex-end-of-bib-entry (item) |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
4135 (save-excursion |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
4136 (condition-case nil |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
4137 (if item |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
4138 (progn (end-of-line) |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
4139 (re-search-forward |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
4140 "\\\\bibitem\\|\\end{thebibliography}") |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
4141 (1- (match-beginning 0))) |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
4142 (progn (forward-list 1) (point))) |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
4143 (error (min (point-max) (+ 300 (point))))))) |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
4144 |
18050 | 4145 ;; Parse bibtex buffers |
4146 | |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4147 (defun reftex-extract-bib-entries (buffers) |
18050 | 4148 ;; Extract bib entries which match regexps from BUFFERS. |
4149 ;; BUFFERS is a list of buffers or file names. | |
4150 ;; Return list with entries." | |
4151 (let* (re-list first-re rest-re | |
4152 (buffer-list (if (listp buffers) buffers (list buffers))) | |
4153 found-list entry buffer1 buffer alist | |
4154 key-point start-point end-point) | |
4155 | |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4156 ;; 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
|
4157 (setq re-list |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4158 (split-string |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4159 (completing-read |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4160 "RegExp [ && RegExp...]: " |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
4161 (if reftex-mode |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
4162 (if (fboundp 'LaTeX-bibitem-list) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
4163 (LaTeX-bibitem-list) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
4164 (cdr (assoc 'bibview-cache |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
4165 (symbol-value reftex-docstruct-symbol)))) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
4166 nil) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4167 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
|
4168 "[ \t]*&&[ \t]*")) |
18050 | 4169 |
4170 (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
|
4171 rest-re (cdr re-list)) ; the others to narrow down. |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
4172 (if (string-match "\\`[ \t]*\\'" (or first-re "")) |
18050 | 4173 (error "Empty regular expression")) |
4174 | |
4175 (save-excursion | |
4176 (save-window-excursion | |
4177 | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4178 ;; Walk through all bibtex files |
18050 | 4179 (while buffer-list |
4180 (setq buffer (car buffer-list) | |
4181 buffer-list (cdr buffer-list)) | |
4182 (if (and (bufferp buffer) | |
4183 (buffer-live-p buffer)) | |
4184 (setq buffer1 buffer) | |
4185 (setq buffer1 (reftex-get-file-buffer-force | |
4186 buffer (not reftex-keep-temporary-buffers)))) | |
4187 (if (not buffer1) | |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
4188 (message "No such BibTeX file %s (ignored)" buffer) |
18050 | 4189 (message "Scanning bibliography database %s" buffer1)) |
4190 | |
4191 (set-buffer buffer1) | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4192 (save-excursion |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4193 (goto-char (point-min)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4194 (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
|
4195 (catch 'search-again |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4196 (setq key-point (point)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4197 (unless (re-search-backward |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4198 "\\(\\`\\|[\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
|
4199 (throw 'search-again nil)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4200 (setq start-point (point)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4201 (goto-char (match-end 0)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4202 (condition-case nil |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4203 (up-list 1) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4204 (error (goto-char key-point) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4205 (throw 'search-again nil))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4206 (setq end-point (point)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4207 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4208 ;; 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
|
4209 ;; outside entries |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4210 (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
|
4211 (string= (downcase (match-string 2)) "comment") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4212 (string= (downcase (match-string 2)) "c") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4213 (< (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
|
4214 (goto-char key-point) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4215 (throw 'search-again nil)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4216 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4217 ;; Well, we have got a match |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4218 (setq entry (concat |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4219 (buffer-substring start-point (point)) "\n")) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4220 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4221 ;; 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
|
4222 (setq re-list rest-re) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4223 (while re-list |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4224 (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
|
4225 ;; nope - move on |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4226 (throw 'search-again nil)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4227 (pop re-list)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4228 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4229 (setq alist (reftex-parse-bibtex-entry |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4230 nil start-point end-point)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4231 (push (cons "&entry" entry) alist) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4232 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4233 ;; check for crossref entries |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4234 (if (assoc "crossref" alist) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4235 (setq alist |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4236 (append |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4237 alist (reftex-get-crossref-alist alist)))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4238 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4239 ;; format the entry |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4240 (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
|
4241 alist) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4242 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4243 ;; make key the first element |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4244 (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
|
4245 |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4246 ;; add it to the list |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4247 (push alist found-list)))) |
18050 | 4248 (reftex-kill-temporary-buffers)))) |
4249 (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
|
4250 |
18050 | 4251 ;; Sorting |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4252 (cond |
18050 | 4253 ((eq 'author reftex-sort-bibtex-matches) |
4254 (sort found-list 'reftex-bib-sort-author)) | |
4255 ((eq 'year reftex-sort-bibtex-matches) | |
4256 (sort found-list 'reftex-bib-sort-year)) | |
4257 ((eq 'reverse-year reftex-sort-bibtex-matches) | |
4258 (sort found-list 'reftex-bib-sort-year-reverse)) | |
4259 (t found-list)))) | |
4260 | |
4261 (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
|
4262 (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
|
4263 (al2 (reftex-get-bib-names "author" e2))) |
18050 | 4264 (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
|
4265 (pop al1) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4266 (pop al2)) |
18050 | 4267 (if (and (stringp (car al1)) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4268 (stringp (car al2))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4269 (string< (car al1) (car al2)) |
18050 | 4270 (not (stringp (car al1)))))) |
4271 | |
4272 (defun reftex-bib-sort-year (e1 e2) | |
4273 (< (string-to-int (cdr (assoc "year" e1))) | |
4274 (string-to-int (cdr (assoc "year" e2))))) | |
4275 | |
4276 (defun reftex-bib-sort-year-reverse (e1 e2) | |
4277 (> (string-to-int (or (cdr (assoc "year" e1)) "0")) | |
4278 (string-to-int (or (cdr (assoc "year" e2)) "0")))) | |
4279 | |
4280 (defun reftex-get-crossref-alist (entry) | |
4281 ;; return the alist from a crossref entry | |
4282 (let ((crkey (cdr (assoc "crossref" entry))) | |
4283 start) | |
4284 (save-excursion | |
4285 (save-restriction | |
4286 (widen) | |
4287 (if (re-search-forward | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4288 (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
|
4289 "[ \t\n\r]*,") nil t) |
18050 | 4290 (progn |
4291 (setq start (match-beginning 0)) | |
4292 (condition-case nil | |
4293 (up-list 1) | |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4294 (error nil)) |
18050 | 4295 (reftex-parse-bibtex-entry nil start (point))) |
4296 nil))))) | |
4297 | |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4298 ;; Parse the thebibliography environment |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4299 (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
|
4300 ;; 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
|
4301 ;; 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
|
4302 ;; 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
|
4303 |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4304 (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
|
4305 (unless file |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4306 (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
|
4307 (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
|
4308 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
|
4309 (unless buf |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4310 (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
|
4311 (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
|
4312 |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4313 (save-excursion |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4314 (set-buffer buf) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4315 (save-restriction |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4316 (widen) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4317 (goto-char (point-min)) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4318 (if (re-search-forward |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4319 "\\(\\`\\|[\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
|
4320 (progn |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4321 (beginning-of-line 2) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4322 (setq start (point)))) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4323 (if (re-search-forward |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4324 "\\(\\`\\|[\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
|
4325 (progn |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4326 (beginning-of-line 1) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4327 (setq end (point)))) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4328 (when (and start end) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4329 (setq entries |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4330 (mapcar 'reftex-parse-bibitem |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4331 (delete "" |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4332 (split-string |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4333 (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
|
4334 "[ \t\n\r]*\\\\bibitem\\(\\[[^]]*]\\)*"))))))) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4335 (unless entries |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4336 (error "No bibitems found")) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4337 |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4338 (setq re-list (split-string |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4339 (read-string "RegExp [ && RegExp...]: " |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4340 nil 'reftex-cite-regexp-hist) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4341 "[ \t]*&&[ \t]*")) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4342 (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
|
4343 (error "Empty regular expression")) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4344 |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4345 (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
|
4346 (setq entries |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4347 (delq nil (mapcar |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4348 (function |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4349 (lambda (x) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4350 (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
|
4351 x nil))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4352 entries)))) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4353 (setq entries |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4354 (mapcar |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4355 (lambda (x) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4356 (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
|
4357 (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
|
4358 x) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4359 entries)) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4360 |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4361 entries)) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4362 |
18050 | 4363 ;; Parse and format individual entries |
4364 | |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4365 (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
|
4366 ;; 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
|
4367 (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
|
4368 (if (equal "" names) |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4369 (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
|
4370 (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
|
4371 (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
|
4372 (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
|
4373 (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
|
4374 (while (string-match "^[ \t]+\\|[ \t]+$" names) |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4375 (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
|
4376 (while (string-match "[ \t][ \t]+" names) |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4377 (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
|
4378 (split-string names "\n"))) |
18050 | 4379 |
4380 (defun reftex-parse-bibtex-entry (entry &optional from to) | |
4381 (let (alist key start field) | |
4382 (save-excursion | |
4383 (save-restriction | |
4384 (if entry | |
4385 (progn | |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4386 (set-buffer (get-buffer-create " *RefTeX-scratch*")) |
18050 | 4387 (fundamental-mode) |
4388 (erase-buffer) | |
4389 (insert entry)) | |
4390 (widen) | |
4391 (narrow-to-region from to)) | |
4392 (goto-char (point-min)) | |
4393 | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4394 (if (re-search-forward |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
4395 "@\\(\\w+\\)[ \t\n\r]*[{(][ \t\n\r]*\\([^ \t\n\r,]+\\)" nil t) |
18050 | 4396 (setq alist |
4397 (list | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4398 (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
|
4399 (cons "&key" (reftex-match-string 2))))) |
18050 | 4400 (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
|
4401 (setq key (downcase (reftex-match-string 1))) |
18050 | 4402 (cond |
4403 ((= (following-char) ?{) | |
4404 (forward-char 1) | |
4405 (setq start (point)) | |
4406 (condition-case nil | |
4407 (up-list 1) | |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4408 (error nil))) |
18050 | 4409 ((= (following-char) ?\") |
4410 (forward-char 1) | |
4411 (setq start (point)) | |
4412 (while (and (search-forward "\"" nil t) | |
4413 (= ?\\ (char-after (- (point) 2)))))) | |
4414 (t | |
4415 (setq start (point)) | |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4416 (re-search-forward "[ \t]*[\n\r,}]" nil 1))) |
18050 | 4417 (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
|
4418 ;; remove extra whitespace |
18050 | 4419 (while (string-match "[\n\t\r]\\|[ \t][ \t]+" field) |
4420 (setq field (replace-match " " nil t field))) | |
4421 ;; remove leading garbage | |
4422 (if (string-match "^[ \t{]+" field) | |
4423 (setq field (replace-match "" nil t field))) | |
4424 ;; remove trailing garbage | |
4425 (if (string-match "[ \t}]+$" field) | |
4426 (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
|
4427 (push (cons key field) alist)))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4428 alist)) |
18050 | 4429 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4430 (defun reftex-get-bib-field (fieldname entry &optional format) |
18050 | 4431 ;; 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
|
4432 (let ((cell (assoc fieldname entry))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4433 (if cell |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4434 (if format |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4435 (format format (cdr cell)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4436 (cdr cell)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4437 ""))) |
18050 | 4438 |
4439 (defun reftex-format-bib-entry (entry) | |
4440 ;; Format a BibTeX ENTRY so that it is nice to look at | |
4441 (let* | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4442 ((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
|
4443 (authors (mapconcat 'identity auth-list ", ")) |
18050 | 4444 (year (reftex-get-bib-field "year" entry)) |
4445 (title (reftex-get-bib-field "title" entry)) | |
4446 (type (reftex-get-bib-field "&type" entry)) | |
4447 (key (reftex-get-bib-field "&key" entry)) | |
4448 (extra | |
4449 (cond | |
4450 ((equal type "article") | |
4451 (concat (reftex-get-bib-field "journal" entry) " " | |
4452 (reftex-get-bib-field "volume" entry) ", " | |
4453 (reftex-get-bib-field "pages" entry))) | |
4454 ((equal type "book") | |
4455 (concat "book (" (reftex-get-bib-field "publisher" entry) ")")) | |
4456 ((equal type "phdthesis") | |
4457 (concat "PhD: " (reftex-get-bib-field "school" entry))) | |
4458 ((equal type "mastersthesis") | |
4459 (concat "Master: " (reftex-get-bib-field "school" entry))) | |
4460 ((equal type "inbook") | |
4461 (concat "Chap: " (reftex-get-bib-field "chapter" entry) | |
4462 ", pp. " (reftex-get-bib-field "pages" entry))) | |
4463 ((or (equal type "conference") | |
4464 (equal type "incollection") | |
4465 (equal type "inproceedings")) | |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4466 (reftex-get-bib-field "booktitle" entry "in: %s")) |
18050 | 4467 (t "")))) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4468 (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
|
4469 (when (reftex-use-fonts) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4470 (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
|
4471 (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
|
4472 'font-lock-constant-face |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4473 'font-lock-reference-face) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4474 key) |
21114
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
4475 (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
|
4476 authors) |
21114
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
4477 (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
|
4478 year) |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
4479 (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
|
4480 title) |
21114
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
4481 (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
|
4482 extra)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4483 (concat key "\n " authors " " year " " extra "\n " title "\n\n"))) |
18050 | 4484 |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4485 (defun reftex-parse-bibitem (item) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4486 ;; Parse a \bibitem entry |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4487 (let ((key "") (text "")) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4488 (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
|
4489 (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
|
4490 text (match-string 2 item))) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4491 ;; 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
|
4492 (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
|
4493 (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
|
4494 (if (string-match "\\`[ \t]+" text) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4495 (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
|
4496 (list |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4497 (cons "&key" key) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4498 (cons "&text" text) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4499 (cons "&entry" (concat key " " text))))) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4500 |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4501 (defun reftex-format-bibitem (item) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4502 ;; 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
|
4503 (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
|
4504 (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
|
4505 (lines nil)) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4506 |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4507 ;; 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
|
4508 (while (and (> (length text) 70) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4509 (string-match " " (substring text 60))) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4510 (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
|
4511 (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
|
4512 (push text lines) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4513 (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
|
4514 |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4515 (when (reftex-use-fonts) |
21114
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
4516 (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
|
4517 (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
|
4518 |
18050 | 4519 ;; Make a citation |
4520 | |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4521 ;;;###autoload |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4522 (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
|
4523 "Make a citation using BibTeX database files. |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
4524 After prompting for a regular expression, scans the buffers with |
18050 | 4525 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
|
4526 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
|
4527 to `reftex-cite-format' and inserted into the buffer. |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
4528 |
18050 | 4529 If NO-INSERT is non-nil, nothing is inserted, only the selected key returned. |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
4530 |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
4531 When called with one or two `C-u' prefixes, first rescans the document. |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
4532 When called with a numeric prefix, make that many citations. When |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
4533 called with point inside the braces of a `\cite' command, it will |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
4534 add another key, ignoring the value of `reftex-cite-format'. |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
4535 |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
4536 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
|
4537 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
|
4538 While entering the regexp, completion on knows citation keys is possible. |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
4539 `=' is a good regular expression to match all entries in all files." |
18050 | 4540 |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4541 (interactive) |
18050 | 4542 |
4543 ;; check for recursive edit | |
4544 (reftex-check-recursive-edit) | |
4545 | |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4546 ;; 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
|
4547 ;; 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
|
4548 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4549 (when reftex-mode |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4550 (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
|
4551 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4552 ;; Call reftex-do-citation, but protected |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4553 (unwind-protect |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4554 (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
|
4555 (reftex-kill-temporary-buffers))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4556 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4557 (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
|
4558 ;; 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
|
4559 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4560 (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
|
4561 (docstruct-symbol reftex-docstruct-symbol) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4562 (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
|
4563 (insert-entries selected-entries) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4564 entry string cite-view) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4565 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4566 (unless selected-entries (error "Quit")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4567 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4568 (if (stringp selected-entries) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4569 ;; Nonexistent entry |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4570 (setq selected-entries nil |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4571 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
|
4572 (cons "&key" selected-entries)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4573 ;; 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
|
4574 (setq cite-view t)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4575 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4576 (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
|
4577 ;; 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
|
4578 (pop selected-entries) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4579 (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
|
4580 (setq insert-entries |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4581 (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
|
4582 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4583 (unless no-insert |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4584 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4585 ;; 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
|
4586 (message "Formatting...") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4587 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4588 (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
|
4589 ;; 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
|
4590 (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
|
4591 (funcall reftex-format-cite-function |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4592 (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
|
4593 format) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4594 (reftex-format-citation entry format))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4595 (insert string)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4596 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4597 ;; Reposition cursor? |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4598 (when (string-match "\\?" string) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4599 (search-backward "?") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4600 (delete-char 1)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4601 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4602 ;; Tell AUCTeX |
23200
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
4603 (when (and reftex-mode |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
4604 (fboundp 'LaTeX-add-bibitems) |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
4605 reftex-plug-into-AUCTeX) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4606 (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
|
4607 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4608 ;; Produce the cite-view strings |
23200
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
4609 (when (and reftex-mode reftex-cache-cite-echo cite-view) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4610 (mapcar (lambda (entry) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4611 (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
|
4612 selected-entries)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4613 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4614 (message "")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4615 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4616 (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
|
4617 (reftex-kill-buffer "*RefTeX Select*") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4618 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4619 ;; 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
|
4620 (when (integerp arg) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4621 (if (> arg 1) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4622 (progn |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4623 (skip-chars-backward "}") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4624 (decf arg) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4625 (reftex-do-citation arg)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4626 (forward-char 1))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4627 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4628 ;; Return the citation key |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4629 (car (car selected-entries)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4630 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4631 (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
|
4632 ;; Check if there is already a cite command at point and change cite format |
18050 | 4633 ;; 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
|
4634 (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
|
4635 (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
|
4636 key format) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4637 (cond |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4638 (no-insert |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4639 ;; 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
|
4640 (setq format "%l")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4641 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4642 ((and (stringp macro) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4643 (string-match "\\`\\\\cite\\|cite\\'" macro)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4644 ;; 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
|
4645 (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
|
4646 (setq format |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4647 (concat |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4648 (if (member (preceding-char) '(?\{ ?,)) "" ",") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4649 "%l" |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4650 (if (member (following-char) '(?\} ?,)) "" ","))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4651 (setq format "%l"))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4652 (t |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4653 ;; Figure out the correct format |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4654 (setq format |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4655 (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
|
4656 (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
|
4657 (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
|
4658 cite-format-value)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4659 (when (listp format) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4660 (setq key |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4661 (reftex-select-with-char |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4662 "" (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
|
4663 (mapconcat |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4664 (lambda (x) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4665 (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
|
4666 (if (> (car x) 31) " " "") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4667 (cdr x))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4668 format "\n")))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4669 (if (assq key format) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4670 (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
|
4671 (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
|
4672 format)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4673 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4674 (defun reftex-get-cite-format () |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4675 ;; 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
|
4676 ;; 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
|
4677 (if (and reftex-docstruct-symbol |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4678 (symbolp reftex-docstruct-symbol) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4679 (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
|
4680 (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
|
4681 reftex-cite-format)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4682 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4683 (defun reftex-offer-bib-menu () |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4684 ;; 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
|
4685 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4686 (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
|
4687 (while |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4688 (not |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4689 (catch 'done |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4690 ;; Scan bibtex files |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4691 (setq found-list |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4692 (cond |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4693 ((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
|
4694 ;; using BibTeX database files. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4695 (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
|
4696 ((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
|
4697 ;; using thebibliography environment. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4698 (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
|
4699 (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
|
4700 (reftex-default-bibliography |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4701 (message "Using default bibliography") |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
4702 (reftex-extract-bib-entries (reftex-default-bibliography))) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4703 (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
|
4704 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4705 (unless found-list |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4706 (error "Sorry, no matches found")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4707 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4708 ;; Remember where we came from |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4709 (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
|
4710 (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
|
4711 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4712 ;; Offer selection |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4713 (save-window-excursion |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4714 (delete-other-windows) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4715 (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
|
4716 (reftex-kill-buffer "*RefTeX Select*") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4717 (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
|
4718 (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
|
4719 (reftex-select-bib-mode)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4720 (let ((buffer-read-only nil)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4721 (erase-buffer) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4722 (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
|
4723 (setq buffer-read-only t) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4724 (if (= 0 (buffer-size)) |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
4725 (error "No matches found")) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4726 (setq truncate-lines t) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4727 (goto-char 1) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4728 (while t |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4729 (setq rtn |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4730 (reftex-select-item |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4731 reftex-citation-prompt |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4732 reftex-citation-help |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4733 reftex-select-bib-map |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4734 nil |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4735 'reftex-bibtex-selection-callback nil)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4736 (setq key (car rtn) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4737 data (nth 1 rtn)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4738 (unless key (throw 'done t)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4739 (cond |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4740 ((eq key ?g) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4741 ;; Start over |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4742 (throw 'done nil)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4743 ((eq key ?r) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4744 ;; Restrict with new regular expression |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4745 (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
|
4746 (let ((buffer-read-only nil)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4747 (erase-buffer) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4748 (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
|
4749 (goto-char 1)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4750 ((eq key ?A) |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
4751 (debug) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4752 ;; Take all |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4753 (setq selected-entries found-list) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4754 (throw 'done t)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4755 ((eq key ?a) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4756 ;; Take all |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4757 (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
|
4758 (throw 'done t)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4759 ((or (eq key ?\C-m) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4760 (eq key 'return)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4761 ;; Take selected |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4762 (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
|
4763 (throw 'done t)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4764 ((stringp key) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4765 ;; Got this one with completion |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4766 (setq selected-entries key) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4767 (throw 'done t)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4768 (t |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4769 (ding)))))))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4770 selected-entries)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4771 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4772 (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
|
4773 ;; 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
|
4774 (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
|
4775 "RegExp [ && RegExp...]: " |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4776 nil 'reftex-cite-regexp-hist) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4777 "[ \t]*&&[ \t]*")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4778 (found-list-r found-list) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4779 re) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4780 (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
|
4781 (setq found-list-r |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4782 (delq nil |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4783 (mapcar |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4784 (lambda (x) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4785 (if (string-match |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4786 re (cdr (assoc "&entry" x))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4787 x |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4788 nil)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4789 found-list-r)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4790 (if found-list-r |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4791 found-list-r |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4792 (ding) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4793 found-list))) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4794 |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4795 (defun reftex-insert-bib-matches (list) |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4796 ;; 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
|
4797 (let ((mouse-face |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
4798 (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
|
4799 reftex-mouse-selected-face |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
4800 nil)) |
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
4801 tmp len) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4802 (mapcar |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4803 (function |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4804 (lambda (x) |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4805 (setq tmp (cdr (assoc "&formatted" x)) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4806 len (length tmp)) |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
4807 (put-text-property 0 len :data x tmp) |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4808 (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
|
4809 (insert tmp))) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4810 list)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4811 (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
|
4812 |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4813 (defun reftex-format-names (namelist n) |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4814 (let (last (len (length namelist))) |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4815 (cond |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4816 ((< len 1) "") |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4817 ((= 1 len) (car namelist)) |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4818 ((> 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
|
4819 (t |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4820 (setq n (min len n) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4821 last (nth (1- n) namelist)) |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4822 (setcdr (nthcdr (- n 2) namelist) nil) |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4823 (concat |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4824 (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
|
4825 (nth 1 reftex-cite-punctuation) |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4826 last))))) |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4827 |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4828 (defun reftex-format-citation (entry format) |
18050 | 4829 ;; 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
|
4830 |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4831 (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
|
4832 |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4833 (if (and reftex-comment-citations |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4834 (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
|
4835 (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
|
4836 |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4837 (while (string-match |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4838 "\\(\\`\\|[^%]\\)\\(\\(%\\([0-9]*\\)\\([a-zA-Z]\\)\\)[.,;: ]*\\)" |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4839 format) |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4840 (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
|
4841 (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
|
4842 rpl b e) |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4843 (save-match-data |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4844 (setq rpl |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4845 (cond |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4846 ((= l ?l) (concat |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4847 (reftex-get-bib-field "&key" entry) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4848 (if reftex-comment-citations |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4849 reftex-cite-comment-format |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4850 ""))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4851 ((= l ?a) (reftex-format-names |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4852 (reftex-get-bib-names "author" entry) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4853 (or n 2))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4854 ((= 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
|
4855 ((= 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
|
4856 ((= l ?B) (reftex-abbreviate-title |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4857 (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
|
4858 ((= 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
|
4859 ((= 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
|
4860 ((= l ?e) (reftex-format-names |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4861 (reftex-get-bib-names "editor" entry) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4862 (or n 2))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4863 ((= 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
|
4864 ((= 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
|
4865 ((= 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
|
4866 ((= 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
|
4867 ((= 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
|
4868 ((= 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
|
4869 ((= 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
|
4870 ((= 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
|
4871 ((= 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
|
4872 ((= l ?P) (car (split-string |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4873 (reftex-get-bib-field "pages" entry) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4874 "[- .]+"))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4875 ((= 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
|
4876 ((= 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
|
4877 ((= 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
|
4878 ((= 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
|
4879 ((= l ?T) (reftex-abbreviate-title |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4880 (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
|
4881 ((= 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
|
4882 ((= 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
|
4883 |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4884 (if (string= rpl "") |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
4885 (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
|
4886 (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
|
4887 (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
|
4888 (while (string-match "%%" format) |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4889 (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
|
4890 (while (string-match "[ ,.;:]*%<" format) |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4891 (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
|
4892 format) |
18050 | 4893 |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4894 (defun reftex-bibtex-selection-callback (data ignore no-revisit) |
18050 | 4895 ;; 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
|
4896 ;; 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
|
4897 ;; recommended for follow mode. It works OK for individual lookups. |
18050 | 4898 (let ((win (selected-window)) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4899 (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
|
4900 bibfile-list item tmp) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4901 |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4902 (catch 'exit |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4903 (save-excursion |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4904 (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
|
4905 (cond |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4906 ((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
|
4907 (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
|
4908 ((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
|
4909 (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
|
4910 item t)) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4911 (reftex-default-bibliography |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
4912 (setq bibfile-list (reftex-default-bibliography))) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4913 (t (ding) (throw 'exit)))) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4914 |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4915 (when no-revisit |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4916 (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
|
4917 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4918 (condition-case nil |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4919 (reftex-pop-to-bibtex-entry |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4920 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
|
4921 (error (ding)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4922 |
18050 | 4923 (select-window win))) |
4924 | |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
4925 ;;; ========================================================================= |
18050 | 4926 ;;; |
4927 ;;; Here is the routine used for selection | |
4928 | |
4929 ;; Marker for return point from recursive edit | |
4930 (defvar reftex-recursive-edit-marker (make-marker)) | |
4931 | |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4932 (defvar reftex-last-data nil) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4933 (defvar reftex-last-line nil) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4934 |
18050 | 4935 (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
|
4936 ;; Check if we are already in a recursive edit. Abort with helpful |
18050 | 4937 ;; message if so. |
4938 (if (marker-position reftex-recursive-edit-marker) | |
4939 (error | |
4940 (substitute-command-keys | |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
4941 "In unfinished selection process. Finish, or abort with \\[abort-recursive-edit]")))) |
18050 | 4942 |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4943 (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
|
4944 &optional offset |
21115
fea2f6a2818d
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21114
diff
changeset
|
4945 call-back cb-flag) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4946 ;; 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
|
4947 ;; 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
|
4948 ;; selected. |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4949 ;; 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
|
4950 ;; selection commands. |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4951 ;; 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
|
4952 ;; 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
|
4953 ;; 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
|
4954 ;; 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
|
4955 ;; of the element. |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4956 ;; 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
|
4957 |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
4958 (let* (ev data last-data (selection-buffer (current-buffer))) |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
4959 |
18050 | 4960 (setq ev |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4961 (catch 'myexit |
18050 | 4962 (save-window-excursion |
4963 (setq truncate-lines t) | |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4964 |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4965 ;; Find a good starting point |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
4966 (reftex-find-start-point |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
4967 (point-min) offset reftex-last-data reftex-last-line) |
18050 | 4968 (beginning-of-line 1) |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4969 (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
|
4970 |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4971 (unwind-protect |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4972 (progn |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4973 (use-local-map keymap) |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4974 (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
|
4975 (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
|
4976 (princ prompt) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4977 (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
|
4978 ;; XEmacs does not run post-command-hook here |
23200
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
4979 (and (featurep 'xemacs) (run-hooks 'post-command-hook)) |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4980 (recursive-edit)) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
4981 |
21075
0c95fb73e090
1998-03-06 Carsten Dominik <cd@delysid.gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21002
diff
changeset
|
4982 (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
|
4983 (save-excursion |
0c95fb73e090
1998-03-06 Carsten Dominik <cd@delysid.gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21002
diff
changeset
|
4984 (set-buffer selection-buffer) |
0c95fb73e090
1998-03-06 Carsten Dominik <cd@delysid.gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21002
diff
changeset
|
4985 (use-local-map nil) |
0c95fb73e090
1998-03-06 Carsten Dominik <cd@delysid.gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21002
diff
changeset
|
4986 (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
|
4987 (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
|
4988 '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
|
4989 |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4990 (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
|
4991 (+ (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
|
4992 (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
|
4993 (reftex-kill-buffer "*RefTeX Help*") |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
4994 (setq reftex-callback-fwd (not reftex-callback-fwd)) ;; ;-))) |
18050 | 4995 (message "") |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4996 (list ev data last-data))) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4997 |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
4998 ;; 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
|
4999 ;; 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
|
5000 |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
5001 (defvar found-list) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
5002 (defvar cb-flag) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
5003 (defvar data) |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5004 (defvar prompt) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5005 (defvar last-data) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
5006 (defvar call-back) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
5007 (defvar help-string) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
5008 (defvar varioref) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
5009 |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
5010 ;; The selection commands |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
5011 |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5012 (defun reftex-select-pre-command-hook () |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5013 (reftex-unhighlight 1) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5014 (reftex-unhighlight 0)) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5015 |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5016 (defun reftex-select-post-command-hook () |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5017 (let (b e) |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5018 (setq data (get-text-property (point) :data)) |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5019 (setq last-data (or data last-data)) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5020 |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5021 (when (and data cb-flag |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5022 (not (equal reftex-last-follow-point (point)))) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5023 (setq reftex-last-follow-point (point)) |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5024 (funcall call-back data reftex-callback-fwd |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5025 (not reftex-revisit-to-follow))) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5026 (if data |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5027 (setq b (or (previous-single-property-change |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5028 (1+ (point)) :data) |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5029 (point-min)) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5030 e (or (next-single-property-change |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5031 (point) :data) |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5032 (point-max))) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5033 (setq b (point) e (point))) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5034 (and (memq reftex-highlight-selection '(cursor both)) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5035 (reftex-highlight 1 b e)) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5036 (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
|
5037 (not (pos-visible-in-window-p e))) |
23200
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5038 (recenter '(4))) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5039 (unless (current-message) |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5040 (princ prompt)))) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5041 |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5042 (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
|
5043 "Move to next selectable item." |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5044 (interactive "p") |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5045 (setq reftex-callback-fwd t) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
5046 (or (eobp) (forward-char 1)) |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5047 (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
|
5048 (beginning-of-line 1)) |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5049 (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
|
5050 "Move to previous selectable item." |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5051 (interactive "p") |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5052 (setq reftex-callback-fwd nil) |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5053 (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
|
5054 (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
|
5055 "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
|
5056 (interactive "p") |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
5057 (end-of-line) |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5058 (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
|
5059 (beginning-of-line)) |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5060 (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
|
5061 "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
|
5062 (interactive "p") |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5063 (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
|
5064 (defun reftex-select-quit () |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5065 "Abort selection process." |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
5066 (interactive) |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5067 (throw 'myexit nil)) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5068 (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
|
5069 "Abort selection process." |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5070 (interactive) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5071 (throw 'exit t)) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
5072 (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
|
5073 "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
|
5074 (interactive) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
5075 (let (pos) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
5076 (cond |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
5077 ((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
|
5078 reftex-last-data |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
5079 (setq pos (text-property-any (point-min) (point-max) |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5080 :data reftex-last-data))) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
5081 (goto-char pos)) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
5082 ((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
|
5083 (integerp reftex-last-line)) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
5084 (goto-line reftex-last-line)) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
5085 (t (ding))))) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
5086 (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
|
5087 "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
|
5088 (interactive) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5089 (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
|
5090 (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
|
5091 (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
|
5092 "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
|
5093 (interactive) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
5094 (if (string= varioref "\\ref") |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
5095 (setq varioref "\\vref") |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
5096 (setq varioref "\\ref")) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
5097 (force-mode-line-update)) |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5098 (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
|
5099 "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
|
5100 (interactive) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5101 (let ((this-window (selected-window))) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5102 (unwind-protect |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5103 (progn |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5104 (switch-to-buffer-other-window |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5105 (marker-buffer reftex-select-return-marker)) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5106 (goto-char (marker-position reftex-select-return-marker)) |
23200
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5107 (recenter '(4))) |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5108 (select-window this-window)))) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
5109 (defun reftex-select-callback () |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5110 "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
|
5111 (interactive) |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5112 (if data (funcall call-back data reftex-callback-fwd nil) (ding))) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
5113 (defun reftex-select-accept () |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5114 "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
|
5115 (interactive) |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5116 (throw 'myexit 'return)) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5117 (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
|
5118 "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
|
5119 (interactive "e") |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5120 (mouse-set-point ev) |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5121 (setq data (get-text-property (point) :data)) |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5122 (setq last-data (or data last-data)) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5123 (throw 'myexit 'return)) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
5124 (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
|
5125 "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
|
5126 (interactive) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
5127 (let ((label (completing-read |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
5128 "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
|
5129 nil nil reftex-prefix))) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
5130 (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
|
5131 (throw 'myexit label)))) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
5132 (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
|
5133 "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
|
5134 (interactive) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5135 (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
|
5136 (entry (assoc key found-list))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5137 (cond |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5138 ((or (null key) (equal key ""))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5139 (entry |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5140 (setq data entry) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5141 (setq last-data data) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5142 (throw 'myexit 'return)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5143 (t (throw 'myexit key))))) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
5144 (defun reftex-select-help () |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5145 "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
|
5146 (interactive) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
5147 (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
|
5148 (princ help-string)) |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5149 (reftex-enlarge-to-fit "*RefTeX Help*" t)) |
18050 | 5150 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5151 ;;; ========================================================================= |
18050 | 5152 ;;; |
5153 ;;; View cross references | |
5154 | |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5155 (defun reftex-view-crossref (&optional arg auto-how) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5156 "View cross reference of macro at point. Point must be on the KEY |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5157 argument. When at at `\ref' macro, show corresponding `\label' |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5158 definition, also in external documents (`xr'). When on a label, show |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5159 a locations where KEY is referenced. Subsequent calls find additional |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5160 locations. When on a `\cite', show the associated `\bibitem' macro or |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5161 the BibTeX database entry. When on a `\bibitem', show a `\cite' macro |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5162 which uses this KEY. When on an `\index', show other locations marked |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5163 by the same index entry. |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5164 To define additional cross referencing items, use the option |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5165 `reftex-view-crossref-extra'. See also `reftex-view-crossref-from-bibtex'. |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
5166 With one or two C-u prefixes, enforce rescanning of the document. |
23200
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5167 With argument 2, select the window showing the cross reference. |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5168 AUTO-HOW is only for the automatic crossref display and is handed through |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5169 to the functions `reftex-view-cr-cite' and `reftex-view-cr-ref'." |
18050 | 5170 |
5171 (interactive "P") | |
5172 ;; See where we are. | |
23200
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5173 (let* ((macro (car (reftex-what-macro 1))) |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5174 (key (reftex-this-word "^{}%\n\r,")) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5175 dw) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5176 |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5177 (if (or (null macro) (reftex-in-comment)) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5178 (error "Not on a crossref macro argument")) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5179 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5180 (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
|
5181 |
23200
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5182 (cond |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5183 ((string-match "\\`\\\\cite\\|cite\\*?\\'" macro) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5184 ;; A citation macro: search for bibitems or BibTeX entries |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5185 (setq dw (reftex-view-cr-cite arg key auto-how))) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5186 ((string-match "\\`\\\\ref\\|ref\\*?\\'" macro) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5187 ;; A reference macro: search for labels |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5188 (setq dw (reftex-view-cr-ref arg key auto-how))) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5189 (auto-how nil) ;; No further action for automatic display (speed) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5190 ((or (equal macro "\\label") |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5191 (member macro reftex-macros-with-labels)) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5192 ;; A label macro: search for reference macros |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5193 (reftex-access-scan-info arg) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5194 (setq dw (reftex-view-regexp-match |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5195 (format reftex-find-reference-format (regexp-quote key)) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5196 3 nil nil))) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5197 ((equal macro "\\bibitem") |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5198 ;; A bibitem macro: search for citations |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5199 (reftex-access-scan-info arg) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5200 (setq dw (reftex-view-regexp-match |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5201 (format reftex-find-citation-regexp-format (regexp-quote key)) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5202 3 nil nil))) |
23200
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5203 (t |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5204 (reftex-access-scan-info arg) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5205 (catch 'exit |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5206 (let ((list reftex-view-crossref-extra) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5207 entry mre action group) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5208 (while (setq entry (pop list)) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5209 (setq mre (car entry) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5210 action (nth 1 entry) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5211 group (nth 2 entry)) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5212 (when (string-match mre macro) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5213 (setq dw (reftex-view-regexp-match |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5214 (format action key) group nil nil)) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5215 (throw 'exit t)))) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5216 (error "Not on a crossref macro argument")))) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5217 (if (and (eq arg 2) (windowp dw)) (select-window dw)))) |
23200
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5218 |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5219 (defun reftex-view-cr-cite (arg key how) |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5220 ;; View crossreference of a ref cite. HOW can have the values |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5221 ;; nil: Show in another window. |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5222 ;; echo: Show one-line info in echo area. |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5223 ;; tmp-window: Show in small window and arrange for window to disappear. |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5224 |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5225 ;; Ensure access to scanning info |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5226 (reftex-access-scan-info (or arg current-prefix-arg)) |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5227 |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5228 (if (eq how 'tmp-window) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5229 ;; Remember the window configuration |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5230 (put 'reftex-auto-view-crossref 'last-window-conf |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5231 (current-window-configuration))) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5232 |
23200
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5233 (let (files size item (pos (point)) (win (selected-window)) pop-win) |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5234 ;; Find the citation mode and the file list |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5235 (cond |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5236 ((assq 'bib (symbol-value reftex-docstruct-symbol)) |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5237 (setq item nil |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5238 files (reftex-get-bibfile-list))) |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5239 ((assq 'thebib (symbol-value reftex-docstruct-symbol)) |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5240 (setq item t |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5241 files (list (cdr (assq 'thebib |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5242 (symbol-value reftex-docstruct-symbol)))))) |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5243 (reftex-default-bibliography |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5244 (setq item nil |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5245 files (reftex-default-bibliography))) |
23200
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5246 (how) ;; don't throw for special display |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5247 (t (error "Cannot display crossref"))) |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5248 |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5249 (if (eq how 'echo) |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5250 ;; Display in Echo area |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5251 (reftex-echo-cite key files item) |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5252 ;; Display in a window |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5253 (if (not (eq how 'tmp-window)) |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5254 ;; Normal display |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5255 (reftex-pop-to-bibtex-entry key files nil t item) |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5256 ;; A temporary window |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5257 (condition-case nil |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5258 (reftex-pop-to-bibtex-entry key files nil t item) |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5259 (error (goto-char pos) |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5260 (message "cite: no such citation key %s" key) |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5261 (error ""))) |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5262 ;; Resize the window |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5263 (setq size (max 1 (count-lines (point) |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5264 (reftex-end-of-bib-entry item)))) |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5265 (let ((window-min-height 2)) |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5266 (shrink-window (1- (- (window-height) size))) |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5267 (recenter 0)) |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5268 ;; Arrange restoration |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5269 (add-hook 'pre-command-hook 'reftex-restore-window-conf)) |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5270 |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5271 ;; Normal display in other window |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5272 (add-hook 'pre-command-hook 'reftex-highlight-shall-die) |
23200
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5273 (setq pop-win (selected-window)) |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5274 (select-window win) |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5275 (goto-char pos) |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5276 (when (equal arg 2) |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5277 (select-window pop-win))))) |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5278 |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5279 (defun reftex-view-cr-ref (arg label how) |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5280 ;; View crossreference of a ref macro. HOW can have the values |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5281 ;; nil: Show in another window. |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5282 ;; echo: Show one-line info in echo area. |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5283 ;; tmp-window: Show in small window and arrange for window to disappear. |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5284 |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5285 ;; Ensure access to scanning info |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5286 (reftex-access-scan-info (or arg current-prefix-arg)) |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5287 |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5288 (if (eq how 'tmp-window) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5289 ;; Remember the window configuration |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5290 (put 'reftex-auto-view-crossref 'last-window-conf |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5291 (current-window-configuration))) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5292 |
23200
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5293 (let* ((xr-data (assoc 'xr (symbol-value reftex-docstruct-symbol))) |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5294 (xr-re (nth 2 xr-data)) |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5295 (entry (assoc label (symbol-value reftex-docstruct-symbol))) |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5296 (win (selected-window)) pop-win (pos (point))) |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5297 |
23200
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5298 (if (and (not entry) (stringp label) xr-re (string-match xr-re label)) |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5299 ;; Label is defined in external document |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5300 (save-excursion |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5301 (save-match-data |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5302 (set-buffer |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5303 (or (reftex-get-file-buffer-force |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5304 (cdr (assoc (match-string 1 label) (nth 1 |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5305 xr-data)))) |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5306 (error "Problem with external label %s" label)))) |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5307 (setq label (substring label (match-end 1))) |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5308 (reftex-access-scan-info) |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5309 (setq entry |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5310 (assoc label (symbol-value reftex-docstruct-symbol))))) |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5311 (if (eq how 'echo) |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5312 ;; Display in echo area |
23200
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5313 (reftex-echo-ref label entry (symbol-value reftex-docstruct-symbol)) |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5314 (let ((window-conf (current-window-configuration))) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5315 (condition-case nil |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5316 (reftex-show-label-location entry t nil t t) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5317 (error (set-window-configuration window-conf) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5318 (message "ref: Label %s not found" label) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5319 (error "ref: Label %s not found" label)))) ;; 2nd is line OK |
23200
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5320 (add-hook 'pre-command-hook 'reftex-highlight-shall-die) |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5321 |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5322 (when (eq how 'tmp-window) |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5323 ;; Resize window and arrange restauration |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5324 (shrink-window (1- (- (window-height) 9))) |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5325 (recenter '(4)) |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5326 (add-hook 'pre-command-hook 'reftex-restore-window-conf)) |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5327 (setq pop-win (selected-window)) |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5328 (select-window win) |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5329 (goto-char pos) |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5330 (when (equal arg 2) |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5331 (select-window pop-win))))) |
18050 | 5332 |
5333 (defun reftex-mouse-view-crossref (ev) | |
18123 | 5334 "View cross reference of \\ref or \\cite macro where you click. |
5335 If the macro at point is a \\ref, show the corresponding label definition. | |
5336 If it is a \\cite, show the BibTeX database entry. | |
18050 | 5337 If there is no such macro at point, search forward to find one. |
5338 With argument, actually select the window showing the cross reference." | |
5339 (interactive "e") | |
5340 (mouse-set-point ev) | |
5341 (reftex-view-crossref current-prefix-arg)) | |
5342 | |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5343 (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
|
5344 "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
|
5345 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5346 (defun reftex-view-crossref-when-idle () |
23200
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5347 ;; Display info about crossref at point in echo area or a window. |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5348 ;; 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
|
5349 ;; 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
|
5350 (and reftex-mode |
23200
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5351 ;; Make sure message area is free if we need it. |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5352 (or (eq reftex-auto-view-crossref 'window) (not (current-message))) |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5353 ;; Make sure we are not already displaying this one |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5354 (not (memq last-command '(reftex-view-crossref |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5355 reftex-mouse-view-crossref))) |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5356 ;; Quick precheck if this might be a relevant spot |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5357 ;; FIXME: Can fail with backslash in comment |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5358 (save-excursion |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5359 (search-backward "\\" nil t) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5360 (looking-at "\\\\[a-zA-Z]*\\(cite\\|ref\\)")) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5361 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5362 (condition-case nil |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5363 (let ((current-prefix-arg nil)) |
23200
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5364 (cond |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5365 ((eq reftex-auto-view-crossref t) |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5366 (reftex-view-crossref -1 'echo)) |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5367 ((eq reftex-auto-view-crossref 'window) |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5368 (reftex-view-crossref -1 'tmp-window)) |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5369 (t nil))) |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5370 (error nil)))) |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5371 |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5372 (defun reftex-restore-window-conf () |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5373 (set-window-configuration (get 'reftex-auto-view-crossref 'last-window-conf)) |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5374 (put 'reftex-auto-view-crossref 'last-window-conf nil) |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5375 (remove-hook 'pre-command-hook 'reftex-restore-window-conf)) |
22991
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-echo-ref (label entry docstruct) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5378 ;; 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
|
5379 (cond |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5380 ((null docstruct) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5381 (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
|
5382 ((null entry) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5383 (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
|
5384 (t |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5385 (when (stringp (nth 2 entry)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5386 (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
|
5387 (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
|
5388 (when buf |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5389 (save-excursion |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5390 (set-buffer buf) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5391 (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
|
5392 |
23200
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5393 (defun reftex-echo-cite (key files item) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5394 ;; Display citation info in echo area. |
23200
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5395 (let* ((cache (assq 'bibview-cache (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
|
5396 (cache-entry (assoc key (cdr cache))) |
23200
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5397 entry string buf (all-files files)) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5398 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5399 (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
|
5400 ;; 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
|
5401 (setq string (cdr cache-entry)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5402 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5403 ;; 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
|
5404 (unless reftex-revisit-to-echo |
23200
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5405 (setq files (reftex-visited-files files))) |
22991
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 (setq entry |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5408 (condition-case nil |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5409 (save-excursion |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5410 (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
|
5411 (error |
23200
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5412 (if (and files (= (length all-files) (length files))) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5413 (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
|
5414 (message (substitute-command-keys |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5415 (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
|
5416 nil))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5417 (when entry |
23200
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5418 (if item |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5419 (setq string (reftex-nicify-text entry)) |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5420 (setq string (reftex-make-cite-echo-string |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5421 (reftex-parse-bibtex-entry entry) |
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5422 reftex-docstruct-symbol))))) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5423 (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
|
5424 (message "cite: %s" string)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5425 (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
|
5426 (save-excursion |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5427 (set-buffer buf) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5428 (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
|
5429 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5430 (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
|
5431 ;; 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
|
5432 (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
|
5433 (string |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5434 (let* ((reftex-cite-punctuation '(" " " & " " etal."))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5435 (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
|
5436 (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
|
5437 (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
|
5438 (unless cache |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5439 ;; 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
|
5440 (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
|
5441 (symbol-value docstruct-symbol)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5442 (when reftex-cache-cite-echo |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5443 (setq key (copy-sequence key)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5444 (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
|
5445 (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
|
5446 (if cache-entry |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5447 (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
|
5448 (setcdr cache-entry string) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5449 (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
|
5450 (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
|
5451 (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
|
5452 string)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5453 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5454 (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
|
5455 "*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
|
5456 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
|
5457 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5458 (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
|
5459 "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
|
5460 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
|
5461 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
|
5462 (interactive) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5463 (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
|
5464 (progn |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5465 (if (featurep 'xemacs) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5466 (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
|
5467 (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
|
5468 (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
|
5469 (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
|
5470 (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
|
5471 (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
|
5472 (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
|
5473 (if (featurep 'xemacs) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5474 (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
|
5475 (start-itimer "RefTeX Idle Timer" |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5476 'reftex-view-crossref-when-idle |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5477 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
|
5478 (add-hook 'post-command-hook 'reftex-start-itimer-once) |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5479 t) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5480 (run-with-idle-timer |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5481 reftex-idle-time t 'reftex-view-crossref-when-idle))) |
23344
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
5482 (unless reftex-auto-view-crossref |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
5483 (setq reftex-auto-view-crossref t)) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5484 (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
|
5485 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5486 (defun reftex-start-itimer-once () |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5487 (and reftex-mode |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5488 (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
|
5489 (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
|
5490 (start-itimer "RefTeX Idle Timer" |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5491 'reftex-view-crossref-when-idle |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5492 reftex-idle-time nil t)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5493 |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5494 (defun reftex-view-crossref-from-bibtex (&optional arg) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5495 "View location in a LaTeX document which cites the BibTeX entry at point. |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5496 Since BibTeX files can be used by many LaTeX documents, this function |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5497 promps upon first use for a buffer in RefTeX mode. To reset this |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5498 link to a document, call the function with with a prefix arg. |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5499 Calling this function several times find successive citation locations." |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5500 (interactive "P") |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5501 (when arg |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5502 ;; Break connection to reference buffer |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5503 (remprop 'reftex-bibtex-view-cite-locations :ref-buffer)) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5504 (let ((ref-buffer (get 'reftex-bibtex-view-cite-locations :ref-buffer))) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5505 ;; Establish connection to reference buffer |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5506 (unless ref-buffer |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5507 (setq ref-buffer |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5508 (save-excursion |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5509 (completing-read |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5510 "Reference buffer: " |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5511 (delq nil |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5512 (mapcar |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5513 (lambda (b) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5514 (set-buffer b) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5515 (if reftex-mode (list (buffer-name b)) nil)) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5516 (buffer-list))) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5517 nil t))) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5518 (put 'reftex-bibtex-view-cite-locations :ref-buffer ref-buffer)) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5519 ;; Search for citations |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5520 (bibtex-beginning-of-entry) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5521 (if (looking-at |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5522 "@[a-zA-Z]+[ \t\n\r]*[{(][ \t\n\r]*\\([^, \t\r\n}]+\\)") |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5523 (progn |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5524 (goto-char (match-beginning 1)) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5525 (reftex-view-regexp-match |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5526 (format reftex-find-citation-regexp-format |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5527 (regexp-quote (match-string 1))) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5528 3 arg ref-buffer)) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5529 (error "Cannot find citation key in BibTeX entry")))) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5530 |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5531 (defun reftex-view-regexp-match (re &optional highlight-group new ref-buffer) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5532 ;; Search for RE in current document or in the document of REF-BUFFER. |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5533 ;; Continue the search, if the same re was searched last. |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5534 ;; Highlight the group HIGHLIGHT-GROUP of the match. |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5535 ;; When NEW is non-nil, start a new search regardless. |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5536 ;; Match point is displayed in another window. |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5537 ;; Upon success, returns the window which displays the match. |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5538 |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5539 ;;; Decide if new search or continued search |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5540 (let* ((oldprop (get 'reftex-view-regexp-match :props)) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5541 (newprop (list (current-buffer) re)) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5542 (cont (and (not new) (equal oldprop newprop))) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5543 (cnt (if cont (get 'reftex-view-regexp-match :cnt) 0)) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5544 (current-window (selected-window)) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5545 (window-conf (current-window-configuration)) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5546 match pop-window) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5547 (switch-to-buffer-other-window (or ref-buffer (current-buffer))) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5548 ;; Search |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5549 (condition-case nil |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5550 (if cont |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5551 (setq match (reftex-global-search-continue)) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5552 (reftex-access-scan-info) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5553 (setq match (reftex-global-search re (reftex-all-document-files)))) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5554 (error nil)) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5555 ;; Evaluate the match. |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5556 (if match |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5557 (progn |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5558 (put 'reftex-view-regexp-match :props newprop) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5559 (put 'reftex-view-regexp-match :cnt (incf cnt)) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5560 (reftex-highlight 0 (match-beginning highlight-group) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5561 (match-end highlight-group)) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5562 (add-hook 'pre-command-hook 'reftex-highlight-shall-die) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5563 (setq pop-window (selected-window))) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5564 (remprop 'reftex-view-regexp-match :props) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5565 (or cont (set-window-configuration window-conf))) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5566 (select-window current-window) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5567 (if match |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5568 (progn |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5569 (message "Match Nr. %s" cnt) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5570 pop-window) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5571 (if cont |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5572 (error "No further matches (total number of matches: %d)" cnt) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5573 (error "No matches"))))) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5574 |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5575 (defvar reftex-global-search-marker (make-marker)) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5576 (defun reftex-global-search (regexp file-list) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5577 ;; Start a search for REGEXP in all files of FILE-LIST |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5578 (put 'reftex-global-search :file-list file-list) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5579 (put 'reftex-global-search :regexp regexp) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5580 (move-marker reftex-global-search-marker nil) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5581 (reftex-global-search-continue)) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5582 |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5583 (defun reftex-global-search-continue () |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5584 ;; Continue a global search started with `reftex-global-search' |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5585 (unless (get 'reftex-global-search :file-list) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5586 (error "No global search to continue")) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5587 (let* ((file-list (get 'reftex-global-search :file-list)) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5588 (regexp (get 'reftex-global-search :regexp)) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5589 (buf (or (marker-buffer reftex-global-search-marker) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5590 (reftex-get-file-buffer-force (car file-list)))) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5591 (pos (or (marker-position reftex-global-search-marker) 1)) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5592 file) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5593 ;; Take up starting position |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5594 (unless buf (error "No such buffer %s" buf)) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5595 (switch-to-buffer buf) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5596 (widen) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5597 (goto-char pos) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5598 ;; Search and switch file if necessary |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5599 (if (catch 'exit |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5600 (while t |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5601 (when (re-search-forward regexp nil t) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5602 (move-marker reftex-global-search-marker (point)) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5603 (throw 'exit t)) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5604 ;; No match - goto next file |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5605 (pop file-list) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5606 (or file-list (throw 'exit nil)) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5607 (setq file (car file-list) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5608 buf (reftex-get-file-buffer-force file)) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5609 (unless buf (error "Cannot access file %s" file)) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5610 (put 'reftex-global-search :file-list file-list) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5611 (switch-to-buffer buf) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5612 (widen) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5613 (goto-char 1))) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5614 t |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5615 (move-marker reftex-global-search-marker nil) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5616 (error "All files processed")))) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
5617 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5618 ;;; ========================================================================= |
18050 | 5619 ;;; |
5620 ;;; Functions that check out the surroundings | |
5621 | |
5622 (defun reftex-what-macro (which &optional bound) | |
5623 ;; 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
|
5624 ;; The return value is either ("\\macro" . (point)) or a list of them. |
18050 | 5625 |
5626 ;; 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
|
5627 ;; If WHICH is 1, return innermost enclosing macro. |
18050 | 5628 ;; If WHICH is t, return list of all macros enclosing point. |
5629 ;; If WHICH is a list of macros, look only for those macros and return the | |
5630 ;; name of the first macro in this list found to enclose point. | |
5631 ;; 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
|
5632 ;; searches to this point. If it is nil, limit to nearest \section - |
18050 | 5633 ;; like statement. |
5634 | |
5635 ;; 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
|
5636 ;; 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
|
5637 ;; 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
|
5638 ;; considered an argument of macro \macro. |
18050 | 5639 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5640 (unless reftex-section-regexp (reftex-compile-variables)) |
18050 | 5641 (catch 'exit |
5642 (if (null which) (throw 'exit nil)) | |
5643 (let ((bound (or bound (save-excursion (re-search-backward | |
5644 reftex-section-regexp nil 1) | |
5645 (point)))) | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5646 pos cmd-list cmd cnt cnt-opt entry) |
18050 | 5647 (save-restriction |
5648 (save-excursion | |
5649 (narrow-to-region (max 1 bound) (point-max)) | |
5650 ;; move back out of the current parenthesis | |
5651 (while (condition-case nil | |
5652 (progn (up-list -1) t) | |
5653 (error nil)) | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5654 (setq cnt 1 cnt-opt 0) |
18050 | 5655 ;; 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
|
5656 (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
|
5657 (condition-case nil |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5658 (progn (backward-sexp) t) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5659 (error nil))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5660 (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
|
5661 (incf cnt)) |
18050 | 5662 (setq pos (point)) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5663 (when (and (or (= (following-char) ?\[) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5664 (= (following-char) ?\{)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5665 (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
|
5666 (setq cmd (reftex-match-string 0)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5667 (when (looking-at "\\\\begin{[^}]*}") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5668 (setq cmd (reftex-match-string 0) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5669 cnt (1- cnt))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5670 ;; 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
|
5671 (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
|
5672 (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
|
5673 (setq cmd nil))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5674 (cond |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5675 ((null cmd)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5676 ((eq t which) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5677 (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
|
5678 ((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
|
5679 (throw 'exit (cons cmd (point)))))) |
18050 | 5680 (goto-char pos))) |
5681 (nreverse cmd-list))))) | |
5682 | |
5683 (defun reftex-what-environment (which &optional bound) | |
5684 ;; 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
|
5685 ;; The return value is (e.g.) either ("equation" . (point)) or a list of |
18050 | 5686 ;; them. |
5687 | |
5688 ;; 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
|
5689 ;; If WHICH is 1, return innermost enclosing environment. |
18050 | 5690 ;; If WHICH is t, return list of all environments enclosing point. |
5691 ;; If WHICH is a list of environments, look only for those environments and | |
5692 ;; return the name of the first environment in this list found to enclose | |
5693 ;; point. | |
5694 | |
5695 ;; 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
|
5696 ;; this point. If it is nil, limit to nearest \section - like statement. |
18050 | 5697 |
23200
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5698 (unless reftex-section-regexp (reftex-compile-variables)) |
18050 | 5699 (catch 'exit |
5700 (save-excursion | |
5701 (if (null which) (throw 'exit nil)) | |
5702 (let ((bound (or bound (save-excursion (re-search-backward | |
5703 reftex-section-regexp nil 1) | |
5704 (point)))) | |
5705 env-list end-list env) | |
5706 (while (re-search-backward "\\\\\\(begin\\|end\\){\\([^}]+\\)}" | |
5707 bound t) | |
5708 (setq env (buffer-substring-no-properties | |
5709 (match-beginning 2) (match-end 2))) | |
5710 (cond | |
5711 ((string= (match-string 1) "end") | |
5712 (add-to-list 'end-list env)) | |
5713 ((member env end-list) | |
5714 (setq end-list (delete env end-list))) | |
5715 ((eq t which) | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5716 (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
|
5717 ((or (eq 1 which) (member env which)) |
18050 | 5718 (throw 'exit (cons env (point)))))) |
5719 (nreverse env-list))))) | |
5720 | |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5721 ;;; ========================================================================= |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5722 ;;; |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5723 ;;; Finding files |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5724 |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5725 (defun reftex-locate-file (file type master-dir &optional die) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5726 "Find FILE of type TYPE in MASTER-DIR or on the path associcted with TYPE. |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5727 If the file does not have any of the legal extensions for TYPE, |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5728 try first the default extension and only then the naked file name. |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5729 When DIE is non-nil, throw an error if file not found." |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5730 (let* ((rec-values (if reftex-search-unrecursed-path-first '(nil t) '(t))) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5731 (extensions (cdr (assoc type reftex-file-extensions))) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5732 (def-ext (car extensions)) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5733 (ext-re (concat "\\(" |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5734 (mapconcat 'regexp-quote extensions "\\|") |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5735 "\\)\\'")) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5736 (files (if (string-match ext-re file) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5737 (cons file nil) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5738 (cons (concat file def-ext) file))) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5739 path old-path file1) |
23344
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
5740 (cond |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
5741 ((file-name-absolute-p file) |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5742 (setq file1 |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5743 (or |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5744 (and (car files) (file-regular-p (car files)) (car files)) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5745 (and (cdr files) (file-regular-p (cdr files)) (cdr files))))) |
23344
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
5746 ((and reftex-use-external-file-finders |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5747 (assoc type reftex-external-file-finders)) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5748 (setq file1 (reftex-find-file-externally file type master-dir))) |
23344
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
5749 (t |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5750 (while (and (null file1) rec-values) |
23200
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5751 (setq path (reftex-access-search-path |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5752 type (pop rec-values) master-dir file)) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5753 (if (or (null old-path) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5754 (not (eq old-path path))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5755 (setq old-path path |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5756 path (cons master-dir path) |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5757 file1 (or (and (car files) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5758 (reftex-find-file-on-path |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5759 (car files) path master-dir)) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5760 (and (cdr files) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5761 (reftex-find-file-on-path |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5762 (cdr files) path master-dir)))))))) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5763 (cond (file1 file1) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5764 (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
|
5765 (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
|
5766 |
23344
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
5767 (defun reftex-find-file-externally (file type &optional master-dir) |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
5768 ;; Use external program to find FILE. |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5769 ;; The program is taken from `reftex-external-file-finders'. |
23344
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
5770 ;; Interprete relative path definitions starting from MASTER-DIR. |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
5771 (let ((default-directory (or master-dir default-directory)) |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
5772 (prg (cdr (assoc type reftex-external-file-finders))) |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
5773 out) |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
5774 (if (string-match "%f" prg) |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
5775 (setq prg (replace-match file t t prg))) |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
5776 (setq out (apply 'reftex-process-string (split-string prg))) |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
5777 (if (string-match "[ \t\n]+\\'" out) |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
5778 (setq out (replace-match "" nil nil out))) |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
5779 (cond ((equal out "") nil) |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
5780 ((file-regular-p out) out) |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
5781 (t nil)))) |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
5782 |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
5783 (defun reftex-process-string (program &rest args) |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
5784 "Execute PROGRAM with arguments ARGS and return its STDOUT as a string." |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
5785 (with-output-to-string |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5786 (with-current-buffer standard-output |
23344
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
5787 (apply 'call-process program nil '(t nil) nil args)))) |
608bc56ca20e
(reftex-finding-files): New customize group.
Carsten Dominik <dominik@science.uva.nl>
parents:
23200
diff
changeset
|
5788 |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5789 (defun reftex-access-search-path (type &optional recurse master-dir file) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5790 ;; Access path from environment variables. TYPE is either "tex" or "bib". |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5791 ;; 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
|
5792 ;; 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
|
5793 ;; 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
|
5794 ;; 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
|
5795 ;; 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
|
5796 ;; Returns the derived path. |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5797 (let* ((pathvar (intern (concat "reftex-" type "-path")))) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5798 (when (null (get pathvar 'status)) |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5799 ;; Get basic path |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5800 (set pathvar |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5801 (reftex-uniq |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5802 (reftex-parse-colon-path |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5803 (mapconcat |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5804 (lambda(x) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5805 (if (string-match "^!" x) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5806 (apply 'reftex-process-string |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5807 (split-string (substring x 1))) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5808 (or (getenv x) x))) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5809 ;; For consistency, the next line should look like this: |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5810 ;; (cdr (assoc type reftex-path-environment)) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5811 ;; However, historically we have separate options for the |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5812 ;; environment variables, so we have to do this: |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5813 (symbol-value (intern (concat "reftex-" type |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5814 "path-environment-variables"))) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5815 path-separator)))) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5816 (put pathvar 'status 'split) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5817 ;; 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
|
5818 (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
|
5819 (while (setq dir (pop path)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5820 (when (string= (substring dir -2) "//") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5821 (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
|
5822 (setq rec (or rec 'absolute)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5823 (setq rec 'relative)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5824 (put pathvar 'rec-type rec))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5825 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5826 (if recurse |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5827 ;; 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
|
5828 (cond |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5829 ((not (get pathvar 'rec-type)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5830 ;; 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
|
5831 (symbol-value pathvar)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5832 ((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
|
5833 (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
|
5834 (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
|
5835 ;; 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
|
5836 ;; 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
|
5837 ;; relative to new default directory |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5838 (message "Expanding search path to find %s file: %s ..." type file) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5839 (put pathvar 'recursive-path |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5840 (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
|
5841 (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
|
5842 (get pathvar 'recursive-path)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5843 (t |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5844 ;; 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
|
5845 (get pathvar 'recursive-path))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5846 ;; The simple path was requested |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5847 (symbol-value pathvar)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5848 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5849 (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
|
5850 ;; 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
|
5851 ;; 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
|
5852 (catch 'exit |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5853 (when (file-name-absolute-p file) |
23200
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5854 (if (file-regular-p file) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5855 (throw 'exit file) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5856 (throw 'exit nil))) |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5857 (let* ((thepath path) file1 dir) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5858 (while (setq dir (pop thepath)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5859 (when (string= (substring dir -2) "//") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5860 (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
|
5861 (setq file1 (expand-file-name file (expand-file-name dir def-dir))) |
23200
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
5862 (if (file-regular-p file1) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5863 (throw 'exit file1))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5864 ;; No such file |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5865 nil))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5866 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5867 (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
|
5868 ;; 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
|
5869 ;; 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
|
5870 (mapcar |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5871 (lambda (dir) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5872 (if (string-match "\\(//+\\|/*!+\\)\\'" dir) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5873 (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
|
5874 (file-name-as-directory dir)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5875 (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
|
5876 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5877 (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
|
5878 ;; 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
|
5879 ;; 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
|
5880 (let (path1 dir recursive) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5881 (while (setq dir (pop path)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5882 (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
|
5883 (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
|
5884 (if (and recursive |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5885 (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
|
5886 (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
|
5887 (if recursive |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5888 ;; Expand recursively |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5889 (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
|
5890 ;; Keep unchanged |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5891 (push dir path1))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5892 (nreverse path1))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5893 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5894 (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
|
5895 ;; 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
|
5896 (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
|
5897 (while (setq dir (pop path)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5898 (when (file-directory-p dir) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5899 (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
|
5900 (while (setq file (pop files)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5901 (if (file-directory-p file) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5902 (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
|
5903 (push dir path1))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5904 path1)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5905 |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5906 (defun reftex-uniq (list) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5907 (let (new) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5908 (while list |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5909 (or (member (car list) new) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5910 (push (car list) new)) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5911 (pop list)) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5912 (nreverse new))) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5913 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5914 ;;; ========================================================================= |
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 ;;; Some generally useful functions |
18050 | 5917 |
5918 (defun reftex-no-props (string) | |
5919 ;; Return STRING with all text properties removed | |
5920 (and (stringp string) | |
5921 (set-text-properties 0 (length string) nil string)) | |
5922 string) | |
5923 | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5924 (defun reftex-match-string (n) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5925 ;; Match string without properties |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5926 (when (match-beginning n) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5927 (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
|
5928 |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
5929 (defun reftex-kill-buffer (buffer) |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5930 ;; 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
|
5931 (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
|
5932 (kill-buffer buffer))) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
5933 |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5934 (defun reftex-erase-buffer (&optional buffer) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5935 ;; 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
|
5936 ;; This even erases read-only buffers. |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5937 (cond |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5938 ((null buffer) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5939 ;; erase current buffer |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5940 (let ((buffer-read-only nil)) (erase-buffer))) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5941 ((setq buffer (get-buffer buffer)) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5942 ;; buffer exists |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5943 (save-excursion |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5944 (set-buffer buffer) |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
5945 (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
|
5946 |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5947 (defun reftex-this-word (&optional class) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5948 ;; Grab the word around point. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5949 (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
|
5950 (save-excursion |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5951 (buffer-substring-no-properties |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5952 (progn (skip-chars-backward class) (point)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5953 (progn (skip-chars-forward class) (point))))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5954 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5955 (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
|
5956 ;; 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
|
5957 (let (rtn) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5958 (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
|
5959 (push (car list) rtn) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5960 (pop list)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5961 (nreverse rtn))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5962 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5963 (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
|
5964 ;; 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
|
5965 (let (rtn) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5966 (while list |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5967 (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
|
5968 (push (car list) rtn)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5969 (pop list)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5970 (nreverse rtn))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5971 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5972 (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
|
5973 ;; 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
|
5974 ;; 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
|
5975 ;; 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
|
5976 ;; On success, returns the association. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5977 (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
|
5978 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5979 (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
|
5980 (setq list (memq ass list)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5981 (memq elt list)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5982 (setq last-ass ass |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5983 list (cdr list))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5984 last-ass)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
5985 |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5986 (defun reftex-truncate (string ncols &optional ellipses padding) |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5987 ;; Truncate STRING to NCOLS characters. |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5988 ;; When PADDING is non-nil, and string is shorter than NCOLS, fill with |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5989 ;; white space to NCOLS characters. When ELLIPSES is non-nil and the |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5990 ;; string needs to be truncated, replace last 3 characters by dots. |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5991 (setq string |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5992 (if (<= (length string) ncols) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5993 string |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5994 (if ellipses |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5995 (concat (substring string 0 (- ncols 3)) "...") |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
5996 (substring string 0 ncols)))) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5997 (if padding |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5998 (format (format "%%-%ds" ncols) string) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
5999 string)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6000 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6001 (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
|
6002 ;; 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
|
6003 ;; 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
|
6004 ;; 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
|
6005 (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
|
6006 (goto-char start) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6007 (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
|
6008 (setq match1 (match-data))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6009 (goto-char start) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6010 (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
|
6011 (setq match2 (match-data))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6012 (goto-char start) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6013 (setq match |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6014 (cond |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6015 ((not match1) match2) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6016 ((not match2) match1) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6017 ((< (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
|
6018 (t match2))) |
21170
dbe101f49d57
(reftex-nearest-match): store-match-data => set-match-data.
Richard M. Stallman <rms@gnu.org>
parents:
21130
diff
changeset
|
6019 (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
|
6020 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6021 (defun reftex-auto-mode-alist () |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6022 ;; 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
|
6023 ;; Stolen from gnus nnheader. |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6024 (let ((alist auto-mode-alist) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6025 out) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6026 (while alist |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6027 (when (listp (cdr (car alist))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6028 (push (car alist) out)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6029 (pop alist)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6030 (nreverse out))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6031 |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
6032 (defun reftex-window-height () |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
6033 (if (fboundp 'window-displayed-height) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
6034 (window-displayed-height) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
6035 (window-height))) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
6036 |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6037 (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
|
6038 ;; 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
|
6039 ;; 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
|
6040 (let* ((win1 (selected-window)) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6041 (buf1 (current-buffer)) |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
6042 (win2 (get-buffer-window buf2))) ;; Only on current frame. |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6043 (when win2 |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6044 (select-window win2) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6045 (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
|
6046 (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
|
6047 (enlarge-window (1+ (- (count-lines 1 (point-max)) |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
6048 (reftex-window-height)))))) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6049 (cond |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6050 ((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
|
6051 (keep-current |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6052 ;; 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
|
6053 (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
|
6054 (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
|
6055 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6056 (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
|
6057 ;; 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
|
6058 ;; also with HELP-STRING. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6059 ;; 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
|
6060 (let ((char ?\?)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6061 (save-window-excursion |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6062 (catch 'exit |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6063 (message (concat prompt " (?=Help)")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6064 (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
|
6065 (= ?\? (setq char (read-char-exclusive)))) |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
6066 (reftex-kill-buffer "*RefTeX Select*") |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
6067 (switch-to-buffer-other-window "*RefTeX Select*") |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
6068 (insert help-string) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
6069 (goto-char 1) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
6070 (unless (and (pos-visible-in-window-p 1) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
6071 (pos-visible-in-window-p (point-max))) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
6072 (enlarge-window (1+ (- (count-lines 1 (point-max)) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
6073 (reftex-window-height))))) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6074 (setq truncate-lines t)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6075 (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
|
6076 (message prompt) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6077 (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
|
6078 (while t |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6079 (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
|
6080 ((equal char ?\?)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6081 ((and scroll (equal char ?\ )) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6082 (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
|
6083 (message prompt)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6084 ((and scroll (equal char ?\C-? )) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6085 (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
|
6086 (message prompt)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6087 (t (throw 'exit char))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6088 (setq char (read-char-exclusive))))))) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6089 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6090 (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
|
6091 ;; convert STRING into a regexp, allowing ^M for \n and vice versa |
18050 | 6092 (let ((start -2)) |
6093 (setq string (regexp-quote string)) | |
6094 (while (setq start (string-match "[\n\r]" string (+ 3 start))) | |
6095 (setq string (replace-match "[\n\r]" nil t string))) | |
6096 string)) | |
6097 | |
6098 (defun reftex-get-buffer-visiting (file) | |
6099 ;; return a buffer visiting FILE | |
6100 (cond | |
6101 ((boundp 'find-file-compare-truenames) ; XEmacs | |
6102 (let ((find-file-compare-truenames t)) | |
6103 (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
|
6104 ((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
|
6105 (find-buffer-visiting file)) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6106 (t (error "This should not happen (reftex-get-buffer-visiting)")))) |
18050 | 6107 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6108 ;; 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
|
6109 (defvar message-stack) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6110 (if (and (featurep 'xemacs) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6111 (not (fboundp 'current-message))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6112 (defun current-message (&optional frame) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6113 (cdr (car message-stack)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6114 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6115 (defun reftex-visited-files (list) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6116 ;; 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
|
6117 (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
|
6118 list))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6119 |
18050 | 6120 (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
|
6121 ;; 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
|
6122 ;; 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
|
6123 ;; 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
|
6124 ;; 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
|
6125 ;; and mark the buffer to be killed after use. |
18050 | 6126 |
6127 (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
|
6128 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6129 (cond (buf |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6130 ;; 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
|
6131 buf) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6132 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6133 ((file-readable-p file) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6134 ;; 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
|
6135 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6136 (if (or (not mark-to-kill) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6137 (eq t reftex-initialize-temporary-buffers)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6138 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6139 ;; Visit the file with full magic |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6140 (setq buf (find-file-noselect file)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6141 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6142 ;; 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
|
6143 ;; with limited Magic |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6144 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6145 ;; The magic goes away |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6146 (let ((format-alist nil) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6147 (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
|
6148 (default-major-mode 'fundamental-mode) |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
6149 (enable-local-variables nil) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6150 (after-insert-file-functions nil)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6151 (setq buf (find-file-noselect file))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6152 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6153 ;; Is there a hook to run? |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6154 (when (listp reftex-initialize-temporary-buffers) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6155 (save-excursion |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6156 (set-buffer buf) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6157 (run-hooks 'reftex-initialize-temporary-buffers)))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6158 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6159 ;; 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
|
6160 (and mark-to-kill |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6161 (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
|
6162 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6163 ;; Return the new buffer |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6164 buf) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6165 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6166 ;; 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
|
6167 (t nil)))) |
18050 | 6168 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6169 (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
|
6170 ;; 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
|
6171 (cond |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6172 (buffer |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6173 (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
|
6174 (kill-buffer buffer) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6175 (setq reftex-buffers-to-kill |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6176 (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
|
6177 (t |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6178 (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
|
6179 (when (bufferp buffer) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6180 (and (buffer-modified-p buffer) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6181 (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
|
6182 (buffer-file-name buffer))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6183 (save-excursion |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6184 (set-buffer buffer) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6185 (save-buffer))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6186 (kill-buffer buffer)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6187 (pop reftex-buffers-to-kill))))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6188 |
18050 | 6189 (defun reftex-splice-symbols-into-list (list alist) |
6190 ;; Splice the association in ALIST of any symbols in LIST into the list. | |
6191 ;; Return new list. | |
6192 (let (rtn tmp) | |
6193 (while list | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6194 (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
|
6195 (symbolp (car list))) |
18050 | 6196 (setq tmp (car list)) |
6197 (cond | |
6198 ((assoc tmp alist) | |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
6199 (setq list (append (nth 2 (assoc tmp alist)) (cdr list)))) |
18050 | 6200 (t |
6201 (error "Cannot treat symbol %s in reftex-label-alist" | |
6202 (symbol-name tmp))))) | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6203 (push (pop list) rtn)) |
18050 | 6204 (nreverse rtn))) |
6205 | |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6206 (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
|
6207 ;; 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
|
6208 ;; Elements of KEEP-LIST are not removed even if duplicate. |
18050 | 6209 (let (new elm) |
6210 (while alist | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6211 (setq elm (pop alist)) |
18050 | 6212 (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
|
6213 (not (assoc (car elm) new))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6214 (push elm new))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6215 (nreverse new))) |
18050 | 6216 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6217 ;;; ========================================================================= |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6218 ;;; |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6219 ;;; Fontification and Highlighting |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6220 |
18050 | 6221 (defun reftex-use-fonts () |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
6222 ;; Return t if we can and want to use fonts. |
18050 | 6223 (and window-system |
6224 reftex-use-fonts | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6225 (featurep 'font-lock))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6226 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6227 (defun reftex-refontify () |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6228 ;; 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
|
6229 (and (reftex-use-fonts) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6230 (or (eq t reftex-refontify-context) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6231 (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
|
6232 ;; 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
|
6233 (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
|
6234 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6235 (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
|
6236 ;; 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
|
6237 ;; 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
|
6238 (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
|
6239 parent-buffer 'reftex-ref) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6240 (let* ((oldname (buffer-name)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6241 (newname (concat "Fontify-me-" oldname))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6242 (unwind-protect |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6243 (progn |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6244 ;; 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
|
6245 (rename-buffer newname t) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6246 (cond |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6247 ((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
|
6248 ;; 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
|
6249 (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
|
6250 '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
|
6251 (let ((major-mode 'latex-mode)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6252 (font-lock-mode 1))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6253 ((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
|
6254 ;; Looks like the XEmacs font-lock stuff. |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
6255 ;; FIXME: this is still kind of a hack, but it works. |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6256 (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
|
6257 (let ((major-mode 'latex-mode) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6258 (font-lock-defaults-computed nil)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6259 (font-lock-set-defaults-1) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6260 (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
|
6261 (t |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6262 ;; Oops? |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6263 (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
|
6264 (rename-buffer oldname)))) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6265 |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6266 (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
|
6267 ;; 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
|
6268 (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
|
6269 'font-lock-default-fontify-region |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6270 'font-lock-fontify-region)) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6271 beg1 end1) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6272 (goto-char beg) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6273 (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
|
6274 (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
|
6275 (funcall func beg1 end1 nil) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6276 (goto-char end1)))) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6277 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6278 (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
|
6279 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6280 (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
|
6281 ;; 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
|
6282 ;; 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
|
6283 ;; 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
|
6284 ;; 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
|
6285 ;; 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
|
6286 ;; to font-lock-constant-face. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6287 (let (face) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6288 (catch 'exit |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6289 (while (setq face (pop faces)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6290 (if (featurep 'xemacs) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6291 (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
|
6292 (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
|
6293 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6294 ;; 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
|
6295 (if (featurep 'xemacs) (require 'overlay)) |
18050 | 6296 |
6297 ;; 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
|
6298 (defvar reftex-highlight-overlays [nil nil]) |
18050 | 6299 |
6300 ;; Initialize the overlays | |
6301 (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
|
6302 (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
|
6303 'face 'highlight) |
18050 | 6304 (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
|
6305 (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
|
6306 'face reftex-cursor-selected-face) |
18050 | 6307 |
6308 ;; Two functions for activating and deactivation highlight overlays | |
6309 (defun reftex-highlight (index begin end &optional buffer) | |
6310 "Highlight a region with overlay INDEX." | |
6311 (move-overlay (aref reftex-highlight-overlays index) | |
6312 begin end (or buffer (current-buffer)))) | |
6313 (defun reftex-unhighlight (index) | |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6314 "Detach overlay INDEX." |
18050 | 6315 (delete-overlay (aref reftex-highlight-overlays index))) |
6316 | |
6317 (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
|
6318 ;; Function used in pre-command-hook to remove highlights. |
18050 | 6319 (remove-hook 'pre-command-hook 'reftex-highlight-shall-die) |
6320 (reftex-unhighlight 0)) | |
6321 | |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6322 ;;; ========================================================================= |
18050 | 6323 ;;; |
6324 ;;; Functions to compile the tables, reset the mode etc. | |
6325 | |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6326 ;; 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
|
6327 ;; 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
|
6328 (defconst reftex-cache-variables |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6329 '(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
|
6330 reftex-env-or-mac-alist reftex-everything-regexp |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
6331 reftex-macros-with-labels |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6332 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
|
6333 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
|
6334 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
|
6335 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
|
6336 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
|
6337 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
|
6338 reftex-words-to-typekey-alist)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6339 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6340 (defun reftex-ensure-compiled-variables () |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6341 ;; 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
|
6342 (let* ((mem reftex-memory) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6343 (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
|
6344 (cmem (car cache)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6345 (alist reftex-label-alist) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6346 (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
|
6347 (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
|
6348 (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
|
6349 (cond |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6350 (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
|
6351 ((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
|
6352 (eq levels (nth 1 mem)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6353 (eq style (nth 2 mem)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6354 (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
|
6355 ((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
|
6356 (eq levels (nth 1 cmem)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6357 (eq style (nth 2 cmem)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6358 (eq default (nth 2 cmem))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6359 ;; restore the cache |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6360 (message "Restoring cache") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6361 (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
|
6362 (t (reftex-compile-variables))))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6363 |
18050 | 6364 (defun reftex-reset-mode () |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6365 "Reset RefTeX Mode. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6366 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
|
6367 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
|
6368 on next use." |
18050 | 6369 (interactive) |
6370 | |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6371 ;; 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
|
6372 (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
|
6373 (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
|
6374 (put 'reftex-bib-path prop nil)) |
18050 | 6375 |
18219
aaeaae005e98
Updated documentation at several points in the file.
Richard M. Stallman <rms@gnu.org>
parents:
18123
diff
changeset
|
6376 ;; 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
|
6377 ;; 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
|
6378 (save-excursion |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6379 (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
|
6380 "*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
|
6381 buf) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6382 (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
|
6383 (if (get-buffer buf) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6384 (kill-buffer buf)))) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6385 (reftex-erase-all-selection-buffers)) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6386 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6387 ;; 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
|
6388 (reftex-reset-scanning-information) |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
6389 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6390 ;; Remove any parse info file |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6391 (reftex-access-parse-file 'kill) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6392 |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6393 ;; 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
|
6394 (and reftex-plug-into-AUCTeX |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6395 (reftex-plug-into-AUCTeX)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6396 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6397 (reftex-compile-variables)) |
18050 | 6398 |
6399 (defun reftex-reset-scanning-information () | |
6400 "Reset the symbols containing information from buffer scanning. | |
6401 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
|
6402 (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
|
6403 (reftex-erase-buffer "*toc*")) |
18050 | 6404 (let ((symlist reftex-multifile-symbols) |
6405 symbol) | |
6406 (while symlist | |
6407 (setq symbol (car symlist) | |
6408 symlist (cdr symlist)) | |
6409 (if (and (symbolp (symbol-value symbol)) | |
6410 (not (null (symbol-value symbol)))) | |
6411 (set (symbol-value symbol) nil))))) | |
6412 | |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6413 (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
|
6414 ;; 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
|
6415 (mapcar |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6416 (lambda (type) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6417 (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
|
6418 reftex-typekey-list)) |
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 (defun reftex-compile-variables () |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6421 ;; 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
|
6422 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6423 (message "Compiling label environment definitions...") |
18050 | 6424 |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6425 ;; Update AUCTeX style information |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6426 (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
|
6427 (condition-case nil (TeX-update-style) (error nil))) |
18050 | 6428 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6429 ;; 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
|
6430 (setq reftex-tables-dirty nil) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6431 (setq reftex-memory |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6432 (list reftex-label-alist |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6433 (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
|
6434 (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
|
6435 reftex-default-label-alist-entries)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6436 |
18050 | 6437 ;; 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
|
6438 (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
|
6439 (reftex-splice-symbols-into-list |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6440 (append reftex-label-alist |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6441 (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
|
6442 reftex-default-label-alist-entries) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6443 reftex-label-alist-builtin) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6444 '(nil))) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6445 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
|
6446 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
|
6447 nargs nlabel opt-args cell sum i) |
18050 | 6448 |
6449 (setq reftex-words-to-typekey-alist nil | |
6450 reftex-typekey-list nil | |
6451 reftex-typekey-to-format-alist nil | |
6452 reftex-typekey-to-prefix-alist nil | |
6453 reftex-env-or-mac-alist nil | |
6454 reftex-label-env-list nil | |
6455 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
|
6456 (while all |
18050 | 6457 (catch 'next-entry |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6458 (setq entry (car all) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6459 env-or-mac (car entry) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6460 entry (cdr entry) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6461 all (cdr all)) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6462 (if (null env-or-mac) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6463 (setq env-or-mac "")) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6464 (if (stringp (car entry)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6465 ;; 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
|
6466 ;; 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
|
6467 (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
|
6468 (cons (concat (car entry) ":") |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6469 (cdr entry))))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6470 (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
|
6471 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
|
6472 prefix (nth 1 entry) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6473 fmt (nth 2 entry) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6474 context (nth 3 entry) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6475 wordlist (nth 4 entry)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6476 (if (stringp wordlist) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6477 ;; 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
|
6478 (setq wordlist (nthcdr 4 entry))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6479 |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6480 (if (and (stringp fmt) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6481 (string-match "@" fmt)) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6482 ;; 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
|
6483 (setq fmt (split-string fmt "@+")) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6484 (setq fmt (list "\\label{%s}" fmt))) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6485 (setq labelfmt (car fmt) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6486 reffmt (nth 1 fmt)) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6487 ;; Note a new typekey |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6488 (if typekey |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6489 (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
|
6490 (if (and typekey prefix |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6491 (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
|
6492 (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
|
6493 (cons typekey prefix))) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6494 ;; 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
|
6495 (cond |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6496 ((string-match "\\`\\\\" env-or-mac) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6497 ;; It's a macro |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6498 (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
|
6499 (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
|
6500 nargs (second result) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6501 nlabel (third result) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6502 opt-args (fourth result)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6503 (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
|
6504 (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
|
6505 (t |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6506 ;; It's an environment |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6507 (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
|
6508 (cond ((string= env-or-mac "any")) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6509 ((string= env-or-mac "")) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6510 ((string= env-or-mac "section")) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6511 (t |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6512 (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
|
6513 ;; Translate some special context cases |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6514 (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
|
6515 (setq context |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6516 (format |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6517 (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
|
6518 (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
|
6519 ;; 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
|
6520 (and reffmt |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6521 (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
|
6522 (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
|
6523 ;; 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
|
6524 (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
|
6525 (not (string= env-or-mac "")) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6526 (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
|
6527 (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
|
6528 nargs nlabel opt-args) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6529 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
|
6530 ;; 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
|
6531 (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
|
6532 (setq wordlist (cdr wordlist)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6533 (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
|
6534 ;; 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
|
6535 (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
|
6536 (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
|
6537 (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
|
6538 (cond |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6539 ((string= "" env-or-mac) nil) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6540 ((setq cell (assoc typekey qh-list)) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6541 (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
|
6542 (typekey |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6543 (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
|
6544 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6545 (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
|
6546 (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
|
6547 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6548 ;; 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
|
6549 (setq qh-list |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6550 (sort qh-list (function |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6551 (lambda (x1 x2) (string< (car x1) (car x2)))))) |
18050 | 6552 (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
|
6553 (concat "Label type: [" |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6554 (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
|
6555 qh-list "") |
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 ;; In the help string, we need to wrap lines... |
18050 | 6558 (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
|
6559 (concat |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6560 "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
|
6561 (mapconcat |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6562 (lambda(x) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6563 (setq sum 0) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6564 (format " [%s] %s" |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6565 (car x) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6566 (mapconcat (lambda(env) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6567 (setq sum (+ sum (length env))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6568 (if (< sum 60) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6569 env |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6570 (setq sum 0) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6571 (concat "\n " env))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6572 (cdr x) " "))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6573 qh-list "\n"))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6574 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6575 ;; 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
|
6576 ;; 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
|
6577 ;; 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
|
6578 (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
|
6579 (mapcar |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6580 (lambda (x) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6581 (setq word (car x) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6582 typekey (cdr x) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6583 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
|
6584 (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
|
6585 (setq i 0) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6586 (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
|
6587 (< i (length fmt)) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6588 (not (member (aref fmt i) '(?%)))) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6589 (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
|
6590 (substring fmt 0 (1+ i))))) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6591 (incf i)) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6592 (cons (concat word "\\)\\=") typekey)) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
6593 (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
|
6594 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6595 ;; 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
|
6596 (setq reftex-section-levels-all |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6597 (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
|
6598 reftex-section-levels)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6599 |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6600 ;; Calculate the regular expressions |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6601 (let* ((wbol "\\(\\`\\|[\n\r]\\)[ \t]*") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6602 (label-re "\\\\label{\\([^}]*\\)}") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6603 (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
|
6604 (section-re |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6605 (concat wbol "\\\\\\(" |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6606 (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
|
6607 "\\)\\*?\\(\\[[^]]*\\]\\)?{")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6608 (appendix-re (concat wbol "\\(\\\\appendix\\)")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6609 (macro-re |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6610 (if macros-with-labels |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6611 (concat "\\(" |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6612 (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
|
6613 "\\)[[{]") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6614 "")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6615 (find-label-re-format |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6616 (concat "\\(" |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6617 (mapconcat 'regexp-quote (append '("\\label") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6618 macros-with-labels) "\\|") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6619 "\\)\\([[{][^]}]*[]}]\\)*[[{]\\(%s\\)[]}]"))) |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6620 (setq reftex-section-regexp section-re |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6621 reftex-section-or-include-regexp |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6622 (concat section-re "\\|" include-re) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6623 reftex-everything-regexp |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6624 (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
|
6625 "\\|" appendix-re |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6626 (if macros-with-labels "\\|" "") macro-re) |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
6627 reftex-macros-with-labels macros-with-labels |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
6628 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
|
6629 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
|
6630 "\\([]} \t\n\r]\\)\\([[{]\\)\\(%s\\)[]}]") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6631 (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
|
6632 (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
|
6633 (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
|
6634 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6635 ;;; ========================================================================= |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6636 ;;; |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6637 ;;; Operations on entire Multifile documents |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6638 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6639 (defun reftex-create-tags-file () |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6640 "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
|
6641 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
|
6642 (interactive) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6643 (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
|
6644 (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
|
6645 (files (reftex-all-document-files)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6646 (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
|
6647 (save-excursion |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6648 (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
|
6649 (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
|
6650 (shell-command cmd) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6651 (visit-tags-table "TAGS")))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6652 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6653 ;; History of grep commands. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6654 (defvar reftex-grep-history nil) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6655 (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
|
6656 "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
|
6657 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6658 (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
|
6659 "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
|
6660 With prefix arg, force to rescan document. |
23200
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
6661 No active TAGS table is required." |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6662 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6663 (interactive |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6664 (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
|
6665 reftex-grep-command nil nil |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6666 'reftex-grep-history))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6667 (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
|
6668 (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
|
6669 (cmd (format |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6670 "%s %s" grep-cmd |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6671 (mapconcat 'identity files " ")))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6672 (grep cmd))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6673 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6674 (defun reftex-search-document (&optional regexp) |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
6675 "Regexp search through all files of the current document. |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6676 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
|
6677 To continue searching for next match, use command \\[tags-loop-continue]. |
23200
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
6678 No active TAGS table is required." |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6679 (interactive) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6680 (let ((default (reftex-this-word))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6681 (unless regexp |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6682 (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
|
6683 default)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6684 (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
|
6685 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6686 (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
|
6687 (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
|
6688 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6689 (defun reftex-query-replace-document (&optional from to delimited) |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
6690 "Run a query-replace-regexp of FROM with TO over the entire document. |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6691 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
|
6692 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
|
6693 with the command \\[tags-loop-continue]. |
23200
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
6694 No active TAGS table is required." |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6695 (interactive) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6696 (let ((default (reftex-this-word))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6697 (unless from |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6698 (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
|
6699 default))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6700 (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
|
6701 (unless to |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6702 (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
|
6703 (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
|
6704 (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
|
6705 (list 'reftex-all-document-files)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6706 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6707 (defun reftex-find-duplicate-labels () |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6708 "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
|
6709 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6710 (interactive) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6711 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6712 ;; 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
|
6713 (reftex-access-scan-info t) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6714 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6715 (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
|
6716 (cnt 0) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6717 (dlist |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6718 (mapcar |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6719 (function |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6720 (lambda (x) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6721 (let (x1) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6722 (cond |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6723 ((memq (car x) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6724 '(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
|
6725 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
|
6726 is-multi)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6727 nil) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6728 (t |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6729 (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
|
6730 (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
|
6731 (if (< 1 (length x1)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6732 (append (list (car x)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6733 (mapcar (function |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6734 (lambda(x) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6735 (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
|
6736 x1)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6737 (list nil))))))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6738 (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
|
6739 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6740 (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
|
6741 (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
|
6742 (switch-to-buffer-other-window "*Duplicate Labels*") |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
6743 (set (make-local-variable 'TeX-master) master) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6744 (erase-buffer) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6745 (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
|
6746 (insert |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6747 " 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
|
6748 " 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
|
6749 (insert " LABEL FILE\n") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6750 (insert " -------------------------------------------------------------\n") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6751 (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
|
6752 (local-set-key [?q] (function |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6753 (lambda () "Kill this buffer." (interactive) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6754 (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
|
6755 (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
|
6756 (while dlist |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6757 (when (and (car (car dlist)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6758 (cdr (car dlist))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6759 (incf cnt) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6760 (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
|
6761 (pop dlist)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6762 (goto-char (point-min)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6763 (when (= cnt 0) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6764 (kill-buffer (current-buffer)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6765 (delete-window) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6766 (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
|
6767 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6768 (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
|
6769 "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
|
6770 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
|
6771 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
|
6772 with the command \\[tags-loop-continue]. |
23200
4750ba95a176
(reftex-view-crossref): Split up into several functions. No longer moves
Carsten Dominik <dominik@science.uva.nl>
parents:
22991
diff
changeset
|
6773 No active TAGS table is required." |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6774 (interactive) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6775 (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
|
6776 (unless from |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6777 (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
|
6778 default)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6779 (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
|
6780 (unless to |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6781 (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
|
6782 from)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6783 (reftex-query-replace-document |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6784 (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
|
6785 (format "\\\\\\1{%s}" to)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6786 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6787 (defun reftex-renumber-simple-labels () |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6788 "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
|
6789 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
|
6790 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
|
6791 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
|
6792 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
|
6793 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
|
6794 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
|
6795 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
|
6796 one with the `xr' package." |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6797 (interactive) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6798 ;; Resan the entire document |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6799 (reftex-access-scan-info 1) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6800 ;; Get some insurance |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6801 (if (and (reftex-is-multi) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6802 (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
|
6803 (error "Abort")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6804 ;; Make the translation list |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6805 (let* ((re-core (concat "\\(" |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6806 (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
|
6807 "\\)")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6808 (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
|
6809 (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
|
6810 (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
|
6811 (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
|
6812 reftex-typekey-to-prefix-alist)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6813 (files (reftex-all-document-files)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6814 (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
|
6815 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
|
6816 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6817 (while (setq entry (pop list)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6818 (when (and (stringp (car entry)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6819 (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
|
6820 (setq label (car entry) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6821 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
|
6822 label-numbers-alist)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6823 (if (assoc label translate-alist) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6824 (error "Duplicate label %s" label)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6825 (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
|
6826 (incf (cdr nr-cell)))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6827 (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
|
6828 (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
|
6829 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6830 (unless changed-sequence |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6831 (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
|
6832 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6833 ;; 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
|
6834 (reftex-save-all-document-buffers) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6835 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6836 ;; 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
|
6837 (setq n (reftex-translate |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6838 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
|
6839 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6840 ;; Now the real thing. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6841 (if (yes-or-no-p |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6842 (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
|
6843 (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
|
6844 (progn |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6845 (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
|
6846 (reftex-translate |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6847 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
|
6848 (setq quit-flag nil)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6849 (if (and (reftex-is-multi) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6850 (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
|
6851 (reftex-save-all-document-buffers)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6852 ;; Rescan again... |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6853 (reftex-access-scan-info 1) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6854 (message "Done replacing simple labels.")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6855 (message "No replacements done")))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6856 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6857 (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
|
6858 ;; 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
|
6859 ;; its association in TRANSLATE-ALSIT. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6860 ;; 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
|
6861 ;; to ignore the problematic string. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6862 ;; 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
|
6863 ;; Return the number of replacements. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6864 (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
|
6865 (while (setq file (pop files)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6866 (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
|
6867 (unless buf |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6868 (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
|
6869 (set-buffer buf) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6870 (save-excursion |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6871 (save-restriction |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6872 (widen) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6873 (goto-char (point-min)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6874 (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
|
6875 (save-excursion |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6876 (backward-char) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6877 (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
|
6878 cell (assoc label translate-alist) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6879 match-data (match-data) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6880 macro (reftex-what-macro 1) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6881 pos (cdr macro)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6882 (goto-char (or pos (point))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6883 (when (and macro |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6884 (or (looking-at "\\\\ref") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6885 (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
|
6886 (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
|
6887 (looking-at (format |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6888 reftex-find-label-regexp-format |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6889 (regexp-quote label))))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6890 ;; OK, we should replace it. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6891 (set-match-data match-data) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6892 (cond |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6893 ((and test (not cell)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6894 ;; We've got a problem |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6895 (unwind-protect |
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 (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
|
6898 (ding) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6899 (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
|
6900 (error "Abort"))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6901 (reftex-unhighlight 1))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6902 ((and test cell) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6903 (incf n)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6904 ((and (not test) cell) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6905 ;; Replace |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6906 (goto-char (match-beginning 1)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6907 (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
|
6908 (insert (cdr cell))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6909 (t nil)))))))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6910 n)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6911 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6912 (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
|
6913 "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
|
6914 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
|
6915 labels." |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6916 (interactive) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6917 (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
|
6918 file buffer) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6919 (save-excursion |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6920 (while (setq file (pop files)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6921 (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
|
6922 (when buffer |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6923 (set-buffer buffer) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6924 (save-buffer)))))) |
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 ;;; ========================================================================= |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6927 ;;; |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6928 ;;; AUCTeX Interface |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6929 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6930 (defun reftex-plug-flag (which) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6931 ;; 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
|
6932 (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
|
6933 (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
|
6934 (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
|
6935 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6936 (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
|
6937 "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
|
6938 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
|
6939 (let (label) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6940 (cond |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6941 ((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
|
6942 ;; 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
|
6943 (unwind-protect |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6944 (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
|
6945 (delete-backward-char 1))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6946 ((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
|
6947 ;; Reference a label with RefTeX |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6948 (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
|
6949 (t |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6950 ;; AUCTeX's default mechanism |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6951 (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
|
6952 (LaTeX-label-list))))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6953 (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
|
6954 (LaTeX-add-labels label)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6955 (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
|
6956 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6957 (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
|
6958 "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
|
6959 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
|
6960 (let (items) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6961 (cond |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6962 ((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
|
6963 (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
|
6964 (t |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6965 (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
|
6966 (if prompt prompt "Add key") |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6967 ": (default none) ")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6968 (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
|
6969 (apply 'LaTeX-add-bibitems items) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6970 (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
|
6971 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6972 (defun reftex-plug-into-AUCTeX () |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6973 ;; 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
|
6974 ;; 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
|
6975 ;; `reftex-plug-into-AUCTeX'. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6976 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6977 (if (reftex-plug-flag 0) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6978 (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
|
6979 (setq LaTeX-label-function nil)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6980 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6981 (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
|
6982 (fboundp 'TeX-arg-label)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6983 (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
|
6984 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6985 (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
|
6986 (fboundp 'TeX-arg-cite)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6987 (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
|
6988 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6989 (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
|
6990 "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
|
6991 (interactive) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6992 (unless (and (featurep 'tex-site) (featurep 'latex)) |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
6993 (error "AUCTeX's LaTeX mode does not seem to be loaded")) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6994 (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
|
6995 (reftex-plug-into-AUCTeX) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6996 (if reftex-plug-into-AUCTeX |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
6997 (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
|
6998 (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
|
6999 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7000 (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
|
7001 "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
|
7002 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
|
7003 for details. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7004 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
|
7005 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
|
7006 `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
|
7007 `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
|
7008 `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
|
7009 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
|
7010 (unless reftex-docstruct-symbol |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7011 (reftex-tie-multifile-symbols)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7012 (when (and reftex-docstruct-symbol |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7013 (symbolp reftex-docstruct-symbol)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7014 (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
|
7015 entry changed) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7016 (while entry-list |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7017 (setq entry (pop entry-list)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7018 (unless (member entry list) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7019 (setq reftex-tables-dirty t |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7020 changed t) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7021 (push entry list))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7022 (when changed |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7023 (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
|
7024 (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
|
7025 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7026 (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
|
7027 "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
|
7028 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
|
7029 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
|
7030 `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
|
7031 (unless reftex-docstruct-symbol |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7032 (reftex-tie-multifile-symbols)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7033 (when (and reftex-docstruct-symbol |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7034 (symbolp reftex-docstruct-symbol)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7035 (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
|
7036 entry changed) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7037 (while entry-list |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7038 (setq entry (pop entry-list)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7039 (unless (member entry list) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7040 (setq reftex-tables-dirty t |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7041 changed t) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7042 (push entry list))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7043 (when changed |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7044 (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
|
7045 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7046 (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
|
7047 "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
|
7048 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
|
7049 `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
|
7050 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
|
7051 (unless reftex-docstruct-symbol |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7052 (reftex-tie-multifile-symbols)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7053 (when (and reftex-docstruct-symbol |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7054 (symbolp reftex-docstruct-symbol)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7055 (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
|
7056 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7057 (defun reftex-notice-new-section () |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7058 "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
|
7059 ;; 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
|
7060 ;; 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
|
7061 ;; 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
|
7062 ;; section label is created. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7063 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7064 (condition-case nil |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7065 (catch 'exit |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7066 (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
|
7067 (reftex-access-scan-info) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7068 (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
|
7069 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
|
7070 section-number context) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7071 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7072 (save-excursion |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7073 (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
|
7074 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7075 ;; Find where we are |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7076 (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
|
7077 (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
|
7078 (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
|
7079 '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
|
7080 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
|
7081 '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
|
7082 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7083 ;; Initialize section numbers |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7084 (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
|
7085 (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
|
7086 (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
|
7087 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7088 ;; Match the section command |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7089 (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
|
7090 (match-end 3)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7091 (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
|
7092 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
|
7093 level (nth 5 toc-entry) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7094 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
|
7095 (symbol-value reftex-docstruct-symbol))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7096 (if tail |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7097 ;; Insert the section info |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7098 (push toc-entry (cdr tail)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7099 (throw 'exit nil)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7100 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7101 ;; 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
|
7102 (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
|
7103 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7104 ;; Update the remaining toc items |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7105 (setq tail (cdr tail)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7106 (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
|
7107 (setq toc-entry (car tail)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7108 (>= (nth 5 toc-entry) level)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7109 (setq section-number |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7110 (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
|
7111 context (nth 2 toc-entry)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7112 (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
|
7113 context) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7114 (when (and (not appendix) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7115 (>= (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
|
7116 ;; 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
|
7117 (throw 'exit nil)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7118 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7119 ;; Change the section number. |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7120 (setf (nth 2 toc-entry) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7121 (concat (match-string 1 context) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7122 section-number |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7123 (match-string 3 context)))))))))) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7124 (error nil)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7125 ) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7126 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7127 ;;; ========================================================================= |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7128 ;;; |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7129 ;;; Keybindings |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7130 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7131 ;; 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
|
7132 (loop for x in |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7133 '(("\C-c=" . reftex-toc) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7134 ("\C-c(" . reftex-label) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7135 ("\C-c)" . reftex-reference) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7136 ("\C-c[" . reftex-citation) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7137 ("\C-c&" . reftex-view-crossref)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7138 do (define-key reftex-mode-map (car x) (cdr x))) |
18050 | 7139 |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
7140 (eval-after-load |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
7141 "bibtex" |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
7142 '(define-key bibtex-mode-map "\C-c&" 'reftex-view-crossref-from-bibtex)) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
7143 |
21130
60e882bbb28b
Added keybinding for `reftex-mouse-view-crossref' to S-mouse-2.
Carsten Dominik <dominik@science.uva.nl>
parents:
21124
diff
changeset
|
7144 ;; Bind `reftex-mouse-view-crossref' only when the key is still free |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
7145 (let ((key (if (featurep 'xemacs) [(shift button2)] [(shift mouse-2)]))) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
7146 (unless (key-binding key) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
7147 (define-key reftex-mode-map key 'reftex-mouse-view-crossref))) |
21130
60e882bbb28b
Added keybinding for `reftex-mouse-view-crossref' to S-mouse-2.
Carsten Dominik <dominik@science.uva.nl>
parents:
21124
diff
changeset
|
7148 |
18050 | 7149 ;; 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
|
7150 (when reftex-extra-bindings |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7151 (loop for x in |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7152 '(("\C-ct" . reftex-toc) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7153 ("\C-cl" . reftex-label) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7154 ("\C-cr" . reftex-reference) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7155 ("\C-cc" . reftex-citation) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7156 ("\C-cv" . reftex-view-crossref) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7157 ("\C-cg" . reftex-grep-document) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7158 ("\C-cs" . reftex-search-document)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7159 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
|
7160 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7161 ;; 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
|
7162 (let ((map (make-sparse-keymap))) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
7163 (substitute-key-definition |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
7164 '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
|
7165 (substitute-key-definition |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
7166 '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
|
7167 (substitute-key-definition |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
7168 '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
|
7169 (substitute-key-definition |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
7170 '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
|
7171 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7172 (loop for x in |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7173 '((" " . reftex-select-callback) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7174 ("n" . reftex-select-next) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7175 ([(down)] . reftex-select-next) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7176 ("p" . reftex-select-previous) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7177 ([(up)] . reftex-select-previous) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7178 ("f" . reftex-select-toggle-follow) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7179 ("\C-m" . reftex-select-accept) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7180 ([(return)] . reftex-select-accept) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7181 ("q" . reftex-select-quit) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7182 ("." . reftex-select-show-insertion-point) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7183 ("?" . reftex-select-help)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7184 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
|
7185 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7186 ;; The mouse-2 binding |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
7187 (define-key map (if (featurep 'xemacs) [(button2)] [(mouse-2)]) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
7188 'reftex-select-mouse-accept) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7189 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7190 ;; Digit arguments |
20979
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
7191 (loop for key across "0123456789" do |
38e7bcbb3595
(reftex-toc-mode, reftex-select-label-mode):
Karl Heuer <kwzh@gnu.org>
parents:
20953
diff
changeset
|
7192 (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
|
7193 (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
|
7194 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7195 ;; Make two maps |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
7196 (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
|
7197 (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
|
7198 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7199 ;; 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
|
7200 (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
|
7201 (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
|
7202 (list 'lambda '() |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7203 "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
|
7204 '(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
|
7205 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7206 (loop for x in |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7207 '(("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
|
7208 ("v" . reftex-select-toggle-varioref) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7209 ([(tab)] . reftex-select-read-label) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7210 ("\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
|
7211 ("\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
|
7212 ("\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
|
7213 do |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7214 (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
|
7215 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7216 ;; 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
|
7217 (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
|
7218 (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
|
7219 (list 'lambda '() |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7220 "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
|
7221 '(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
|
7222 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7223 (loop for x in |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7224 '(("\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
|
7225 ([(tab)] . reftex-select-read-cite)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7226 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
|
7227 |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
7228 ;; Table of Contents map |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
7229 (define-key reftex-toc-map (if (featurep 'xemacs) [(button2)] [(mouse-2)]) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
7230 'reftex-toc-mouse-goto-line-and-hide) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7231 |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
7232 (substitute-key-definition |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
7233 'next-line 'reftex-toc-next reftex-toc-map global-map) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
7234 (substitute-key-definition |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
7235 'previous-line 'reftex-toc-previous reftex-toc-map global-map) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
7236 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7237 (loop for x in |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
7238 '(("n" . reftex-toc-next) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
7239 ("p" . reftex-toc-previous) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7240 ("?" . reftex-toc-show-help) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7241 (" " . reftex-toc-view-line) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7242 ("\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
|
7243 ("\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
|
7244 ("r" . reftex-toc-rescan) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7245 ("R" . reftex-toc-Rescan) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7246 ("g" . revert-buffer) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7247 ("q" . reftex-toc-quit) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7248 ("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
|
7249 ("f" . reftex-toc-toggle-follow) |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
7250 ("i" . reftex-toc-toggle-file-boundary) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
7251 ("l" . reftex-toc-toggle-labels) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
7252 ("c" . reftex-toc-toggle-context) |
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
7253 ("%" . reftex-toc-toggle-commented) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7254 ("x" . reftex-toc-external) |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
7255 ("." . reftex-toc-show-calling-point)) |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7256 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
|
7257 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7258 (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
|
7259 (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
|
7260 (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
|
7261 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7262 ;;; ========================================================================= |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7263 ;;; |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7264 ;;; Menu |
18050 | 7265 |
7266 ;; Define a menu for the menu bar if Emacs is running under X | |
7267 | |
7268 (require 'easymenu) | |
7269 | |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
7270 (easy-menu-define reftex-mode-menu reftex-mode-map |
18050 | 7271 "Menu used in RefTeX mode" |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
7272 `("Ref" |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
7273 ["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
|
7274 "---" |
19660
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
7275 ["\\label" reftex-label t] |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
7276 ["\\ref" reftex-reference t] |
fa3d4e7a76d9
(reftex-customize): Added call to customize browse.
Richard M. Stallman <rms@gnu.org>
parents:
18321
diff
changeset
|
7277 ["\\cite" reftex-citation t] |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
7278 ["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
|
7279 "---" |
20177
6ebc3e300106
The menu now used toggle and radio for some items.
Karl Heuer <kwzh@gnu.org>
parents:
20102
diff
changeset
|
7280 ("Parse Document" |
6ebc3e300106
The menu now used toggle and radio for some items.
Karl Heuer <kwzh@gnu.org>
parents:
20102
diff
changeset
|
7281 ["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
|
7282 ["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
|
7283 ["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
|
7284 (> (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
|
7285 ["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
|
7286 "---" |
6ebc3e300106
The menu now used toggle and radio for some items.
Karl Heuer <kwzh@gnu.org>
parents:
20102
diff
changeset
|
7287 ["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
|
7288 ("Global Actions" |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
7289 ["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
|
7290 ["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
|
7291 ["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
|
7292 "---" |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
7293 ["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
|
7294 "---" |
20102
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
7295 ["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
|
7296 ["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
|
7297 ["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
|
7298 "---" |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
7299 ["Save Document" reftex-save-all-document-buffers t]) |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
7300 "---" |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7301 ("Options" |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
7302 "PARSER" |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
7303 ["Partial Scans" |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
7304 (setq reftex-enable-partial-scans (not reftex-enable-partial-scans)) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
7305 :style toggle :selected reftex-enable-partial-scans] |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
7306 ["Auto-Save Parse Info" |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
7307 (setq reftex-save-parse-info (not reftex-save-parse-info)) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
7308 :style toggle :selected reftex-save-parse-info] |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
7309 "---" |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
7310 "CROSSREF INFO" |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
7311 ["Automatic Info" reftex-toggle-auto-view-crossref |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
7312 :style toggle :selected reftex-auto-view-crossref-timer] |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
7313 ["...in Echo Area" (setq reftex-auto-view-crossref t) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
7314 :style radio :selected (eq reftex-auto-view-crossref t)] |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
7315 ["...in Other Window" (setq reftex-auto-view-crossref 'window) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
7316 :style radio :selected (eq reftex-auto-view-crossref 'window)] |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
7317 "---" |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
7318 "MISC" |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
7319 ["AUC TeX Interface" reftex-toggle-plug-into-AUCTeX |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
7320 :style toggle :selected reftex-plug-into-AUCTeX]) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
7321 ("Reference Style" |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
7322 ["Standard" (setq reftex-vref-is-default nil) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
7323 :style radio :selected (not reftex-vref-is-default)] |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
7324 ["Varioref" (setq reftex-vref-is-default t) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
7325 :style radio :selected reftex-vref-is-default]) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
7326 ("Citation Style" |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
7327 ,@(mapcar |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
7328 (function |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
7329 (lambda (x) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
7330 (vector |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
7331 (capitalize (symbol-name (car x))) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
7332 (list 'reftex-set-cite-format (list 'quote (car x))) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
7333 :style 'radio :selected |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
7334 (list 'eq (list 'reftex-get-cite-format) (list 'quote (car x)))))) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
7335 reftex-cite-format-builtin) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
7336 "---" |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
7337 "Sort Database Matches" |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
7338 ["Not" (setq reftex-sort-bibtex-matches nil) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
7339 :style radio :selected (eq reftex-sort-bibtex-matches nil)] |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
7340 ["by Author" (setq reftex-sort-bibtex-matches 'author) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
7341 :style radio :selected (eq reftex-sort-bibtex-matches 'author)] |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
7342 ["by Year" (setq reftex-sort-bibtex-matches 'year) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
7343 :style radio :selected (eq reftex-sort-bibtex-matches 'year)] |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
7344 ["by Year, reversed" (setq reftex-sort-bibtex-matches 'reverse-year) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
7345 :style radio :selected (eq reftex-sort-bibtex-matches 'reverse-year)]) |
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
7346 "---" |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
7347 ("Customize" |
23707
b0fe513da546
(reftex-finding-files): Group documentation fixed.
Carsten Dominik <dominik@science.uva.nl>
parents:
23344
diff
changeset
|
7348 ["Browse RefTeX Group" reftex-customize t] |
20829
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
7349 "---" |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
7350 ["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
|
7351 (fboundp 'customize-menu-create)]) |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
7352 ("Documentation" |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
7353 ["Info" reftex-info t] |
f9ac469887a8
(reftex-toc): Fixed bug with split-window. Using
Richard M. Stallman <rms@gnu.org>
parents:
20177
diff
changeset
|
7354 ["Commentary" reftex-show-commentary t]))) |
18050 | 7355 |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7356 (defun reftex-customize () |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7357 "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
|
7358 (interactive) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7359 (customize-browse 'reftex)) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7360 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7361 (defun reftex-create-customize-menu () |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7362 "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
|
7363 (interactive) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7364 (if (fboundp 'customize-menu-create) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7365 (progn |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7366 (easy-menu-change |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7367 '("Ref") "Customize" |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7368 `(["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
|
7369 "---" |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7370 ,(customize-menu-create 'reftex) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7371 ["Set" Custom-set t] |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7372 ["Save" Custom-save t] |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7373 ["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
|
7374 ["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
|
7375 ["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
|
7376 (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
|
7377 (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
|
7378 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7379 (defun reftex-show-commentary () |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7380 "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
|
7381 (interactive) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7382 (require 'finder) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7383 (finder-commentary "reftex.el")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7384 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7385 (defun reftex-info () |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7386 "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
|
7387 (interactive) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7388 (require 'info) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7389 (Info-goto-node "(reftex)")) |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7390 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7391 ;;; 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
|
7392 |
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7393 (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
|
7394 (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
|
7395 |
18050 | 7396 ;;; Run Hook ------------------------------------------------------------------ |
7397 | |
7398 (run-hooks 'reftex-load-hook) | |
7399 | |
7400 ;;; That's it! ---------------------------------------------------------------- | |
7401 | |
21114
3e8ab19bdccb
1998-03-08 Carsten Dominik <cd@gnu.org>
Carsten Dominik <dominik@science.uva.nl>
parents:
21075
diff
changeset
|
7402 (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
|
7403 (provide 'reftex) |
c00f010468c2
Using cl macros push, pop, when, unless throughout
Karl Heuer <kwzh@gnu.org>
parents:
19660
diff
changeset
|
7404 |
18050 | 7405 ;;;============================================================================ |
7406 | |
18321
0ed97be54a28
Changed all doc strings to comply with conventions.
Richard M. Stallman <rms@gnu.org>
parents:
18220
diff
changeset
|
7407 ;;; reftex.el ends here |
22991
313091cd2751
(reftex-reparse-document): Renamed from `reftex-parse-document'.
Carsten Dominik <dominik@science.uva.nl>
parents:
22388
diff
changeset
|
7408 |
23995
a56b80c4166a
(reftex-section-levels): Allow negative levels.
Carsten Dominik <dominik@science.uva.nl>
parents:
23707
diff
changeset
|
7409 |