aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuanma Barranquero2003-01-29 11:54:35 +0000
committerJuanma Barranquero2003-01-29 11:54:35 +0000
commit12a382d45e26f717fdf4e0beb2365f75405f9435 (patch)
tree6a4ab71e244297bf7eedfb5ed0f086dd5bc4d379
parent47fb27231c47c16d064aca4afaf9c6c90d2e636b (diff)
downloademacs-12a382d45e26f717fdf4e0beb2365f75405f9435.tar.gz
emacs-12a382d45e26f717fdf4e0beb2365f75405f9435.zip
(reftex-TeX-master-file): Use really the buffer file name if no other master
file is located.
-rw-r--r--lisp/textmodes/reftex.el174
1 files changed, 87 insertions, 87 deletions
diff --git a/lisp/textmodes/reftex.el b/lisp/textmodes/reftex.el
index 5bdc1702e9e..f484b1da9e2 100644
--- a/lisp/textmodes/reftex.el
+++ b/lisp/textmodes/reftex.el
@@ -25,7 +25,7 @@
25;;--------------------------------------------------------------------------- 25;;---------------------------------------------------------------------------
26;; 26;;
27;;; Commentary: 27;;; Commentary:
28;; 28;;
29;; RefTeX is a minor mode with distinct support for \ref, \label, \cite, 29;; RefTeX is a minor mode with distinct support for \ref, \label, \cite,
30;; and \index commands in (multi-file) LaTeX documents. 30;; and \index commands in (multi-file) LaTeX documents.
31;; - A table of contents provides easy access to any part of a document. 31;; - A table of contents provides easy access to any part of a document.
@@ -70,7 +70,7 @@
70;; 70;;
71;; Introduction 71;; Introduction
72;; ************ 72;; ************
73;; 73;;
74;; RefTeX is a specialized package for support of labels, references, 74;; RefTeX is a specialized package for support of labels, references,
75;; citations, and the index in LaTeX. RefTeX wraps itself round 4 LaTeX 75;; citations, and the index in LaTeX. RefTeX wraps itself round 4 LaTeX
76;; macros: `\label', `\ref', `\cite', and `\index'. Using these macros 76;; macros: `\label', `\ref', `\cite', and `\index'. Using these macros
@@ -79,13 +79,13 @@
79;; time-consuming tasks almost entirely. It also provides functions to 79;; time-consuming tasks almost entirely. It also provides functions to
80;; display the structure of a document and to move around in this 80;; display the structure of a document and to move around in this
81;; structure quickly. 81;; structure quickly.
82;; 82;;
83;; *Note Imprint::, for information about who to contact for help, bug 83;; *Note Imprint::, for information about who to contact for help, bug
84;; reports or suggestions. 84;; reports or suggestions.
85;; 85;;
86;; Environment 86;; Environment
87;; =========== 87;; ===========
88;; 88;;
89;; RefTeX needs to access all files which are part of a multifile 89;; RefTeX needs to access all files which are part of a multifile
90;; document, and the BibTeX database files requested by the 90;; document, and the BibTeX database files requested by the
91;; `\bibliography' command. To find these files, RefTeX will require a 91;; `\bibliography' command. To find these files, RefTeX will require a
@@ -94,26 +94,26 @@
94;; which are also used by RefTeX. However, on some systems these 94;; which are also used by RefTeX. However, on some systems these
95;; variables do not contain the full search path. If RefTeX does not work 95;; variables do not contain the full search path. If RefTeX does not work
96;; for you because it cannot find some files, read *Note Finding Files::. 96;; for you because it cannot find some files, read *Note Finding Files::.
97;; 97;;
98;; Entering RefTeX Mode 98;; Entering RefTeX Mode
99;; ==================== 99;; ====================
100;; 100;;
101;; To turn RefTeX Mode on and off in a particular buffer, use `M-x 101;; To turn RefTeX Mode on and off in a particular buffer, use `M-x
102;; reftex-mode'. To turn on RefTeX Mode for all LaTeX files, add the 102;; reftex-mode'. To turn on RefTeX Mode for all LaTeX files, add the
103;; following lines to your `.emacs' file: 103;; following lines to your `.emacs' file:
104;; 104;;
105;; (add-hook 'LaTeX-mode-hook 'turn-on-reftex) ; with AUCTeX LaTeX mode 105;; (add-hook 'LaTeX-mode-hook 'turn-on-reftex) ; with AUCTeX LaTeX mode
106;; (add-hook 'latex-mode-hook 'turn-on-reftex) ; with Emacs latex mode 106;; (add-hook 'latex-mode-hook 'turn-on-reftex) ; with Emacs latex mode
107;; 107;;
108;; RefTeX in a Nutshell 108;; RefTeX in a Nutshell
109;; ==================== 109;; ====================
110;; 110;;
111;; 1. Table of Contents 111;; 1. Table of Contents
112;; Typing `C-c =' (`reftex-toc') will show a table of contents of the 112;; Typing `C-c =' (`reftex-toc') will show a table of contents of the
113;; document. This buffer can display sections, labels and index 113;; document. This buffer can display sections, labels and index
114;; entries defined in the document. From the buffer, you can jump 114;; entries defined in the document. From the buffer, you can jump
115;; quickly to every part of your document. Press `?' to get help. 115;; quickly to every part of your document. Press `?' to get help.
116;; 116;;
117;; 2. Labels and References 117;; 2. Labels and References
118;; RefTeX helps to create unique labels and to find the correct key 118;; RefTeX helps to create unique labels and to find the correct key
119;; for references quickly. It distinguishes labels for different 119;; for references quickly. It distinguishes labels for different
@@ -121,7 +121,7 @@
121;; others), and can be configured to recognize any additional labeled 121;; others), and can be configured to recognize any additional labeled
122;; environments you have defined yourself (variable 122;; environments you have defined yourself (variable
123;; `reftex-label-alist'). 123;; `reftex-label-alist').
124;; 124;;
125;; * Creating Labels 125;; * Creating Labels
126;; Type `C-c (' (`reftex-label') to insert a label at point. 126;; Type `C-c (' (`reftex-label') to insert a label at point.
127;; RefTeX will either 127;; RefTeX will either
@@ -130,17 +130,17 @@
130;; tables) or 130;; tables) or
131;; - insert a simple label made of a prefix and a number (all 131;; - insert a simple label made of a prefix and a number (all
132;; other environments) 132;; other environments)
133;; 133;;
134;; Which labels are created how is configurable with the variable 134;; Which labels are created how is configurable with the variable
135;; `reftex-insert-label-flags'. 135;; `reftex-insert-label-flags'.
136;; 136;;
137;; * Referencing Labels 137;; * Referencing Labels
138;; To make a reference, type `C-c )' (`reftex-reference'). This 138;; To make a reference, type `C-c )' (`reftex-reference'). This
139;; shows an outline of the document with all labels of a certain 139;; shows an outline of the document with all labels of a certain
140;; type (figure, equation,...) and some label context. 140;; type (figure, equation,...) and some label context.
141;; Selecting a label inserts a `\ref{LABEL}' macro into the 141;; Selecting a label inserts a `\ref{LABEL}' macro into the
142;; original buffer. 142;; original buffer.
143;; 143;;
144;; 3. Citations 144;; 3. Citations
145;; Typing `C-c [' (`reftex-citation') will let you specify a regular 145;; Typing `C-c [' (`reftex-citation') will let you specify a regular
146;; expression to search in current BibTeX database files (as 146;; expression to search in current BibTeX database files (as
@@ -149,7 +149,7 @@
149;; sorted. The selected article is referenced as `\cite{KEY}' (see 149;; sorted. The selected article is referenced as `\cite{KEY}' (see
150;; the variable `reftex-cite-format' if you want to insert different 150;; the variable `reftex-cite-format' if you want to insert different
151;; macros). 151;; macros).
152;; 152;;
153;; 4. Index Support 153;; 4. Index Support
154;; RefTeX helps to enter index entries. It also compiles all entries 154;; RefTeX helps to enter index entries. It also compiles all entries
155;; into an alphabetically sorted `*Index*' buffer which you can use 155;; into an alphabetically sorted `*Index*' buffer which you can use
@@ -157,25 +157,25 @@
157;; index macros and can be configured to recognize any additional 157;; index macros and can be configured to recognize any additional
158;; macros you have defined (`reftex-index-macros'). Multiple indices 158;; macros you have defined (`reftex-index-macros'). Multiple indices
159;; are supported. 159;; are supported.
160;; 160;;
161;; * Creating Index Entries 161;; * Creating Index Entries
162;; To index the current selection or the word at point, type 162;; To index the current selection or the word at point, type
163;; `C-c /' (`reftex-index-selection-or-word'). The default macro 163;; `C-c /' (`reftex-index-selection-or-word'). The default macro
164;; `reftex-index-default-macro' will be used. For a more 164;; `reftex-index-default-macro' will be used. For a more
165;; complex entry type `C-c <' (`reftex-index'), select any of 165;; complex entry type `C-c <' (`reftex-index'), select any of
166;; the index macros and enter the arguments with completion. 166;; the index macros and enter the arguments with completion.
167;; 167;;
168;; * The Index Phrases File (Delayed Indexing) 168;; * The Index Phrases File (Delayed Indexing)
169;; Type `C-c \' (`reftex-index-phrase-selection-or-word') to add 169;; Type `C-c \' (`reftex-index-phrase-selection-or-word') to add
170;; the current word or selection to a special _index phrase 170;; the current word or selection to a special _index phrase
171;; file_. RefTeX can later search the document for occurrences 171;; file_. RefTeX can later search the document for occurrences
172;; of these phrases and let you interactively index the matches. 172;; of these phrases and let you interactively index the matches.
173;; 173;;
174;; * Displaying and Editing the Index 174;; * Displaying and Editing the Index
175;; To display the compiled index in a special buffer, type `C-c 175;; To display the compiled index in a special buffer, type `C-c
176;; >' (`reftex-display-index'). From that buffer you can check 176;; >' (`reftex-display-index'). From that buffer you can check
177;; and edit all entries. 177;; and edit all entries.
178;; 178;;
179;; 5. Viewing Cross-References 179;; 5. Viewing Cross-References
180;; When point is on the KEY argument of a cross-referencing macro 180;; When point is on the KEY argument of a cross-referencing macro
181;; (`\label', `\ref', `\cite', `\bibitem', `\index', and variations) 181;; (`\label', `\ref', `\cite', `\bibitem', `\index', and variations)
@@ -185,14 +185,14 @@
185;; When the enclosing macro is `\cite' or `\ref' and no other message 185;; When the enclosing macro is `\cite' or `\ref' and no other message
186;; occupies the echo area, information about the citation or label 186;; occupies the echo area, information about the citation or label
187;; will automatically be displayed in the echo area. 187;; will automatically be displayed in the echo area.
188;; 188;;
189;; 6. Multifile Documents 189;; 6. Multifile Documents
190;; Multifile Documents are fully supported. The included files must 190;; Multifile Documents are fully supported. The included files must
191;; have a file variable `TeX-master' or `tex-main-file' pointing to 191;; have a file variable `TeX-master' or `tex-main-file' pointing to
192;; the master file. RefTeX provides cross-referencing information 192;; the master file. RefTeX provides cross-referencing information
193;; from all parts of the document, and across document borders 193;; from all parts of the document, and across document borders
194;; (`xr.sty'). 194;; (`xr.sty').
195;; 195;;
196;; 7. Document Parsing 196;; 7. Document Parsing
197;; RefTeX needs to parse the document in order to find labels and 197;; RefTeX needs to parse the document in order to find labels and
198;; other information. It does it automatically once and updates its 198;; other information. It does it automatically once and updates its
@@ -201,23 +201,23 @@
201;; with a raw `C-u' prefix, or press the `r' key in the label 201;; with a raw `C-u' prefix, or press the `r' key in the label
202;; selection buffer, the table of contents buffer, or the index 202;; selection buffer, the table of contents buffer, or the index
203;; buffer. 203;; buffer.
204;; 204;;
205;; 8. AUCTeX 205;; 8. AUCTeX
206;; If your major LaTeX mode is AUCTeX, RefTeX can cooperate with it 206;; If your major LaTeX mode is AUCTeX, RefTeX can cooperate with it
207;; (see variable `reftex-plug-into-AUCTeX'). AUCTeX contains style 207;; (see variable `reftex-plug-into-AUCTeX'). AUCTeX contains style
208;; files which trigger appropriate settings in RefTeX, so that for 208;; files which trigger appropriate settings in RefTeX, so that for
209;; many of the popular LaTeX packages no additional customizations 209;; many of the popular LaTeX packages no additional customizations
210;; will be necessary. 210;; will be necessary.
211;; 211;;
212;; 9. Useful Settings 212;; 9. Useful Settings
213;; To make RefTeX faster for large documents, try these: 213;; To make RefTeX faster for large documents, try these:
214;; (setq reftex-enable-partial-scans t) 214;; (setq reftex-enable-partial-scans t)
215;; (setq reftex-save-parse-info t) 215;; (setq reftex-save-parse-info t)
216;; (setq reftex-use-multiple-selection-buffers t) 216;; (setq reftex-use-multiple-selection-buffers t)
217;; 217;;
218;; To integrate with AUCTeX, use 218;; To integrate with AUCTeX, use
219;; (setq reftex-plug-into-AUCTeX t) 219;; (setq reftex-plug-into-AUCTeX t)
220;; 220;;
221;; To make your own LaTeX macro definitions known to RefTeX, 221;; To make your own LaTeX macro definitions known to RefTeX,
222;; customize the variables 222;; customize the variables
223;; `reftex-label-alist' (for label macros/environments) 223;; `reftex-label-alist' (for label macros/environments)
@@ -227,7 +227,7 @@
227;; `reftex-index-default-macro' (to set the default macro) 227;; `reftex-index-default-macro' (to set the default macro)
228;; If you have a large number of macros defined, you may want to write 228;; If you have a large number of macros defined, you may want to write
229;; an AUCTeX style file to support them with both AUCTeX and RefTeX. 229;; an AUCTeX style file to support them with both AUCTeX and RefTeX.
230;; 230;;
231;; 10. Where Next? 231;; 10. Where Next?
232;; Go ahead and use RefTeX. Use its menus until you have picked up 232;; Go ahead and use RefTeX. Use its menus until you have picked up
233;; the key bindings. For an overview of what you can do in each of 233;; the key bindings. For an overview of what you can do in each of
@@ -236,7 +236,7 @@
236;; The first part of the manual explains in a tutorial way how to use 236;; The first part of the manual explains in a tutorial way how to use
237;; and customize RefTeX. The second part is a command and variable 237;; and customize RefTeX. The second part is a command and variable
238;; reference. 238;; reference.
239;; 239;;
240;;--------------------------------------------------------------------------- 240;;---------------------------------------------------------------------------
241;; 241;;
242;; AUTHOR 242;; AUTHOR
@@ -312,7 +312,7 @@
312 (setq reftex-syntax-table (copy-syntax-table)) 312 (setq reftex-syntax-table (copy-syntax-table))
313 (modify-syntax-entry ?\( "." reftex-syntax-table) 313 (modify-syntax-entry ?\( "." reftex-syntax-table)
314 (modify-syntax-entry ?\) "." reftex-syntax-table)) 314 (modify-syntax-entry ?\) "." reftex-syntax-table))
315 315
316(unless reftex-syntax-table-for-bib 316(unless reftex-syntax-table-for-bib
317 (setq reftex-syntax-table-for-bib 317 (setq reftex-syntax-table-for-bib
318 (copy-syntax-table reftex-syntax-table)) 318 (copy-syntax-table reftex-syntax-table))
@@ -388,7 +388,7 @@ on the menu bar.
388 (setq reftex-syntax-table (copy-syntax-table (syntax-table))) 388 (setq reftex-syntax-table (copy-syntax-table (syntax-table)))
389 (modify-syntax-entry ?\( "." reftex-syntax-table) 389 (modify-syntax-entry ?\( "." reftex-syntax-table)
390 (modify-syntax-entry ?\) "." reftex-syntax-table) 390 (modify-syntax-entry ?\) "." reftex-syntax-table)
391 391
392 (setq reftex-syntax-table-for-bib 392 (setq reftex-syntax-table-for-bib
393 (copy-syntax-table reftex-syntax-table)) 393 (copy-syntax-table reftex-syntax-table))
394 (modify-syntax-entry ?\' "." reftex-syntax-table-for-bib) 394 (modify-syntax-entry ?\' "." reftex-syntax-table-for-bib)
@@ -529,7 +529,7 @@ on the menu bar.
529 ((master 529 ((master
530 (cond 530 (cond
531 ((fboundp 'TeX-master-file) ; AUCTeX is loaded. Use its mechanism. 531 ((fboundp 'TeX-master-file) ; AUCTeX is loaded. Use its mechanism.
532 (condition-case nil 532 (condition-case nil
533 (TeX-master-file t) 533 (TeX-master-file t)
534 (error (buffer-file-name)))) 534 (error (buffer-file-name))))
535 ((fboundp 'tex-main-file) (tex-main-file)) ; Emacs LaTeX mode 535 ((fboundp 'tex-main-file) (tex-main-file)) ; Emacs LaTeX mode
@@ -569,7 +569,7 @@ on the menu bar.
569 ) 569 )
570 (t 570 (t
571 ;; Use buffer file name. 571 ;; Use buffer file name.
572 (buffer-file-name))) 572 (setq master (buffer-file-name))))
573 (expand-file-name master))) 573 (expand-file-name master)))
574 574
575(defun reftex-is-multi () 575(defun reftex-is-multi ()
@@ -728,14 +728,14 @@ the label information is recompiled on next use."
728 728
729;; A list of all variables in the cache. 729;; A list of all variables in the cache.
730;; The cache is used to save the compiled versions of some variables. 730;; The cache is used to save the compiled versions of some variables.
731(defconst reftex-cache-variables 731(defconst reftex-cache-variables
732 '(reftex-memory ;; This MUST ALWAYS be the first! 732 '(reftex-memory ;; This MUST ALWAYS be the first!
733 733
734 ;; Outline 734 ;; Outline
735 reftex-section-levels-all 735 reftex-section-levels-all
736 736
737 ;; Labels 737 ;; Labels
738 reftex-env-or-mac-alist 738 reftex-env-or-mac-alist
739 reftex-special-env-parsers 739 reftex-special-env-parsers
740 reftex-macros-with-labels 740 reftex-macros-with-labels
741 reftex-label-mac-list 741 reftex-label-mac-list
@@ -751,7 +751,7 @@ the label information is recompiled on next use."
751 reftex-index-macro-alist 751 reftex-index-macro-alist
752 reftex-macros-with-index 752 reftex-macros-with-index
753 reftex-query-index-macro-prompt 753 reftex-query-index-macro-prompt
754 reftex-query-index-macro-help 754 reftex-query-index-macro-help
755 reftex-key-to-index-macro-alist 755 reftex-key-to-index-macro-alist
756 756
757 ;; Regular expressions 757 ;; Regular expressions
@@ -796,7 +796,7 @@ the label information is recompiled on next use."
796 (t (reftex-compile-variables))))) 796 (t (reftex-compile-variables)))))
797 797
798(defun reftex-reset-mode () 798(defun reftex-reset-mode ()
799 "Reset RefTeX Mode. 799 "Reset RefTeX Mode.
800This will re-compile the configuration information and remove all 800This will re-compile the configuration information and remove all
801current scanning information and the parse file to enforce a rescan 801current scanning information and the parse file to enforce a rescan
802on next use." 802on next use."
@@ -846,12 +846,12 @@ This enforces rescanning the buffer on next use."
846 846
847(defun reftex-erase-all-selection-and-index-buffers () 847(defun reftex-erase-all-selection-and-index-buffers ()
848 ;; Remove all selection buffers associated with current document. 848 ;; Remove all selection buffers associated with current document.
849 (mapcar 849 (mapcar
850 (lambda (type) 850 (lambda (type)
851 (reftex-erase-buffer (reftex-make-selection-buffer-name type))) 851 (reftex-erase-buffer (reftex-make-selection-buffer-name type)))
852 reftex-typekey-list) 852 reftex-typekey-list)
853 ;; Kill all index buffers 853 ;; Kill all index buffers
854 (mapcar 854 (mapcar
855 (lambda (tag) 855 (lambda (tag)
856 (reftex-kill-buffer (reftex-make-index-buffer-name tag))) 856 (reftex-kill-buffer (reftex-make-index-buffer-name tag)))
857 (cdr (assoc 'index-tags (symbol-value reftex-docstruct-symbol))))) 857 (cdr (assoc 'index-tags (symbol-value reftex-docstruct-symbol)))))
@@ -867,7 +867,7 @@ This enforces rescanning the buffer on next use."
867 867
868 ;; Record that we have done this, and what we have used. 868 ;; Record that we have done this, and what we have used.
869 (setq reftex-tables-dirty nil) 869 (setq reftex-tables-dirty nil)
870 (setq reftex-memory 870 (setq reftex-memory
871 (list reftex-label-alist 871 (list reftex-label-alist
872 (get reftex-docstruct-symbol 'reftex-section-levels) 872 (get reftex-docstruct-symbol 'reftex-section-levels)
873 (get reftex-docstruct-symbol 'reftex-label-alist-style) 873 (get reftex-docstruct-symbol 'reftex-label-alist-style)
@@ -886,7 +886,7 @@ This enforces rescanning the buffer on next use."
886 '(nil))) 886 '(nil)))
887 (all-index (reftex-uniquify-by-car 887 (all-index (reftex-uniquify-by-car
888 (reftex-splice-symbols-into-list 888 (reftex-splice-symbols-into-list
889 (append reftex-index-macros 889 (append reftex-index-macros
890 (get reftex-docstruct-symbol 890 (get reftex-docstruct-symbol
891 'reftex-index-macros-style) 891 'reftex-index-macros-style)
892 '(default)) 892 '(default))
@@ -947,7 +947,7 @@ This enforces rescanning the buffer on next use."
947 ((symbolp env-or-mac) 947 ((symbolp env-or-mac)
948 ;; A special parser function 948 ;; A special parser function
949 (unless (fboundp env-or-mac) 949 (unless (fboundp env-or-mac)
950 (message "Warning: %s does not seem to be a valid function" 950 (message "Warning: %s does not seem to be a valid function"
951 env-or-mac)) 951 env-or-mac))
952 (setq nargs nil nlabel nil opt-args nil) 952 (setq nargs nil nlabel nil opt-args nil)
953 (add-to-list 'reftex-special-env-parsers env-or-mac) 953 (add-to-list 'reftex-special-env-parsers env-or-mac)
@@ -975,8 +975,8 @@ This enforces rescanning the buffer on next use."
975 (push (cons string toc-level) toc-levels)))))))) 975 (push (cons string toc-level) toc-levels))))))))
976 ;; Translate some special context cases 976 ;; Translate some special context cases
977 (when (assq context reftex-default-context-regexps) 977 (when (assq context reftex-default-context-regexps)
978 (setq context 978 (setq context
979 (format 979 (format
980 (cdr (assq context reftex-default-context-regexps)) 980 (cdr (assq context reftex-default-context-regexps))
981 (regexp-quote env-or-mac)))) 981 (regexp-quote env-or-mac))))
982 ;; See if this is the first format for this typekey 982 ;; See if this is the first format for this typekey
@@ -1009,7 +1009,7 @@ This enforces rescanning the buffer on next use."
1009 (nreverse reftex-typekey-to-prefix-alist)) 1009 (nreverse reftex-typekey-to-prefix-alist))
1010 1010
1011 ;; Prepare the typekey query prompt and help string. 1011 ;; Prepare the typekey query prompt and help string.
1012 (setq qh-list 1012 (setq qh-list
1013 (sort qh-list 1013 (sort qh-list
1014 (lambda (x1 x2) 1014 (lambda (x1 x2)
1015 (string< (downcase (car x1)) (downcase (car x2)))))) 1015 (string< (downcase (car x1)) (downcase (car x2))))))
@@ -1020,7 +1020,7 @@ This enforces rescanning the buffer on next use."
1020 "]")) 1020 "]"))
1021 ;; In the help string, we need to wrap lines... 1021 ;; In the help string, we need to wrap lines...
1022 (setq reftex-type-query-help 1022 (setq reftex-type-query-help
1023 (concat 1023 (concat
1024 "SELECT A LABEL TYPE:\n--------------------\n" 1024 "SELECT A LABEL TYPE:\n--------------------\n"
1025 (mapconcat 1025 (mapconcat
1026 (lambda(x) 1026 (lambda(x)
@@ -1040,7 +1040,7 @@ This enforces rescanning the buffer on next use."
1040 ;; which allow for some chars from the ref format to be in the buffer. 1040 ;; which allow for some chars from the ref format to be in the buffer.
1041 ;; These characters will be seen and removed. 1041 ;; These characters will be seen and removed.
1042 (setq reftex-words-to-typekey-alist 1042 (setq reftex-words-to-typekey-alist
1043 (mapcar 1043 (mapcar
1044 (lambda (x) 1044 (lambda (x)
1045 (setq word (car x) 1045 (setq word (car x)
1046 typekey (cdr x) 1046 typekey (cdr x)
@@ -1093,18 +1093,18 @@ This enforces rescanning the buffer on next use."
1093 (setq reftex-key-to-index-macro-alist 1093 (setq reftex-key-to-index-macro-alist
1094 (sort reftex-key-to-index-macro-alist 1094 (sort reftex-key-to-index-macro-alist
1095 (lambda (a b) (< (downcase (car a)) (downcase (car b)))))) 1095 (lambda (a b) (< (downcase (car a)) (downcase (car b))))))
1096 (setq reftex-query-index-macro-prompt 1096 (setq reftex-query-index-macro-prompt
1097 (concat "Index macro: [" 1097 (concat "Index macro: ["
1098 (mapconcat (lambda (x) (char-to-string (car x))) 1098 (mapconcat (lambda (x) (char-to-string (car x)))
1099 reftex-key-to-index-macro-alist "") 1099 reftex-key-to-index-macro-alist "")
1100 "]")) 1100 "]"))
1101 (setq i 0 1101 (setq i 0
1102 reftex-query-index-macro-help 1102 reftex-query-index-macro-help
1103 (concat 1103 (concat
1104 "SELECT A MACRO:\n---------------\n" 1104 "SELECT A MACRO:\n---------------\n"
1105 (mapconcat 1105 (mapconcat
1106 (lambda(x) 1106 (lambda(x)
1107 (format "[%c] %-20.20s%s" (car x) (nth 1 x) 1107 (format "[%c] %-20.20s%s" (car x) (nth 1 x)
1108 (if (= 0 (mod (incf i) 3)) "\n" ""))) 1108 (if (= 0 (mod (incf i) 3)) "\n" "")))
1109 reftex-key-to-index-macro-alist ""))) 1109 reftex-key-to-index-macro-alist "")))
1110 1110
@@ -1118,11 +1118,11 @@ This enforces rescanning the buffer on next use."
1118 (let* ( 1118 (let* (
1119; (wbol "\\(\\`\\|[\n\r]\\)[ \t]*") 1119; (wbol "\\(\\`\\|[\n\r]\\)[ \t]*")
1120 (wbol "\\(^\\)[ \t]*") ; Need to keep the empty group because 1120 (wbol "\\(^\\)[ \t]*") ; Need to keep the empty group because
1121 ;;; because match number are hard coded 1121 ;;; because match number are hard coded
1122 (label-re "\\\\label{\\([^}]*\\)}") 1122 (label-re "\\\\label{\\([^}]*\\)}")
1123 (include-re (concat wbol 1123 (include-re (concat wbol
1124 "\\\\\\(" 1124 "\\\\\\("
1125 (mapconcat 'identity 1125 (mapconcat 'identity
1126 reftex-include-file-commands "\\|") 1126 reftex-include-file-commands "\\|")
1127 "\\)[{ \t]+\\([^} \t\n\r]+\\)")) 1127 "\\)[{ \t]+\\([^} \t\n\r]+\\)"))
1128 (section-re 1128 (section-re
@@ -1176,7 +1176,7 @@ This enforces rescanning the buffer on next use."
1176 reftex-macros-with-labels macros-with-labels 1176 reftex-macros-with-labels macros-with-labels
1177 reftex-find-index-entry-regexp-format find-index-re-format 1177 reftex-find-index-entry-regexp-format find-index-re-format
1178 reftex-find-label-regexp-format find-label-re-format 1178 reftex-find-label-regexp-format find-label-re-format
1179 reftex-find-label-regexp-format2 1179 reftex-find-label-regexp-format2
1180 "\\([]} \t\n\r]\\)\\([[{]\\)\\(%s\\)[]}]") 1180 "\\([]} \t\n\r]\\)\\([[{]\\)\\(%s\\)[]}]")
1181 (message "Compiling label environment definitions...done"))) 1181 (message "Compiling label environment definitions...done")))
1182 (put reftex-docstruct-symbol 'reftex-cache 1182 (put reftex-docstruct-symbol 'reftex-cache
@@ -1248,7 +1248,7 @@ This enforces rescanning the buffer on next use."
1248 (and (symbolp reftex-docstruct-symbol) 1248 (and (symbolp reftex-docstruct-symbol)
1249 (symbol-value reftex-docstruct-symbol) 1249 (symbol-value reftex-docstruct-symbol)
1250 t)) 1250 t))
1251 1251
1252(defun reftex-silence-toc-markers (list n) 1252(defun reftex-silence-toc-markers (list n)
1253 ;; Set all toc markers in the first N entries in list to nil 1253 ;; Set all toc markers in the first N entries in list to nil
1254 (while (and list (> (decf n) -1)) 1254 (while (and list (> (decf n) -1))
@@ -1265,7 +1265,7 @@ Valid actions are: readable, restore, read, kill, write."
1265 (master (reftex-TeX-master-file)) 1265 (master (reftex-TeX-master-file))
1266 (enable-local-variables nil) 1266 (enable-local-variables nil)
1267 (file (if (string-match "\\.[a-zA-Z]+\\'" master) 1267 (file (if (string-match "\\.[a-zA-Z]+\\'" master)
1268 (concat (substring master 0 (match-beginning 0)) 1268 (concat (substring master 0 (match-beginning 0))
1269 reftex-parse-file-extension) 1269 reftex-parse-file-extension)
1270 (concat master reftex-parse-file-extension)))) 1270 (concat master reftex-parse-file-extension))))
1271 (cond 1271 (cond
@@ -1344,7 +1344,7 @@ Valid actions are: readable, restore, read, kill, write."
1344 1344
1345 ;; Check if the master is the same: when moving a document, this will see it. 1345 ;; Check if the master is the same: when moving a document, this will see it.
1346 (let* ((real-master (reftex-TeX-master-file)) 1346 (let* ((real-master (reftex-TeX-master-file))
1347 (parsed-master 1347 (parsed-master
1348 (nth 1 (assq 'bof (symbol-value reftex-docstruct-symbol))))) 1348 (nth 1 (assq 'bof (symbol-value reftex-docstruct-symbol)))))
1349 (unless (string= (file-truename real-master) (file-truename parsed-master)) 1349 (unless (string= (file-truename real-master) (file-truename parsed-master))
1350 (message "Master file name in load file is different: %s versus %s" 1350 (message "Master file name in load file is different: %s versus %s"
@@ -1364,7 +1364,7 @@ Valid actions are: readable, restore, read, kill, write."
1364(defun reftex-select-external-document (xr-alist xr-index) 1364(defun reftex-select-external-document (xr-alist xr-index)
1365 ;; Return index of an external document. 1365 ;; Return index of an external document.
1366 (let* ((len (length xr-alist)) (highest (1- (+ ?0 len))) 1366 (let* ((len (length xr-alist)) (highest (1- (+ ?0 len)))
1367 (prompt (format "[%c-%c] Select TAB: Read prefix with completion" 1367 (prompt (format "[%c-%c] Select TAB: Read prefix with completion"
1368 ?0 highest)) 1368 ?0 highest))
1369 key prefix) 1369 key prefix)
1370 (cond 1370 (cond
@@ -1375,7 +1375,7 @@ Valid actions are: readable, restore, read, kill, write."
1375 (- 1 xr-index)) 1375 (- 1 xr-index))
1376 (t 1376 (t
1377 (save-excursion 1377 (save-excursion
1378 (let* ((length (apply 'max (mapcar 1378 (let* ((length (apply 'max (mapcar
1379 (lambda(x) (length (car x))) xr-alist))) 1379 (lambda(x) (length (car x))) xr-alist)))
1380 (fmt (format " [%%c] %%-%ds %%s\n" length)) 1380 (fmt (format " [%%c] %%-%ds %%s\n" length))
1381 (n (1- ?0))) 1381 (n (1- ?0)))
@@ -1385,7 +1385,7 @@ Valid actions are: readable, restore, read, kill, write."
1385 (concat 1385 (concat
1386 "SELECT EXTERNAL DOCUMENT\n------------------------\n" 1386 "SELECT EXTERNAL DOCUMENT\n------------------------\n"
1387 (mapconcat 1387 (mapconcat
1388 (lambda (x) 1388 (lambda (x)
1389 (format fmt (incf n) (or (car x) "") 1389 (format fmt (incf n) (or (car x) "")
1390 (abbreviate-file-name (cdr x)))) 1390 (abbreviate-file-name (cdr x))))
1391 xr-alist "")) 1391 xr-alist ""))
@@ -1409,7 +1409,7 @@ When DIE is non-nil, throw an error if file not found."
1409 (let* ((rec-values (if reftex-search-unrecursed-path-first '(nil t) '(t))) 1409 (let* ((rec-values (if reftex-search-unrecursed-path-first '(nil t) '(t)))
1410 (extensions (cdr (assoc type reftex-file-extensions))) 1410 (extensions (cdr (assoc type reftex-file-extensions)))
1411 (def-ext (car extensions)) 1411 (def-ext (car extensions))
1412 (ext-re (concat "\\(" 1412 (ext-re (concat "\\("
1413 (mapconcat 'regexp-quote extensions "\\|") 1413 (mapconcat 'regexp-quote extensions "\\|")
1414 "\\)\\'")) 1414 "\\)\\'"))
1415 (files (if (string-match ext-re file) 1415 (files (if (string-match ext-re file)
@@ -1418,8 +1418,8 @@ When DIE is non-nil, throw an error if file not found."
1418 path old-path file1) 1418 path old-path file1)
1419 (cond 1419 (cond
1420 ((file-name-absolute-p file) 1420 ((file-name-absolute-p file)
1421 (setq file1 1421 (setq file1
1422 (or 1422 (or
1423 (and (car files) (file-regular-p (car files)) (car files)) 1423 (and (car files) (file-regular-p (car files)) (car files))
1424 (and (cdr files) (file-regular-p (cdr files)) (cdr files))))) 1424 (and (cdr files) (file-regular-p (cdr files)) (cdr files)))))
1425 ((and reftex-use-external-file-finders 1425 ((and reftex-use-external-file-finders
@@ -1434,10 +1434,10 @@ When DIE is non-nil, throw an error if file not found."
1434 (setq old-path path 1434 (setq old-path path
1435 path (cons master-dir path) 1435 path (cons master-dir path)
1436 file1 (or (and (car files) 1436 file1 (or (and (car files)
1437 (reftex-find-file-on-path 1437 (reftex-find-file-on-path
1438 (car files) path master-dir)) 1438 (car files) path master-dir))
1439 (and (cdr files) 1439 (and (cdr files)
1440 (reftex-find-file-on-path 1440 (reftex-find-file-on-path
1441 (cdr files) path master-dir)))))))) 1441 (cdr files) path master-dir))))))))
1442 (cond (file1 file1) 1442 (cond (file1 file1)
1443 (die (error "No such file: %s" file) nil) 1443 (die (error "No such file: %s" file) nil)
@@ -1482,7 +1482,7 @@ When DIE is non-nil, throw an error if file not found."
1482 (reftex-uniq 1482 (reftex-uniq
1483 (reftex-parse-colon-path 1483 (reftex-parse-colon-path
1484 (mapconcat 1484 (mapconcat
1485 (lambda(x) 1485 (lambda(x)
1486 (if (string-match "^!" x) 1486 (if (string-match "^!" x)
1487 (apply 'reftex-process-string 1487 (apply 'reftex-process-string
1488 (split-string (substring x 1))) 1488 (split-string (substring x 1)))
@@ -1491,7 +1491,7 @@ When DIE is non-nil, throw an error if file not found."
1491 ;; (cdr (assoc type reftex-path-environment)) 1491 ;; (cdr (assoc type reftex-path-environment))
1492 ;; However, historically we have separate options for the 1492 ;; However, historically we have separate options for the
1493 ;; environment variables, so we have to do this: 1493 ;; environment variables, so we have to do this:
1494 (symbol-value (intern (concat "reftex-" type 1494 (symbol-value (intern (concat "reftex-" type
1495 "path-environment-variables"))) 1495 "path-environment-variables")))
1496 path-separator)))) 1496 path-separator))))
1497 (put pathvar 'status 'split) 1497 (put pathvar 'status 'split)
@@ -1517,11 +1517,11 @@ When DIE is non-nil, throw an error if file not found."
1517 ;; or: Relative recursive path elements need to be expanded 1517 ;; or: Relative recursive path elements need to be expanded
1518 ;; relative to new default directory 1518 ;; relative to new default directory
1519 (message "Expanding search path to find %s file: %s ..." type file) 1519 (message "Expanding search path to find %s file: %s ..." type file)
1520 (put pathvar 'recursive-path 1520 (put pathvar 'recursive-path
1521 (reftex-expand-path (symbol-value pathvar) master-dir)) 1521 (reftex-expand-path (symbol-value pathvar) master-dir))
1522 (put pathvar 'master-dir master-dir) 1522 (put pathvar 'master-dir master-dir)
1523 (get pathvar 'recursive-path)) 1523 (get pathvar 'recursive-path))
1524 (t 1524 (t
1525 ;; Recursive path computed earlier is still OK. 1525 ;; Recursive path computed earlier is still OK.
1526 (get pathvar 'recursive-path))) 1526 (get pathvar 'recursive-path)))
1527 ;; The simple path was requested 1527 ;; The simple path was requested
@@ -1550,7 +1550,7 @@ When DIE is non-nil, throw an error if file not found."
1550 ;; Trailing ! or !! will be converted into `//' (emTeX convention) 1550 ;; Trailing ! or !! will be converted into `//' (emTeX convention)
1551 (mapcar 1551 (mapcar
1552 (lambda (dir) 1552 (lambda (dir)
1553 (if (string-match "\\(//+\\|/*!+\\)\\'" dir) 1553 (if (string-match "\\(//+\\|/*!+\\)\\'" dir)
1554 (setq dir (replace-match "//" t t dir))) 1554 (setq dir (replace-match "//" t t dir)))
1555 (file-name-as-directory dir)) 1555 (file-name-as-directory dir))
1556 (delete "" (split-string path (concat path-separator "+"))))) 1556 (delete "" (split-string path (concat path-separator "+")))))
@@ -1579,7 +1579,7 @@ When DIE is non-nil, throw an error if file not found."
1579 (when (file-directory-p dir) 1579 (when (file-directory-p dir)
1580 (setq files (nreverse (directory-files dir t "[^.]"))) 1580 (setq files (nreverse (directory-files dir t "[^.]")))
1581 (while (setq file (pop files)) 1581 (while (setq file (pop files))
1582 (if (file-directory-p file) 1582 (if (file-directory-p file)
1583 (push (file-name-as-directory file) path))) 1583 (push (file-name-as-directory file) path)))
1584 (push dir path1))) 1584 (push dir path1)))
1585 path1)) 1585 path1))
@@ -1863,7 +1863,7 @@ When DIE is non-nil, throw an error if file not found."
1863 (while list 1863 (while list
1864 (if (funcall predicate (car list)) 1864 (if (funcall predicate (car list))
1865 (push (if completion 1865 (push (if completion
1866 (list (nth nth (car list))) 1866 (list (nth nth (car list)))
1867 (nth nth (car list))) 1867 (nth nth (car list)))
1868 rtn)) 1868 rtn))
1869 (setq list (cdr list))) 1869 (setq list (cdr list)))
@@ -1899,7 +1899,7 @@ When DIE is non-nil, throw an error if file not found."
1899 ;; If POS is given, calculate distances relative to it. 1899 ;; If POS is given, calculate distances relative to it.
1900 ;; Return nil if there is no match. 1900 ;; Return nil if there is no match.
1901 (let ((pos (point)) 1901 (let ((pos (point))
1902 (dist (or max-length (length regexp))) 1902 (dist (or max-length (length regexp)))
1903 match1 match2 match) 1903 match1 match2 match)
1904 (goto-char (min (+ pos dist) (point-max))) 1904 (goto-char (min (+ pos dist) (point-max)))
1905 (when (re-search-backward regexp nil t) 1905 (when (re-search-backward regexp nil t)
@@ -1985,10 +1985,10 @@ When DIE is non-nil, throw an error if file not found."
1985 ((and scroll (equal char ?\C-? )) 1985 ((and scroll (equal char ?\C-? ))
1986 (condition-case nil (scroll-down) (error nil)) 1986 (condition-case nil (scroll-down) (error nil))
1987 (message prompt)) 1987 (message prompt))
1988 (t (message "") 1988 (t (message "")
1989 (throw 'exit char))) 1989 (throw 'exit char)))
1990 (setq char (read-char-exclusive))))))) 1990 (setq char (read-char-exclusive)))))))
1991 1991
1992 1992
1993(defun reftex-make-regexp-allow-for-ctrl-m (string) 1993(defun reftex-make-regexp-allow-for-ctrl-m (string)
1994 ;; convert STRING into a regexp, allowing ^M for \n and vice versa 1994 ;; convert STRING into a regexp, allowing ^M for \n and vice versa
@@ -2186,10 +2186,10 @@ IGNORE-WORDS List of words which should be removed from the string."
2186 ;; Restrict number of words 2186 ;; Restrict number of words
2187 (if (> (length words) nwords) 2187 (if (> (length words) nwords)
2188 (setcdr (nthcdr (1- nwords) words) nil)) 2188 (setcdr (nthcdr (1- nwords) words) nil))
2189 2189
2190 ;; First, try to use all words 2190 ;; First, try to use all words
2191 (setq string (mapconcat 'identity words sep)) 2191 (setq string (mapconcat 'identity words sep))
2192 2192
2193 ;; Abbreviate words if enforced by user settings or string length 2193 ;; Abbreviate words if enforced by user settings or string length
2194 (if (or (eq t abbrev) 2194 (if (or (eq t abbrev)
2195 (and abbrev 2195 (and abbrev
@@ -2281,7 +2281,7 @@ IGNORE-WORDS List of words which should be removed from the string."
2281 (font-lock-set-defaults-1) 2281 (font-lock-set-defaults-1)
2282 (reftex-select-font-lock-fontify-region (point-min) (point-max)))) 2282 (reftex-select-font-lock-fontify-region (point-min) (point-max))))
2283 (t 2283 (t
2284 ;; Oops? 2284 ;; Oops?
2285 (message "Sorry: cannot refontify RefTeX Select buffer.")))) 2285 (message "Sorry: cannot refontify RefTeX Select buffer."))))
2286 (rename-buffer oldname)))) 2286 (rename-buffer oldname))))
2287 2287
@@ -2321,7 +2321,7 @@ IGNORE-WORDS List of words which should be removed from the string."
2321 2321
2322;; Initialize the overlays 2322;; Initialize the overlays
2323(aset reftex-highlight-overlays 0 (make-overlay 1 1)) 2323(aset reftex-highlight-overlays 0 (make-overlay 1 1))
2324(overlay-put (aref reftex-highlight-overlays 0) 2324(overlay-put (aref reftex-highlight-overlays 0)
2325 'face 'highlight) 2325 'face 'highlight)
2326(aset reftex-highlight-overlays 1 (make-overlay 1 1)) 2326(aset reftex-highlight-overlays 1 (make-overlay 1 1))
2327(overlay-put (aref reftex-highlight-overlays 1) 2327(overlay-put (aref reftex-highlight-overlays 1)
@@ -2346,7 +2346,7 @@ IGNORE-WORDS List of words which should be removed from the string."
2346 2346
2347;;; ========================================================================= 2347;;; =========================================================================
2348;;; 2348;;;
2349;;; Keybindings 2349;;; Keybindings
2350 2350
2351;; The default bindings in the mode map. 2351;; The default bindings in the mode map.
2352(loop for x in 2352(loop for x in
@@ -2366,10 +2366,10 @@ IGNORE-WORDS List of words which should be removed from the string."
2366;; Bind `reftex-mouse-view-crossref' only when the key is still free 2366;; Bind `reftex-mouse-view-crossref' only when the key is still free
2367(if (featurep 'xemacs) 2367(if (featurep 'xemacs)
2368 (unless (key-binding [(shift button2)]) 2368 (unless (key-binding [(shift button2)])
2369 (define-key reftex-mode-map [(shift button2)] 2369 (define-key reftex-mode-map [(shift button2)]
2370 'reftex-mouse-view-crossref)) 2370 'reftex-mouse-view-crossref))
2371 (unless (key-binding [(shift mouse-2)]) 2371 (unless (key-binding [(shift mouse-2)])
2372 (define-key reftex-mode-map [(shift mouse-2)] 2372 (define-key reftex-mode-map [(shift mouse-2)]
2373 'reftex-mouse-view-crossref))) 2373 'reftex-mouse-view-crossref)))
2374 2374
2375;; Bind `reftex-view-crossref-from-bibtex' in BibTeX mode map 2375;; Bind `reftex-view-crossref-from-bibtex' in BibTeX mode map
@@ -2465,7 +2465,7 @@ IGNORE-WORDS List of words which should be removed from the string."
2465 ("Reference Style" 2465 ("Reference Style"
2466 ["Default" (setq reftex-vref-is-default nil 2466 ["Default" (setq reftex-vref-is-default nil
2467 reftex-fref-is-default nil) 2467 reftex-fref-is-default nil)
2468 :style radio :selected (not (or reftex-vref-is-default 2468 :style radio :selected (not (or reftex-vref-is-default
2469 reftex-fref-is-default))] 2469 reftex-fref-is-default))]
2470 ["Varioref" (setq reftex-vref-is-default t 2470 ["Varioref" (setq reftex-vref-is-default t
2471 reftex-fref-is-default nil) 2471 reftex-fref-is-default nil)
@@ -2500,7 +2500,7 @@ IGNORE-WORDS List of words which should be removed from the string."
2500 (list 'reftex-add-index-macros (list 'list (list 'quote (car x)))) 2500 (list 'reftex-add-index-macros (list 'list (list 'quote (car x))))
2501 :style 'radio :selected 2501 :style 'radio :selected
2502 (list 'memq (list 'quote (car x)) 2502 (list 'memq (list 'quote (car x))
2503 (list 'get 'reftex-docstruct-symbol 2503 (list 'get 'reftex-docstruct-symbol
2504 (list 'quote 'reftex-index-macros-style))))) 2504 (list 'quote 'reftex-index-macros-style)))))
2505 reftex-index-macros-builtin)) 2505 reftex-index-macros-builtin))
2506 "--" 2506 "--"
@@ -2509,7 +2509,7 @@ IGNORE-WORDS List of words which should be removed from the string."
2509 ("Customize" 2509 ("Customize"
2510 ["Browse RefTeX Group" reftex-customize t] 2510 ["Browse RefTeX Group" reftex-customize t]
2511 "--" 2511 "--"
2512 ["Build Full Customize Menu" reftex-create-customize-menu 2512 ["Build Full Customize Menu" reftex-create-customize-menu
2513 (fboundp 'customize-menu-create)]) 2513 (fboundp 'customize-menu-create)])
2514 ("Documentation" 2514 ("Documentation"
2515 ["Info" reftex-info t] 2515 ["Info" reftex-info t]
@@ -2525,7 +2525,7 @@ IGNORE-WORDS List of words which should be removed from the string."
2525 (interactive) 2525 (interactive)
2526 (if (fboundp 'customize-menu-create) 2526 (if (fboundp 'customize-menu-create)
2527 (progn 2527 (progn
2528 (easy-menu-change 2528 (easy-menu-change
2529 '("Ref") "Customize" 2529 '("Ref") "Customize"
2530 `(["Browse RefTeX group" reftex-customize t] 2530 `(["Browse RefTeX group" reftex-customize t]
2531 "--" 2531 "--"
@@ -2563,7 +2563,7 @@ With optional NODE, go directly to that node."
2563;;; That's it! ---------------------------------------------------------------- 2563;;; That's it! ----------------------------------------------------------------
2564 2564
2565(setq reftex-tables-dirty t) ; in case this file is evaluated by hand 2565(setq reftex-tables-dirty t) ; in case this file is evaluated by hand
2566(provide 'reftex) 2566(provide 'reftex)
2567 2567
2568;;;============================================================================ 2568;;;============================================================================
2569 2569