diff options
| author | Richard M. Stallman | 1997-06-11 04:45:34 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1997-06-11 04:45:34 +0000 |
| commit | 025bb6359ec82e2f1d3048d3bd83ebbe0adb0623 (patch) | |
| tree | 9f126acab9610227b7937f2512e3f4730279bbad | |
| parent | 54dfb86c80686afe1ae7e84946ccd55ec8246640 (diff) | |
| download | emacs-025bb6359ec82e2f1d3048d3bd83ebbe0adb0623.tar.gz emacs-025bb6359ec82e2f1d3048d3bd83ebbe0adb0623.zip | |
Updated documentation at several points in the file.
(reftex-label-alist-builtin): New default environment subfigure.
(reftex-find-duplicate-labels): Temporary buffer is now
"*Duplicate Labels*" instead of "*Help*".
(reftex-bibtex-selection-callback): Renamed variable found-list.
(reftex-found-list): Added defvar for this variable.
(TeX-master): Added defvar for this variable.
(reftex-reset-mode): Kill temporary buffers associated with RefTeX.
| -rw-r--r-- | lisp/textmodes/reftex.el | 97 |
1 files changed, 62 insertions, 35 deletions
diff --git a/lisp/textmodes/reftex.el b/lisp/textmodes/reftex.el index 50b47e8112b..892f9fba17d 100644 --- a/lisp/textmodes/reftex.el +++ b/lisp/textmodes/reftex.el | |||
| @@ -143,7 +143,7 @@ | |||
| 143 | ;; documentation string. Look it up for more information! | 143 | ;; documentation string. Look it up for more information! |
| 144 | ;; | 144 | ;; |
| 145 | ;; ;; Configuration Variables and User Options for RefTeX ------------------ | 145 | ;; ;; Configuration Variables and User Options for RefTeX ------------------ |
| 146 | ;; ;; Support for \label and \ref ------------------------------------------ | 146 | ;; ;; Support for \label and \ref -------------------------------------- |
| 147 | ;; (setq reftex-label-alist nil) | 147 | ;; (setq reftex-label-alist nil) |
| 148 | ;; (setq reftex-default-label-alist-entries '(Sideways LaTeX)) | 148 | ;; (setq reftex-default-label-alist-entries '(Sideways LaTeX)) |
| 149 | ;; (setq reftex-use-text-after-label-as-context nil) | 149 | ;; (setq reftex-use-text-after-label-as-context nil) |
| @@ -327,21 +327,26 @@ | |||
| 327 | ;; | 327 | ;; |
| 328 | ;; AUCTeX can support RefTeX via style files. A style file may contain | 328 | ;; AUCTeX can support RefTeX via style files. A style file may contain |
| 329 | ;; calls to reftex-add-to-label-alist which defines additions to | 329 | ;; calls to reftex-add-to-label-alist which defines additions to |
| 330 | ;; reftex-label-alist. The argument taken by this function must have exactly | 330 | ;; reftex-label-alist. The argument taken by this function must have |
| 331 | ;; the same format as reftex-label-alist. E.g. a good entry in a style file | 331 | ;; the same format as reftex-label-alist. E.g. the amsmath.el style file |
| 332 | ;; for the amsmath package would be | 332 | ;; of AUCTeX contains the following: |
| 333 | ;; | 333 | ;; |
| 334 | ;; (and (fboundp 'reftex-add-to-label-alist) | 334 | ;; (TeX-add-style-hook "amsmath" |
| 335 | ;; (reftex-add-to-label-alist '(AMSTeX))) | 335 | ;; (function |
| 336 | ;; (lambda () | ||
| 337 | ;; (if (featurep 'reftex) | ||
| 338 | ;; (reftex-add-to-label-alist '(AMSTeX)))))) | ||
| 336 | ;; | 339 | ;; |
| 337 | ;; while a package defining a proposition environment with \newtheorem | 340 | ;; while a package `myprop' defining a proposition environment with |
| 338 | ;; might use | 341 | ;; \newtheorem might use |
| 339 | ;; | 342 | ;; |
| 340 | ;; (and | 343 | ;; (TeX-add-style-hook "myprop" |
| 341 | ;; (fboundp 'reftex-add-to-label-alist) | 344 | ;; (function |
| 342 | ;; (reftex-add-to-label-alist | 345 | ;; (lambda () |
| 343 | ;; '(("proposition" ?p "prop:" "~\\ref{%s}" t | 346 | ;; (if (featurep 'reftex) |
| 344 | ;; ("Proposition" "Prop."))))) | 347 | ;; (reftex-add-to-label-alist |
| 348 | ;; '(("proposition" ?p "prop:" "~\\ref{%s}" t | ||
| 349 | ;; ("Proposition" "Prop.")))))))) | ||
| 345 | ;; | 350 | ;; |
| 346 | ;; Bib-cite.el | 351 | ;; Bib-cite.el |
| 347 | ;; ----------- | 352 | ;; ----------- |
| @@ -474,6 +479,7 @@ | |||
| 474 | ;; Finally thanks to Uwe Bolick <bolick@physik.tu-berlin.de> who first | 479 | ;; Finally thanks to Uwe Bolick <bolick@physik.tu-berlin.de> who first |
| 475 | ;; got me (some years ago) into supporting LaTeX labels and references | 480 | ;; got me (some years ago) into supporting LaTeX labels and references |
| 476 | ;; with an Editor (which was MicroEmacs at the time). | 481 | ;; with an Editor (which was MicroEmacs at the time). |
| 482 | ;; | ||
| 477 | 483 | ||
| 478 | ;;; Code: | 484 | ;;; Code: |
| 479 | 485 | ||
| @@ -639,12 +645,16 @@ This list describes the default label environments RefTeX should always use in | |||
| 639 | addition to the specifications in reftex-label-alist. It is probably a | 645 | addition to the specifications in reftex-label-alist. It is probably a |
| 640 | mistake to remove the LaTeX symbol from this list. | 646 | mistake to remove the LaTeX symbol from this list. |
| 641 | 647 | ||
| 642 | Here are the current options: | 648 | The options include: |
| 643 | |||
| 644 | LaTeX The standard LaTeX environments | 649 | LaTeX The standard LaTeX environments |
| 645 | Sideways The sidewaysfigure and sidewaystable environments | 650 | Sideways The sidewaysfigure and sidewaystable environments |
| 646 | AMSTeX The math environments in the AMS_LaTeX amsmath package | 651 | AMSTeX The math environments in the AMS_LaTeX amsmath package |
| 647 | AAS The deluxetable environment from the American Astronomical Society" | 652 | AAS The deluxetable environment from the American Astronomical Society |
| 653 | |||
| 654 | For the full list of options, see the constant reftex-label-alist-builtin. | ||
| 655 | Better still, try | ||
| 656 | |||
| 657 | M-x customize-variable RET reftex-default-label-alist-entries RET." | ||
| 648 | :group 'reftex-defining-label-environments | 658 | :group 'reftex-defining-label-environments |
| 649 | :set 'reftex-set-dirty | 659 | :set 'reftex-set-dirty |
| 650 | :type '(list :indent 4 | 660 | :type '(list :indent 4 |
| @@ -1085,13 +1095,15 @@ mode reset is done on the next occasion." | |||
| 1085 | ;;; of each master file with the symbols holding the information on that | 1095 | ;;; of each master file with the symbols holding the information on that |
| 1086 | ;;; document. Each buffer has local variables which point to these symbols. | 1096 | ;;; document. Each buffer has local variables which point to these symbols. |
| 1087 | 1097 | ||
| 1088 | |||
| 1089 | ;; List of variables which handle the multifile stuff. | 1098 | ;; List of variables which handle the multifile stuff. |
| 1090 | ;; This list is used to tie, untie, and reset these symbols. | 1099 | ;; This list is used to tie, untie, and reset these symbols. |
| 1091 | (defconst reftex-multifile-symbols | 1100 | (defconst reftex-multifile-symbols |
| 1092 | '(reftex-label-numbers-symbol reftex-list-of-labels-symbol | 1101 | '(reftex-label-numbers-symbol reftex-list-of-labels-symbol |
| 1093 | reftex-bibfile-list-symbol)) | 1102 | reftex-bibfile-list-symbol)) |
| 1094 | 1103 | ||
| 1104 | ;; Silence warnings about TeX-master, which is defined in AUCTeX | ||
| 1105 | (defvar TeX-master) | ||
| 1106 | |||
| 1095 | ;; Alist connecting master file names with the corresponding lisp symbols | 1107 | ;; Alist connecting master file names with the corresponding lisp symbols |
| 1096 | (defvar reftex-master-index-list nil) | 1108 | (defvar reftex-master-index-list nil) |
| 1097 | 1109 | ||
| @@ -1168,8 +1180,8 @@ mode reset is done on the next occasion." | |||
| 1168 | (defun reftex-TeX-master-file () | 1180 | (defun reftex-TeX-master-file () |
| 1169 | ;; Return the name of the master file associated with the current buffer. | 1181 | ;; Return the name of the master file associated with the current buffer. |
| 1170 | ;; When AUCTeX is loaded, we will use it's more sophisticated method. | 1182 | ;; When AUCTeX is loaded, we will use it's more sophisticated method. |
| 1171 | ;; We also support the default TeX and LaTeX modes | 1183 | ;; We also support the default TeX and LaTeX modes by checking for a |
| 1172 | ;; by checking for a variable tex-main-file. | 1184 | ;; variable tex-main-file. |
| 1173 | 1185 | ||
| 1174 | (let | 1186 | (let |
| 1175 | ((master | 1187 | ((master |
| @@ -2354,7 +2366,7 @@ Changing this is only fully operational after the next buffer scan.") | |||
| 2354 | (reftex-uniquify (symbol-value reftex-list-of-labels-symbol))))) | 2366 | (reftex-uniquify (symbol-value reftex-list-of-labels-symbol))))) |
| 2355 | (setq dlist (reftex-uniquify dlist)) | 2367 | (setq dlist (reftex-uniquify dlist)) |
| 2356 | (if (null dlist) (error "No duplicate labels in document")) | 2368 | (if (null dlist) (error "No duplicate labels in document")) |
| 2357 | (switch-to-buffer-other-window "*Help*") | 2369 | (switch-to-buffer-other-window "*Duplicate Labels*") |
| 2358 | (make-local-variable 'TeX-master) | 2370 | (make-local-variable 'TeX-master) |
| 2359 | (setq TeX-master master) | 2371 | (setq TeX-master master) |
| 2360 | (erase-buffer) | 2372 | (erase-buffer) |
| @@ -2688,6 +2700,9 @@ MENU: SPC=view RET=goto [q]uit [Q]uit+kill [r]escan [f]ollow-mode on/off | |||
| 2688 | 2700 | ||
| 2689 | ;; Variables and constants | 2701 | ;; Variables and constants |
| 2690 | 2702 | ||
| 2703 | ;; Define variable to silence compiler warnings | ||
| 2704 | (defvar reftex-found-list) | ||
| 2705 | |||
| 2691 | ;; Internal variable, but used from different functions | 2706 | ;; Internal variable, but used from different functions |
| 2692 | (defvar reftex-cite-format1 nil) | 2707 | (defvar reftex-cite-format1 nil) |
| 2693 | 2708 | ||
| @@ -3173,15 +3188,15 @@ bibliography statement (e.g. if it was changed)." | |||
| 3173 | (let* (key entry cnt rtn ins-string re-list re | 3188 | (let* (key entry cnt rtn ins-string re-list re |
| 3174 | ;; scan bibtex files | 3189 | ;; scan bibtex files |
| 3175 | (lazy-lock-minimum-size 1) | 3190 | (lazy-lock-minimum-size 1) |
| 3176 | (found-list (reftex-extract-bib-entries | 3191 | (reftex-found-list (reftex-extract-bib-entries |
| 3177 | (reftex-get-bibfile-list))) | 3192 | (reftex-get-bibfile-list))) |
| 3178 | (found-list-r nil) | 3193 | (found-list-r nil) |
| 3179 | (accept-keys | 3194 | (accept-keys |
| 3180 | (if (and (listp reftex-cite-format1) | 3195 | (if (and (listp reftex-cite-format1) |
| 3181 | (listp (car reftex-cite-format1))) | 3196 | (listp (car reftex-cite-format1))) |
| 3182 | (mapcar 'car reftex-cite-format1) | 3197 | (mapcar 'car reftex-cite-format1) |
| 3183 | '(?\C-m)))) | 3198 | '(?\C-m)))) |
| 3184 | (if (not found-list) | 3199 | (if (not reftex-found-list) |
| 3185 | (error "Sorry, no matches found")) | 3200 | (error "Sorry, no matches found")) |
| 3186 | 3201 | ||
| 3187 | ;; remember where we came from | 3202 | ;; remember where we came from |
| @@ -3192,7 +3207,7 @@ bibliography statement (e.g. if it was changed)." | |||
| 3192 | (switch-to-buffer-other-window "*RefTeX Select*") | 3207 | (switch-to-buffer-other-window "*RefTeX Select*") |
| 3193 | (erase-buffer) | 3208 | (erase-buffer) |
| 3194 | (mapcar '(lambda (x) (insert (cdr (assoc "&formatted" x)))) | 3209 | (mapcar '(lambda (x) (insert (cdr (assoc "&formatted" x)))) |
| 3195 | found-list) | 3210 | reftex-found-list) |
| 3196 | (if (= 0 (buffer-size)) | 3211 | (if (= 0 (buffer-size)) |
| 3197 | (error "Sorry, no matches found")) | 3212 | (error "Sorry, no matches found")) |
| 3198 | (setq truncate-lines t) | 3213 | (setq truncate-lines t) |
| @@ -3236,18 +3251,18 @@ bibliography statement (e.g. if it was changed)." | |||
| 3236 | (cdr (assoc "&entry" x))) | 3251 | (cdr (assoc "&entry" x))) |
| 3237 | x | 3252 | x |
| 3238 | "")) | 3253 | "")) |
| 3239 | found-list)))) | 3254 | reftex-found-list)))) |
| 3240 | (if found-list-r | 3255 | (if found-list-r |
| 3241 | (setq found-list found-list-r) | 3256 | (setq reftex-found-list found-list-r) |
| 3242 | (ding)) | 3257 | (ding)) |
| 3243 | (erase-buffer) | 3258 | (erase-buffer) |
| 3244 | (mapcar '(lambda (x) (insert (cdr (assoc "&formatted" x)))) | 3259 | (mapcar '(lambda (x) (insert (cdr (assoc "&formatted" x)))) |
| 3245 | found-list) | 3260 | reftex-found-list) |
| 3246 | (goto-char 1)) | 3261 | (goto-char 1)) |
| 3247 | ((or (member key accept-keys) | 3262 | ((or (member key accept-keys) |
| 3248 | (equal key ?\C-m) | 3263 | (equal key ?\C-m) |
| 3249 | (equal key 'return)) | 3264 | (equal key 'return)) |
| 3250 | (setq entry (nth cnt found-list)) | 3265 | (setq entry (nth cnt reftex-found-list)) |
| 3251 | (throw 'exit t)) | 3266 | (throw 'exit t)) |
| 3252 | (t | 3267 | (t |
| 3253 | (ding))))) | 3268 | (ding))))) |
| @@ -3322,10 +3337,8 @@ bibliography statement (e.g. if it was changed)." | |||
| 3322 | ;; Callback function to be called from the BibTeX selection, in | 3337 | ;; Callback function to be called from the BibTeX selection, in |
| 3323 | ;; order to display context. This function is relatively slow and not | 3338 | ;; order to display context. This function is relatively slow and not |
| 3324 | ;; recommended for follow mode, just for individual lookups. | 3339 | ;; recommended for follow mode, just for individual lookups. |
| 3325 | ;; When compiled, this gives a warning about found-list. However, | ||
| 3326 | ;; the calling function binds found-list with let. | ||
| 3327 | (let ((win (selected-window)) | 3340 | (let ((win (selected-window)) |
| 3328 | (key (reftex-get-bib-field "&key" (nth cnt found-list))) | 3341 | (key (reftex-get-bib-field "&key" (nth cnt reftex-found-list))) |
| 3329 | (bibfile-list (save-excursion | 3342 | (bibfile-list (save-excursion |
| 3330 | (set-buffer reftex-call-back-to-this-buffer) | 3343 | (set-buffer reftex-call-back-to-this-buffer) |
| 3331 | (reftex-get-bibfile-list)))) | 3344 | (reftex-get-bibfile-list)))) |
| @@ -3872,6 +3885,11 @@ With argument, actually select the window showing the cross reference." | |||
| 3872 | ("sidewaysfigure" ?f nil nil "\\\\caption\\(\\[[^]]*\\]\\)?{") | 3885 | ("sidewaysfigure" ?f nil nil "\\\\caption\\(\\[[^]]*\\]\\)?{") |
| 3873 | ("sidewaystable" ?t nil nil "\\\\caption\\(\\[[^]]*\\]\\)?{")) | 3886 | ("sidewaystable" ?t nil nil "\\\\caption\\(\\[[^]]*\\]\\)?{")) |
| 3874 | 3887 | ||
| 3888 | (Subfigure | ||
| 3889 | "Subfigure environment and macro" | ||
| 3890 | ("subfigure" ?f nil nil "\\\\caption\\(\\[[^]]*\\]\\)?{") | ||
| 3891 | ("\\subfigure" ?f nil nil "\\\\subfigure[[{]")) | ||
| 3892 | |||
| 3875 | (AMSTeX | 3893 | (AMSTeX |
| 3876 | "AMS-LaTeX: amsmath package environents" | 3894 | "AMS-LaTeX: amsmath package environents" |
| 3877 | ("align" ?e "eq:" "~\\eqref{%s}" "\\\\begin{align}\\|\\\\\\\\") | 3895 | ("align" ?e "eq:" "~\\eqref{%s}" "\\\\begin{align}\\|\\\\\\\\") |
| @@ -3896,9 +3914,18 @@ variables. It is called when RefTeX is first used, and after changes to | |||
| 3896 | these variables via reftex-add-to-label-alist." | 3914 | these variables via reftex-add-to-label-alist." |
| 3897 | (interactive) | 3915 | (interactive) |
| 3898 | 3916 | ||
| 3899 | ; record that we have done this | 3917 | ;; Record that we have done this |
| 3900 | (setq reftex-tables-dirty nil) | 3918 | (setq reftex-tables-dirty nil) |
| 3901 | 3919 | ||
| 3920 | ;; Kill temporary buffers associated with RefTeX - just in case they | ||
| 3921 | ;; were not cleaned up properly | ||
| 3922 | (let ((buffer-list '("*reftex-master.tex*" "*RefTeX Help*" "*RefTeX Select*" | ||
| 3923 | "*Duplicate Labels*" "*toc*" "*RefTeX-scratch*"))) | ||
| 3924 | (while buffer-list | ||
| 3925 | (if (get-buffer (car buffer-list)) | ||
| 3926 | (kill-buffer (car buffer-list))) | ||
| 3927 | (setq buffer-list (cdr buffer-list)))) | ||
| 3928 | |||
| 3902 | ;; To update buffer-local variables | 3929 | ;; To update buffer-local variables |
| 3903 | (hack-local-variables) | 3930 | (hack-local-variables) |
| 3904 | (message "updating internal tables...") | 3931 | (message "updating internal tables...") |
| @@ -4052,9 +4079,9 @@ This enforces rescanning the buffer on next use." | |||
| 4052 | '("Ref" | 4079 | '("Ref" |
| 4053 | ["Table of Contents" reftex-toc t] | 4080 | ["Table of Contents" reftex-toc t] |
| 4054 | "----" | 4081 | "----" |
| 4055 | ["\\label" reftex-label t] | 4082 | ["\\label" reftex-label t] |
| 4056 | ["\\ref" reftex-reference t] | 4083 | ["\\ref" reftex-reference t] |
| 4057 | ["\\cite" reftex-citation t] | 4084 | ["\\cite" reftex-citation t] |
| 4058 | ["View crossref" reftex-view-crossref t] | 4085 | ["View crossref" reftex-view-crossref t] |
| 4059 | "----" | 4086 | "----" |
| 4060 | ("Search and Replace" | 4087 | ("Search and Replace" |