comparison lisp/textmodes/reftex.el @ 18220:36a61aa59b9d

(tex-main-file, outline-minor-mode): Add defvars.
author Richard M. Stallman <rms@gnu.org>
date Wed, 11 Jun 1997 04:51:57 +0000
parents aaeaae005e98
children 0ed97be54a28
comparison
equal deleted inserted replaced
18219:aaeaae005e98 18220:36a61aa59b9d
1 ;; reftex.el --- Minor mode for doing \label, \ref and \cite in LaTeX 1 ;; reftex.el --- Minor mode for doing \label, \ref and \cite in LaTeX
2
2 ;; Copyright (c) 1997 Free Software Foundation, Inc. 3 ;; Copyright (c) 1997 Free Software Foundation, Inc.
3 4
4 ;; Author: Carsten Dominik <dominik@strw.LeidenUniv.nl> 5 ;; Author: Carsten Dominik <dominik@strw.LeidenUniv.nl>
5 ;; Keywords: tex 6 ;; Keywords: tex
6 7
525 :group 'reftex-label-support) 526 :group 'reftex-label-support)
526 527
527 528
528 (defcustom reftex-label-alist nil 529 (defcustom reftex-label-alist nil
529 "Alist with information on environments for \\label-\\ref use. 530 "Alist with information on environments for \\label-\\ref use.
530 See the definition of reftex-label-alist-builtin for examples. This variable 531 See the definition of `reftex-label-alist-builtin' for examples. This variable
531 should define additions and changes to the default. The only things you MUST 532 should define additions and changes to the default. The only things you MUST
532 NOT change is that '?s' is the type indicator for section labels and SPACE is 533 NOT change is that `?s' is the type indicator for section labels and SPACE is
533 for the 'any' label type. These are hard-coded at other places in the code. 534 for the 'any' label type. These are hard-coded at other places in the code.
534 535
535 Changes to this variable after reftex.el has been loaded become only 536 Changes to this variable after RefTeX has been loaded only become
536 effective when RefTeX is reset with \\[reftex-reset-mode]. 537 effective when RefTeX is reset with \\[reftex-reset-mode].
537 538
538 Each list entry is a list describing an environment or macro carrying a 539 Each list entry is a list describing an environment or macro carrying a
539 label. The elements of each list entry are: 540 label. The elements of each list entry are:
540 541
541 0. Name of the environment (like \"table\") or macro (like \"\\\\myfig\"). 542 0. Name of the environment (like \"table\") or macro (like \"\\\\myfig\").
542 Special names: `section' for section labels, `any' to define a group 543 Special names: `section' for section labels, `any' to define a group
543 which contains all labels. 544 which contains all labels.
544 This may also be nil if this entry is only meant to change some settings 545 This may also be nil if this entry is only meant to change some settings
545 associated with the type indicator character (see below). 546 associated with the type indicator character (see below).
546 547
547 1. Type indicator character, like ?t. 548 1. Type indicator character, like ?t.
548 The type indicator is a single character used in prompts for 549 The type indicator is a single character used in prompts for
549 label types. It must be a printable character. The same character 550 label types. It must be a printable character. The same character
550 may occur several times in this list, to cover cases in which different 551 may occur several times in this list, to cover cases in which different
551 environments carry the same label type (like equation and eqnarray). 552 environments carry the same label type (like equation and eqnarray).
552 553
553 2. Label prefix string, like \"tab:\". 554 2. Label prefix string, like \"tab:\".
554 The prefix is a short string used as the start of a label. It may be the 555 The prefix is a short string used as the start of a label. It may be the
555 empty string. 556 empty string.
556 557
557 3. Format string for reference insert in buffer. Each %s will be replaced by 558 3. Format string for reference insert in buffer. Each `%s' will be
558 the label (yes, several %s can be in there, so that you can set this to: 559 replaced by the label (you can use more than one several `%s', so
559 \"\\ref{%s} on page~\\pageref{%s}\"). 560 that you can set this to: \"\\ref{%s} on page~\\pageref{%s}\").
560 When the format starts with ~, whitespace before point will be removed so 561 When the format starts with `~', whitespace before point will be
561 that the reference cannot be separated from the word before it. 562 removed so that the reference cannot be separated from the word
563 before it.
562 564
563 4. Indication on how to find the short context. 565 4. Indication on how to find the short context.
564 - If `nil', use the text following the \\label{...} macro. 566 - If nil, use the text following the \\label{...} macro.
565 - If `t', use 567 - If t, use
566 - text following the \\begin{...} statement of environments 568 - text following the \\begin{...} statement of environments
567 (not a good choice in in eqnarray or enumerate environments!) 569 (not a good choice in in eqnarray or enumerate environments!)
568 - the section heading for section labels. 570 - the section heading for section labels.
569 - the begin of the macro for macros. 571 - the begin of the macro for macros.
570 - If a string, use as regexp to search *backward* from the label. Context 572 - If a string, use as regexp to search *backward* from the label. Context
571 is then the text following the end of the match. E.g. putting this to 573 is then the text following the end of the match. E.g. putting this to
572 \"\\\\\\\\caption{\" will use the beginning of the caption in a figure 574 \"\\\\\\\\caption{\" will use the beginning of the caption in a figure
573 or table environment. \"\\\\\\\\begin{eqnarray}\\\\|\\\\\\\\\\\\\\\\\" 575 or table environment. \"\\\\\\\\begin{eqnarray}\\\\|\\\\\\\\\\\\\\\\\"
574 works for eqnarrays. 576 works for eqnarrays.
575 - If a function, call this function with the name of the environment/macro 577 - If a function, call this function with the name of the environment/macro
576 as argument. On call, point will be just after the \\label macro. The 578 as argument. On call, point will be just after the \\label macro. The
577 function is expected to return a suitable context string. It should 579 function is expected to return a suitable context string. It should
578 throw an exception (error) when failing to find context. 580 throw an exception (error) when failing to find context.
579 Consider the following example, which would return the 10 characters 581 Consider the following example, which would return the 10 characters
580 following the label as context: 582 following the label as context:
581 583
582 (defun my-context-function (env-or-mac) 584 (defun my-context-function (env-or-mac)
583 (if (> (point-max) (+ 10 (point))) 585 (if (> (point-max) (+ 10 (point)))
584 (buffer-substring (point) (+ 10 (point))) 586 (buffer-substring (point) (+ 10 (point)))
585 (error \"Buffer too small\"))) 587 (error \"Buffer too small\")))
586 588
587 Setting the variable reftex-use-text-after-label-as-context to t overrides 589 Setting the variable `reftex-use-text-after-label-as-context' to t
588 the setting here. 590 overrides the setting here.
589 591
590 5. List of magic words which identify a reference to be of this type. If the 592 5. List of magic words which identify a reference to be of this type. If the
591 word before point is equal to one of these words when calling 593 word before point is equal to one of these words when calling
592 reftex-reference, the label list offered will be automatically restricted 594 `reftex-reference', the label list offered will be automatically restricted
593 to labels of the correct type. 595 to labels of the correct type.
594 596
595 If the type indicator characters of two or more entries are the same, RefTeX 597 If the type indicator characters of two or more entries are the same, RefTeX
596 will use 598 will use
597 - the first non-nil format and prefix 599 - the first non-nil format and prefix
598 - the magic words of all involved entries. 600 - the magic words of all involved entries.
599 601
600 Any list entry may also be a symbol. If that has an association in 602 Any list entry may also be a symbol. If that has an association in
601 reftex-label-alist-builtin, the cdr of that association is spliced into the 603 reftex-label-alist-builtin, the cdr of that association is spliced into the
602 list. See the AMSTeX configuration example in the comment section of 604 list. See the AMSTeX configuration example in the comment section of
603 reftex.el." 605 `reftex.el'."
604 :group 'reftex-defining-label-environments 606 :group 'reftex-defining-label-environments
605 :set 'reftex-set-dirty 607 :set 'reftex-set-dirty
606 :type '(list 608 :type '(list
607 :convert-widget 609 :convert-widget
608 (lambda (widget) 610 (lambda (widget)
1101 ;; This list is used to tie, untie, and reset these symbols. 1103 ;; This list is used to tie, untie, and reset these symbols.
1102 (defconst reftex-multifile-symbols 1104 (defconst reftex-multifile-symbols
1103 '(reftex-label-numbers-symbol reftex-list-of-labels-symbol 1105 '(reftex-label-numbers-symbol reftex-list-of-labels-symbol
1104 reftex-bibfile-list-symbol)) 1106 reftex-bibfile-list-symbol))
1105 1107
1106 ;; Silence warnings about TeX-master, which is defined in AUCTeX 1108 ;; Silence warnings about TeX-master, which is defined in AUCTeX.
1107 (defvar TeX-master) 1109 (defvar TeX-master)
1108 1110
1109 ;; Alist connecting master file names with the corresponding lisp symbols 1111 ;; Silence additional warnings.
1112 (defvar tex-main-file)
1113 (defvar outline-minor-mode)
1114
1115 ;; Alist connecting master file names with the corresponding Lisp symbols.
1110 (defvar reftex-master-index-list nil) 1116 (defvar reftex-master-index-list nil)
1111 1117
1112 ;; Last index used for a master file 1118 ;; Last index used for a master file
1113 (defvar reftex-multifile-index 0) 1119 (defvar reftex-multifile-index 0)
1114 1120