aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/textmodes/reftex.el
diff options
context:
space:
mode:
authorGlenn Morris2008-02-28 03:45:53 +0000
committerGlenn Morris2008-02-28 03:45:53 +0000
commita2e43f129bf52cf0d1663cb48a48d06e29f7f95d (patch)
treeb9174dbbbaf5c76755ff1e020b1dce5d5dcb252c /lisp/textmodes/reftex.el
parentaf8b50d18f529b5b2ca665e81ee6b612d60a38dc (diff)
downloademacs-a2e43f129bf52cf0d1663cb48a48d06e29f7f95d.tar.gz
emacs-a2e43f129bf52cf0d1663cb48a48d06e29f7f95d.zip
(reftex-show-commentary): Don't require finder.
(reftex-info): Don't require info. Use info rather than Info-goto-node.
Diffstat (limited to 'lisp/textmodes/reftex.el')
-rw-r--r--lisp/textmodes/reftex.el168
1 files changed, 83 insertions, 85 deletions
diff --git a/lisp/textmodes/reftex.el b/lisp/textmodes/reftex.el
index d9233c050f5..ed74e887a0a 100644
--- a/lisp/textmodes/reftex.el
+++ b/lisp/textmodes/reftex.el
@@ -27,7 +27,7 @@
27;;--------------------------------------------------------------------------- 27;;---------------------------------------------------------------------------
28;; 28;;
29;;; Commentary: 29;;; Commentary:
30;; 30;;
31;; RefTeX is a minor mode with distinct support for \ref, \label, \cite, 31;; RefTeX is a minor mode with distinct support for \ref, \label, \cite,
32;; and \index commands in (multi-file) LaTeX documents. 32;; and \index commands in (multi-file) LaTeX documents.
33;; - A table of contents provides easy access to any part of a document. 33;; - A table of contents provides easy access to any part of a document.
@@ -72,7 +72,7 @@
72;; 72;;
73;; Introduction 73;; Introduction
74;; ************ 74;; ************
75;; 75;;
76;; RefTeX is a specialized package for support of labels, references, 76;; RefTeX is a specialized package for support of labels, references,
77;; citations, and the index in LaTeX. RefTeX wraps itself round 4 LaTeX 77;; citations, and the index in LaTeX. RefTeX wraps itself round 4 LaTeX
78;; macros: `\label', `\ref', `\cite', and `\index'. Using these macros 78;; macros: `\label', `\ref', `\cite', and `\index'. Using these macros
@@ -81,13 +81,13 @@
81;; time-consuming tasks almost entirely. It also provides functions to 81;; time-consuming tasks almost entirely. It also provides functions to
82;; display the structure of a document and to move around in this 82;; display the structure of a document and to move around in this
83;; structure quickly. 83;; structure quickly.
84;; 84;;
85;; *Note Imprint::, for information about who to contact for help, bug 85;; *Note Imprint::, for information about who to contact for help, bug
86;; reports or suggestions. 86;; reports or suggestions.
87;; 87;;
88;; Environment 88;; Environment
89;; =========== 89;; ===========
90;; 90;;
91;; RefTeX needs to access all files which are part of a multifile 91;; RefTeX needs to access all files which are part of a multifile
92;; document, and the BibTeX database files requested by the 92;; document, and the BibTeX database files requested by the
93;; `\bibliography' command. To find these files, RefTeX will require a 93;; `\bibliography' command. To find these files, RefTeX will require a
@@ -96,26 +96,26 @@
96;; which are also used by RefTeX. However, on some systems these 96;; which are also used by RefTeX. However, on some systems these
97;; variables do not contain the full search path. If RefTeX does not work 97;; variables do not contain the full search path. If RefTeX does not work
98;; for you because it cannot find some files, read *Note Finding Files::. 98;; for you because it cannot find some files, read *Note Finding Files::.
99;; 99;;
100;; Entering RefTeX Mode 100;; Entering RefTeX Mode
101;; ==================== 101;; ====================
102;; 102;;
103;; To turn RefTeX Mode on and off in a particular buffer, use `M-x 103;; To turn RefTeX Mode on and off in a particular buffer, use `M-x
104;; reftex-mode'. To turn on RefTeX Mode for all LaTeX files, add the 104;; reftex-mode'. To turn on RefTeX Mode for all LaTeX files, add the
105;; following lines to your `.emacs' file: 105;; following lines to your `.emacs' file:
106;; 106;;
107;; (add-hook 'LaTeX-mode-hook 'turn-on-reftex) ; with AUCTeX LaTeX mode 107;; (add-hook 'LaTeX-mode-hook 'turn-on-reftex) ; with AUCTeX LaTeX mode
108;; (add-hook 'latex-mode-hook 'turn-on-reftex) ; with Emacs latex mode 108;; (add-hook 'latex-mode-hook 'turn-on-reftex) ; with Emacs latex mode
109;; 109;;
110;; RefTeX in a Nutshell 110;; RefTeX in a Nutshell
111;; ==================== 111;; ====================
112;; 112;;
113;; 1. Table of Contents 113;; 1. Table of Contents
114;; Typing `C-c =' (`reftex-toc') will show a table of contents of the 114;; Typing `C-c =' (`reftex-toc') will show a table of contents of the
115;; document. This buffer can display sections, labels and index 115;; document. This buffer can display sections, labels and index
116;; entries defined in the document. From the buffer, you can jump 116;; entries defined in the document. From the buffer, you can jump
117;; quickly to every part of your document. Press `?' to get help. 117;; quickly to every part of your document. Press `?' to get help.
118;; 118;;
119;; 2. Labels and References 119;; 2. Labels and References
120;; RefTeX helps to create unique labels and to find the correct key 120;; RefTeX helps to create unique labels and to find the correct key
121;; for references quickly. It distinguishes labels for different 121;; for references quickly. It distinguishes labels for different
@@ -123,7 +123,7 @@
123;; others), and can be configured to recognize any additional labeled 123;; others), and can be configured to recognize any additional labeled
124;; environments you have defined yourself (variable 124;; environments you have defined yourself (variable
125;; `reftex-label-alist'). 125;; `reftex-label-alist').
126;; 126;;
127;; * Creating Labels 127;; * Creating Labels
128;; Type `C-c (' (`reftex-label') to insert a label at point. 128;; Type `C-c (' (`reftex-label') to insert a label at point.
129;; RefTeX will either 129;; RefTeX will either
@@ -132,17 +132,17 @@
132;; tables) or 132;; tables) or
133;; - insert a simple label made of a prefix and a number (all 133;; - insert a simple label made of a prefix and a number (all
134;; other environments) 134;; other environments)
135;; 135;;
136;; Which labels are created how is configurable with the variable 136;; Which labels are created how is configurable with the variable
137;; `reftex-insert-label-flags'. 137;; `reftex-insert-label-flags'.
138;; 138;;
139;; * Referencing Labels 139;; * Referencing Labels
140;; To make a reference, type `C-c )' (`reftex-reference'). This 140;; To make a reference, type `C-c )' (`reftex-reference'). This
141;; shows an outline of the document with all labels of a certain 141;; shows an outline of the document with all labels of a certain
142;; type (figure, equation,...) and some label context. 142;; type (figure, equation,...) and some label context.
143;; Selecting a label inserts a `\ref{LABEL}' macro into the 143;; Selecting a label inserts a `\ref{LABEL}' macro into the
144;; original buffer. 144;; original buffer.
145;; 145;;
146;; 3. Citations 146;; 3. Citations
147;; Typing `C-c [' (`reftex-citation') will let you specify a regular 147;; Typing `C-c [' (`reftex-citation') will let you specify a regular
148;; expression to search in current BibTeX database files (as 148;; expression to search in current BibTeX database files (as
@@ -151,7 +151,7 @@
151;; sorted. The selected article is referenced as `\cite{KEY}' (see 151;; sorted. The selected article is referenced as `\cite{KEY}' (see
152;; the variable `reftex-cite-format' if you want to insert different 152;; the variable `reftex-cite-format' if you want to insert different
153;; macros). 153;; macros).
154;; 154;;
155;; 4. Index Support 155;; 4. Index Support
156;; RefTeX helps to enter index entries. It also compiles all entries 156;; RefTeX helps to enter index entries. It also compiles all entries
157;; into an alphabetically sorted `*Index*' buffer which you can use 157;; into an alphabetically sorted `*Index*' buffer which you can use
@@ -159,25 +159,25 @@
159;; index macros and can be configured to recognize any additional 159;; index macros and can be configured to recognize any additional
160;; macros you have defined (`reftex-index-macros'). Multiple indices 160;; macros you have defined (`reftex-index-macros'). Multiple indices
161;; are supported. 161;; are supported.
162;; 162;;
163;; * Creating Index Entries 163;; * Creating Index Entries
164;; To index the current selection or the word at point, type 164;; To index the current selection or the word at point, type
165;; `C-c /' (`reftex-index-selection-or-word'). The default macro 165;; `C-c /' (`reftex-index-selection-or-word'). The default macro
166;; `reftex-index-default-macro' will be used. For a more 166;; `reftex-index-default-macro' will be used. For a more
167;; complex entry type `C-c <' (`reftex-index'), select any of 167;; complex entry type `C-c <' (`reftex-index'), select any of
168;; the index macros and enter the arguments with completion. 168;; the index macros and enter the arguments with completion.
169;; 169;;
170;; * The Index Phrases File (Delayed Indexing) 170;; * The Index Phrases File (Delayed Indexing)
171;; Type `C-c \' (`reftex-index-phrase-selection-or-word') to add 171;; Type `C-c \' (`reftex-index-phrase-selection-or-word') to add
172;; the current word or selection to a special _index phrase 172;; the current word or selection to a special _index phrase
173;; file_. RefTeX can later search the document for occurrences 173;; file_. RefTeX can later search the document for occurrences
174;; of these phrases and let you interactively index the matches. 174;; of these phrases and let you interactively index the matches.
175;; 175;;
176;; * Displaying and Editing the Index 176;; * Displaying and Editing the Index
177;; To display the compiled index in a special buffer, type `C-c 177;; To display the compiled index in a special buffer, type `C-c
178;; >' (`reftex-display-index'). From that buffer you can check 178;; >' (`reftex-display-index'). From that buffer you can check
179;; and edit all entries. 179;; and edit all entries.
180;; 180;;
181;; 5. Viewing Cross-References 181;; 5. Viewing Cross-References
182;; When point is on the KEY argument of a cross-referencing macro 182;; When point is on the KEY argument of a cross-referencing macro
183;; (`\label', `\ref', `\cite', `\bibitem', `\index', and variations) 183;; (`\label', `\ref', `\cite', `\bibitem', `\index', and variations)
@@ -187,14 +187,14 @@
187;; When the enclosing macro is `\cite' or `\ref' and no other message 187;; When the enclosing macro is `\cite' or `\ref' and no other message
188;; occupies the echo area, information about the citation or label 188;; occupies the echo area, information about the citation or label
189;; will automatically be displayed in the echo area. 189;; will automatically be displayed in the echo area.
190;; 190;;
191;; 6. Multifile Documents 191;; 6. Multifile Documents
192;; Multifile Documents are fully supported. The included files must 192;; Multifile Documents are fully supported. The included files must
193;; have a file variable `TeX-master' or `tex-main-file' pointing to 193;; have a file variable `TeX-master' or `tex-main-file' pointing to
194;; the master file. RefTeX provides cross-referencing information 194;; the master file. RefTeX provides cross-referencing information
195;; from all parts of the document, and across document borders 195;; from all parts of the document, and across document borders
196;; (`xr.sty'). 196;; (`xr.sty').
197;; 197;;
198;; 7. Document Parsing 198;; 7. Document Parsing
199;; RefTeX needs to parse the document in order to find labels and 199;; RefTeX needs to parse the document in order to find labels and
200;; other information. It does it automatically once and updates its 200;; other information. It does it automatically once and updates its
@@ -203,23 +203,23 @@
203;; with a raw `C-u' prefix, or press the `r' key in the label 203;; with a raw `C-u' prefix, or press the `r' key in the label
204;; selection buffer, the table of contents buffer, or the index 204;; selection buffer, the table of contents buffer, or the index
205;; buffer. 205;; buffer.
206;; 206;;
207;; 8. AUCTeX 207;; 8. AUCTeX
208;; If your major LaTeX mode is AUCTeX, RefTeX can cooperate with it 208;; If your major LaTeX mode is AUCTeX, RefTeX can cooperate with it
209;; (see variable `reftex-plug-into-AUCTeX'). AUCTeX contains style 209;; (see variable `reftex-plug-into-AUCTeX'). AUCTeX contains style
210;; files which trigger appropriate settings in RefTeX, so that for 210;; files which trigger appropriate settings in RefTeX, so that for
211;; many of the popular LaTeX packages no additional customizations 211;; many of the popular LaTeX packages no additional customizations
212;; will be necessary. 212;; will be necessary.
213;; 213;;
214;; 9. Useful Settings 214;; 9. Useful Settings
215;; To make RefTeX faster for large documents, try these: 215;; To make RefTeX faster for large documents, try these:
216;; (setq reftex-enable-partial-scans t) 216;; (setq reftex-enable-partial-scans t)
217;; (setq reftex-save-parse-info t) 217;; (setq reftex-save-parse-info t)
218;; (setq reftex-use-multiple-selection-buffers t) 218;; (setq reftex-use-multiple-selection-buffers t)
219;; 219;;
220;; To integrate with AUCTeX, use 220;; To integrate with AUCTeX, use
221;; (setq reftex-plug-into-AUCTeX t) 221;; (setq reftex-plug-into-AUCTeX t)
222;; 222;;
223;; To make your own LaTeX macro definitions known to RefTeX, 223;; To make your own LaTeX macro definitions known to RefTeX,
224;; customize the variables 224;; customize the variables
225;; `reftex-label-alist' (for label macros/environments) 225;; `reftex-label-alist' (for label macros/environments)
@@ -229,7 +229,7 @@
229;; `reftex-index-default-macro' (to set the default macro) 229;; `reftex-index-default-macro' (to set the default macro)
230;; If you have a large number of macros defined, you may want to write 230;; If you have a large number of macros defined, you may want to write
231;; an AUCTeX style file to support them with both AUCTeX and RefTeX. 231;; an AUCTeX style file to support them with both AUCTeX and RefTeX.
232;; 232;;
233;; 10. Where Next? 233;; 10. Where Next?
234;; Go ahead and use RefTeX. Use its menus until you have picked up 234;; Go ahead and use RefTeX. Use its menus until you have picked up
235;; the key bindings. For an overview of what you can do in each of 235;; the key bindings. For an overview of what you can do in each of
@@ -238,7 +238,7 @@
238;; The first part of the manual explains in a tutorial way how to use 238;; The first part of the manual explains in a tutorial way how to use
239;; and customize RefTeX. The second part is a command and variable 239;; and customize RefTeX. The second part is a command and variable
240;; reference. 240;; reference.
241;; 241;;
242;;--------------------------------------------------------------------------- 242;;---------------------------------------------------------------------------
243;; 243;;
244;; AUTHOR 244;; AUTHOR
@@ -322,7 +322,7 @@
322 (setq reftex-syntax-table (copy-syntax-table)) 322 (setq reftex-syntax-table (copy-syntax-table))
323 (modify-syntax-entry ?\( "." reftex-syntax-table) 323 (modify-syntax-entry ?\( "." reftex-syntax-table)
324 (modify-syntax-entry ?\) "." reftex-syntax-table)) 324 (modify-syntax-entry ?\) "." reftex-syntax-table))
325 325
326(unless reftex-syntax-table-for-bib 326(unless reftex-syntax-table-for-bib
327 (setq reftex-syntax-table-for-bib 327 (setq reftex-syntax-table-for-bib
328 (copy-syntax-table reftex-syntax-table)) 328 (copy-syntax-table reftex-syntax-table))
@@ -396,7 +396,7 @@
396 "Show the table of contents for the current document." t) 396 "Show the table of contents for the current document." t)
397(autoload 'reftex-toc-recenter "reftex-toc" 397(autoload 'reftex-toc-recenter "reftex-toc"
398 "Display the TOC window and highlight line corresponding to current position." t) 398 "Display the TOC window and highlight line corresponding to current position." t)
399(autoload 'reftex-toggle-auto-toc-recenter "reftex-toc" 399(autoload 'reftex-toggle-auto-toc-recenter "reftex-toc"
400 "Toggle automatic recentering of TOC window." t) 400 "Toggle automatic recentering of TOC window." t)
401 401
402;;; ========================================================================= 402;;; =========================================================================
@@ -561,7 +561,7 @@ on the menu bar.
561 (setq reftex-syntax-table (copy-syntax-table (syntax-table))) 561 (setq reftex-syntax-table (copy-syntax-table (syntax-table)))
562 (modify-syntax-entry ?\( "." reftex-syntax-table) 562 (modify-syntax-entry ?\( "." reftex-syntax-table)
563 (modify-syntax-entry ?\) "." reftex-syntax-table) 563 (modify-syntax-entry ?\) "." reftex-syntax-table)
564 564
565 (setq reftex-syntax-table-for-bib 565 (setq reftex-syntax-table-for-bib
566 (copy-syntax-table reftex-syntax-table)) 566 (copy-syntax-table reftex-syntax-table))
567 (modify-syntax-entry ?\' "." reftex-syntax-table-for-bib) 567 (modify-syntax-entry ?\' "." reftex-syntax-table-for-bib)
@@ -703,7 +703,7 @@ on the menu bar.
703 ((master 703 ((master
704 (cond 704 (cond
705 ((fboundp 'TeX-master-file) ; AUCTeX is loaded. Use its mechanism. 705 ((fboundp 'TeX-master-file) ; AUCTeX is loaded. Use its mechanism.
706 (condition-case nil 706 (condition-case nil
707 (TeX-master-file t) 707 (TeX-master-file t)
708 (error (buffer-file-name)))) 708 (error (buffer-file-name))))
709 ((fboundp 'tex-main-file) (tex-main-file)) ; Emacs LaTeX mode 709 ((fboundp 'tex-main-file) (tex-main-file)) ; Emacs LaTeX mode
@@ -904,14 +904,14 @@ the label information is recompiled on next use."
904 904
905;; A list of all variables in the cache. 905;; A list of all variables in the cache.
906;; The cache is used to save the compiled versions of some variables. 906;; The cache is used to save the compiled versions of some variables.
907(defconst reftex-cache-variables 907(defconst reftex-cache-variables
908 '(reftex-memory ;; This MUST ALWAYS be the first! 908 '(reftex-memory ;; This MUST ALWAYS be the first!
909 909
910 ;; Outline 910 ;; Outline
911 reftex-section-levels-all 911 reftex-section-levels-all
912 912
913 ;; Labels 913 ;; Labels
914 reftex-env-or-mac-alist 914 reftex-env-or-mac-alist
915 reftex-special-env-parsers 915 reftex-special-env-parsers
916 reftex-macros-with-labels 916 reftex-macros-with-labels
917 reftex-label-mac-list 917 reftex-label-mac-list
@@ -928,7 +928,7 @@ the label information is recompiled on next use."
928 reftex-index-macro-alist 928 reftex-index-macro-alist
929 reftex-macros-with-index 929 reftex-macros-with-index
930 reftex-query-index-macro-prompt 930 reftex-query-index-macro-prompt
931 reftex-query-index-macro-help 931 reftex-query-index-macro-help
932 reftex-key-to-index-macro-alist 932 reftex-key-to-index-macro-alist
933 933
934 ;; Regular expressions 934 ;; Regular expressions
@@ -973,7 +973,7 @@ the label information is recompiled on next use."
973 (t (reftex-compile-variables))))) 973 (t (reftex-compile-variables)))))
974 974
975(defun reftex-reset-mode () 975(defun reftex-reset-mode ()
976 "Reset RefTeX Mode. 976 "Reset RefTeX Mode.
977This will re-compile the configuration information and remove all 977This will re-compile the configuration information and remove all
978current scanning information and the parse file to enforce a rescan 978current scanning information and the parse file to enforce a rescan
979on next use." 979on next use."
@@ -1045,7 +1045,7 @@ This enforces rescanning the buffer on next use."
1045 1045
1046 ;; Record that we have done this, and what we have used. 1046 ;; Record that we have done this, and what we have used.
1047 (setq reftex-tables-dirty nil) 1047 (setq reftex-tables-dirty nil)
1048 (setq reftex-memory 1048 (setq reftex-memory
1049 (list reftex-label-alist 1049 (list reftex-label-alist
1050 (get reftex-docstruct-symbol 'reftex-section-levels) 1050 (get reftex-docstruct-symbol 'reftex-section-levels)
1051 (get reftex-docstruct-symbol 'reftex-label-alist-style) 1051 (get reftex-docstruct-symbol 'reftex-label-alist-style)
@@ -1064,7 +1064,7 @@ This enforces rescanning the buffer on next use."
1064 '(nil))) 1064 '(nil)))
1065 (all-index (reftex-uniquify-by-car 1065 (all-index (reftex-uniquify-by-car
1066 (reftex-splice-symbols-into-list 1066 (reftex-splice-symbols-into-list
1067 (append reftex-index-macros 1067 (append reftex-index-macros
1068 (get reftex-docstruct-symbol 1068 (get reftex-docstruct-symbol
1069 'reftex-index-macros-style) 1069 'reftex-index-macros-style)
1070 '(default)) 1070 '(default))
@@ -1075,7 +1075,7 @@ This enforces rescanning the buffer on next use."
1075 macro verify repeat nindex tag key toc-level toc-levels) 1075 macro verify repeat nindex tag key toc-level toc-levels)
1076 1076
1077 (setq reftex-words-to-typekey-alist nil 1077 (setq reftex-words-to-typekey-alist nil
1078 reftex-prefix-to-typekey-alist 1078 reftex-prefix-to-typekey-alist
1079 '(("sec:" . "s") ("cha:" . "s") ("chap:" . "s")) 1079 '(("sec:" . "s") ("cha:" . "s") ("chap:" . "s"))
1080 reftex-typekey-list nil 1080 reftex-typekey-list nil
1081 reftex-typekey-to-format-alist nil 1081 reftex-typekey-to-format-alist nil
@@ -1131,7 +1131,7 @@ This enforces rescanning the buffer on next use."
1131 ((symbolp env-or-mac) 1131 ((symbolp env-or-mac)
1132 ;; A special parser function 1132 ;; A special parser function
1133 (unless (fboundp env-or-mac) 1133 (unless (fboundp env-or-mac)
1134 (message "Warning: %s does not seem to be a valid function" 1134 (message "Warning: %s does not seem to be a valid function"
1135 env-or-mac)) 1135 env-or-mac))
1136 (setq nargs nil nlabel nil opt-args nil) 1136 (setq nargs nil nlabel nil opt-args nil)
1137 (add-to-list 'reftex-special-env-parsers env-or-mac) 1137 (add-to-list 'reftex-special-env-parsers env-or-mac)
@@ -1159,8 +1159,8 @@ This enforces rescanning the buffer on next use."
1159 (push (cons string toc-level) toc-levels)))))))) 1159 (push (cons string toc-level) toc-levels))))))))
1160 ;; Translate some special context cases 1160 ;; Translate some special context cases
1161 (when (assq context reftex-default-context-regexps) 1161 (when (assq context reftex-default-context-regexps)
1162 (setq context 1162 (setq context
1163 (format 1163 (format
1164 (cdr (assq context reftex-default-context-regexps)) 1164 (cdr (assq context reftex-default-context-regexps))
1165 (regexp-quote env-or-mac)))) 1165 (regexp-quote env-or-mac))))
1166 ;; See if this is the first format for this typekey 1166 ;; See if this is the first format for this typekey
@@ -1193,7 +1193,7 @@ This enforces rescanning the buffer on next use."
1193 (nreverse reftex-typekey-to-prefix-alist)) 1193 (nreverse reftex-typekey-to-prefix-alist))
1194 1194
1195 ;; Prepare the typekey query prompt and help string. 1195 ;; Prepare the typekey query prompt and help string.
1196 (setq qh-list 1196 (setq qh-list
1197 (sort qh-list 1197 (sort qh-list
1198 (lambda (x1 x2) 1198 (lambda (x1 x2)
1199 (string< (downcase (car x1)) (downcase (car x2)))))) 1199 (string< (downcase (car x1)) (downcase (car x2))))))
@@ -1204,7 +1204,7 @@ This enforces rescanning the buffer on next use."
1204 "]")) 1204 "]"))
1205 ;; In the help string, we need to wrap lines... 1205 ;; In the help string, we need to wrap lines...
1206 (setq reftex-type-query-help 1206 (setq reftex-type-query-help
1207 (concat 1207 (concat
1208 "SELECT A LABEL TYPE:\n--------------------\n" 1208 "SELECT A LABEL TYPE:\n--------------------\n"
1209 (mapconcat 1209 (mapconcat
1210 (lambda(x) 1210 (lambda(x)
@@ -1224,7 +1224,7 @@ This enforces rescanning the buffer on next use."
1224 ;; which allow for some chars from the ref format to be in the buffer. 1224 ;; which allow for some chars from the ref format to be in the buffer.
1225 ;; These characters will be seen and removed. 1225 ;; These characters will be seen and removed.
1226 (setq reftex-words-to-typekey-alist 1226 (setq reftex-words-to-typekey-alist
1227 (mapcar 1227 (mapcar
1228 (lambda (x) 1228 (lambda (x)
1229 (setq word (car x) 1229 (setq word (car x)
1230 typekey (cdr x) 1230 typekey (cdr x)
@@ -1277,18 +1277,18 @@ This enforces rescanning the buffer on next use."
1277 (setq reftex-key-to-index-macro-alist 1277 (setq reftex-key-to-index-macro-alist
1278 (sort reftex-key-to-index-macro-alist 1278 (sort reftex-key-to-index-macro-alist
1279 (lambda (a b) (< (downcase (car a)) (downcase (car b)))))) 1279 (lambda (a b) (< (downcase (car a)) (downcase (car b))))))
1280 (setq reftex-query-index-macro-prompt 1280 (setq reftex-query-index-macro-prompt
1281 (concat "Index macro: [" 1281 (concat "Index macro: ["
1282 (mapconcat (lambda (x) (char-to-string (car x))) 1282 (mapconcat (lambda (x) (char-to-string (car x)))
1283 reftex-key-to-index-macro-alist "") 1283 reftex-key-to-index-macro-alist "")
1284 "]")) 1284 "]"))
1285 (setq i 0 1285 (setq i 0
1286 reftex-query-index-macro-help 1286 reftex-query-index-macro-help
1287 (concat 1287 (concat
1288 "SELECT A MACRO:\n---------------\n" 1288 "SELECT A MACRO:\n---------------\n"
1289 (mapconcat 1289 (mapconcat
1290 (lambda(x) 1290 (lambda(x)
1291 (format "[%c] %-20.20s%s" (car x) (nth 1 x) 1291 (format "[%c] %-20.20s%s" (car x) (nth 1 x)
1292 (if (= 0 (mod (incf i) 3)) "\n" ""))) 1292 (if (= 0 (mod (incf i) 3)) "\n" "")))
1293 reftex-key-to-index-macro-alist ""))) 1293 reftex-key-to-index-macro-alist "")))
1294 1294
@@ -1302,11 +1302,11 @@ This enforces rescanning the buffer on next use."
1302 (let* ( 1302 (let* (
1303; (wbol "\\(\\`\\|[\n\r]\\)[ \t]*") 1303; (wbol "\\(\\`\\|[\n\r]\\)[ \t]*")
1304 (wbol "\\(^\\)[ \t]*") ; Need to keep the empty group because 1304 (wbol "\\(^\\)[ \t]*") ; Need to keep the empty group because
1305 ;;; because match number are hard coded 1305 ;;; because match number are hard coded
1306 (label-re "\\\\label{\\([^}]*\\)}") 1306 (label-re "\\\\label{\\([^}]*\\)}")
1307 (include-re (concat wbol 1307 (include-re (concat wbol
1308 "\\\\\\(" 1308 "\\\\\\("
1309 (mapconcat 'identity 1309 (mapconcat 'identity
1310 reftex-include-file-commands "\\|") 1310 reftex-include-file-commands "\\|")
1311 "\\)[{ \t]+\\([^} \t\n\r]+\\)")) 1311 "\\)[{ \t]+\\([^} \t\n\r]+\\)"))
1312 (section-re 1312 (section-re
@@ -1360,7 +1360,7 @@ This enforces rescanning the buffer on next use."
1360 reftex-macros-with-labels macros-with-labels 1360 reftex-macros-with-labels macros-with-labels
1361 reftex-find-index-entry-regexp-format find-index-re-format 1361 reftex-find-index-entry-regexp-format find-index-re-format
1362 reftex-find-label-regexp-format find-label-re-format 1362 reftex-find-label-regexp-format find-label-re-format
1363 reftex-find-label-regexp-format2 1363 reftex-find-label-regexp-format2
1364 "\\([]} \t\n\r]\\)\\([[{]\\)\\(%s\\)[]}]") 1364 "\\([]} \t\n\r]\\)\\([[{]\\)\\(%s\\)[]}]")
1365 (message "Compiling label environment definitions...done"))) 1365 (message "Compiling label environment definitions...done")))
1366 (put reftex-docstruct-symbol 'reftex-cache 1366 (put reftex-docstruct-symbol 'reftex-cache
@@ -1437,7 +1437,7 @@ This enforces rescanning the buffer on next use."
1437 (and (symbolp reftex-docstruct-symbol) 1437 (and (symbolp reftex-docstruct-symbol)
1438 (symbol-value reftex-docstruct-symbol) 1438 (symbol-value reftex-docstruct-symbol)
1439 t)) 1439 t))
1440 1440
1441(defun reftex-silence-toc-markers (list n) 1441(defun reftex-silence-toc-markers (list n)
1442 ;; Set all toc markers in the first N entries in list to nil 1442 ;; Set all toc markers in the first N entries in list to nil
1443 (while (and list (> (decf n) -1)) 1443 (while (and list (> (decf n) -1))
@@ -1454,7 +1454,7 @@ Valid actions are: readable, restore, read, kill, write."
1454 (master (reftex-TeX-master-file)) 1454 (master (reftex-TeX-master-file))
1455 (enable-local-variables nil) 1455 (enable-local-variables nil)
1456 (file (if (string-match "\\.[a-zA-Z]+\\'" master) 1456 (file (if (string-match "\\.[a-zA-Z]+\\'" master)
1457 (concat (substring master 0 (match-beginning 0)) 1457 (concat (substring master 0 (match-beginning 0))
1458 reftex-parse-file-extension) 1458 reftex-parse-file-extension)
1459 (concat master reftex-parse-file-extension)))) 1459 (concat master reftex-parse-file-extension))))
1460 (cond 1460 (cond
@@ -1529,7 +1529,7 @@ Valid actions are: readable, restore, read, kill, write."
1529 1529
1530 ;; Check if the master is the same: when moving a document, this will see it. 1530 ;; Check if the master is the same: when moving a document, this will see it.
1531 (let* ((real-master (reftex-TeX-master-file)) 1531 (let* ((real-master (reftex-TeX-master-file))
1532 (parsed-master 1532 (parsed-master
1533 (nth 1 (assq 'bof (symbol-value reftex-docstruct-symbol))))) 1533 (nth 1 (assq 'bof (symbol-value reftex-docstruct-symbol)))))
1534 (unless (string= (file-truename real-master) (file-truename parsed-master)) 1534 (unless (string= (file-truename real-master) (file-truename parsed-master))
1535 (message "Master file name in load file is different: %s versus %s" 1535 (message "Master file name in load file is different: %s versus %s"
@@ -1549,7 +1549,7 @@ Valid actions are: readable, restore, read, kill, write."
1549(defun reftex-select-external-document (xr-alist xr-index) 1549(defun reftex-select-external-document (xr-alist xr-index)
1550 ;; Return index of an external document. 1550 ;; Return index of an external document.
1551 (let* ((len (length xr-alist)) (highest (1- (+ ?0 len))) 1551 (let* ((len (length xr-alist)) (highest (1- (+ ?0 len)))
1552 (prompt (format "[%c-%c] Select TAB: Read prefix with completion" 1552 (prompt (format "[%c-%c] Select TAB: Read prefix with completion"
1553 ?0 highest)) 1553 ?0 highest))
1554 key prefix) 1554 key prefix)
1555 (cond 1555 (cond
@@ -1560,7 +1560,7 @@ Valid actions are: readable, restore, read, kill, write."
1560 (- 1 xr-index)) 1560 (- 1 xr-index))
1561 (t 1561 (t
1562 (save-excursion 1562 (save-excursion
1563 (let* ((length (apply 'max (mapcar 1563 (let* ((length (apply 'max (mapcar
1564 (lambda(x) (length (car x))) xr-alist))) 1564 (lambda(x) (length (car x))) xr-alist)))
1565 (fmt (format " [%%c] %%-%ds %%s\n" length)) 1565 (fmt (format " [%%c] %%-%ds %%s\n" length))
1566 (n (1- ?0))) 1566 (n (1- ?0)))
@@ -1570,7 +1570,7 @@ Valid actions are: readable, restore, read, kill, write."
1570 (concat 1570 (concat
1571 "SELECT EXTERNAL DOCUMENT\n------------------------\n" 1571 "SELECT EXTERNAL DOCUMENT\n------------------------\n"
1572 (mapconcat 1572 (mapconcat
1573 (lambda (x) 1573 (lambda (x)
1574 (format fmt (incf n) (or (car x) "") 1574 (format fmt (incf n) (or (car x) "")
1575 (abbreviate-file-name (cdr x)))) 1575 (abbreviate-file-name (cdr x))))
1576 xr-alist "")) 1576 xr-alist ""))
@@ -1594,7 +1594,7 @@ When DIE is non-nil, throw an error if file not found."
1594 (let* ((rec-values (if reftex-search-unrecursed-path-first '(nil t) '(t))) 1594 (let* ((rec-values (if reftex-search-unrecursed-path-first '(nil t) '(t)))
1595 (extensions (cdr (assoc type reftex-file-extensions))) 1595 (extensions (cdr (assoc type reftex-file-extensions)))
1596 (def-ext (car extensions)) 1596 (def-ext (car extensions))
1597 (ext-re (concat "\\(" 1597 (ext-re (concat "\\("
1598 (mapconcat 'regexp-quote extensions "\\|") 1598 (mapconcat 'regexp-quote extensions "\\|")
1599 "\\)\\'")) 1599 "\\)\\'"))
1600 (files (if (string-match ext-re file) 1600 (files (if (string-match ext-re file)
@@ -1667,7 +1667,7 @@ When DIE is non-nil, throw an error if file not found."
1667 (reftex-uniquify 1667 (reftex-uniquify
1668 (reftex-parse-colon-path 1668 (reftex-parse-colon-path
1669 (mapconcat 1669 (mapconcat
1670 (lambda(x) 1670 (lambda(x)
1671 (if (string-match "^!" x) 1671 (if (string-match "^!" x)
1672 (apply 'reftex-process-string 1672 (apply 'reftex-process-string
1673 (split-string (substring x 1))) 1673 (split-string (substring x 1)))
@@ -1676,7 +1676,7 @@ When DIE is non-nil, throw an error if file not found."
1676 ;; (cdr (assoc type reftex-path-environment)) 1676 ;; (cdr (assoc type reftex-path-environment))
1677 ;; However, historically we have separate options for the 1677 ;; However, historically we have separate options for the
1678 ;; environment variables, so we have to do this: 1678 ;; environment variables, so we have to do this:
1679 (symbol-value (intern (concat "reftex-" type 1679 (symbol-value (intern (concat "reftex-" type
1680 "path-environment-variables"))) 1680 "path-environment-variables")))
1681 path-separator)))) 1681 path-separator))))
1682 (put pathvar 'status 'split) 1682 (put pathvar 'status 'split)
@@ -1702,11 +1702,11 @@ When DIE is non-nil, throw an error if file not found."
1702 ;; or: Relative recursive path elements need to be expanded 1702 ;; or: Relative recursive path elements need to be expanded
1703 ;; relative to new default directory 1703 ;; relative to new default directory
1704 (message "Expanding search path to find %s file: %s ..." type file) 1704 (message "Expanding search path to find %s file: %s ..." type file)
1705 (put pathvar 'recursive-path 1705 (put pathvar 'recursive-path
1706 (reftex-expand-path (symbol-value pathvar) master-dir)) 1706 (reftex-expand-path (symbol-value pathvar) master-dir))
1707 (put pathvar 'master-dir master-dir) 1707 (put pathvar 'master-dir master-dir)
1708 (get pathvar 'recursive-path)) 1708 (get pathvar 'recursive-path))
1709 (t 1709 (t
1710 ;; Recursive path computed earlier is still OK. 1710 ;; Recursive path computed earlier is still OK.
1711 (get pathvar 'recursive-path))) 1711 (get pathvar 'recursive-path)))
1712 ;; The simple path was requested 1712 ;; The simple path was requested
@@ -1735,7 +1735,7 @@ When DIE is non-nil, throw an error if file not found."
1735 ;; Trailing ! or !! will be converted into `//' (emTeX convention) 1735 ;; Trailing ! or !! will be converted into `//' (emTeX convention)
1736 (mapcar 1736 (mapcar
1737 (lambda (dir) 1737 (lambda (dir)
1738 (if (string-match "\\(//+\\|/*!+\\)\\'" dir) 1738 (if (string-match "\\(//+\\|/*!+\\)\\'" dir)
1739 (setq dir (replace-match "//" t t dir))) 1739 (setq dir (replace-match "//" t t dir)))
1740 (file-name-as-directory dir)) 1740 (file-name-as-directory dir))
1741 (delete "" (split-string path (concat path-separator "+"))))) 1741 (delete "" (split-string path (concat path-separator "+")))))
@@ -1764,7 +1764,7 @@ When DIE is non-nil, throw an error if file not found."
1764 (when (file-directory-p dir) 1764 (when (file-directory-p dir)
1765 (setq files (nreverse (directory-files dir t "[^.]"))) 1765 (setq files (nreverse (directory-files dir t "[^.]")))
1766 (while (setq file (pop files)) 1766 (while (setq file (pop files))
1767 (if (file-directory-p file) 1767 (if (file-directory-p file)
1768 (push (file-name-as-directory file) path))) 1768 (push (file-name-as-directory file) path)))
1769 (push dir path1))) 1769 (push dir path1)))
1770 path1)) 1770 path1))
@@ -1883,7 +1883,7 @@ When DIE is non-nil, throw an error if file not found."
1883 (while list 1883 (while list
1884 (if (funcall predicate (car list)) 1884 (if (funcall predicate (car list))
1885 (push (if completion 1885 (push (if completion
1886 (list (nth nth (car list))) 1886 (list (nth nth (car list)))
1887 (nth nth (car list))) 1887 (nth nth (car list)))
1888 rtn)) 1888 rtn))
1889 (setq list (cdr list))) 1889 (setq list (cdr list)))
@@ -1919,7 +1919,7 @@ When DIE is non-nil, throw an error if file not found."
1919 ;; If POS is given, calculate distances relative to it. 1919 ;; If POS is given, calculate distances relative to it.
1920 ;; Return nil if there is no match. 1920 ;; Return nil if there is no match.
1921 (let ((pos (point)) 1921 (let ((pos (point))
1922 (dist (or max-length (length regexp))) 1922 (dist (or max-length (length regexp)))
1923 match1 match2 match) 1923 match1 match2 match)
1924 (goto-char (min (+ pos dist) (point-max))) 1924 (goto-char (min (+ pos dist) (point-max)))
1925 (when (re-search-backward regexp nil t) 1925 (when (re-search-backward regexp nil t)
@@ -2005,10 +2005,10 @@ When DIE is non-nil, throw an error if file not found."
2005 ((and scroll (equal char ?\C-? )) 2005 ((and scroll (equal char ?\C-? ))
2006 (condition-case nil (scroll-down) (error nil)) 2006 (condition-case nil (scroll-down) (error nil))
2007 (message "%s" prompt)) 2007 (message "%s" prompt))
2008 (t (message "") 2008 (t (message "")
2009 (throw 'exit char))) 2009 (throw 'exit char)))
2010 (setq char (read-char-exclusive))))))) 2010 (setq char (read-char-exclusive)))))))
2011 2011
2012 2012
2013(defun reftex-make-regexp-allow-for-ctrl-m (string) 2013(defun reftex-make-regexp-allow-for-ctrl-m (string)
2014 ;; convert STRING into a regexp, allowing ^M for \n and vice versa 2014 ;; convert STRING into a regexp, allowing ^M for \n and vice versa
@@ -2206,10 +2206,10 @@ IGNORE-WORDS List of words which should be removed from the string."
2206 ;; Restrict number of words 2206 ;; Restrict number of words
2207 (if (> (length words) nwords) 2207 (if (> (length words) nwords)
2208 (setcdr (nthcdr (1- nwords) words) nil)) 2208 (setcdr (nthcdr (1- nwords) words) nil))
2209 2209
2210 ;; First, try to use all words 2210 ;; First, try to use all words
2211 (setq string (mapconcat 'identity words sep)) 2211 (setq string (mapconcat 'identity words sep))
2212 2212
2213 ;; Abbreviate words if enforced by user settings or string length 2213 ;; Abbreviate words if enforced by user settings or string length
2214 (if (or (eq t abbrev) 2214 (if (or (eq t abbrev)
2215 (and abbrev 2215 (and abbrev
@@ -2301,7 +2301,7 @@ IGNORE-WORDS List of words which should be removed from the string."
2301 (font-lock-set-defaults-1) 2301 (font-lock-set-defaults-1)
2302 (reftex-select-font-lock-fontify-region (point-min) (point-max)))) 2302 (reftex-select-font-lock-fontify-region (point-min) (point-max))))
2303 (t 2303 (t
2304 ;; Oops? 2304 ;; Oops?
2305 (message "Sorry: cannot refontify RefTeX Select buffer.")))) 2305 (message "Sorry: cannot refontify RefTeX Select buffer."))))
2306 (rename-buffer oldname)))) 2306 (rename-buffer oldname))))
2307 2307
@@ -2348,7 +2348,7 @@ IGNORE-WORDS List of words which should be removed from the string."
2348 2348
2349;; Initialize the overlays 2349;; Initialize the overlays
2350(aset reftex-highlight-overlays 0 (reftex-make-overlay 1 1)) 2350(aset reftex-highlight-overlays 0 (reftex-make-overlay 1 1))
2351(reftex-overlay-put (aref reftex-highlight-overlays 0) 2351(reftex-overlay-put (aref reftex-highlight-overlays 0)
2352 'face 'highlight) 2352 'face 'highlight)
2353(aset reftex-highlight-overlays 1 (reftex-make-overlay 1 1)) 2353(aset reftex-highlight-overlays 1 (reftex-make-overlay 1 1))
2354(reftex-overlay-put (aref reftex-highlight-overlays 1) 2354(reftex-overlay-put (aref reftex-highlight-overlays 1)
@@ -2373,7 +2373,7 @@ IGNORE-WORDS List of words which should be removed from the string."
2373 2373
2374;;; ========================================================================= 2374;;; =========================================================================
2375;;; 2375;;;
2376;;; Keybindings 2376;;; Keybindings
2377 2377
2378;; The default bindings in the mode map. 2378;; The default bindings in the mode map.
2379(loop for x in 2379(loop for x in
@@ -2393,10 +2393,10 @@ IGNORE-WORDS List of words which should be removed from the string."
2393;; Bind `reftex-mouse-view-crossref' only when the key is still free 2393;; Bind `reftex-mouse-view-crossref' only when the key is still free
2394(if (featurep 'xemacs) 2394(if (featurep 'xemacs)
2395 (unless (key-binding [(shift button2)]) 2395 (unless (key-binding [(shift button2)])
2396 (define-key reftex-mode-map [(shift button2)] 2396 (define-key reftex-mode-map [(shift button2)]
2397 'reftex-mouse-view-crossref)) 2397 'reftex-mouse-view-crossref))
2398 (unless (key-binding [(shift mouse-2)]) 2398 (unless (key-binding [(shift mouse-2)])
2399 (define-key reftex-mode-map [(shift mouse-2)] 2399 (define-key reftex-mode-map [(shift mouse-2)]
2400 'reftex-mouse-view-crossref))) 2400 'reftex-mouse-view-crossref)))
2401 2401
2402;; Bind `reftex-view-crossref-from-bibtex' in BibTeX mode map 2402;; Bind `reftex-view-crossref-from-bibtex' in BibTeX mode map
@@ -2498,7 +2498,7 @@ IGNORE-WORDS List of words which should be removed from the string."
2498 ("Reference Style" 2498 ("Reference Style"
2499 ["Default" (setq reftex-vref-is-default nil 2499 ["Default" (setq reftex-vref-is-default nil
2500 reftex-fref-is-default nil) 2500 reftex-fref-is-default nil)
2501 :style radio :selected (not (or reftex-vref-is-default 2501 :style radio :selected (not (or reftex-vref-is-default
2502 reftex-fref-is-default))] 2502 reftex-fref-is-default))]
2503 ["Varioref" (setq reftex-vref-is-default t 2503 ["Varioref" (setq reftex-vref-is-default t
2504 reftex-fref-is-default nil) 2504 reftex-fref-is-default nil)
@@ -2533,7 +2533,7 @@ IGNORE-WORDS List of words which should be removed from the string."
2533 (list 'reftex-add-index-macros (list 'list (list 'quote (car x)))) 2533 (list 'reftex-add-index-macros (list 'list (list 'quote (car x))))
2534 :style 'radio :selected 2534 :style 'radio :selected
2535 (list 'memq (list 'quote (car x)) 2535 (list 'memq (list 'quote (car x))
2536 (list 'get 'reftex-docstruct-symbol 2536 (list 'get 'reftex-docstruct-symbol
2537 (list 'quote 'reftex-index-macros-style))))) 2537 (list 'quote 'reftex-index-macros-style)))))
2538 reftex-index-macros-builtin)) 2538 reftex-index-macros-builtin))
2539 "--" 2539 "--"
@@ -2542,7 +2542,7 @@ IGNORE-WORDS List of words which should be removed from the string."
2542 ("Customize" 2542 ("Customize"
2543 ["Browse RefTeX Group" reftex-customize t] 2543 ["Browse RefTeX Group" reftex-customize t]
2544 "--" 2544 "--"
2545 ["Build Full Customize Menu" reftex-create-customize-menu 2545 ["Build Full Customize Menu" reftex-create-customize-menu
2546 (fboundp 'customize-menu-create)]) 2546 (fboundp 'customize-menu-create)])
2547 ("Documentation" 2547 ("Documentation"
2548 ["Info" reftex-info t] 2548 ["Info" reftex-info t]
@@ -2558,7 +2558,7 @@ IGNORE-WORDS List of words which should be removed from the string."
2558 (interactive) 2558 (interactive)
2559 (if (fboundp 'customize-menu-create) 2559 (if (fboundp 'customize-menu-create)
2560 (progn 2560 (progn
2561 (easy-menu-change 2561 (easy-menu-change
2562 '("Ref") "Customize" 2562 '("Ref") "Customize"
2563 `(["Browse RefTeX group" reftex-customize t] 2563 `(["Browse RefTeX group" reftex-customize t]
2564 "--" 2564 "--"
@@ -2574,15 +2574,13 @@ IGNORE-WORDS List of words which should be removed from the string."
2574(defun reftex-show-commentary () 2574(defun reftex-show-commentary ()
2575 "Use the finder to view the file documentation from `reftex.el'." 2575 "Use the finder to view the file documentation from `reftex.el'."
2576 (interactive) 2576 (interactive)
2577 (require 'finder)
2578 (finder-commentary "reftex.el")) 2577 (finder-commentary "reftex.el"))
2579 2578
2580(defun reftex-info (&optional node) 2579(defun reftex-info (&optional node)
2581 "Read documentation for RefTeX in the info system. 2580 "Read documentation for RefTeX in the info system.
2582With optional NODE, go directly to that node." 2581With optional NODE, go directly to that node."
2583 (interactive) 2582 (interactive)
2584 (eval-and-compile (require 'info)) 2583 (info (format "(reftex)%s" (or node ""))))
2585 (Info-goto-node (format "(reftex)%s" (or node ""))))
2586 2584
2587;;; Install the kill-buffer and kill-emacs hooks ------------------------------ 2585;;; Install the kill-buffer and kill-emacs hooks ------------------------------
2588 2586
@@ -2596,7 +2594,7 @@ With optional NODE, go directly to that node."
2596;;; That's it! ---------------------------------------------------------------- 2594;;; That's it! ----------------------------------------------------------------
2597 2595
2598(setq reftex-tables-dirty t) ; in case this file is evaluated by hand 2596(setq reftex-tables-dirty t) ; in case this file is evaluated by hand
2599(provide 'reftex) 2597(provide 'reftex)
2600 2598
2601;;;============================================================================ 2599;;;============================================================================
2602 2600