diff options
Diffstat (limited to 'lisp/textmodes/reftex.el')
| -rw-r--r-- | lisp/textmodes/reftex.el | 1292 |
1 files changed, 639 insertions, 653 deletions
diff --git a/lisp/textmodes/reftex.el b/lisp/textmodes/reftex.el index c00400a7b96..e0ac95ecfab 100644 --- a/lisp/textmodes/reftex.el +++ b/lisp/textmodes/reftex.el | |||
| @@ -1,8 +1,8 @@ | |||
| 1 | ;;; reftex.el --- minor mode for doing \label, \ref, \cite, \index in LaTeX | 1 | ;;; reftex.el --- minor mode for doing \label, \ref, \cite, \index in LaTeX |
| 2 | ;; Copyright (c) 1997, 1998, 1999, 2000, 2003 Free Software Foundation, Inc. | 2 | ;; Copyright (c) 1997, 1998, 1999, 2000, 2003 Free Software Foundation, Inc. |
| 3 | 3 | ||
| 4 | ;; Author: Carsten Dominik <dominik@science.uva.nl> | 4 | ;; Author: Carsten Dominik <dominik@science.uva.nl> |
| 5 | ;; Version: 4.21 | 5 | ;; Version: 4.18 |
| 6 | ;; Keywords: tex | 6 | ;; Keywords: tex |
| 7 | 7 | ||
| 8 | ;; This file is part of GNU Emacs. | 8 | ;; This file is part of GNU Emacs. |
| @@ -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. |
| @@ -64,13 +64,13 @@ | |||
| 64 | ;; | 64 | ;; |
| 65 | ;; The documentation in various formats is also available at | 65 | ;; The documentation in various formats is also available at |
| 66 | ;; | 66 | ;; |
| 67 | ;; http://zon.astro.uva.nl/~dominik/Tools/ | 67 | ;; http://www.strw.leidenuniv.nl/~dominik/Tools/ |
| 68 | ;; | 68 | ;; |
| 69 | ;;--------------------------------------------------------------------------- | 69 | ;;--------------------------------------------------------------------------- |
| 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,13 +236,13 @@ | |||
| 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 |
| 243 | ;; ====== | 243 | ;; ====== |
| 244 | ;; | 244 | ;; |
| 245 | ;; Carsten Dominik <dominik@science.uva.nl> | 245 | ;; Carsten Dominik <dominik@strw.LeidenUniv.nl> |
| 246 | ;; | 246 | ;; |
| 247 | ;; with contributions from Stephen Eglen | 247 | ;; with contributions from Stephen Eglen |
| 248 | ;; | 248 | ;; |
| @@ -250,7 +250,7 @@ | |||
| 250 | ;; XEmacs 21.x. If you need to install it yourself, you can find a | 250 | ;; XEmacs 21.x. If you need to install it yourself, you can find a |
| 251 | ;; distribution at | 251 | ;; distribution at |
| 252 | ;; | 252 | ;; |
| 253 | ;; http://zon.astro.uva.nl/~dominik/Tools/ | 253 | ;; http://www.strw.leidenuniv.nl/~dominik/Tools/ |
| 254 | ;; | 254 | ;; |
| 255 | ;; THANKS TO: | 255 | ;; THANKS TO: |
| 256 | ;; --------- | 256 | ;; --------- |
| @@ -282,12 +282,6 @@ | |||
| 282 | (defvar reftex-tables-dirty t | 282 | (defvar reftex-tables-dirty t |
| 283 | "Flag showing if tables need to be re-computed.") | 283 | "Flag showing if tables need to be re-computed.") |
| 284 | 284 | ||
| 285 | (eval-and-compile | ||
| 286 | (defun reftex-set-dirty (symbol value) | ||
| 287 | (setq reftex-tables-dirty t) | ||
| 288 | (set symbol value))) | ||
| 289 | |||
| 290 | |||
| 291 | ;;; ========================================================================= | 285 | ;;; ========================================================================= |
| 292 | ;;; | 286 | ;;; |
| 293 | ;;; Configuration variables | 287 | ;;; Configuration variables |
| @@ -300,7 +294,7 @@ | |||
| 300 | ;;; Define the formal stuff for a minor mode named RefTeX. | 294 | ;;; Define the formal stuff for a minor mode named RefTeX. |
| 301 | ;;; | 295 | ;;; |
| 302 | 296 | ||
| 303 | (defconst reftex-version "RefTeX version 4.21" | 297 | (defconst reftex-version "RefTeX version 4.18" |
| 304 | "Version string for RefTeX.") | 298 | "Version string for RefTeX.") |
| 305 | 299 | ||
| 306 | (defvar reftex-mode nil | 300 | (defvar reftex-mode nil |
| @@ -318,10 +312,10 @@ | |||
| 318 | (setq reftex-syntax-table (copy-syntax-table)) | 312 | (setq reftex-syntax-table (copy-syntax-table)) |
| 319 | (modify-syntax-entry ?\( "." reftex-syntax-table) | 313 | (modify-syntax-entry ?\( "." reftex-syntax-table) |
| 320 | (modify-syntax-entry ?\) "." reftex-syntax-table)) | 314 | (modify-syntax-entry ?\) "." reftex-syntax-table)) |
| 321 | 315 | ||
| 322 | (unless reftex-syntax-table-for-bib | 316 | (unless reftex-syntax-table-for-bib |
| 323 | (setq reftex-syntax-table-for-bib | 317 | (setq reftex-syntax-table-for-bib |
| 324 | (copy-syntax-table reftex-syntax-table)) | 318 | (copy-syntax-table reftex-syntax-table)) |
| 325 | (modify-syntax-entry ?\' "." reftex-syntax-table-for-bib) | 319 | (modify-syntax-entry ?\' "." reftex-syntax-table-for-bib) |
| 326 | (modify-syntax-entry ?\" "." reftex-syntax-table-for-bib) | 320 | (modify-syntax-entry ?\" "." reftex-syntax-table-for-bib) |
| 327 | (modify-syntax-entry ?\[ "." reftex-syntax-table-for-bib) | 321 | (modify-syntax-entry ?\[ "." reftex-syntax-table-for-bib) |
| @@ -377,30 +371,30 @@ on the menu bar. | |||
| 377 | 371 | ||
| 378 | (if reftex-mode | 372 | (if reftex-mode |
| 379 | (progn | 373 | (progn |
| 380 | ;; Mode was turned on | 374 | ;; Mode was turned on |
| 381 | (easy-menu-add reftex-mode-menu) | 375 | (easy-menu-add reftex-mode-menu) |
| 382 | (and reftex-plug-into-AUCTeX | 376 | (and reftex-plug-into-AUCTeX |
| 383 | (reftex-plug-into-AUCTeX)) | 377 | (reftex-plug-into-AUCTeX)) |
| 384 | (unless (get 'reftex-auto-view-crossref 'initialized) | 378 | (unless (get 'reftex-auto-view-crossref 'initialized) |
| 385 | (and reftex-auto-view-crossref | 379 | (and reftex-auto-view-crossref |
| 386 | (reftex-toggle-auto-view-crossref)) | 380 | (reftex-toggle-auto-view-crossref)) |
| 387 | (put 'reftex-auto-view-crossref 'initialized t)) | 381 | (put 'reftex-auto-view-crossref 'initialized t)) |
| 388 | (unless (get 'reftex-auto-recenter-toc 'initialized) | 382 | (unless (get 'reftex-auto-recenter-toc 'initialized) |
| 389 | (and (eq reftex-auto-recenter-toc t) | 383 | (and reftex-auto-recenter-toc |
| 390 | (reftex-toggle-auto-toc-recenter)) | 384 | (reftex-toggle-auto-toc-recenter)) |
| 391 | (put 'reftex-auto-recenter-toc 'initialized t)) | 385 | (put 'reftex-auto-recenter-toc 'initialized t)) |
| 392 | 386 | ||
| 393 | ;; Prepare the special syntax tables. | 387 | ;; Prepare the special syntax tables. |
| 394 | (setq reftex-syntax-table (copy-syntax-table (syntax-table))) | 388 | (setq reftex-syntax-table (copy-syntax-table (syntax-table))) |
| 395 | (modify-syntax-entry ?\( "." reftex-syntax-table) | 389 | (modify-syntax-entry ?\( "." reftex-syntax-table) |
| 396 | (modify-syntax-entry ?\) "." reftex-syntax-table) | 390 | (modify-syntax-entry ?\) "." reftex-syntax-table) |
| 397 | 391 | ||
| 398 | (setq reftex-syntax-table-for-bib | 392 | (setq reftex-syntax-table-for-bib |
| 399 | (copy-syntax-table reftex-syntax-table)) | 393 | (copy-syntax-table reftex-syntax-table)) |
| 400 | (modify-syntax-entry ?\' "." reftex-syntax-table-for-bib) | 394 | (modify-syntax-entry ?\' "." reftex-syntax-table-for-bib) |
| 401 | (modify-syntax-entry ?\" "." reftex-syntax-table-for-bib) | 395 | (modify-syntax-entry ?\" "." reftex-syntax-table-for-bib) |
| 402 | (modify-syntax-entry ?\[ "." reftex-syntax-table-for-bib) | 396 | (modify-syntax-entry ?\[ "." reftex-syntax-table-for-bib) |
| 403 | (modify-syntax-entry ?\] "." reftex-syntax-table-for-bib) | 397 | (modify-syntax-entry ?\] "." reftex-syntax-table-for-bib) |
| 404 | 398 | ||
| 405 | (run-hooks 'reftex-mode-hook)) | 399 | (run-hooks 'reftex-mode-hook)) |
| 406 | ;; Mode was turned off | 400 | ;; Mode was turned off |
| @@ -425,13 +419,13 @@ on the menu bar. | |||
| 425 | ;; This function should be installed in `kill-buffer-hook'. | 419 | ;; This function should be installed in `kill-buffer-hook'. |
| 426 | ;; We are careful to make sure nothing goes wring in this function. | 420 | ;; We are careful to make sure nothing goes wring in this function. |
| 427 | (when (and (boundp 'reftex-mode) reftex-mode | 421 | (when (and (boundp 'reftex-mode) reftex-mode |
| 428 | (boundp 'reftex-save-parse-info) reftex-save-parse-info | 422 | (boundp 'reftex-save-parse-info) reftex-save-parse-info |
| 429 | (boundp 'reftex-docstruct-symbol) reftex-docstruct-symbol | 423 | (boundp 'reftex-docstruct-symbol) reftex-docstruct-symbol |
| 430 | (symbol-value reftex-docstruct-symbol) | 424 | (symbol-value reftex-docstruct-symbol) |
| 431 | (get reftex-docstruct-symbol 'modified)) | 425 | (get reftex-docstruct-symbol 'modified)) |
| 432 | ;; Write the file. | 426 | ;; Write the file. |
| 433 | (condition-case nil | 427 | (condition-case nil |
| 434 | (reftex-access-parse-file 'write) | 428 | (reftex-access-parse-file 'write) |
| 435 | (error nil)))) | 429 | (error nil)))) |
| 436 | 430 | ||
| 437 | (defun reftex-kill-emacs-hook () | 431 | (defun reftex-kill-emacs-hook () |
| @@ -439,9 +433,9 @@ on the menu bar. | |||
| 439 | ;; This function should be installed in `kill-emacs-hook'. | 433 | ;; This function should be installed in `kill-emacs-hook'. |
| 440 | (save-excursion | 434 | (save-excursion |
| 441 | (mapcar (lambda (buf) | 435 | (mapcar (lambda (buf) |
| 442 | (set-buffer buf) | 436 | (set-buffer buf) |
| 443 | (reftex-kill-buffer-hook)) | 437 | (reftex-kill-buffer-hook)) |
| 444 | (buffer-list)))) | 438 | (buffer-list)))) |
| 445 | 439 | ||
| 446 | ;;; ========================================================================= | 440 | ;;; ========================================================================= |
| 447 | ;;; | 441 | ;;; |
| @@ -511,8 +505,8 @@ on the menu bar. | |||
| 511 | (put (symbol-value symbol) :master-index index) | 505 | (put (symbol-value symbol) :master-index index) |
| 512 | ;; Initialize if new symbols. | 506 | ;; Initialize if new symbols. |
| 513 | (when newflag | 507 | (when newflag |
| 514 | (set (symbol-value symbol) nil) | 508 | (set (symbol-value symbol) nil) |
| 515 | (put (symbol-value symbol) 'reftex-index-macros-style '(default)))) | 509 | (put (symbol-value symbol) 'reftex-index-macros-style '(default)))) |
| 516 | 510 | ||
| 517 | ;; Return t if the symbols did already exist, nil when we've made them. | 511 | ;; Return t if the symbols did already exist, nil when we've made them. |
| 518 | (not newflag))) | 512 | (not newflag))) |
| @@ -535,10 +529,10 @@ on the menu bar. | |||
| 535 | ((master | 529 | ((master |
| 536 | (cond | 530 | (cond |
| 537 | ((fboundp 'TeX-master-file) ; AUCTeX is loaded. Use its mechanism. | 531 | ((fboundp 'TeX-master-file) ; AUCTeX is loaded. Use its mechanism. |
| 538 | (condition-case nil | 532 | (condition-case nil |
| 539 | (TeX-master-file t) | 533 | (TeX-master-file t) |
| 540 | (error (buffer-file-name)))) | 534 | (error (buffer-file-name)))) |
| 541 | ((fboundp 'tex-main-file) (tex-main-file)) ; Emacs LaTeX mode | 535 | ((fboundp 'tex-main-file) (tex-main-file)) ; Emacs LaTeX mode |
| 542 | ((boundp 'TeX-master) ; The variable is defined - lets use it. | 536 | ((boundp 'TeX-master) ; The variable is defined - lets use it. |
| 543 | (cond | 537 | (cond |
| 544 | ((eq TeX-master t) | 538 | ((eq TeX-master t) |
| @@ -564,7 +558,7 @@ on the menu bar. | |||
| 564 | (buffer-file-name))))) | 558 | (buffer-file-name))))) |
| 565 | (cond | 559 | (cond |
| 566 | ((null master) | 560 | ((null master) |
| 567 | (error "Need a filename for this buffer, please save it first")) | 561 | (error "Need a filename for this buffer, please save it first")) |
| 568 | ((or (file-exists-p (concat master ".tex")) | 562 | ((or (file-exists-p (concat master ".tex")) |
| 569 | (reftex-get-buffer-visiting (concat master ".tex"))) | 563 | (reftex-get-buffer-visiting (concat master ".tex"))) |
| 570 | ;; Ahh, an extra .tex was missing... | 564 | ;; Ahh, an extra .tex was missing... |
| @@ -575,7 +569,7 @@ on the menu bar. | |||
| 575 | ) | 569 | ) |
| 576 | (t | 570 | (t |
| 577 | ;; Use buffer file name. | 571 | ;; Use buffer file name. |
| 578 | (buffer-file-name))) | 572 | (setq master (buffer-file-name)))) |
| 579 | (expand-file-name master))) | 573 | (expand-file-name master))) |
| 580 | 574 | ||
| 581 | (defun reftex-is-multi () | 575 | (defun reftex-is-multi () |
| @@ -593,15 +587,15 @@ for possible values. This function should be used from AUCTeX style files." | |||
| 593 | (unless reftex-docstruct-symbol | 587 | (unless reftex-docstruct-symbol |
| 594 | (reftex-tie-multifile-symbols)) | 588 | (reftex-tie-multifile-symbols)) |
| 595 | (when (and reftex-docstruct-symbol | 589 | (when (and reftex-docstruct-symbol |
| 596 | (symbolp reftex-docstruct-symbol)) | 590 | (symbolp reftex-docstruct-symbol)) |
| 597 | (put reftex-docstruct-symbol 'reftex-cite-format value))) | 591 | (put reftex-docstruct-symbol 'reftex-cite-format value))) |
| 598 | 592 | ||
| 599 | (defun reftex-get-cite-format () | 593 | (defun reftex-get-cite-format () |
| 600 | ;; Return the current citation format. Either the document-local value in | 594 | ;; Return the current citation format. Either the document-local value in |
| 601 | ;; reftex-cite-format-symbol, or the global value in reftex-cite-format. | 595 | ;; reftex-cite-format-symbol, or the global value in reftex-cite-format. |
| 602 | (if (and reftex-docstruct-symbol | 596 | (if (and reftex-docstruct-symbol |
| 603 | (symbolp reftex-docstruct-symbol) | 597 | (symbolp reftex-docstruct-symbol) |
| 604 | (get reftex-docstruct-symbol 'reftex-cite-format)) | 598 | (get reftex-docstruct-symbol 'reftex-cite-format)) |
| 605 | (get reftex-docstruct-symbol 'reftex-cite-format) | 599 | (get reftex-docstruct-symbol 'reftex-cite-format) |
| 606 | reftex-cite-format)) | 600 | reftex-cite-format)) |
| 607 | 601 | ||
| @@ -617,22 +611,22 @@ the label information is recompiled on next use." | |||
| 617 | (unless reftex-docstruct-symbol | 611 | (unless reftex-docstruct-symbol |
| 618 | (reftex-tie-multifile-symbols)) | 612 | (reftex-tie-multifile-symbols)) |
| 619 | (when (and reftex-docstruct-symbol | 613 | (when (and reftex-docstruct-symbol |
| 620 | (symbolp reftex-docstruct-symbol)) | 614 | (symbolp reftex-docstruct-symbol)) |
| 621 | (let ((list (get reftex-docstruct-symbol 'reftex-index-macros-style)) | 615 | (let ((list (get reftex-docstruct-symbol 'reftex-index-macros-style)) |
| 622 | entry changed) | 616 | entry changed) |
| 623 | (while entry-list | 617 | (while entry-list |
| 624 | (setq entry (pop entry-list)) | 618 | (setq entry (pop entry-list)) |
| 625 | ;; When it is a symbol, remove all other symbols | 619 | ;; When it is a symbol, remove all other symbols |
| 626 | (and (symbolp entry) | 620 | (and (symbolp entry) |
| 627 | (not (memq entry list)) | 621 | (not (memq entry list)) |
| 628 | (setq list (reftex-remove-symbols-from-list list))) | 622 | (setq list (reftex-remove-symbols-from-list list))) |
| 629 | ;; Add to list unless already member | 623 | ;; Add to list unless already member |
| 630 | (unless (member entry list) | 624 | (unless (member entry list) |
| 631 | (setq reftex-tables-dirty t | 625 | (setq reftex-tables-dirty t |
| 632 | changed t) | 626 | changed t) |
| 633 | (push entry list))) | 627 | (push entry list))) |
| 634 | (when changed | 628 | (when changed |
| 635 | (put reftex-docstruct-symbol 'reftex-index-macros-style list))))) | 629 | (put reftex-docstruct-symbol 'reftex-index-macros-style list))))) |
| 636 | 630 | ||
| 637 | ;;; ========================================================================= | 631 | ;;; ========================================================================= |
| 638 | ;;; | 632 | ;;; |
| @@ -734,14 +728,14 @@ the label information is recompiled on next use." | |||
| 734 | 728 | ||
| 735 | ;; A list of all variables in the cache. | 729 | ;; A list of all variables in the cache. |
| 736 | ;; 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. |
| 737 | (defconst reftex-cache-variables | 731 | (defconst reftex-cache-variables |
| 738 | '(reftex-memory ;; This MUST ALWAYS be the first! | 732 | '(reftex-memory ;; This MUST ALWAYS be the first! |
| 739 | 733 | ||
| 740 | ;; Outline | 734 | ;; Outline |
| 741 | reftex-section-levels-all | 735 | reftex-section-levels-all |
| 742 | 736 | ||
| 743 | ;; Labels | 737 | ;; Labels |
| 744 | reftex-env-or-mac-alist | 738 | reftex-env-or-mac-alist |
| 745 | reftex-special-env-parsers | 739 | reftex-special-env-parsers |
| 746 | reftex-macros-with-labels | 740 | reftex-macros-with-labels |
| 747 | reftex-label-mac-list | 741 | reftex-label-mac-list |
| @@ -757,7 +751,7 @@ the label information is recompiled on next use." | |||
| 757 | reftex-index-macro-alist | 751 | reftex-index-macro-alist |
| 758 | reftex-macros-with-index | 752 | reftex-macros-with-index |
| 759 | reftex-query-index-macro-prompt | 753 | reftex-query-index-macro-prompt |
| 760 | reftex-query-index-macro-help | 754 | reftex-query-index-macro-help |
| 761 | reftex-key-to-index-macro-alist | 755 | reftex-key-to-index-macro-alist |
| 762 | 756 | ||
| 763 | ;; Regular expressions | 757 | ;; Regular expressions |
| @@ -774,35 +768,35 @@ the label information is recompiled on next use." | |||
| 774 | (defun reftex-ensure-compiled-variables () | 768 | (defun reftex-ensure-compiled-variables () |
| 775 | ;; Recompile the label alist when necessary | 769 | ;; Recompile the label alist when necessary |
| 776 | (let* ((mem reftex-memory) | 770 | (let* ((mem reftex-memory) |
| 777 | (cache (get reftex-docstruct-symbol 'reftex-cache)) | 771 | (cache (get reftex-docstruct-symbol 'reftex-cache)) |
| 778 | (cmem (car cache)) | 772 | (cmem (car cache)) |
| 779 | (alist reftex-label-alist) | 773 | (alist reftex-label-alist) |
| 780 | (levels (get reftex-docstruct-symbol 'reftex-section-levels)) | 774 | (levels (get reftex-docstruct-symbol 'reftex-section-levels)) |
| 781 | (style (get reftex-docstruct-symbol 'reftex-label-alist-style)) | 775 | (style (get reftex-docstruct-symbol 'reftex-label-alist-style)) |
| 782 | (default reftex-default-label-alist-entries) | 776 | (default reftex-default-label-alist-entries) |
| 783 | (index reftex-index-macros) | 777 | (index reftex-index-macros) |
| 784 | (istyle (get reftex-docstruct-symbol 'reftex-index-macros-style))) | 778 | (istyle (get reftex-docstruct-symbol 'reftex-index-macros-style))) |
| 785 | (cond | 779 | (cond |
| 786 | (reftex-tables-dirty (reftex-compile-variables)) | 780 | (reftex-tables-dirty (reftex-compile-variables)) |
| 787 | ((and (eq alist (nth 0 mem)) | 781 | ((and (eq alist (nth 0 mem)) |
| 788 | (eq levels (nth 1 mem)) | 782 | (eq levels (nth 1 mem)) |
| 789 | (eq style (nth 2 mem)) | 783 | (eq style (nth 2 mem)) |
| 790 | (eq default (nth 3 mem)) | 784 | (eq default (nth 3 mem)) |
| 791 | (eq index (nth 4 mem)) | 785 | (eq index (nth 4 mem)) |
| 792 | (eq istyle (nth 5 mem)))) ;; everything is OK | 786 | (eq istyle (nth 5 mem)))) ;; everything is OK |
| 793 | ((and (eq alist (nth 0 cmem)) | 787 | ((and (eq alist (nth 0 cmem)) |
| 794 | (eq levels (nth 1 cmem)) | 788 | (eq levels (nth 1 cmem)) |
| 795 | (eq style (nth 2 cmem)) | 789 | (eq style (nth 2 cmem)) |
| 796 | (eq default (nth 2 cmem)) | 790 | (eq default (nth 2 cmem)) |
| 797 | (eq index (nth 4 cmem)) | 791 | (eq index (nth 4 cmem)) |
| 798 | (eq istyle (nth 5 cmem))) | 792 | (eq istyle (nth 5 cmem))) |
| 799 | ;; restore the cache | 793 | ;; restore the cache |
| 800 | (message "Restoring cache") | 794 | (message "Restoring cache") |
| 801 | (mapcar (lambda (sym) (set sym (pop cache))) reftex-cache-variables)) | 795 | (mapcar (lambda (sym) (set sym (pop cache))) reftex-cache-variables)) |
| 802 | (t (reftex-compile-variables))))) | 796 | (t (reftex-compile-variables))))) |
| 803 | 797 | ||
| 804 | (defun reftex-reset-mode () | 798 | (defun reftex-reset-mode () |
| 805 | "Reset RefTeX Mode. | 799 | "Reset RefTeX Mode. |
| 806 | This will re-compile the configuration information and remove all | 800 | This will re-compile the configuration information and remove all |
| 807 | current scanning information and the parse file to enforce a rescan | 801 | current scanning information and the parse file to enforce a rescan |
| 808 | on next use." | 802 | on next use." |
| @@ -810,18 +804,18 @@ on next use." | |||
| 810 | 804 | ||
| 811 | ;; Reset the file search path variables | 805 | ;; Reset the file search path variables |
| 812 | (loop for prop in '(status master-dir recursive-path rec-type) do | 806 | (loop for prop in '(status master-dir recursive-path rec-type) do |
| 813 | (put 'reftex-tex-path prop nil) | 807 | (put 'reftex-tex-path prop nil) |
| 814 | (put 'reftex-bib-path prop nil)) | 808 | (put 'reftex-bib-path prop nil)) |
| 815 | 809 | ||
| 816 | ;; Kill temporary buffers associated with RefTeX - just in case they | 810 | ;; Kill temporary buffers associated with RefTeX - just in case they |
| 817 | ;; were not cleaned up properly | 811 | ;; were not cleaned up properly |
| 818 | (save-excursion | 812 | (save-excursion |
| 819 | (let ((buffer-list '("*RefTeX Help*" "*RefTeX Select*" | 813 | (let ((buffer-list '("*RefTeX Help*" "*RefTeX Select*" |
| 820 | "*Duplicate Labels*" "*toc*" " *RefTeX-scratch*")) | 814 | "*Duplicate Labels*" "*toc*" " *RefTeX-scratch*")) |
| 821 | buf) | 815 | buf) |
| 822 | (while (setq buf (pop buffer-list)) | 816 | (while (setq buf (pop buffer-list)) |
| 823 | (if (get-buffer buf) | 817 | (if (get-buffer buf) |
| 824 | (kill-buffer buf)))) | 818 | (kill-buffer buf)))) |
| 825 | (reftex-erase-all-selection-and-index-buffers)) | 819 | (reftex-erase-all-selection-and-index-buffers)) |
| 826 | 820 | ||
| 827 | ;; Make sure the current document will be rescanned soon. | 821 | ;; Make sure the current document will be rescanned soon. |
| @@ -836,7 +830,6 @@ on next use." | |||
| 836 | 830 | ||
| 837 | (reftex-compile-variables)) | 831 | (reftex-compile-variables)) |
| 838 | 832 | ||
| 839 | ;;;###autoload | ||
| 840 | (defun reftex-reset-scanning-information () | 833 | (defun reftex-reset-scanning-information () |
| 841 | "Reset the symbols containing information from buffer scanning. | 834 | "Reset the symbols containing information from buffer scanning. |
| 842 | This enforces rescanning the buffer on next use." | 835 | This enforces rescanning the buffer on next use." |
| @@ -853,12 +846,12 @@ This enforces rescanning the buffer on next use." | |||
| 853 | 846 | ||
| 854 | (defun reftex-erase-all-selection-and-index-buffers () | 847 | (defun reftex-erase-all-selection-and-index-buffers () |
| 855 | ;; Remove all selection buffers associated with current document. | 848 | ;; Remove all selection buffers associated with current document. |
| 856 | (mapcar | 849 | (mapcar |
| 857 | (lambda (type) | 850 | (lambda (type) |
| 858 | (reftex-erase-buffer (reftex-make-selection-buffer-name type))) | 851 | (reftex-erase-buffer (reftex-make-selection-buffer-name type))) |
| 859 | reftex-typekey-list) | 852 | reftex-typekey-list) |
| 860 | ;; Kill all index buffers | 853 | ;; Kill all index buffers |
| 861 | (mapcar | 854 | (mapcar |
| 862 | (lambda (tag) | 855 | (lambda (tag) |
| 863 | (reftex-kill-buffer (reftex-make-index-buffer-name tag))) | 856 | (reftex-kill-buffer (reftex-make-index-buffer-name tag))) |
| 864 | (cdr (assoc 'index-tags (symbol-value reftex-docstruct-symbol))))) | 857 | (cdr (assoc 'index-tags (symbol-value reftex-docstruct-symbol))))) |
| @@ -874,34 +867,34 @@ This enforces rescanning the buffer on next use." | |||
| 874 | 867 | ||
| 875 | ;; Record that we have done this, and what we have used. | 868 | ;; Record that we have done this, and what we have used. |
| 876 | (setq reftex-tables-dirty nil) | 869 | (setq reftex-tables-dirty nil) |
| 877 | (setq reftex-memory | 870 | (setq reftex-memory |
| 878 | (list reftex-label-alist | 871 | (list reftex-label-alist |
| 879 | (get reftex-docstruct-symbol 'reftex-section-levels) | 872 | (get reftex-docstruct-symbol 'reftex-section-levels) |
| 880 | (get reftex-docstruct-symbol 'reftex-label-alist-style) | 873 | (get reftex-docstruct-symbol 'reftex-label-alist-style) |
| 881 | reftex-default-label-alist-entries | 874 | reftex-default-label-alist-entries |
| 882 | reftex-index-macros | 875 | reftex-index-macros |
| 883 | (get reftex-docstruct-symbol 'reftex-index-macros-style))) | 876 | (get reftex-docstruct-symbol 'reftex-index-macros-style))) |
| 884 | 877 | ||
| 885 | ;; Compile information in reftex-label-alist | 878 | ;; Compile information in reftex-label-alist |
| 886 | (let ((all (reftex-uniquify-by-car | 879 | (let ((all (reftex-uniquify-by-car |
| 887 | (reftex-splice-symbols-into-list | 880 | (reftex-splice-symbols-into-list |
| 888 | (append reftex-label-alist | 881 | (append reftex-label-alist |
| 889 | (get reftex-docstruct-symbol | 882 | (get reftex-docstruct-symbol |
| 890 | 'reftex-label-alist-style) | 883 | 'reftex-label-alist-style) |
| 891 | reftex-default-label-alist-entries) | 884 | reftex-default-label-alist-entries) |
| 892 | reftex-label-alist-builtin) | 885 | reftex-label-alist-builtin) |
| 893 | '(nil))) | 886 | '(nil))) |
| 894 | (all-index (reftex-uniquify-by-car | 887 | (all-index (reftex-uniquify-by-car |
| 895 | (reftex-splice-symbols-into-list | 888 | (reftex-splice-symbols-into-list |
| 896 | (append reftex-index-macros | 889 | (append reftex-index-macros |
| 897 | (get reftex-docstruct-symbol | 890 | (get reftex-docstruct-symbol |
| 898 | 'reftex-index-macros-style) | 891 | 'reftex-index-macros-style) |
| 899 | '(default)) | 892 | '(default)) |
| 900 | reftex-index-macros-builtin))) | 893 | reftex-index-macros-builtin))) |
| 901 | entry env-or-mac typekeychar typekey prefix context word | 894 | entry env-or-mac typekeychar typekey prefix context word |
| 902 | fmt reffmt labelfmt wordlist qh-list macros-with-labels | 895 | fmt reffmt labelfmt wordlist qh-list macros-with-labels |
| 903 | nargs nlabel opt-args cell sum i | 896 | nargs nlabel opt-args cell sum i |
| 904 | macro verify repeat nindex tag key toc-level toc-levels) | 897 | macro verify repeat nindex tag key toc-level toc-levels) |
| 905 | 898 | ||
| 906 | (setq reftex-words-to-typekey-alist nil | 899 | (setq reftex-words-to-typekey-alist nil |
| 907 | reftex-typekey-list nil | 900 | reftex-typekey-list nil |
| @@ -930,7 +923,7 @@ This enforces rescanning the buffer on next use." | |||
| 930 | fmt (nth 2 entry) | 923 | fmt (nth 2 entry) |
| 931 | context (nth 3 entry) | 924 | context (nth 3 entry) |
| 932 | wordlist (nth 4 entry) | 925 | wordlist (nth 4 entry) |
| 933 | toc-level (nth 5 entry)) | 926 | toc-level (nth 5 entry)) |
| 934 | (if (stringp wordlist) | 927 | (if (stringp wordlist) |
| 935 | ;; This is before version 2.04 - convert to new format | 928 | ;; This is before version 2.04 - convert to new format |
| 936 | (setq wordlist (nthcdr 4 entry))) | 929 | (setq wordlist (nthcdr 4 entry))) |
| @@ -942,66 +935,66 @@ This enforces rescanning the buffer on next use." | |||
| 942 | (setq fmt (list "\\label{%s}" fmt))) | 935 | (setq fmt (list "\\label{%s}" fmt))) |
| 943 | (setq labelfmt (car fmt) | 936 | (setq labelfmt (car fmt) |
| 944 | reffmt (nth 1 fmt)) | 937 | reffmt (nth 1 fmt)) |
| 945 | ;; Note a new typekey | 938 | ;; Note a new typekey |
| 946 | (if typekey | 939 | (if typekey |
| 947 | (add-to-list 'reftex-typekey-list typekey)) | 940 | (add-to-list 'reftex-typekey-list typekey)) |
| 948 | (if (and typekey prefix | 941 | (if (and typekey prefix |
| 949 | (not (assoc typekey reftex-typekey-to-prefix-alist))) | 942 | (not (assoc typekey reftex-typekey-to-prefix-alist))) |
| 950 | (add-to-list 'reftex-typekey-to-prefix-alist | 943 | (add-to-list 'reftex-typekey-to-prefix-alist |
| 951 | (cons typekey prefix))) | 944 | (cons typekey prefix))) |
| 952 | ;; Check if this is a macro or environment | 945 | ;; Check if this is a macro or environment |
| 953 | (cond | 946 | (cond |
| 954 | ((symbolp env-or-mac) | 947 | ((symbolp env-or-mac) |
| 955 | ;; A special parser function | 948 | ;; A special parser function |
| 956 | (unless (fboundp env-or-mac) | 949 | (unless (fboundp env-or-mac) |
| 957 | (message "Warning: %s does not seem to be a valid function" | 950 | (message "Warning: %s does not seem to be a valid function" |
| 958 | env-or-mac)) | 951 | env-or-mac)) |
| 959 | (setq nargs nil nlabel nil opt-args nil) | 952 | (setq nargs nil nlabel nil opt-args nil) |
| 960 | (add-to-list 'reftex-special-env-parsers env-or-mac) | 953 | (add-to-list 'reftex-special-env-parsers env-or-mac) |
| 961 | (setq env-or-mac (symbol-name env-or-mac))) | 954 | (setq env-or-mac (symbol-name env-or-mac))) |
| 962 | ((string-match "\\`\\\\" env-or-mac) | 955 | ((string-match "\\`\\\\" env-or-mac) |
| 963 | ;; It's a macro | 956 | ;; It's a macro |
| 964 | (let ((result (reftex-parse-args env-or-mac))) | 957 | (let ((result (reftex-parse-args env-or-mac))) |
| 965 | (setq env-or-mac (or (first result) env-or-mac) | 958 | (setq env-or-mac (or (first result) env-or-mac) |
| 966 | nargs (second result) | 959 | nargs (second result) |
| 967 | nlabel (third result) | 960 | nlabel (third result) |
| 968 | opt-args (fourth result)) | 961 | opt-args (fourth result)) |
| 969 | (if nlabel (add-to-list 'macros-with-labels env-or-mac))) | 962 | (if nlabel (add-to-list 'macros-with-labels env-or-mac))) |
| 970 | (if typekey (add-to-list 'reftex-label-mac-list env-or-mac))) | 963 | (if typekey (add-to-list 'reftex-label-mac-list env-or-mac))) |
| 971 | (t | 964 | (t |
| 972 | ;; It's an environment | 965 | ;; It's an environment |
| 973 | (setq nargs nil nlabel nil opt-args nil) | 966 | (setq nargs nil nlabel nil opt-args nil) |
| 974 | (cond ((string= env-or-mac "any")) | 967 | (cond ((string= env-or-mac "any")) |
| 975 | ((string= env-or-mac "")) | 968 | ((string= env-or-mac "")) |
| 976 | ((string= env-or-mac "section")) | 969 | ((string= env-or-mac "section")) |
| 977 | (t | 970 | (t |
| 978 | (add-to-list 'reftex-label-env-list env-or-mac) | 971 | (add-to-list 'reftex-label-env-list env-or-mac) |
| 979 | (if toc-level | 972 | (if toc-level |
| 980 | (let ((string (format "begin{%s}" env-or-mac))) | 973 | (let ((string (format "begin{%s}" env-or-mac))) |
| 981 | (or (assoc string toc-levels) | 974 | (or (assoc string toc-levels) |
| 982 | (push (cons string toc-level) toc-levels)))))))) | 975 | (push (cons string toc-level) toc-levels)))))))) |
| 983 | ;; Translate some special context cases | 976 | ;; Translate some special context cases |
| 984 | (when (assq context reftex-default-context-regexps) | 977 | (when (assq context reftex-default-context-regexps) |
| 985 | (setq context | 978 | (setq context |
| 986 | (format | 979 | (format |
| 987 | (cdr (assq context reftex-default-context-regexps)) | 980 | (cdr (assq context reftex-default-context-regexps)) |
| 988 | (regexp-quote env-or-mac)))) | 981 | (regexp-quote env-or-mac)))) |
| 989 | ;; See if this is the first format for this typekey | 982 | ;; See if this is the first format for this typekey |
| 990 | (and reffmt | 983 | (and reffmt |
| 991 | (not (assoc typekey reftex-typekey-to-format-alist)) | 984 | (not (assoc typekey reftex-typekey-to-format-alist)) |
| 992 | (push (cons typekey reffmt) reftex-typekey-to-format-alist)) | 985 | (push (cons typekey reffmt) reftex-typekey-to-format-alist)) |
| 993 | ;; See if this is the first definition for this env-or-mac | 986 | ;; See if this is the first definition for this env-or-mac |
| 994 | (and (not (string= env-or-mac "any")) | 987 | (and (not (string= env-or-mac "any")) |
| 995 | (not (string= env-or-mac "")) | 988 | (not (string= env-or-mac "")) |
| 996 | (not (assoc env-or-mac reftex-env-or-mac-alist)) | 989 | (not (assoc env-or-mac reftex-env-or-mac-alist)) |
| 997 | (push (list env-or-mac typekey context labelfmt | 990 | (push (list env-or-mac typekey context labelfmt |
| 998 | nargs nlabel opt-args) | 991 | nargs nlabel opt-args) |
| 999 | reftex-env-or-mac-alist)) | 992 | reftex-env-or-mac-alist)) |
| 1000 | ;; Are the magic words regular expressions? Quote normal words. | 993 | ;; Are the magic words regular expressions? Quote normal words. |
| 1001 | (if (eq (car wordlist) 'regexp) | 994 | (if (eq (car wordlist) 'regexp) |
| 1002 | (setq wordlist (cdr wordlist)) | 995 | (setq wordlist (cdr wordlist)) |
| 1003 | (setq wordlist (mapcar 'regexp-quote wordlist))) | 996 | (setq wordlist (mapcar 'regexp-quote wordlist))) |
| 1004 | ;; Remember the first association of each word. | 997 | ;; Remember the first association of each word. |
| 1005 | (while (stringp (setq word (pop wordlist))) | 998 | (while (stringp (setq word (pop wordlist))) |
| 1006 | (or (assoc word reftex-words-to-typekey-alist) | 999 | (or (assoc word reftex-words-to-typekey-alist) |
| 1007 | (push (cons word typekey) reftex-words-to-typekey-alist))) | 1000 | (push (cons word typekey) reftex-words-to-typekey-alist))) |
| @@ -1016,10 +1009,10 @@ This enforces rescanning the buffer on next use." | |||
| 1016 | (nreverse reftex-typekey-to-prefix-alist)) | 1009 | (nreverse reftex-typekey-to-prefix-alist)) |
| 1017 | 1010 | ||
| 1018 | ;; Prepare the typekey query prompt and help string. | 1011 | ;; Prepare the typekey query prompt and help string. |
| 1019 | (setq qh-list | 1012 | (setq qh-list |
| 1020 | (sort qh-list | 1013 | (sort qh-list |
| 1021 | (lambda (x1 x2) | 1014 | (lambda (x1 x2) |
| 1022 | (string< (downcase (car x1)) (downcase (car x2)))))) | 1015 | (string< (downcase (car x1)) (downcase (car x2)))))) |
| 1023 | (setq reftex-type-query-prompt | 1016 | (setq reftex-type-query-prompt |
| 1024 | (concat "Label type: [" | 1017 | (concat "Label type: [" |
| 1025 | (mapconcat (lambda(x) (format "%s" (car x))) | 1018 | (mapconcat (lambda(x) (format "%s" (car x))) |
| @@ -1027,164 +1020,164 @@ This enforces rescanning the buffer on next use." | |||
| 1027 | "]")) | 1020 | "]")) |
| 1028 | ;; In the help string, we need to wrap lines... | 1021 | ;; In the help string, we need to wrap lines... |
| 1029 | (setq reftex-type-query-help | 1022 | (setq reftex-type-query-help |
| 1030 | (concat | 1023 | (concat |
| 1031 | "SELECT A LABEL TYPE:\n--------------------\n" | 1024 | "SELECT A LABEL TYPE:\n--------------------\n" |
| 1032 | (mapconcat | 1025 | (mapconcat |
| 1033 | (lambda(x) | 1026 | (lambda(x) |
| 1034 | (setq sum 0) | 1027 | (setq sum 0) |
| 1035 | (format " [%s] %s" | 1028 | (format " [%s] %s" |
| 1036 | (car x) | 1029 | (car x) |
| 1037 | (mapconcat (lambda(env) | 1030 | (mapconcat (lambda(env) |
| 1038 | (setq sum (+ sum (length env))) | 1031 | (setq sum (+ sum (length env))) |
| 1039 | (if (< sum 60) | 1032 | (if (< sum 60) |
| 1040 | env | 1033 | env |
| 1041 | (setq sum 0) | 1034 | (setq sum 0) |
| 1042 | (concat "\n " env))) | 1035 | (concat "\n " env))) |
| 1043 | (cdr x) " "))) | 1036 | (cdr x) " "))) |
| 1044 | qh-list "\n"))) | 1037 | qh-list "\n"))) |
| 1045 | 1038 | ||
| 1046 | ;; Convert magic words to regular expressions. We make regular expressions | 1039 | ;; Convert magic words to regular expressions. We make regular expressions |
| 1047 | ;; 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. |
| 1048 | ;; These characters will be seen and removed. | 1041 | ;; These characters will be seen and removed. |
| 1049 | (setq reftex-words-to-typekey-alist | 1042 | (setq reftex-words-to-typekey-alist |
| 1050 | (mapcar | 1043 | (mapcar |
| 1051 | (lambda (x) | 1044 | (lambda (x) |
| 1052 | (setq word (car x) | 1045 | (setq word (car x) |
| 1053 | typekey (cdr x) | 1046 | typekey (cdr x) |
| 1054 | fmt (cdr (assoc typekey reftex-typekey-to-format-alist))) | 1047 | fmt (cdr (assoc typekey reftex-typekey-to-format-alist))) |
| 1055 | (setq word (concat "\\W\\(" word "[ \t\n\r]*\\)\\(")) | 1048 | (setq word (concat "\\W\\(" word "[ \t\n\r]*\\)\\(")) |
| 1056 | (setq i 0) | 1049 | (setq i 0) |
| 1057 | (while (and (< i 10) ; maximum number of format chars allowed | 1050 | (while (and (< i 10) ; maximum number of format chars allowed |
| 1058 | (< i (length fmt)) | 1051 | (< i (length fmt)) |
| 1059 | (not (member (aref fmt i) '(?%)))) | 1052 | (not (member (aref fmt i) '(?%)))) |
| 1060 | (setq word (concat word "\\|" (regexp-quote | 1053 | (setq word (concat word "\\|" (regexp-quote |
| 1061 | (substring fmt 0 (1+ i))))) | 1054 | (substring fmt 0 (1+ i))))) |
| 1062 | (incf i)) | 1055 | (incf i)) |
| 1063 | (cons (concat word "\\)\\=") typekey)) | 1056 | (cons (concat word "\\)\\=") typekey)) |
| 1064 | (nreverse reftex-words-to-typekey-alist))) | 1057 | (nreverse reftex-words-to-typekey-alist))) |
| 1065 | 1058 | ||
| 1066 | ;; Parse the index macros | 1059 | ;; Parse the index macros |
| 1067 | (setq reftex-index-macro-alist nil | 1060 | (setq reftex-index-macro-alist nil |
| 1068 | reftex-key-to-index-macro-alist nil | 1061 | reftex-key-to-index-macro-alist nil |
| 1069 | reftex-macros-with-index nil) | 1062 | reftex-macros-with-index nil) |
| 1070 | (while all-index | 1063 | (while all-index |
| 1071 | (setq entry (car all-index) | 1064 | (setq entry (car all-index) |
| 1072 | macro (car entry) | 1065 | macro (car entry) |
| 1073 | tag (nth 1 entry) | 1066 | tag (nth 1 entry) |
| 1074 | key (nth 2 entry) | 1067 | key (nth 2 entry) |
| 1075 | prefix (or (nth 3 entry) "") | 1068 | prefix (or (nth 3 entry) "") |
| 1076 | verify (nth 4 entry) | 1069 | verify (nth 4 entry) |
| 1077 | ;; For repeat, we need to be compatible with older code | 1070 | ;; For repeat, we need to be compatible with older code |
| 1078 | ;; This information used to be given only for the default macro, | 1071 | ;; This information used to be given only for the default macro, |
| 1079 | ;; but later we required to have it for *every* index macro | 1072 | ;; but later we required to have it for *every* index macro |
| 1080 | repeat (cond ((> (length entry) 5) (nth 5 entry)) | 1073 | repeat (cond ((> (length entry) 5) (nth 5 entry)) |
| 1081 | ((and (eq key (car reftex-index-default-macro)) | 1074 | ((and (eq key (car reftex-index-default-macro)) |
| 1082 | (> (length reftex-index-default-macro) 2)) | 1075 | (> (length reftex-index-default-macro) 2)) |
| 1083 | ;; User has old setting - respect it | 1076 | ;; User has old setting - respect it |
| 1084 | (nth 2 reftex-index-default-macro)) | 1077 | (nth 2 reftex-index-default-macro)) |
| 1085 | (t t)) | 1078 | (t t)) |
| 1086 | all-index (cdr all-index)) | 1079 | all-index (cdr all-index)) |
| 1087 | (let ((result (reftex-parse-args macro))) | 1080 | (let ((result (reftex-parse-args macro))) |
| 1088 | (setq macro (or (first result) macro) | 1081 | (setq macro (or (first result) macro) |
| 1089 | nargs (second result) | 1082 | nargs (second result) |
| 1090 | nindex (third result) | 1083 | nindex (third result) |
| 1091 | opt-args (fourth result)) | 1084 | opt-args (fourth result)) |
| 1092 | (unless (member macro reftex-macros-with-index) | 1085 | (unless (member macro reftex-macros-with-index) |
| 1093 | ;; 0 1 2 3 4 5 6 7 | 1086 | ;; 0 1 2 3 4 5 6 7 |
| 1094 | (push (list macro tag prefix verify nargs nindex opt-args repeat) | 1087 | (push (list macro tag prefix verify nargs nindex opt-args repeat) |
| 1095 | reftex-index-macro-alist) | 1088 | reftex-index-macro-alist) |
| 1096 | (or (assoc key reftex-key-to-index-macro-alist) | 1089 | (or (assoc key reftex-key-to-index-macro-alist) |
| 1097 | (push (list key macro) reftex-key-to-index-macro-alist)) | 1090 | (push (list key macro) reftex-key-to-index-macro-alist)) |
| 1098 | (push macro reftex-macros-with-index)))) | 1091 | (push macro reftex-macros-with-index)))) |
| 1099 | ;; Make the prompt and help string for index macros query | 1092 | ;; Make the prompt and help string for index macros query |
| 1100 | (setq reftex-key-to-index-macro-alist | 1093 | (setq reftex-key-to-index-macro-alist |
| 1101 | (sort reftex-key-to-index-macro-alist | 1094 | (sort reftex-key-to-index-macro-alist |
| 1102 | (lambda (a b) (< (downcase (car a)) (downcase (car b)))))) | 1095 | (lambda (a b) (< (downcase (car a)) (downcase (car b)))))) |
| 1103 | (setq reftex-query-index-macro-prompt | 1096 | (setq reftex-query-index-macro-prompt |
| 1104 | (concat "Index macro: [" | 1097 | (concat "Index macro: [" |
| 1105 | (mapconcat (lambda (x) (char-to-string (car x))) | 1098 | (mapconcat (lambda (x) (char-to-string (car x))) |
| 1106 | reftex-key-to-index-macro-alist "") | 1099 | reftex-key-to-index-macro-alist "") |
| 1107 | "]")) | 1100 | "]")) |
| 1108 | (setq i 0 | 1101 | (setq i 0 |
| 1109 | reftex-query-index-macro-help | 1102 | reftex-query-index-macro-help |
| 1110 | (concat | 1103 | (concat |
| 1111 | "SELECT A MACRO:\n---------------\n" | 1104 | "SELECT A MACRO:\n---------------\n" |
| 1112 | (mapconcat | 1105 | (mapconcat |
| 1113 | (lambda(x) | 1106 | (lambda(x) |
| 1114 | (format "[%c] %-20.20s%s" (car x) (nth 1 x) | 1107 | (format "[%c] %-20.20s%s" (car x) (nth 1 x) |
| 1115 | (if (= 0 (mod (incf i) 3)) "\n" ""))) | 1108 | (if (= 0 (mod (incf i) 3)) "\n" ""))) |
| 1116 | reftex-key-to-index-macro-alist ""))) | 1109 | reftex-key-to-index-macro-alist ""))) |
| 1117 | 1110 | ||
| 1118 | ;; Make the full list of section levels | 1111 | ;; Make the full list of section levels |
| 1119 | (setq reftex-section-levels-all | 1112 | (setq reftex-section-levels-all |
| 1120 | (append toc-levels | 1113 | (append toc-levels |
| 1121 | (get reftex-docstruct-symbol 'reftex-section-levels) | 1114 | (get reftex-docstruct-symbol 'reftex-section-levels) |
| 1122 | reftex-section-levels)) | 1115 | reftex-section-levels)) |
| 1123 | 1116 | ||
| 1124 | ;; Calculate the regular expressions | 1117 | ;; Calculate the regular expressions |
| 1125 | (let* ( | 1118 | (let* ( |
| 1126 | ; (wbol "\\(\\`\\|[\n\r]\\)[ \t]*") | 1119 | ; (wbol "\\(\\`\\|[\n\r]\\)[ \t]*") |
| 1127 | (wbol "\\(^\\)[ \t]*") ; Need to keep the empty group because | 1120 | (wbol "\\(^\\)[ \t]*") ; Need to keep the empty group because |
| 1128 | ;;; because match number are hard coded | 1121 | ;;; because match number are hard coded |
| 1129 | (label-re "\\\\label{\\([^}]*\\)}") | 1122 | (label-re "\\\\label{\\([^}]*\\)}") |
| 1130 | (include-re (concat wbol | 1123 | (include-re (concat wbol |
| 1131 | "\\\\\\(" | 1124 | "\\\\\\(" |
| 1132 | (mapconcat 'identity | 1125 | (mapconcat 'identity |
| 1133 | reftex-include-file-commands "\\|") | 1126 | reftex-include-file-commands "\\|") |
| 1134 | "\\)[{ \t]+\\([^} \t\n\r]+\\)")) | 1127 | "\\)[{ \t]+\\([^} \t\n\r]+\\)")) |
| 1135 | (section-re | 1128 | (section-re |
| 1136 | (concat wbol "\\\\\\(" | 1129 | (concat wbol "\\\\\\(" |
| 1137 | (mapconcat (lambda (x) (regexp-quote (car x))) | 1130 | (mapconcat (lambda (x) (regexp-quote (car x))) |
| 1138 | reftex-section-levels-all "\\|") | 1131 | reftex-section-levels-all "\\|") |
| 1139 | "\\)\\*?\\(\\[[^]]*\\]\\)?[[{ \t\r\n]")) | 1132 | "\\)\\*?\\(\\[[^]]*\\]\\)?[[{ \t\r\n]")) |
| 1140 | (appendix-re (concat wbol "\\(\\\\appendix\\)")) | 1133 | (appendix-re (concat wbol "\\(\\\\appendix\\)")) |
| 1141 | (macro-re | 1134 | (macro-re |
| 1142 | (if macros-with-labels | 1135 | (if macros-with-labels |
| 1143 | (concat "\\(" | 1136 | (concat "\\(" |
| 1144 | (mapconcat 'regexp-quote macros-with-labels "\\|") | 1137 | (mapconcat 'regexp-quote macros-with-labels "\\|") |
| 1145 | "\\)[[{]") | 1138 | "\\)[[{]") |
| 1146 | "")) | 1139 | "")) |
| 1147 | (index-re | 1140 | (index-re |
| 1148 | (concat "\\(" | 1141 | (concat "\\(" |
| 1149 | (mapconcat 'regexp-quote reftex-macros-with-index "\\|") | 1142 | (mapconcat 'regexp-quote reftex-macros-with-index "\\|") |
| 1150 | "\\)[[{]")) | 1143 | "\\)[[{]")) |
| 1151 | (find-index-re-format | 1144 | (find-index-re-format |
| 1152 | (concat "\\(" | 1145 | (concat "\\(" |
| 1153 | (mapconcat 'regexp-quote reftex-macros-with-index "\\|") | 1146 | (mapconcat 'regexp-quote reftex-macros-with-index "\\|") |
| 1154 | "\\)\\([[{][^]}]*[]}]\\)*[[{]\\(%s\\)[]}]")) | 1147 | "\\)\\([[{][^]}]*[]}]\\)*[[{]\\(%s\\)[]}]")) |
| 1155 | (find-label-re-format | 1148 | (find-label-re-format |
| 1156 | (concat "\\(" | 1149 | (concat "\\(" |
| 1157 | (mapconcat 'regexp-quote (append '("\\label") | 1150 | (mapconcat 'regexp-quote (append '("\\label") |
| 1158 | macros-with-labels) "\\|") | 1151 | macros-with-labels) "\\|") |
| 1159 | "\\)\\([[{][^]}]*[]}]\\)*[[{]\\(%s\\)[]}]")) | 1152 | "\\)\\([[{][^]}]*[]}]\\)*[[{]\\(%s\\)[]}]")) |
| 1160 | (index-level-re | 1153 | (index-level-re |
| 1161 | (regexp-quote (nth 0 reftex-index-special-chars))) | 1154 | (regexp-quote (nth 0 reftex-index-special-chars))) |
| 1162 | (index-key-end-re ;; ^]- not allowed | 1155 | (index-key-end-re ;; ^]- not allowed |
| 1163 | (concat "[^" (nth 3 reftex-index-special-chars) "]" | 1156 | (concat "[^" (nth 3 reftex-index-special-chars) "]" |
| 1164 | "[" (nth 1 reftex-index-special-chars) | 1157 | "[" (nth 1 reftex-index-special-chars) |
| 1165 | (nth 2 reftex-index-special-chars) "]")) | 1158 | (nth 2 reftex-index-special-chars) "]")) |
| 1166 | ) | 1159 | ) |
| 1167 | (setq reftex-section-regexp section-re | 1160 | (setq reftex-section-regexp section-re |
| 1168 | reftex-section-or-include-regexp | 1161 | reftex-section-or-include-regexp |
| 1169 | (concat section-re "\\|" include-re) | 1162 | (concat section-re "\\|" include-re) |
| 1170 | reftex-everything-regexp | 1163 | reftex-everything-regexp |
| 1171 | (concat label-re "\\|" section-re "\\|" include-re | 1164 | (concat label-re "\\|" section-re "\\|" include-re |
| 1172 | "\\|" appendix-re | 1165 | "\\|" appendix-re |
| 1173 | "\\|" index-re | 1166 | "\\|" index-re |
| 1174 | (if macros-with-labels "\\|" "") macro-re) | 1167 | (if macros-with-labels "\\|" "") macro-re) |
| 1175 | reftex-everything-regexp-no-index | 1168 | reftex-everything-regexp-no-index |
| 1176 | (concat label-re "\\|" section-re "\\|" include-re | 1169 | (concat label-re "\\|" section-re "\\|" include-re |
| 1177 | "\\|" appendix-re | 1170 | "\\|" appendix-re |
| 1178 | "\\|" "\\(\\\\6\\\\3\\\\1\\)" ; This is unlikely to match | 1171 | "\\|" "\\(\\\\6\\\\3\\\\1\\)" ; This is unlikely to match |
| 1179 | (if macros-with-labels "\\|" "") macro-re) | 1172 | (if macros-with-labels "\\|" "") macro-re) |
| 1180 | reftex-index-re index-re | 1173 | reftex-index-re index-re |
| 1181 | reftex-index-level-re index-level-re | 1174 | reftex-index-level-re index-level-re |
| 1182 | reftex-index-key-end-re index-key-end-re | 1175 | reftex-index-key-end-re index-key-end-re |
| 1183 | reftex-macros-with-labels macros-with-labels | 1176 | reftex-macros-with-labels macros-with-labels |
| 1184 | reftex-find-index-entry-regexp-format find-index-re-format | 1177 | reftex-find-index-entry-regexp-format find-index-re-format |
| 1185 | reftex-find-label-regexp-format find-label-re-format | 1178 | reftex-find-label-regexp-format find-label-re-format |
| 1186 | reftex-find-label-regexp-format2 | 1179 | reftex-find-label-regexp-format2 |
| 1187 | "\\([]} \t\n\r]\\)\\([[{]\\)\\(%s\\)[]}]") | 1180 | "\\([]} \t\n\r]\\)\\([[{]\\)\\(%s\\)[]}]") |
| 1188 | (message "Compiling label environment definitions...done"))) | 1181 | (message "Compiling label environment definitions...done"))) |
| 1189 | (put reftex-docstruct-symbol 'reftex-cache | 1182 | (put reftex-docstruct-symbol 'reftex-cache |
| 1190 | (mapcar 'symbol-value reftex-cache-variables))) | 1183 | (mapcar 'symbol-value reftex-cache-variables))) |
| @@ -1202,8 +1195,8 @@ This enforces rescanning the buffer on next use." | |||
| 1202 | (when (eq ?\[ (string-to-char args)) | 1195 | (when (eq ?\[ (string-to-char args)) |
| 1203 | (push cnt opt-list)) | 1196 | (push cnt opt-list)) |
| 1204 | (when (and (match-end 1) | 1197 | (when (and (match-end 1) |
| 1205 | (not nlabel)) | 1198 | (not nlabel)) |
| 1206 | (setq nlabel cnt)) | 1199 | (setq nlabel cnt)) |
| 1207 | (setq args (substring args (match-end 0)))) | 1200 | (setq args (substring args (match-end 0)))) |
| 1208 | (list must-match cnt nlabel opt-list))) | 1201 | (list must-match cnt nlabel opt-list))) |
| 1209 | nil)) | 1202 | nil)) |
| @@ -1227,14 +1220,14 @@ This enforces rescanning the buffer on next use." | |||
| 1227 | (reftex-ensure-compiled-variables) | 1220 | (reftex-ensure-compiled-variables) |
| 1228 | 1221 | ||
| 1229 | (when (or (null (symbol-value reftex-docstruct-symbol)) | 1222 | (when (or (null (symbol-value reftex-docstruct-symbol)) |
| 1230 | (member rescan '(t 1 (4) (16)))) | 1223 | (member rescan '(t 1 (4) (16)))) |
| 1231 | ;; The docstruct will change: Remove selection buffers. | 1224 | ;; The docstruct will change: Remove selection buffers. |
| 1232 | (save-excursion | 1225 | (save-excursion |
| 1233 | (reftex-erase-buffer "*toc*") | 1226 | (reftex-erase-buffer "*toc*") |
| 1234 | (reftex-erase-all-selection-and-index-buffers))) | 1227 | (reftex-erase-all-selection-and-index-buffers))) |
| 1235 | 1228 | ||
| 1236 | (if (and (null (symbol-value reftex-docstruct-symbol)) | 1229 | (if (and (null (symbol-value reftex-docstruct-symbol)) |
| 1237 | (not (member rescan '(t 1 (4) (16)))) | 1230 | (not (member rescan '(t 1 (4) (16)))) |
| 1238 | reftex-save-parse-info) | 1231 | reftex-save-parse-info) |
| 1239 | ;; Try to read the stuff from a file | 1232 | ;; Try to read the stuff from a file |
| 1240 | (reftex-access-parse-file 'read)) | 1233 | (reftex-access-parse-file 'read)) |
| @@ -1248,6 +1241,7 @@ This enforces rescanning the buffer on next use." | |||
| 1248 | ;; Scan whatever was required by the caller. | 1241 | ;; Scan whatever was required by the caller. |
| 1249 | (reftex-do-parse rescan file)))) | 1242 | (reftex-do-parse rescan file)))) |
| 1250 | 1243 | ||
| 1244 | ;;;###autoload | ||
| 1251 | (defun reftex-scanning-info-available-p () | 1245 | (defun reftex-scanning-info-available-p () |
| 1252 | "Is the scanning info about the current document available?" | 1246 | "Is the scanning info about the current document available?" |
| 1253 | (unless reftex-docstruct-symbol | 1247 | (unless reftex-docstruct-symbol |
| @@ -1255,7 +1249,7 @@ This enforces rescanning the buffer on next use." | |||
| 1255 | (and (symbolp reftex-docstruct-symbol) | 1249 | (and (symbolp reftex-docstruct-symbol) |
| 1256 | (symbol-value reftex-docstruct-symbol) | 1250 | (symbol-value reftex-docstruct-symbol) |
| 1257 | t)) | 1251 | t)) |
| 1258 | 1252 | ||
| 1259 | (defun reftex-silence-toc-markers (list n) | 1253 | (defun reftex-silence-toc-markers (list n) |
| 1260 | ;; Set all toc markers in the first N entries in list to nil | 1254 | ;; Set all toc markers in the first N entries in list to nil |
| 1261 | (while (and list (> (decf n) -1)) | 1255 | (while (and list (> (decf n) -1)) |
| @@ -1268,12 +1262,12 @@ This enforces rescanning the buffer on next use." | |||
| 1268 | "Perform ACTION on the parse file (the .rel file). | 1262 | "Perform ACTION on the parse file (the .rel file). |
| 1269 | Valid actions are: readable, restore, read, kill, write." | 1263 | Valid actions are: readable, restore, read, kill, write." |
| 1270 | (let* ((list (symbol-value reftex-docstruct-symbol)) | 1264 | (let* ((list (symbol-value reftex-docstruct-symbol)) |
| 1271 | (docstruct-symbol reftex-docstruct-symbol) | 1265 | (docstruct-symbol reftex-docstruct-symbol) |
| 1272 | (master (reftex-TeX-master-file)) | 1266 | (master (reftex-TeX-master-file)) |
| 1273 | (enable-local-variables nil) | 1267 | (enable-local-variables nil) |
| 1274 | (file (if (string-match "\\.[a-zA-Z]+\\'" master) | 1268 | (file (if (string-match "\\.[a-zA-Z]+\\'" master) |
| 1275 | (concat (substring master 0 (match-beginning 0)) | 1269 | (concat (substring master 0 (match-beginning 0)) |
| 1276 | reftex-parse-file-extension) | 1270 | reftex-parse-file-extension) |
| 1277 | (concat master reftex-parse-file-extension)))) | 1271 | (concat master reftex-parse-file-extension)))) |
| 1278 | (cond | 1272 | (cond |
| 1279 | ((eq action 'readable) | 1273 | ((eq action 'readable) |
| @@ -1285,31 +1279,31 @@ Valid actions are: readable, restore, read, kill, write." | |||
| 1285 | (reftex-tie-multifile-symbols)) | 1279 | (reftex-tie-multifile-symbols)) |
| 1286 | (if (file-exists-p file) | 1280 | (if (file-exists-p file) |
| 1287 | ;; load the file and return t for success | 1281 | ;; load the file and return t for success |
| 1288 | (condition-case nil | 1282 | (condition-case nil |
| 1289 | (progn (load-file file) t) | 1283 | (progn (load-file file) t) |
| 1290 | (error (set reftex-docstruct-symbol nil) | 1284 | (error (set reftex-docstruct-symbol nil) |
| 1291 | (error "Error while loading file %s" file))) | 1285 | (error "Error while loading file %s" file))) |
| 1292 | ;; Throw an exception if the file does not exist | 1286 | ;; Throw an exception if the file does not exist |
| 1293 | (error "No restore file %s" file))) | 1287 | (error "No restore file %s" file))) |
| 1294 | ((eq action 'read) | 1288 | ((eq action 'read) |
| 1295 | (put reftex-docstruct-symbol 'modified nil) | 1289 | (put reftex-docstruct-symbol 'modified nil) |
| 1296 | (if (file-exists-p file) | 1290 | (if (file-exists-p file) |
| 1297 | ;; load the file and return t for success | 1291 | ;; load the file and return t for success |
| 1298 | (condition-case nil | 1292 | (condition-case nil |
| 1299 | (progn | 1293 | (progn |
| 1300 | (load-file file) | 1294 | (load-file file) |
| 1301 | (reftex-check-parse-consistency) | 1295 | (reftex-check-parse-consistency) |
| 1302 | t) | 1296 | t) |
| 1303 | (error (message "Error while restoring file %s" file) | 1297 | (error (message "Error while restoring file %s" file) |
| 1304 | (set reftex-docstruct-symbol nil) | 1298 | (set reftex-docstruct-symbol nil) |
| 1305 | nil)) | 1299 | nil)) |
| 1306 | ;; return nil for failure, but no exception | 1300 | ;; return nil for failure, but no exception |
| 1307 | nil)) | 1301 | nil)) |
| 1308 | ((eq action 'kill) | 1302 | ((eq action 'kill) |
| 1309 | ;; Remove the file | 1303 | ;; Remove the file |
| 1310 | (when (and (file-exists-p file) (file-writable-p file)) | 1304 | (when (and (file-exists-p file) (file-writable-p file)) |
| 1311 | (message "Unlinking file %s" file) | 1305 | (message "Unlinking file %s" file) |
| 1312 | (delete-file file))) | 1306 | (delete-file file))) |
| 1313 | (t | 1307 | (t |
| 1314 | (put docstruct-symbol 'modified nil) | 1308 | (put docstruct-symbol 'modified nil) |
| 1315 | (save-excursion | 1309 | (save-excursion |
| @@ -1325,20 +1319,20 @@ Valid actions are: readable, restore, read, kill, write." | |||
| 1325 | (insert "(set reftex-docstruct-symbol '(\n\n") | 1319 | (insert "(set reftex-docstruct-symbol '(\n\n") |
| 1326 | (let ((standard-output (current-buffer))) | 1320 | (let ((standard-output (current-buffer))) |
| 1327 | (mapcar | 1321 | (mapcar |
| 1328 | (lambda (x) | 1322 | (lambda (x) |
| 1329 | (cond ((eq (car x) 'toc) | 1323 | (cond ((eq (car x) 'toc) |
| 1330 | ;; A toc entry. Do not save the marker. | 1324 | ;; A toc entry. Do not save the marker. |
| 1331 | ;; Save the markers position at position 8 | 1325 | ;; Save the markers position at position 8 |
| 1332 | (print (list 'toc "toc" (nth 2 x) (nth 3 x) | 1326 | (print (list 'toc "toc" (nth 2 x) (nth 3 x) |
| 1333 | nil (nth 5 x) (nth 6 x) (nth 7 x) | 1327 | nil (nth 5 x) (nth 6 x) (nth 7 x) |
| 1334 | (or (and (markerp (nth 4 x)) | 1328 | (or (and (markerp (nth 4 x)) |
| 1335 | (marker-position (nth 4 x))) | 1329 | (marker-position (nth 4 x))) |
| 1336 | (nth 8 x))))) | 1330 | (nth 8 x))))) |
| 1337 | ((and (not (eq t reftex-support-index)) | 1331 | ((and (not (eq t reftex-support-index)) |
| 1338 | (eq (car x) 'index)) | 1332 | (eq (car x) 'index)) |
| 1339 | ;; Don't save index entries | 1333 | ;; Don't save index entries |
| 1340 | ) | 1334 | ) |
| 1341 | (t (print x)))) | 1335 | (t (print x)))) |
| 1342 | list)) | 1336 | list)) |
| 1343 | (insert "))\n\n") | 1337 | (insert "))\n\n") |
| 1344 | (save-buffer 0) | 1338 | (save-buffer 0) |
| @@ -1351,29 +1345,29 @@ Valid actions are: readable, restore, read, kill, write." | |||
| 1351 | 1345 | ||
| 1352 | ;; Check if the master is the same: when moving a document, this will see it. | 1346 | ;; Check if the master is the same: when moving a document, this will see it. |
| 1353 | (let* ((real-master (reftex-TeX-master-file)) | 1347 | (let* ((real-master (reftex-TeX-master-file)) |
| 1354 | (parsed-master | 1348 | (parsed-master |
| 1355 | (nth 1 (assq 'bof (symbol-value reftex-docstruct-symbol))))) | 1349 | (nth 1 (assq 'bof (symbol-value reftex-docstruct-symbol))))) |
| 1356 | (unless (string= (file-truename real-master) (file-truename parsed-master)) | 1350 | (unless (string= (file-truename real-master) (file-truename parsed-master)) |
| 1357 | (message "Master file name in load file is different: %s versus %s" | 1351 | (message "Master file name in load file is different: %s versus %s" |
| 1358 | parsed-master real-master) | 1352 | parsed-master real-master) |
| 1359 | (error "Master file name error"))) | 1353 | (error "Master file name error"))) |
| 1360 | 1354 | ||
| 1361 | ;; Check for the existence of all document files | 1355 | ;; Check for the existence of all document files |
| 1362 | ;;; (let* ((all (symbol-value reftex-docstruct-symbol))) | 1356 | ;;; (let* ((all (symbol-value reftex-docstruct-symbol))) |
| 1363 | ;;; (while all | 1357 | ;;; (while all |
| 1364 | ;;; (when (and (eq (car (car all)) 'bof) | 1358 | ;;; (when (and (eq (car (car all)) 'bof) |
| 1365 | ;;; (not (file-regular-p (nth 1 (car all))))) | 1359 | ;;; (not (file-regular-p (nth 1 (car all))))) |
| 1366 | ;;; (message "File %s in saved parse info not avalable" (cdr (car all))) | 1360 | ;;; (message "File %s in saved parse info not avalable" (cdr (car all))) |
| 1367 | ;;; (error "File not found")) | 1361 | ;;; (error "File not found")) |
| 1368 | ;;; (setq all (cdr all)))) | 1362 | ;;; (setq all (cdr all)))) |
| 1369 | ) | 1363 | ) |
| 1370 | 1364 | ||
| 1371 | (defun reftex-select-external-document (xr-alist xr-index) | 1365 | (defun reftex-select-external-document (xr-alist xr-index) |
| 1372 | ;; Return index of an external document. | 1366 | ;; Return index of an external document. |
| 1373 | (let* ((len (length xr-alist)) (highest (1- (+ ?0 len))) | 1367 | (let* ((len (length xr-alist)) (highest (1- (+ ?0 len))) |
| 1374 | (prompt (format "[%c-%c] Select TAB: Read prefix with completion" | 1368 | (prompt (format "[%c-%c] Select TAB: Read prefix with completion" |
| 1375 | ?0 highest)) | 1369 | ?0 highest)) |
| 1376 | key prefix) | 1370 | key prefix) |
| 1377 | (cond | 1371 | (cond |
| 1378 | ((= len 1) | 1372 | ((= len 1) |
| 1379 | (message "No external documents available") | 1373 | (message "No external documents available") |
| @@ -1382,27 +1376,27 @@ Valid actions are: readable, restore, read, kill, write." | |||
| 1382 | (- 1 xr-index)) | 1376 | (- 1 xr-index)) |
| 1383 | (t | 1377 | (t |
| 1384 | (save-excursion | 1378 | (save-excursion |
| 1385 | (let* ((length (apply 'max (mapcar | 1379 | (let* ((length (apply 'max (mapcar |
| 1386 | (lambda(x) (length (car x))) xr-alist))) | 1380 | (lambda(x) (length (car x))) xr-alist))) |
| 1387 | (fmt (format " [%%c] %%-%ds %%s\n" length)) | 1381 | (fmt (format " [%%c] %%-%ds %%s\n" length)) |
| 1388 | (n (1- ?0))) | 1382 | (n (1- ?0))) |
| 1389 | (setq key | 1383 | (setq key |
| 1390 | (reftex-select-with-char | 1384 | (reftex-select-with-char |
| 1391 | prompt | 1385 | prompt |
| 1392 | (concat | 1386 | (concat |
| 1393 | "SELECT EXTERNAL DOCUMENT\n------------------------\n" | 1387 | "SELECT EXTERNAL DOCUMENT\n------------------------\n" |
| 1394 | (mapconcat | 1388 | (mapconcat |
| 1395 | (lambda (x) | 1389 | (lambda (x) |
| 1396 | (format fmt (incf n) (or (car x) "") | 1390 | (format fmt (incf n) (or (car x) "") |
| 1397 | (abbreviate-file-name (cdr x)))) | 1391 | (abbreviate-file-name (cdr x)))) |
| 1398 | xr-alist "")) | 1392 | xr-alist "")) |
| 1399 | nil t)) | 1393 | nil t)) |
| 1400 | (cond | 1394 | (cond |
| 1401 | ((and (>= key ?0) (<= key highest)) (- key ?0)) | 1395 | ((and (>= key ?0) (<= key highest)) (- key ?0)) |
| 1402 | ((= key ?\C-i) | 1396 | ((= key ?\C-i) |
| 1403 | (setq prefix (completing-read "Prefix: " xr-alist nil t)) | 1397 | (setq prefix (completing-read "Prefix: " xr-alist nil t)) |
| 1404 | (- len (length (memq (assoc prefix xr-alist) xr-alist)))) | 1398 | (- len (length (memq (assoc prefix xr-alist) xr-alist)))) |
| 1405 | (t (error "Illegal document selection [%c]" key))))))))) | 1399 | (t (error "Illegal document selection [%c]" key))))))))) |
| 1406 | 1400 | ||
| 1407 | ;;; ========================================================================= | 1401 | ;;; ========================================================================= |
| 1408 | ;;; | 1402 | ;;; |
| @@ -1414,65 +1408,65 @@ If the file does not have any of the legal extensions for TYPE, | |||
| 1414 | try first the default extension and only then the naked file name. | 1408 | try first the default extension and only then the naked file name. |
| 1415 | When DIE is non-nil, throw an error if file not found." | 1409 | When DIE is non-nil, throw an error if file not found." |
| 1416 | (let* ((rec-values (if reftex-search-unrecursed-path-first '(nil t) '(t))) | 1410 | (let* ((rec-values (if reftex-search-unrecursed-path-first '(nil t) '(t))) |
| 1417 | (extensions (cdr (assoc type reftex-file-extensions))) | 1411 | (extensions (cdr (assoc type reftex-file-extensions))) |
| 1418 | (def-ext (car extensions)) | 1412 | (def-ext (car extensions)) |
| 1419 | (ext-re (concat "\\(" | 1413 | (ext-re (concat "\\(" |
| 1420 | (mapconcat 'regexp-quote extensions "\\|") | 1414 | (mapconcat 'regexp-quote extensions "\\|") |
| 1421 | "\\)\\'")) | 1415 | "\\)\\'")) |
| 1422 | (files (if (string-match ext-re file) | 1416 | (files (if (string-match ext-re file) |
| 1423 | (cons file nil) | 1417 | (cons file nil) |
| 1424 | (cons (concat file def-ext) file))) | 1418 | (cons (concat file def-ext) file))) |
| 1425 | path old-path file1) | 1419 | path old-path file1) |
| 1426 | (cond | 1420 | (cond |
| 1427 | ((file-name-absolute-p file) | 1421 | ((file-name-absolute-p file) |
| 1428 | (setq file1 | 1422 | (setq file1 |
| 1429 | (or | 1423 | (or |
| 1430 | (and (car files) (file-regular-p (car files)) (car files)) | 1424 | (and (car files) (file-regular-p (car files)) (car files)) |
| 1431 | (and (cdr files) (file-regular-p (cdr files)) (cdr files))))) | 1425 | (and (cdr files) (file-regular-p (cdr files)) (cdr files))))) |
| 1432 | ((and reftex-use-external-file-finders | 1426 | ((and reftex-use-external-file-finders |
| 1433 | (assoc type reftex-external-file-finders)) | 1427 | (assoc type reftex-external-file-finders)) |
| 1434 | (setq file1 (reftex-find-file-externally file type master-dir))) | 1428 | (setq file1 (reftex-find-file-externally file type master-dir))) |
| 1435 | (t | 1429 | (t |
| 1436 | (while (and (null file1) rec-values) | 1430 | (while (and (null file1) rec-values) |
| 1437 | (setq path (reftex-access-search-path | 1431 | (setq path (reftex-access-search-path |
| 1438 | type (pop rec-values) master-dir file)) | 1432 | type (pop rec-values) master-dir file)) |
| 1439 | (if (or (null old-path) | 1433 | (if (or (null old-path) |
| 1440 | (not (eq old-path path))) | 1434 | (not (eq old-path path))) |
| 1441 | (setq old-path path | 1435 | (setq old-path path |
| 1442 | path (cons master-dir path) | 1436 | path (cons master-dir path) |
| 1443 | file1 (or (and (car files) | 1437 | file1 (or (and (car files) |
| 1444 | (reftex-find-file-on-path | 1438 | (reftex-find-file-on-path |
| 1445 | (car files) path master-dir)) | 1439 | (car files) path master-dir)) |
| 1446 | (and (cdr files) | 1440 | (and (cdr files) |
| 1447 | (reftex-find-file-on-path | 1441 | (reftex-find-file-on-path |
| 1448 | (cdr files) path master-dir)))))))) | 1442 | (cdr files) path master-dir)))))))) |
| 1449 | (cond (file1 file1) | 1443 | (cond (file1 file1) |
| 1450 | (die (error "No such file: %s" file) nil) | 1444 | (die (error "No such file: %s" file) nil) |
| 1451 | (t (message "No such file: %s (ignored)" file) nil)))) | 1445 | (t (message "No such file: %s (ignored)" file) nil)))) |
| 1452 | 1446 | ||
| 1453 | (defun reftex-find-file-externally (file type &optional master-dir) | 1447 | (defun reftex-find-file-externally (file type &optional master-dir) |
| 1454 | ;; Use external program to find FILE. | 1448 | ;; Use external program to find FILE. |
| 1455 | ;; The program is taken from `reftex-external-file-finders'. | 1449 | ;; The program is taken from `reftex-external-file-finders'. |
| 1456 | ;; Interprete relative path definitions starting from MASTER-DIR. | 1450 | ;; Interprete relative path definitions starting from MASTER-DIR. |
| 1457 | (let ((default-directory (or master-dir default-directory)) | 1451 | (let ((default-directory (or master-dir default-directory)) |
| 1458 | (prg (cdr (assoc type reftex-external-file-finders))) | 1452 | (prg (cdr (assoc type reftex-external-file-finders))) |
| 1459 | out) | 1453 | out) |
| 1460 | (if (string-match "%f" prg) | 1454 | (if (string-match "%f" prg) |
| 1461 | (setq prg (replace-match file t t prg))) | 1455 | (setq prg (replace-match file t t prg))) |
| 1462 | (setq out (apply 'reftex-process-string (split-string prg))) | 1456 | (setq out (apply 'reftex-process-string (split-string prg))) |
| 1463 | (if (string-match "[ \t\n]+\\'" out) ; chomp | 1457 | (if (string-match "[ \t\n]+\\'" out) ; chomp |
| 1464 | (setq out (replace-match "" nil nil out))) | 1458 | (setq out (replace-match "" nil nil out))) |
| 1465 | (cond ((equal out "") nil) | 1459 | (cond ((equal out "") nil) |
| 1466 | ((file-regular-p out) (expand-file-name out master-dir)) | 1460 | ((file-regular-p out) (expand-file-name out master-dir)) |
| 1467 | (t nil)))) | 1461 | (t nil)))) |
| 1468 | 1462 | ||
| 1469 | (defun reftex-process-string (program &rest args) | 1463 | (defun reftex-process-string (program &rest args) |
| 1470 | "Execute PROGRAM with arguments ARGS and return its STDOUT as a string." | 1464 | "Execute PROGRAM with arguments ARGS and return its STDOUT as a string." |
| 1471 | (let ((calling-dir default-directory)) ; remember default directory | 1465 | (let ((calling-dir default-directory)) ; remember default directory |
| 1472 | (with-output-to-string | 1466 | (with-output-to-string |
| 1473 | (with-current-buffer standard-output | 1467 | (with-current-buffer standard-output |
| 1474 | (let ((default-directory calling-dir)) ; set default directory | 1468 | (let ((default-directory calling-dir)) ; set default directory |
| 1475 | (apply 'call-process program nil '(t nil) nil args)))))) | 1469 | (apply 'call-process program nil '(t nil) nil args)))))) |
| 1476 | 1470 | ||
| 1477 | (defun reftex-access-search-path (type &optional recurse master-dir file) | 1471 | (defun reftex-access-search-path (type &optional recurse master-dir file) |
| 1478 | ;; Access path from environment variables. TYPE is either "tex" or "bib". | 1472 | ;; Access path from environment variables. TYPE is either "tex" or "bib". |
| @@ -1486,51 +1480,51 @@ When DIE is non-nil, throw an error if file not found." | |||
| 1486 | (when (null (get pathvar 'status)) | 1480 | (when (null (get pathvar 'status)) |
| 1487 | ;; Get basic path | 1481 | ;; Get basic path |
| 1488 | (set pathvar | 1482 | (set pathvar |
| 1489 | (reftex-uniq | 1483 | (reftex-uniq |
| 1490 | (reftex-parse-colon-path | 1484 | (reftex-parse-colon-path |
| 1491 | (mapconcat | 1485 | (mapconcat |
| 1492 | (lambda(x) | 1486 | (lambda(x) |
| 1493 | (if (string-match "^!" x) | 1487 | (if (string-match "^!" x) |
| 1494 | (apply 'reftex-process-string | 1488 | (apply 'reftex-process-string |
| 1495 | (split-string (substring x 1))) | 1489 | (split-string (substring x 1))) |
| 1496 | (or (getenv x) x))) | 1490 | (or (getenv x) x))) |
| 1497 | ;; For consistency, the next line should look like this: | 1491 | ;; For consistency, the next line should look like this: |
| 1498 | ;; (cdr (assoc type reftex-path-environment)) | 1492 | ;; (cdr (assoc type reftex-path-environment)) |
| 1499 | ;; However, historically we have separate options for the | 1493 | ;; However, historically we have separate options for the |
| 1500 | ;; environment variables, so we have to do this: | 1494 | ;; environment variables, so we have to do this: |
| 1501 | (symbol-value (intern (concat "reftex-" type | 1495 | (symbol-value (intern (concat "reftex-" type |
| 1502 | "path-environment-variables"))) | 1496 | "path-environment-variables"))) |
| 1503 | path-separator)))) | 1497 | path-separator)))) |
| 1504 | (put pathvar 'status 'split) | 1498 | (put pathvar 'status 'split) |
| 1505 | ;; Check if we have recursive elements | 1499 | ;; Check if we have recursive elements |
| 1506 | (let ((path (symbol-value pathvar)) dir rec) | 1500 | (let ((path (symbol-value pathvar)) dir rec) |
| 1507 | (while (setq dir (pop path)) | 1501 | (while (setq dir (pop path)) |
| 1508 | (when (string= (substring dir -2) "//") | 1502 | (when (string= (substring dir -2) "//") |
| 1509 | (if (file-name-absolute-p dir) | 1503 | (if (file-name-absolute-p dir) |
| 1510 | (setq rec (or rec 'absolute)) | 1504 | (setq rec (or rec 'absolute)) |
| 1511 | (setq rec 'relative)))) | 1505 | (setq rec 'relative)))) |
| 1512 | (put pathvar 'rec-type rec))) | 1506 | (put pathvar 'rec-type rec))) |
| 1513 | 1507 | ||
| 1514 | (if recurse | 1508 | (if recurse |
| 1515 | ;; Return the recursive expansion of the path | 1509 | ;; Return the recursive expansion of the path |
| 1516 | (cond | 1510 | (cond |
| 1517 | ((not (get pathvar 'rec-type)) | 1511 | ((not (get pathvar 'rec-type)) |
| 1518 | ;; Path does not contain recursive elements - use simple path | 1512 | ;; Path does not contain recursive elements - use simple path |
| 1519 | (symbol-value pathvar)) | 1513 | (symbol-value pathvar)) |
| 1520 | ((or (not (get pathvar 'recursive-path)) | 1514 | ((or (not (get pathvar 'recursive-path)) |
| 1521 | (and (eq (get pathvar 'rec-type) 'relative) | 1515 | (and (eq (get pathvar 'rec-type) 'relative) |
| 1522 | (not (equal master-dir (get pathvar 'master-dir))))) | 1516 | (not (equal master-dir (get pathvar 'master-dir))))) |
| 1523 | ;; Either: We don't have a recursive expansion yet. | 1517 | ;; Either: We don't have a recursive expansion yet. |
| 1524 | ;; or: Relative recursive path elements need to be expanded | 1518 | ;; or: Relative recursive path elements need to be expanded |
| 1525 | ;; relative to new default directory | 1519 | ;; relative to new default directory |
| 1526 | (message "Expanding search path to find %s file: %s ..." type file) | 1520 | (message "Expanding search path to find %s file: %s ..." type file) |
| 1527 | (put pathvar 'recursive-path | 1521 | (put pathvar 'recursive-path |
| 1528 | (reftex-expand-path (symbol-value pathvar) master-dir)) | 1522 | (reftex-expand-path (symbol-value pathvar) master-dir)) |
| 1529 | (put pathvar 'master-dir master-dir) | 1523 | (put pathvar 'master-dir master-dir) |
| 1530 | (get pathvar 'recursive-path)) | 1524 | (get pathvar 'recursive-path)) |
| 1531 | (t | 1525 | (t |
| 1532 | ;; Recursive path computed earlier is still OK. | 1526 | ;; Recursive path computed earlier is still OK. |
| 1533 | (get pathvar 'recursive-path))) | 1527 | (get pathvar 'recursive-path))) |
| 1534 | ;; The simple path was requested | 1528 | ;; The simple path was requested |
| 1535 | (symbol-value pathvar)))) | 1529 | (symbol-value pathvar)))) |
| 1536 | 1530 | ||
| @@ -1540,15 +1534,15 @@ When DIE is non-nil, throw an error if file not found." | |||
| 1540 | (catch 'exit | 1534 | (catch 'exit |
| 1541 | (when (file-name-absolute-p file) | 1535 | (when (file-name-absolute-p file) |
| 1542 | (if (file-regular-p file) | 1536 | (if (file-regular-p file) |
| 1543 | (throw 'exit file) | 1537 | (throw 'exit file) |
| 1544 | (throw 'exit nil))) | 1538 | (throw 'exit nil))) |
| 1545 | (let* ((thepath path) file1 dir) | 1539 | (let* ((thepath path) file1 dir) |
| 1546 | (while (setq dir (pop thepath)) | 1540 | (while (setq dir (pop thepath)) |
| 1547 | (when (string= (substring dir -2) "//") | 1541 | (when (string= (substring dir -2) "//") |
| 1548 | (setq dir (substring dir 0 -1))) | 1542 | (setq dir (substring dir 0 -1))) |
| 1549 | (setq file1 (expand-file-name file (expand-file-name dir def-dir))) | 1543 | (setq file1 (expand-file-name file (expand-file-name dir def-dir))) |
| 1550 | (if (file-regular-p file1) | 1544 | (if (file-regular-p file1) |
| 1551 | (throw 'exit file1))) | 1545 | (throw 'exit file1))) |
| 1552 | ;; No such file | 1546 | ;; No such file |
| 1553 | nil))) | 1547 | nil))) |
| 1554 | 1548 | ||
| @@ -1557,8 +1551,8 @@ When DIE is non-nil, throw an error if file not found." | |||
| 1557 | ;; Trailing ! or !! will be converted into `//' (emTeX convention) | 1551 | ;; Trailing ! or !! will be converted into `//' (emTeX convention) |
| 1558 | (mapcar | 1552 | (mapcar |
| 1559 | (lambda (dir) | 1553 | (lambda (dir) |
| 1560 | (if (string-match "\\(//+\\|/*!+\\)\\'" dir) | 1554 | (if (string-match "\\(//+\\|/*!+\\)\\'" dir) |
| 1561 | (setq dir (replace-match "//" t t dir))) | 1555 | (setq dir (replace-match "//" t t dir))) |
| 1562 | (file-name-as-directory dir)) | 1556 | (file-name-as-directory dir)) |
| 1563 | (delete "" (split-string path (concat path-separator "+"))))) | 1557 | (delete "" (split-string path (concat path-separator "+"))))) |
| 1564 | 1558 | ||
| @@ -1568,15 +1562,15 @@ When DIE is non-nil, throw an error if file not found." | |||
| 1568 | (let (path1 dir recursive) | 1562 | (let (path1 dir recursive) |
| 1569 | (while (setq dir (pop path)) | 1563 | (while (setq dir (pop path)) |
| 1570 | (if (setq recursive (string= (substring dir -2) "//")) | 1564 | (if (setq recursive (string= (substring dir -2) "//")) |
| 1571 | (setq dir (substring dir 0 -1))) | 1565 | (setq dir (substring dir 0 -1))) |
| 1572 | (if (and recursive | 1566 | (if (and recursive |
| 1573 | (not (file-name-absolute-p dir))) | 1567 | (not (file-name-absolute-p dir))) |
| 1574 | (setq dir (expand-file-name dir default-dir))) | 1568 | (setq dir (expand-file-name dir default-dir))) |
| 1575 | (if recursive | 1569 | (if recursive |
| 1576 | ;; Expand recursively | 1570 | ;; Expand recursively |
| 1577 | (setq path1 (append (reftex-recursive-directory-list dir) path1)) | 1571 | (setq path1 (append (reftex-recursive-directory-list dir) path1)) |
| 1578 | ;; Keep unchanged | 1572 | ;; Keep unchanged |
| 1579 | (push dir path1))) | 1573 | (push dir path1))) |
| 1580 | (nreverse path1))) | 1574 | (nreverse path1))) |
| 1581 | 1575 | ||
| 1582 | (defun reftex-recursive-directory-list (dir) | 1576 | (defun reftex-recursive-directory-list (dir) |
| @@ -1584,18 +1578,18 @@ When DIE is non-nil, throw an error if file not found." | |||
| 1584 | (let ((path (list dir)) path1 file files) | 1578 | (let ((path (list dir)) path1 file files) |
| 1585 | (while (setq dir (pop path)) | 1579 | (while (setq dir (pop path)) |
| 1586 | (when (file-directory-p dir) | 1580 | (when (file-directory-p dir) |
| 1587 | (setq files (nreverse (directory-files dir t "[^.]"))) | 1581 | (setq files (nreverse (directory-files dir t "[^.]"))) |
| 1588 | (while (setq file (pop files)) | 1582 | (while (setq file (pop files)) |
| 1589 | (if (file-directory-p file) | 1583 | (if (file-directory-p file) |
| 1590 | (push (file-name-as-directory file) path))) | 1584 | (push (file-name-as-directory file) path))) |
| 1591 | (push dir path1))) | 1585 | (push dir path1))) |
| 1592 | path1)) | 1586 | path1)) |
| 1593 | 1587 | ||
| 1594 | (defun reftex-uniq (list) | 1588 | (defun reftex-uniq (list) |
| 1595 | (let (new) | 1589 | (let (new) |
| 1596 | (while list | 1590 | (while list |
| 1597 | (or (member (car list) new) | 1591 | (or (member (car list) new) |
| 1598 | (push (car list) new)) | 1592 | (push (car list) new)) |
| 1599 | (pop list)) | 1593 | (pop list)) |
| 1600 | (nreverse new))) | 1594 | (nreverse new))) |
| 1601 | 1595 | ||
| @@ -1658,8 +1652,8 @@ When DIE is non-nil, throw an error if file not found." | |||
| 1658 | "Show the table of contents for the current document." t) | 1652 | "Show the table of contents for the current document." t) |
| 1659 | (autoload 'reftex-toc-recenter "reftex-toc" | 1653 | (autoload 'reftex-toc-recenter "reftex-toc" |
| 1660 | "Display the TOC window and highlight line corresponding to current position." t) | 1654 | "Display the TOC window and highlight line corresponding to current position." t) |
| 1661 | (autoload 'reftex-toggle-auto-toc-recenter "reftex-toc" | 1655 | (autoload 'reftex-toggle-auto-toc-recenter "reftex-toc" t) |
| 1662 | "Toggle automatic recentering of TOC window." t) | 1656 | |
| 1663 | 1657 | ||
| 1664 | ;;; ========================================================================= | 1658 | ;;; ========================================================================= |
| 1665 | ;;; | 1659 | ;;; |
| @@ -1797,13 +1791,6 @@ When DIE is non-nil, throw an error if file not found." | |||
| 1797 | (when (match-beginning n) | 1791 | (when (match-beginning n) |
| 1798 | (buffer-substring-no-properties (match-beginning n) (match-end n)))) | 1792 | (buffer-substring-no-properties (match-beginning n) (match-end n)))) |
| 1799 | 1793 | ||
| 1800 | (defun reftex-region-active-p () | ||
| 1801 | "Is transient-mark-mode on and the region active? | ||
| 1802 | Works on both Emacs and XEmacs." | ||
| 1803 | (if (featurep 'xemacs) | ||
| 1804 | (and zmacs-regions (region-active-p)) | ||
| 1805 | (and transient-mark-mode mark-active))) | ||
| 1806 | |||
| 1807 | (defun reftex-kill-buffer (buffer) | 1794 | (defun reftex-kill-buffer (buffer) |
| 1808 | ;; Kill buffer if it exists. | 1795 | ;; Kill buffer if it exists. |
| 1809 | (and (setq buffer (get-buffer buffer)) | 1796 | (and (setq buffer (get-buffer buffer)) |
| @@ -1861,7 +1848,7 @@ Works on both Emacs and XEmacs." | |||
| 1861 | (let* ((elt (car (member elt list))) (ex (not exclusive)) ass last-ass) | 1848 | (let* ((elt (car (member elt list))) (ex (not exclusive)) ass last-ass) |
| 1862 | (while (and (setq ass (assoc key list)) | 1849 | (while (and (setq ass (assoc key list)) |
| 1863 | (setq list (memq ass list)) | 1850 | (setq list (memq ass list)) |
| 1864 | (or ex (not (eq elt (car list)))) | 1851 | (or ex (not (eq elt (car list)))) |
| 1865 | (memq elt list)) | 1852 | (memq elt list)) |
| 1866 | (setq last-ass ass | 1853 | (setq last-ass ass |
| 1867 | list (cdr list))) | 1854 | list (cdr list))) |
| @@ -1875,22 +1862,22 @@ Works on both Emacs and XEmacs." | |||
| 1875 | (let (rtn) | 1862 | (let (rtn) |
| 1876 | (while list | 1863 | (while list |
| 1877 | (if (funcall predicate (car list)) | 1864 | (if (funcall predicate (car list)) |
| 1878 | (push (if completion | 1865 | (push (if completion |
| 1879 | (list (nth nth (car list))) | 1866 | (list (nth nth (car list))) |
| 1880 | (nth nth (car list))) | 1867 | (nth nth (car list))) |
| 1881 | rtn)) | 1868 | rtn)) |
| 1882 | (setq list (cdr list))) | 1869 | (setq list (cdr list))) |
| 1883 | (nreverse rtn))) | 1870 | (nreverse rtn))) |
| 1884 | 1871 | ||
| 1885 | (defun reftex-make-selection-buffer-name (type &optional index) | 1872 | (defun reftex-make-selection-buffer-name (type &optional index) |
| 1886 | ;; Make unique name for a selection buffer. | 1873 | ;; Make unique name for a selection buffer. |
| 1887 | (format " *RefTeX[%s][%d]*" | 1874 | (format " *RefTeX[%s][%d]*" |
| 1888 | type (or index (get reftex-docstruct-symbol :master-index) 0))) | 1875 | type (or index (get reftex-docstruct-symbol :master-index) 0))) |
| 1889 | 1876 | ||
| 1890 | (defun reftex-make-index-buffer-name (tag &optional cnt) | 1877 | (defun reftex-make-index-buffer-name (tag &optional cnt) |
| 1891 | ;; Make unique name for an index buffer. | 1878 | ;; Make unique name for an index buffer. |
| 1892 | (format "*Index[%s][%d]*" | 1879 | (format "*Index[%s][%d]*" |
| 1893 | tag (or cnt (get reftex-docstruct-symbol :master-index) 0))) | 1880 | tag (or cnt (get reftex-docstruct-symbol :master-index) 0))) |
| 1894 | 1881 | ||
| 1895 | (defun reftex-truncate (string ncols &optional ellipses padding) | 1882 | (defun reftex-truncate (string ncols &optional ellipses padding) |
| 1896 | ;; Truncate STRING to NCOLS characters. | 1883 | ;; Truncate STRING to NCOLS characters. |
| @@ -1898,11 +1885,11 @@ Works on both Emacs and XEmacs." | |||
| 1898 | ;; white space to NCOLS characters. When ELLIPSES is non-nil and the | 1885 | ;; white space to NCOLS characters. When ELLIPSES is non-nil and the |
| 1899 | ;; string needs to be truncated, replace last 3 characters by dots. | 1886 | ;; string needs to be truncated, replace last 3 characters by dots. |
| 1900 | (setq string | 1887 | (setq string |
| 1901 | (if (<= (length string) ncols) | 1888 | (if (<= (length string) ncols) |
| 1902 | string | 1889 | string |
| 1903 | (if ellipses | 1890 | (if ellipses |
| 1904 | (concat (substring string 0 (- ncols 3)) "...") | 1891 | (concat (substring string 0 (- ncols 3)) "...") |
| 1905 | (substring string 0 ncols)))) | 1892 | (substring string 0 ncols)))) |
| 1906 | (if padding | 1893 | (if padding |
| 1907 | (format (format "%%-%ds" ncols) string) | 1894 | (format (format "%%-%ds" ncols) string) |
| 1908 | string)) | 1895 | string)) |
| @@ -1912,8 +1899,8 @@ Works on both Emacs and XEmacs." | |||
| 1912 | ;; If POS is given, calculate distances relative to it. | 1899 | ;; If POS is given, calculate distances relative to it. |
| 1913 | ;; Return nil if there is no match. | 1900 | ;; Return nil if there is no match. |
| 1914 | (let ((pos (point)) | 1901 | (let ((pos (point)) |
| 1915 | (dist (or max-length (length regexp))) | 1902 | (dist (or max-length (length regexp))) |
| 1916 | match1 match2 match) | 1903 | match1 match2 match) |
| 1917 | (goto-char (min (+ pos dist) (point-max))) | 1904 | (goto-char (min (+ pos dist) (point-max))) |
| 1918 | (when (re-search-backward regexp nil t) | 1905 | (when (re-search-backward regexp nil t) |
| 1919 | (setq match1 (match-data))) | 1906 | (setq match1 (match-data))) |
| @@ -1949,14 +1936,14 @@ Works on both Emacs and XEmacs." | |||
| 1949 | ;; Enlarge other window displaying buffer to show whole buffer if possible. | 1936 | ;; Enlarge other window displaying buffer to show whole buffer if possible. |
| 1950 | ;; If KEEP-CURRENT in non-nil, current buffer must remain visible. | 1937 | ;; If KEEP-CURRENT in non-nil, current buffer must remain visible. |
| 1951 | (let* ((win1 (selected-window)) | 1938 | (let* ((win1 (selected-window)) |
| 1952 | (buf1 (current-buffer)) | 1939 | (buf1 (current-buffer)) |
| 1953 | (win2 (get-buffer-window buf2))) ;; Only on current frame. | 1940 | (win2 (get-buffer-window buf2))) ;; Only on current frame. |
| 1954 | (when win2 | 1941 | (when win2 |
| 1955 | (select-window win2) | 1942 | (select-window win2) |
| 1956 | (unless (and (pos-visible-in-window-p (point-min)) | 1943 | (unless (and (pos-visible-in-window-p 1) |
| 1957 | (pos-visible-in-window-p (point-max))) | 1944 | (pos-visible-in-window-p (point-max))) |
| 1958 | (enlarge-window (1+ (- (count-lines (point-min) (point-max)) | 1945 | (enlarge-window (1+ (- (count-lines 1 (point-max)) |
| 1959 | (reftex-window-height)))))) | 1946 | (reftex-window-height)))))) |
| 1960 | (cond | 1947 | (cond |
| 1961 | ((window-live-p win1) (select-window win1)) | 1948 | ((window-live-p win1) (select-window win1)) |
| 1962 | (keep-current | 1949 | (keep-current |
| @@ -1971,37 +1958,37 @@ Works on both Emacs and XEmacs." | |||
| 1971 | (let ((char ?\?)) | 1958 | (let ((char ?\?)) |
| 1972 | (save-window-excursion | 1959 | (save-window-excursion |
| 1973 | (catch 'exit | 1960 | (catch 'exit |
| 1974 | (message (concat prompt " (?=Help)")) | 1961 | (message (concat prompt " (?=Help)")) |
| 1975 | (when (or (sit-for (or delay-time 0)) | 1962 | (when (or (sit-for (or delay-time 0)) |
| 1976 | (= ?\? (setq char (read-char-exclusive)))) | 1963 | (= ?\? (setq char (read-char-exclusive)))) |
| 1977 | (reftex-kill-buffer "*RefTeX Select*") | 1964 | (reftex-kill-buffer "*RefTeX Select*") |
| 1978 | (switch-to-buffer-other-window "*RefTeX Select*") | 1965 | (switch-to-buffer-other-window "*RefTeX Select*") |
| 1979 | (insert help-string) | 1966 | (insert help-string) |
| 1980 | (goto-char 1) | 1967 | (goto-char 1) |
| 1981 | (unless (and (pos-visible-in-window-p (point-min)) | 1968 | (unless (and (pos-visible-in-window-p (point-min)) |
| 1982 | (pos-visible-in-window-p (point-max))) | 1969 | (pos-visible-in-window-p (point-max))) |
| 1983 | (enlarge-window (1+ (- (count-lines (point-min) (point-max)) | 1970 | (enlarge-window (1+ (- (count-lines (point-min) (point-max)) |
| 1984 | (reftex-window-height))))) | 1971 | (reftex-window-height))))) |
| 1985 | (setq truncate-lines t)) | 1972 | (setq truncate-lines t)) |
| 1986 | (if (and (pos-visible-in-window-p (point-min)) | 1973 | (if (and (pos-visible-in-window-p (point-min)) |
| 1987 | (pos-visible-in-window-p (point-max))) | 1974 | (pos-visible-in-window-p (point-max))) |
| 1988 | nil | 1975 | nil |
| 1989 | (setq prompt (concat prompt (if scroll " (SPC/DEL=Scroll)" "")))) | 1976 | (setq prompt (concat prompt (if scroll " (SPC/DEL=Scroll)" "")))) |
| 1990 | (message prompt) | 1977 | (message prompt) |
| 1991 | (and (equal char ?\?) (setq char (read-char-exclusive))) | 1978 | (and (equal char ?\?) (setq char (read-char-exclusive))) |
| 1992 | (while t | 1979 | (while t |
| 1993 | (cond ((equal char ?\C-g) (keyboard-quit)) | 1980 | (cond ((equal char ?\C-g) (keyboard-quit)) |
| 1994 | ((equal char ?\?)) | 1981 | ((equal char ?\?)) |
| 1995 | ((and scroll (equal char ?\ )) | 1982 | ((and scroll (equal char ?\ )) |
| 1996 | (condition-case nil (scroll-up) (error nil)) | 1983 | (condition-case nil (scroll-up) (error nil)) |
| 1997 | (message prompt)) | 1984 | (message prompt)) |
| 1998 | ((and scroll (equal char ?\C-? )) | 1985 | ((and scroll (equal char ?\C-? )) |
| 1999 | (condition-case nil (scroll-down) (error nil)) | 1986 | (condition-case nil (scroll-down) (error nil)) |
| 2000 | (message prompt)) | 1987 | (message prompt)) |
| 2001 | (t (message "") | 1988 | (t (message "") |
| 2002 | (throw 'exit char))) | 1989 | (throw 'exit char))) |
| 2003 | (setq char (read-char-exclusive))))))) | 1990 | (setq char (read-char-exclusive))))))) |
| 2004 | 1991 | ||
| 2005 | 1992 | ||
| 2006 | (defun reftex-make-regexp-allow-for-ctrl-m (string) | 1993 | (defun reftex-make-regexp-allow-for-ctrl-m (string) |
| 2007 | ;; 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 |
| @@ -2024,14 +2011,14 @@ Works on both Emacs and XEmacs." | |||
| 2024 | ;; Define `current-message' for compatibility with XEmacs prior to 20.4 | 2011 | ;; Define `current-message' for compatibility with XEmacs prior to 20.4 |
| 2025 | (defvar message-stack) | 2012 | (defvar message-stack) |
| 2026 | (if (and (featurep 'xemacs) | 2013 | (if (and (featurep 'xemacs) |
| 2027 | (not (fboundp 'current-message))) | 2014 | (not (fboundp 'current-message))) |
| 2028 | (defun current-message (&optional frame) | 2015 | (defun current-message (&optional frame) |
| 2029 | (cdr (car message-stack)))) | 2016 | (cdr (car message-stack)))) |
| 2030 | 2017 | ||
| 2031 | (defun reftex-visited-files (list) | 2018 | (defun reftex-visited-files (list) |
| 2032 | ;; Takes a list of filenames and returns the buffers of those already visited | 2019 | ;; Takes a list of filenames and returns the buffers of those already visited |
| 2033 | (delq nil (mapcar (lambda (x) (if (reftex-get-buffer-visiting x) x nil)) | 2020 | (delq nil (mapcar (lambda (x) (if (reftex-get-buffer-visiting x) x nil)) |
| 2034 | list))) | 2021 | list))) |
| 2035 | 2022 | ||
| 2036 | (defun reftex-get-file-buffer-force (file &optional mark-to-kill) | 2023 | (defun reftex-get-file-buffer-force (file &optional mark-to-kill) |
| 2037 | ;; Return a buffer visiting file. Make one, if necessary. | 2024 | ;; Return a buffer visiting file. Make one, if necessary. |
| @@ -2062,7 +2049,7 @@ Works on both Emacs and XEmacs." | |||
| 2062 | (let ((format-alist nil) | 2049 | (let ((format-alist nil) |
| 2063 | (auto-mode-alist (reftex-auto-mode-alist)) | 2050 | (auto-mode-alist (reftex-auto-mode-alist)) |
| 2064 | (default-major-mode 'fundamental-mode) | 2051 | (default-major-mode 'fundamental-mode) |
| 2065 | (enable-local-variables nil) | 2052 | (enable-local-variables nil) |
| 2066 | (after-insert-file-functions nil)) | 2053 | (after-insert-file-functions nil)) |
| 2067 | (setq buf (find-file-noselect file))) | 2054 | (setq buf (find-file-noselect file))) |
| 2068 | 2055 | ||
| @@ -2072,9 +2059,9 @@ Works on both Emacs and XEmacs." | |||
| 2072 | (set-buffer buf) | 2059 | (set-buffer buf) |
| 2073 | (run-hooks 'reftex-initialize-temporary-buffers)))) | 2060 | (run-hooks 'reftex-initialize-temporary-buffers)))) |
| 2074 | 2061 | ||
| 2075 | ;; Lets see if we got a license to kill :-| | 2062 | ;; Lets see if we got a license to kill :-| |
| 2076 | (and mark-to-kill | 2063 | (and mark-to-kill |
| 2077 | (add-to-list 'reftex-buffers-to-kill buf)) | 2064 | (add-to-list 'reftex-buffers-to-kill buf)) |
| 2078 | 2065 | ||
| 2079 | ;; Return the new buffer | 2066 | ;; Return the new buffer |
| 2080 | buf) | 2067 | buf) |
| @@ -2124,7 +2111,7 @@ Works on both Emacs and XEmacs." | |||
| 2124 | (let (rtn) | 2111 | (let (rtn) |
| 2125 | (while list | 2112 | (while list |
| 2126 | (unless (symbolp (car list)) | 2113 | (unless (symbolp (car list)) |
| 2127 | (push (car list) rtn)) | 2114 | (push (car list) rtn)) |
| 2128 | (setq list (cdr list))) | 2115 | (setq list (cdr list))) |
| 2129 | (nreverse rtn))) | 2116 | (nreverse rtn))) |
| 2130 | 2117 | ||
| @@ -2134,7 +2121,7 @@ Works on both Emacs and XEmacs." | |||
| 2134 | (while list | 2121 | (while list |
| 2135 | (setq elm (pop list)) | 2122 | (setq elm (pop list)) |
| 2136 | (unless (member elm new) | 2123 | (unless (member elm new) |
| 2137 | (push elm new))) | 2124 | (push elm new))) |
| 2138 | (nreverse new))) | 2125 | (nreverse new))) |
| 2139 | 2126 | ||
| 2140 | (defun reftex-uniquify-by-car (alist &optional keep-list) | 2127 | (defun reftex-uniquify-by-car (alist &optional keep-list) |
| @@ -2150,11 +2137,11 @@ Works on both Emacs and XEmacs." | |||
| 2150 | 2137 | ||
| 2151 | (defun reftex-abbreviate-title (string) | 2138 | (defun reftex-abbreviate-title (string) |
| 2152 | (reftex-convert-string string "[-~ \t\n\r,;]" nil t t | 2139 | (reftex-convert-string string "[-~ \t\n\r,;]" nil t t |
| 2153 | 5 40 nil 1 " " (nth 5 reftex-derive-label-parameters))) | 2140 | 5 40 nil 1 " " (nth 5 reftex-derive-label-parameters))) |
| 2154 | 2141 | ||
| 2155 | (defun reftex-convert-string (string split-re illegal-re dot keep-fp | 2142 | (defun reftex-convert-string (string split-re illegal-re dot keep-fp |
| 2156 | nwords maxchar illegal abbrev sep | 2143 | nwords maxchar illegal abbrev sep |
| 2157 | ignore-words &optional downcase) | 2144 | ignore-words &optional downcase) |
| 2158 | "Convert a string (a sentence) to something shorter. | 2145 | "Convert a string (a sentence) to something shorter. |
| 2159 | SPLIT-RE is the regular expression used to split the string into words. | 2146 | SPLIT-RE is the regular expression used to split the string into words. |
| 2160 | ILLEGAL-RE matches characters which are illegal in the final string. | 2147 | ILLEGAL-RE matches characters which are illegal in the final string. |
| @@ -2172,14 +2159,14 @@ SEP String separating different words in the output string. | |||
| 2172 | IGNORE-WORDS List of words which should be removed from the string." | 2159 | IGNORE-WORDS List of words which should be removed from the string." |
| 2173 | 2160 | ||
| 2174 | (let* ((words0 (split-string string (or split-re "[ \t\n\r]"))) | 2161 | (let* ((words0 (split-string string (or split-re "[ \t\n\r]"))) |
| 2175 | (reftex-label-illegal-re (or illegal-re "\000")) | 2162 | (reftex-label-illegal-re (or illegal-re "\000")) |
| 2176 | (abbrev-re (concat | 2163 | (abbrev-re (concat |
| 2177 | "\\`\\(" | 2164 | "\\`\\(" |
| 2178 | (make-string (nth 0 reftex-abbrev-parameters) ?.) | 2165 | (make-string (nth 0 reftex-abbrev-parameters) ?.) |
| 2179 | "[" (nth 2 reftex-abbrev-parameters) "]*" | 2166 | "[" (nth 2 reftex-abbrev-parameters) "]*" |
| 2180 | "\\)" | 2167 | "\\)" |
| 2181 | "[" (nth 3 reftex-abbrev-parameters) "]" | 2168 | "[" (nth 3 reftex-abbrev-parameters) "]" |
| 2182 | (make-string (1- (nth 1 reftex-abbrev-parameters)) ?.))) | 2169 | (make-string (1- (nth 1 reftex-abbrev-parameters)) ?.))) |
| 2183 | words word) | 2170 | words word) |
| 2184 | 2171 | ||
| 2185 | ;; Remove words from the ignore list or with funny characters | 2172 | ;; Remove words from the ignore list or with funny characters |
| @@ -2199,21 +2186,21 @@ IGNORE-WORDS List of words which should be removed from the string." | |||
| 2199 | ;; Restrict number of words | 2186 | ;; Restrict number of words |
| 2200 | (if (> (length words) nwords) | 2187 | (if (> (length words) nwords) |
| 2201 | (setcdr (nthcdr (1- nwords) words) nil)) | 2188 | (setcdr (nthcdr (1- nwords) words) nil)) |
| 2202 | 2189 | ||
| 2203 | ;; First, try to use all words | 2190 | ;; First, try to use all words |
| 2204 | (setq string (mapconcat 'identity words sep)) | 2191 | (setq string (mapconcat 'identity words sep)) |
| 2205 | 2192 | ||
| 2206 | ;; Abbreviate words if enforced by user settings or string length | 2193 | ;; Abbreviate words if enforced by user settings or string length |
| 2207 | (if (or (eq t abbrev) | 2194 | (if (or (eq t abbrev) |
| 2208 | (and abbrev | 2195 | (and abbrev |
| 2209 | (> (length string) maxchar))) | 2196 | (> (length string) maxchar))) |
| 2210 | (setq words | 2197 | (setq words |
| 2211 | (mapcar | 2198 | (mapcar |
| 2212 | (lambda (w) (if (string-match abbrev-re w) | 2199 | (lambda (w) (if (string-match abbrev-re w) |
| 2213 | (if dot | 2200 | (if dot |
| 2214 | (concat (match-string 1 w) ".") | 2201 | (concat (match-string 1 w) ".") |
| 2215 | (match-string 1 w)) | 2202 | (match-string 1 w)) |
| 2216 | w)) | 2203 | w)) |
| 2217 | words) | 2204 | words) |
| 2218 | string (mapconcat 'identity words sep))) | 2205 | string (mapconcat 'identity words sep))) |
| 2219 | 2206 | ||
| @@ -2263,47 +2250,47 @@ IGNORE-WORDS List of words which should be removed from the string." | |||
| 2263 | (and (reftex-use-fonts) | 2250 | (and (reftex-use-fonts) |
| 2264 | (or (eq t reftex-refontify-context) | 2251 | (or (eq t reftex-refontify-context) |
| 2265 | (and (eq 1 reftex-refontify-context) | 2252 | (and (eq 1 reftex-refontify-context) |
| 2266 | ;; Test of we use the font-lock version of x-symbol | 2253 | ;; Test of we use the font-lock version of x-symbol |
| 2267 | (and (featurep 'x-symbol-tex) (not (boundp 'x-symbol-mode))))))) | 2254 | (and (featurep 'x-symbol-tex) (not (boundp 'x-symbol-mode))))))) |
| 2268 | 2255 | ||
| 2269 | (defvar font-lock-defaults-computed) | 2256 | (defvar font-lock-defaults-computed) |
| 2270 | (defun reftex-fontify-select-label-buffer (parent-buffer) | 2257 | (defun reftex-fontify-select-label-buffer (parent-buffer) |
| 2271 | ;; Fontify the `*RefTeX Select*' buffer. Buffer is temporarily renamed to | 2258 | ;; Fontify the `*RefTeX Select*' buffer. Buffer is temporarily renamed to |
| 2272 | ;; start with none-SPC char, beacuse Font-Lock otherwise refuses operation. | 2259 | ;; start with none-SPC char, beacuse Font-Lock otherwise refuses operation. |
| 2273 | (run-hook-with-args 'reftex-pre-refontification-functions | 2260 | (run-hook-with-args 'reftex-pre-refontification-functions |
| 2274 | parent-buffer 'reftex-ref) | 2261 | parent-buffer 'reftex-ref) |
| 2275 | (let* ((oldname (buffer-name)) | 2262 | (let* ((oldname (buffer-name)) |
| 2276 | (newname (concat "Fontify-me-" oldname))) | 2263 | (newname (concat "Fontify-me-" oldname))) |
| 2277 | (unwind-protect | 2264 | (unwind-protect |
| 2278 | (progn | 2265 | (progn |
| 2279 | ;; Rename buffer temporarily to start w/o space (because of font-lock) | 2266 | ;; Rename buffer temporarily to start w/o space (because of font-lock) |
| 2280 | (rename-buffer newname t) | 2267 | (rename-buffer newname t) |
| 2281 | (cond | 2268 | (cond |
| 2282 | ((fboundp 'font-lock-default-fontify-region) | 2269 | ((fboundp 'font-lock-default-fontify-region) |
| 2283 | ;; Good: we have the indirection functions | 2270 | ;; Good: we have the indirection functions |
| 2284 | (set (make-local-variable 'font-lock-fontify-region-function) | 2271 | (set (make-local-variable 'font-lock-fontify-region-function) |
| 2285 | 'reftex-select-font-lock-fontify-region) | 2272 | 'reftex-select-font-lock-fontify-region) |
| 2286 | (let ((major-mode 'latex-mode)) | 2273 | (let ((major-mode 'latex-mode)) |
| 2287 | (font-lock-mode 1))) | 2274 | (font-lock-mode 1))) |
| 2288 | ((fboundp 'font-lock-set-defaults-1) | 2275 | ((fboundp 'font-lock-set-defaults-1) |
| 2289 | ;; Looks like the XEmacs font-lock stuff. | 2276 | ;; Looks like the XEmacs font-lock stuff. |
| 2290 | ;; FIXME: this is still kind of a hack, but it works. | 2277 | ;; FIXME: this is still kind of a hack, but it works. |
| 2291 | (set (make-local-variable 'font-lock-keywords) nil) | 2278 | (set (make-local-variable 'font-lock-keywords) nil) |
| 2292 | (let ((major-mode 'latex-mode) | 2279 | (let ((major-mode 'latex-mode) |
| 2293 | (font-lock-defaults-computed nil)) | 2280 | (font-lock-defaults-computed nil)) |
| 2294 | (font-lock-set-defaults-1) | 2281 | (font-lock-set-defaults-1) |
| 2295 | (reftex-select-font-lock-fontify-region (point-min) (point-max)))) | 2282 | (reftex-select-font-lock-fontify-region (point-min) (point-max)))) |
| 2296 | (t | 2283 | (t |
| 2297 | ;; Oops? | 2284 | ;; Oops? |
| 2298 | (message "Sorry: cannot refontify RefTeX Select buffer.")))) | 2285 | (message "Sorry: cannot refontify RefTeX Select buffer.")))) |
| 2299 | (rename-buffer oldname)))) | 2286 | (rename-buffer oldname)))) |
| 2300 | 2287 | ||
| 2301 | (defun reftex-select-font-lock-fontify-region (beg end &optional loudly) | 2288 | (defun reftex-select-font-lock-fontify-region (beg end &optional loudly) |
| 2302 | ;; Fontify a region, but only lines starting with a dot. | 2289 | ;; Fontify a region, but only lines starting with a dot. |
| 2303 | (let ((func (if (fboundp 'font-lock-default-fontify-region) | 2290 | (let ((func (if (fboundp 'font-lock-default-fontify-region) |
| 2304 | 'font-lock-default-fontify-region | 2291 | 'font-lock-default-fontify-region |
| 2305 | 'font-lock-fontify-region)) | 2292 | 'font-lock-fontify-region)) |
| 2306 | beg1 end1) | 2293 | beg1 end1) |
| 2307 | (goto-char beg) | 2294 | (goto-char beg) |
| 2308 | (while (re-search-forward "^\\." end t) | 2295 | (while (re-search-forward "^\\." end t) |
| 2309 | (setq beg1 (point) end1 (progn (skip-chars-forward "^\n") (point))) | 2296 | (setq beg1 (point) end1 (progn (skip-chars-forward "^\n") (point))) |
| @@ -2322,9 +2309,9 @@ IGNORE-WORDS List of words which should be removed from the string." | |||
| 2322 | (let (face) | 2309 | (let (face) |
| 2323 | (catch 'exit | 2310 | (catch 'exit |
| 2324 | (while (setq face (pop faces)) | 2311 | (while (setq face (pop faces)) |
| 2325 | (if (featurep 'xemacs) | 2312 | (if (featurep 'xemacs) |
| 2326 | (if (find-face face) (throw 'exit face)) | 2313 | (if (find-face face) (throw 'exit face)) |
| 2327 | (if (facep face) (throw 'exit face))))))) | 2314 | (if (facep face) (throw 'exit face))))))) |
| 2328 | 2315 | ||
| 2329 | ;; Highlighting uses overlays. For XEmacs, we need the emulation. | 2316 | ;; Highlighting uses overlays. For XEmacs, we need the emulation. |
| 2330 | (if (featurep 'xemacs) (require 'overlay)) | 2317 | (if (featurep 'xemacs) (require 'overlay)) |
| @@ -2334,14 +2321,14 @@ IGNORE-WORDS List of words which should be removed from the string." | |||
| 2334 | 2321 | ||
| 2335 | ;; Initialize the overlays | 2322 | ;; Initialize the overlays |
| 2336 | (aset reftex-highlight-overlays 0 (make-overlay 1 1)) | 2323 | (aset reftex-highlight-overlays 0 (make-overlay 1 1)) |
| 2337 | (overlay-put (aref reftex-highlight-overlays 0) | 2324 | (overlay-put (aref reftex-highlight-overlays 0) |
| 2338 | 'face 'highlight) | 2325 | 'face 'highlight) |
| 2339 | (aset reftex-highlight-overlays 1 (make-overlay 1 1)) | 2326 | (aset reftex-highlight-overlays 1 (make-overlay 1 1)) |
| 2340 | (overlay-put (aref reftex-highlight-overlays 1) | 2327 | (overlay-put (aref reftex-highlight-overlays 1) |
| 2341 | 'face reftex-cursor-selected-face) | 2328 | 'face reftex-cursor-selected-face) |
| 2342 | (aset reftex-highlight-overlays 2 (make-overlay 1 1)) | 2329 | (aset reftex-highlight-overlays 2 (make-overlay 1 1)) |
| 2343 | (overlay-put (aref reftex-highlight-overlays 2) | 2330 | (overlay-put (aref reftex-highlight-overlays 2) |
| 2344 | 'face reftex-cursor-selected-face) | 2331 | 'face reftex-cursor-selected-face) |
| 2345 | 2332 | ||
| 2346 | ;; Two functions for activating and deactivation highlight overlays | 2333 | ;; Two functions for activating and deactivation highlight overlays |
| 2347 | (defun reftex-highlight (index begin end &optional buffer) | 2334 | (defun reftex-highlight (index begin end &optional buffer) |
| @@ -2359,30 +2346,30 @@ IGNORE-WORDS List of words which should be removed from the string." | |||
| 2359 | 2346 | ||
| 2360 | ;;; ========================================================================= | 2347 | ;;; ========================================================================= |
| 2361 | ;;; | 2348 | ;;; |
| 2362 | ;;; Keybindings | 2349 | ;;; Keybindings |
| 2363 | 2350 | ||
| 2364 | ;; The default bindings in the mode map. | 2351 | ;; The default bindings in the mode map. |
| 2365 | (loop for x in | 2352 | (loop for x in |
| 2366 | '(("\C-c=" . reftex-toc) | 2353 | '(("\C-c=" . reftex-toc) |
| 2367 | ("\C-c-" . reftex-toc-recenter) | 2354 | ("\C-c-" . reftex-toc-recenter) |
| 2368 | ("\C-c(" . reftex-label) | 2355 | ("\C-c(" . reftex-label) |
| 2369 | ("\C-c)" . reftex-reference) | 2356 | ("\C-c)" . reftex-reference) |
| 2370 | ("\C-c[" . reftex-citation) | 2357 | ("\C-c[" . reftex-citation) |
| 2371 | ("\C-c<" . reftex-index) | 2358 | ("\C-c<" . reftex-index) |
| 2372 | ("\C-c>" . reftex-display-index) | 2359 | ("\C-c>" . reftex-display-index) |
| 2373 | ("\C-c/" . reftex-index-selection-or-word) | 2360 | ("\C-c/" . reftex-index-selection-or-word) |
| 2374 | ("\C-c\\" . reftex-index-phrase-selection-or-word) | 2361 | ("\C-c\\" . reftex-index-phrase-selection-or-word) |
| 2375 | ("\C-c|" . reftex-index-visit-phrases-buffer) | 2362 | ("\C-c|" . reftex-index-visit-phrases-buffer) |
| 2376 | ("\C-c&" . reftex-view-crossref)) | 2363 | ("\C-c&" . reftex-view-crossref)) |
| 2377 | do (define-key reftex-mode-map (car x) (cdr x))) | 2364 | do (define-key reftex-mode-map (car x) (cdr x))) |
| 2378 | 2365 | ||
| 2379 | ;; 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 |
| 2380 | (if (featurep 'xemacs) | 2367 | (if (featurep 'xemacs) |
| 2381 | (unless (key-binding [(shift button2)]) | 2368 | (unless (key-binding [(shift button2)]) |
| 2382 | (define-key reftex-mode-map [(shift button2)] | 2369 | (define-key reftex-mode-map [(shift button2)] |
| 2383 | 'reftex-mouse-view-crossref)) | 2370 | 'reftex-mouse-view-crossref)) |
| 2384 | (unless (key-binding [(shift mouse-2)]) | 2371 | (unless (key-binding [(shift mouse-2)]) |
| 2385 | (define-key reftex-mode-map [(shift mouse-2)] | 2372 | (define-key reftex-mode-map [(shift mouse-2)] |
| 2386 | 'reftex-mouse-view-crossref))) | 2373 | 'reftex-mouse-view-crossref))) |
| 2387 | 2374 | ||
| 2388 | ;; Bind `reftex-view-crossref-from-bibtex' in BibTeX mode map | 2375 | ;; Bind `reftex-view-crossref-from-bibtex' in BibTeX mode map |
| @@ -2393,14 +2380,14 @@ IGNORE-WORDS List of words which should be removed from the string." | |||
| 2393 | ;; If the user requests so, she can have a few more bindings: | 2380 | ;; If the user requests so, she can have a few more bindings: |
| 2394 | (when reftex-extra-bindings | 2381 | (when reftex-extra-bindings |
| 2395 | (loop for x in | 2382 | (loop for x in |
| 2396 | '(("\C-ct" . reftex-toc) | 2383 | '(("\C-ct" . reftex-toc) |
| 2397 | ("\C-cl" . reftex-label) | 2384 | ("\C-cl" . reftex-label) |
| 2398 | ("\C-cr" . reftex-reference) | 2385 | ("\C-cr" . reftex-reference) |
| 2399 | ("\C-cc" . reftex-citation) | 2386 | ("\C-cc" . reftex-citation) |
| 2400 | ("\C-cv" . reftex-view-crossref) | 2387 | ("\C-cv" . reftex-view-crossref) |
| 2401 | ("\C-cg" . reftex-grep-document) | 2388 | ("\C-cg" . reftex-grep-document) |
| 2402 | ("\C-cs" . reftex-search-document)) | 2389 | ("\C-cs" . reftex-search-document)) |
| 2403 | do (define-key reftex-mode-map (car x) (cdr x)))) | 2390 | do (define-key reftex-mode-map (car x) (cdr x)))) |
| 2404 | 2391 | ||
| 2405 | ;;; ========================================================================= | 2392 | ;;; ========================================================================= |
| 2406 | ;;; | 2393 | ;;; |
| @@ -2477,23 +2464,23 @@ IGNORE-WORDS List of words which should be removed from the string." | |||
| 2477 | :style toggle :selected reftex-plug-into-AUCTeX]) | 2464 | :style toggle :selected reftex-plug-into-AUCTeX]) |
| 2478 | ("Reference Style" | 2465 | ("Reference Style" |
| 2479 | ["Default" (setq reftex-vref-is-default nil | 2466 | ["Default" (setq reftex-vref-is-default nil |
| 2480 | reftex-fref-is-default nil) | 2467 | reftex-fref-is-default nil) |
| 2481 | :style radio :selected (not (or reftex-vref-is-default | 2468 | :style radio :selected (not (or reftex-vref-is-default |
| 2482 | reftex-fref-is-default))] | 2469 | reftex-fref-is-default))] |
| 2483 | ["Varioref" (setq reftex-vref-is-default t | 2470 | ["Varioref" (setq reftex-vref-is-default t |
| 2484 | reftex-fref-is-default nil) | 2471 | reftex-fref-is-default nil) |
| 2485 | :style radio :selected reftex-vref-is-default] | 2472 | :style radio :selected reftex-vref-is-default] |
| 2486 | ["Fancyref" (setq reftex-fref-is-default t | 2473 | ["Fancyref" (setq reftex-fref-is-default t |
| 2487 | reftex-vref-is-default nil) | 2474 | reftex-vref-is-default nil) |
| 2488 | :style radio :selected reftex-fref-is-default]) | 2475 | :style radio :selected reftex-fref-is-default]) |
| 2489 | ("Citation Style" | 2476 | ("Citation Style" |
| 2490 | ,@(mapcar | 2477 | ,@(mapcar |
| 2491 | (lambda (x) | 2478 | (lambda (x) |
| 2492 | (vector | 2479 | (vector |
| 2493 | (capitalize (symbol-name (car x))) | 2480 | (capitalize (symbol-name (car x))) |
| 2494 | (list 'reftex-set-cite-format (list 'quote (car x))) | 2481 | (list 'reftex-set-cite-format (list 'quote (car x))) |
| 2495 | :style 'radio :selected | 2482 | :style 'radio :selected |
| 2496 | (list 'eq (list 'reftex-get-cite-format) (list 'quote (car x))))) | 2483 | (list 'eq (list 'reftex-get-cite-format) (list 'quote (car x))))) |
| 2497 | reftex-cite-format-builtin) | 2484 | reftex-cite-format-builtin) |
| 2498 | "--" | 2485 | "--" |
| 2499 | "Sort Database Matches" | 2486 | "Sort Database Matches" |
| @@ -2508,13 +2495,13 @@ IGNORE-WORDS List of words which should be removed from the string." | |||
| 2508 | ("Index Style" | 2495 | ("Index Style" |
| 2509 | ,@(mapcar | 2496 | ,@(mapcar |
| 2510 | (lambda (x) | 2497 | (lambda (x) |
| 2511 | (vector | 2498 | (vector |
| 2512 | (capitalize (symbol-name (car x))) | 2499 | (capitalize (symbol-name (car x))) |
| 2513 | (list 'reftex-add-index-macros (list 'list (list 'quote (car x)))) | 2500 | (list 'reftex-add-index-macros (list 'list (list 'quote (car x)))) |
| 2514 | :style 'radio :selected | 2501 | :style 'radio :selected |
| 2515 | (list 'memq (list 'quote (car x)) | 2502 | (list 'memq (list 'quote (car x)) |
| 2516 | (list 'get 'reftex-docstruct-symbol | 2503 | (list 'get 'reftex-docstruct-symbol |
| 2517 | (list 'quote 'reftex-index-macros-style))))) | 2504 | (list 'quote 'reftex-index-macros-style))))) |
| 2518 | reftex-index-macros-builtin)) | 2505 | reftex-index-macros-builtin)) |
| 2519 | "--" | 2506 | "--" |
| 2520 | ["Reset RefTeX Mode" reftex-reset-mode t] | 2507 | ["Reset RefTeX Mode" reftex-reset-mode t] |
| @@ -2522,7 +2509,7 @@ IGNORE-WORDS List of words which should be removed from the string." | |||
| 2522 | ("Customize" | 2509 | ("Customize" |
| 2523 | ["Browse RefTeX Group" reftex-customize t] | 2510 | ["Browse RefTeX Group" reftex-customize t] |
| 2524 | "--" | 2511 | "--" |
| 2525 | ["Build Full Customize Menu" reftex-create-customize-menu | 2512 | ["Build Full Customize Menu" reftex-create-customize-menu |
| 2526 | (fboundp 'customize-menu-create)]) | 2513 | (fboundp 'customize-menu-create)]) |
| 2527 | ("Documentation" | 2514 | ("Documentation" |
| 2528 | ["Info" reftex-info t] | 2515 | ["Info" reftex-info t] |
| @@ -2538,17 +2525,17 @@ IGNORE-WORDS List of words which should be removed from the string." | |||
| 2538 | (interactive) | 2525 | (interactive) |
| 2539 | (if (fboundp 'customize-menu-create) | 2526 | (if (fboundp 'customize-menu-create) |
| 2540 | (progn | 2527 | (progn |
| 2541 | (easy-menu-change | 2528 | (easy-menu-change |
| 2542 | '("Ref") "Customize" | 2529 | '("Ref") "Customize" |
| 2543 | `(["Browse RefTeX group" reftex-customize t] | 2530 | `(["Browse RefTeX group" reftex-customize t] |
| 2544 | "--" | 2531 | "--" |
| 2545 | ,(customize-menu-create 'reftex) | 2532 | ,(customize-menu-create 'reftex) |
| 2546 | ["Set" Custom-set t] | 2533 | ["Set" Custom-set t] |
| 2547 | ["Save" Custom-save t] | 2534 | ["Save" Custom-save t] |
| 2548 | ["Reset to Current" Custom-reset-current t] | 2535 | ["Reset to Current" Custom-reset-current t] |
| 2549 | ["Reset to Saved" Custom-reset-saved t] | 2536 | ["Reset to Saved" Custom-reset-saved t] |
| 2550 | ["Reset to Standard Settings" Custom-reset-standard t])) | 2537 | ["Reset to Standard Settings" Custom-reset-standard t])) |
| 2551 | (message "\"Ref\"-menu now contains full customization menu")) | 2538 | (message "\"Ref\"-menu now contains full customization menu")) |
| 2552 | (error "Cannot expand menu (outdated version of cus-edit.el)"))) | 2539 | (error "Cannot expand menu (outdated version of cus-edit.el)"))) |
| 2553 | 2540 | ||
| 2554 | (defun reftex-show-commentary () | 2541 | (defun reftex-show-commentary () |
| @@ -2576,9 +2563,8 @@ With optional NODE, go directly to that node." | |||
| 2576 | ;;; That's it! ---------------------------------------------------------------- | 2563 | ;;; That's it! ---------------------------------------------------------------- |
| 2577 | 2564 | ||
| 2578 | (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 |
| 2579 | (provide 'reftex) | 2566 | (provide 'reftex) |
| 2580 | 2567 | ||
| 2581 | ;;;============================================================================ | 2568 | ;;;============================================================================ |
| 2582 | 2569 | ||
| 2583 | ;;; arch-tag: 49e0da4e-bd5e-4cfc-a717-fb444fccb9e6 | ||
| 2584 | ;;; reftex.el ends here | 2570 | ;;; reftex.el ends here |