1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-30 11:09:23 +00:00

* reftex.el (reftex-compile-variables): respect new structure of

`reftex-index-macro'
(reftex-compile-variables): Use the changed structure of
`reftex-label-alist'.

* reftex-vars.el (reftex-index-math-format,
(reftex-toc-max-level): New option.
reftex-index-phrases-search-whole-words,
reftex-index-phrases-case-fold-search,
reftex-index-phrases-skip-indexed-matches,
reftex-index-phrases-wrap-long-lines,
reftex-index-phrases-sort-prefers-entry,
reftex-index-phrases-sort-in-blocks): New options.
(reftex-index-macros): Option structure changed.
(reftex-index-macros-builtin): Added `repeat' item to each entry.
(reftex-label-alist): Additional item in each entry to specify if
the environment should be listed in the TOC.
(eval-when-compile (require 'cl)) added.

* reftex-index.el (reftex-index-selection-or-word): No longer
deals with "repeat".
(reftex-index): "repeat property in `reftex-index-macro-alist' is
now used.
(reftex-index-phrases-comment-regexp,
reftex-index-phrases-macrodef-regexp,
reftex-index-phrases-phrase-regexp1,
reftex-index-phrases-phrase-regexp2,
reftex-index-phrases-phrase-regexp12, reftex-index-phrases-help):
New constants.
(reftex-index-phrases-macro-data, reftex-index-phrases-files,
reftex-index-phrases-font-lock-keywords,
reftex-index-phrases-font-lock-defaults, reftex-index-phrases-map,
reftex-index-phrases-restrict-file): New variables.
(reftex-index-phrase-selection-or-word,
reftex-index-visit-phrases-buffer,
reftex-index-initialize-phrases-buffer,
reftex-index-phrases-save-and-return, reftex-index-phrases-mode,
reftex-index-next-phrase, reftex-index-this-phrase,
reftex-index-all-phrases, reftex-index-region-phrases,
reftex-index-phrases-parse-header,
reftex-index-phrases-toggle-restricted, reftex-index-new-phrase,
reftex-index-find-next-conflict-phrase, reftex-index-phrases-info,
reftex-index-phrases-set-macro-key, reftex-index-sort-phrases,
reftex-compare-phrase-lines, reftex-index-make-phrase-regexp,
reftex-index-simplify-phrase, reftex-index-phrases-find-dup-re,
reftex-index-make-replace-string,
reftex-query-index-phrase-globally, reftex-query-index-phrase,
reftex-index-phrase-match-is-indexed,
reftex-index-phrases-fixup-line,
reftex-index-phrases-replace-space,
reftex-index-select-phrases-macro): New functions.
(reftex-index-globalize, reftex-index-globally): functions removed
(eval-when-compile (require 'cl)) added.

* reftex-toc.el (reftex-toc-mode): Create new indicator for max
level.
(reftex-toc-max-level-indicator): New variable.
(reftex-toc-max-level): New command.
(reftex-toc-map): New keybinding `t'.
(reftex-toc-help): Constant updated.
(eval-when-compile (require 'cl)) added.

* reftex-ref.el (reftex-offer-label-menu): Prefix to `t' command key
can change `reftex-toc-max-level'
(eval-when-compile (require 'cl)) added.

* reftex-sel (reftex-insert-docstruct): Respect
`reftex-toc-max-level'
(eval-when-compile (require 'cl)) added.

* reftex-auc.el (eval-when-compile (require 'cl)) added.

* reftex-vcr.el (eval-when-compile (require 'cl)) added.

* reftex-cite.el (reftex-citep, reftex-citet): New commands.
(reftex-citation, reftex-do-citation,
reftex-figure-out-cite-format): Additional argument FORMAT-KEY to
preselect a citation format.
(eval-when-compile (require 'cl)) added.

* reftex-parse.el (reftex-context-substring): Optional parameter
to-end
(reftex-section-info): Deal with environment matches.
(eval-when-compile (require 'cl)) added.

* reftex-global.el (eval-when-compile (require 'cl)) added.
This commit is contained in:
Carsten Dominik 1999-12-15 17:02:38 +00:00
parent cfad01b4c1
commit 7c4d13cca6
11 changed files with 1316 additions and 253 deletions

View File

@ -1,8 +1,9 @@
;;; reftex-auc.el - RefTeX's interface to AUC TeX
;;; Version: 4.6
;;; Version: 4.9
;;;
;;; See main file reftex.el for licensing information
(eval-when-compile (require 'cl))
(provide 'reftex-auc)
(require 'reftex)
;;;

View File

@ -1,8 +1,9 @@
;;; reftex-cite.el - Creating citations with RefTeX
;;; Version: 4.6
;;; Version: 4.9
;;;
;;; See main file reftex.el for licensing information
(eval-when-compile (require 'cl))
(provide 'reftex-cite)
(require 'reftex)
;;;
@ -501,7 +502,7 @@
;; Make a citation
;;;###autoload
(defun reftex-citation (&optional no-insert)
(defun reftex-citation (&optional no-insert format-key)
"Make a citation using BibTeX database files.
After prompting for a regular expression, scans the buffers with
bibtex entries (taken from the \\bibliography command) and offers the
@ -510,6 +511,8 @@ to `reftex-cite-format' and inserted into the buffer.
If NO-INSERT is non-nil, nothing is inserted, only the selected key returned.
FORAT-KEY can be used to pre-select a citation format.
When called with one or two `C-u' prefixes, first rescans the document.
When called with a numeric prefix, make that many citations. When
called with point inside the braces of a `\cite' command, it will
@ -533,13 +536,13 @@ While entering the regexp, completion on knows citation keys is possible.
;; Call reftex-do-citation, but protected
(unwind-protect
(reftex-do-citation current-prefix-arg no-insert)
(reftex-do-citation current-prefix-arg no-insert format-key)
(reftex-kill-temporary-buffers)))
(defun reftex-do-citation (&optional arg no-insert)
(defun reftex-do-citation (&optional arg no-insert format-key)
;; This really does the work of reftex-citation.
(let* ((format (reftex-figure-out-cite-format arg no-insert))
(let* ((format (reftex-figure-out-cite-format arg no-insert format-key))
(docstruct-symbol reftex-docstruct-symbol)
(selected-entries (reftex-offer-bib-menu))
(insert-entries selected-entries)
@ -610,7 +613,7 @@ While entering the regexp, completion on knows citation keys is possible.
;; Return the citation key
(car (car selected-entries))))
(defun reftex-figure-out-cite-format (arg no-insert)
(defun reftex-figure-out-cite-format (arg &optional no-insert format-key)
;; Check if there is already a cite command at point and change cite format
;; in order to only add another reference in the same cite command.
(let ((macro (car (reftex-what-macro 1)))
@ -640,19 +643,30 @@ While entering the regexp, completion on knows citation keys is possible.
cite-format-value))
(when (listp format)
(setq key
(reftex-select-with-char
"" (concat "SELECT A CITATION FORMAT\n\n"
(mapconcat
(lambda (x)
(format "[%c] %s %s" (car x)
(if (> (car x) 31) " " "")
(cdr x)))
format "\n"))))
(or format-key
(reftex-select-with-char
"" (concat "SELECT A CITATION FORMAT\n\n"
(mapconcat
(lambda (x)
(format "[%c] %s %s" (car x)
(if (> (car x) 31) " " "")
(cdr x)))
format "\n")))))
(if (assq key format)
(setq format (cdr (assq key format)))
(error "No citation format associated with key `%c'" key)))))
format))
(defun reftex-citep ()
"Call `reftex-citation' with a format selector `?p'."
(interactive)
(reftex-citation nil ?p))
(defun reftex-citet ()
"Call `reftex-citation' with a format selector `?t'."
(interactive)
(reftex-citation nil ?t))
(defvar reftex-select-bib-map)
(defun reftex-offer-bib-menu ()
;; Offer bib menu and return list of selected items

View File

@ -1,8 +1,9 @@
;;; reftex-global.el - Operations on entire documents with RefTeX
;;; Version: 4.6
;;; Version: 4.9
;;;
;;; See main file reftex.el for licensing information
(eval-when-compile (require 'cl))
(provide 'reftex-global)
(require 'reftex)
;;;
@ -191,7 +192,7 @@ one with the `xr' package."
(if (assoc label translate-alist)
(error "Duplicate label %s" label))
(setq new-label (concat (match-string 1 (car entry))
(incf (cdr nr-cell))))
(int-to-string (incf (cdr nr-cell)))))
(push (cons label new-label) translate-alist)
(or (string= label new-label) (setq changed-sequence t))))

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,9 @@
;;; reftex-parse.el - Parser Functions for RefTeX
;;; Version: 4.6
;;; Version: 4.9
;;;
;;; See main file reftex.el for licensing information
(eval-when-compile (require 'cl))
(provide 'reftex-parse)
(require 'reftex)
@ -216,16 +217,18 @@ of master file."
;; Insert in List
(setq toc-entry (reftex-section-info file))
(setq level (nth 5 toc-entry))
(setq highest-level (min highest-level level))
(if (= level highest-level)
(message
"Scanning %s %s ..."
(car (rassoc level reftex-section-levels-all))
(nth 6 toc-entry)))
(when toc-entry
;; It can happen that section info returns nil
(setq level (nth 5 toc-entry))
(setq highest-level (min highest-level level))
(if (= level highest-level)
(message
"Scanning %s %s ..."
(car (rassoc level reftex-section-levels-all))
(nth 6 toc-entry)))
(push toc-entry docstruct)
(setq reftex-active-toc toc-entry))
(push toc-entry docstruct)
(setq reftex-active-toc toc-entry)))
((match-end 7)
;; It's an include or input
@ -355,6 +358,9 @@ of master file."
;; Carefull: This function expects the match-data to be still in place!
(let* ((marker (set-marker (make-marker) (1- (match-beginning 3))))
(macro (reftex-match-string 3))
(prefix (save-match-data
(if (string-match "begin{\\([^}]+\\)}" macro)
(match-string 1 macro))))
(level-exp (cdr (assoc macro reftex-section-levels-all)))
(level (if (symbolp level-exp)
(save-match-data (funcall level-exp))
@ -363,7 +369,9 @@ of master file."
(unnumbered (or star (< level 0)))
(level (abs level))
(section-number (reftex-section-number level unnumbered))
(text1 (save-match-data (save-excursion (reftex-context-substring))))
(text1 (save-match-data
(save-excursion
(reftex-context-substring prefix))))
(literal (buffer-substring-no-properties
(1- (match-beginning 3))
(min (point-max) (+ (match-end 0) (length text1) 1))))
@ -376,6 +384,7 @@ of master file."
(make-string (* reftex-level-indent level) ?\ )
(if (nth 1 reftex-label-menu-flags) ; section number flag
(concat section-number " "))
(if prefix (concat (capitalize prefix) ": ") "")
text))
(list 'toc "toc" text file marker level section-number
literal (marker-position marker))))
@ -908,10 +917,20 @@ of master file."
(forward-list 1))
(error nil)))
(defun reftex-context-substring ()
(defun reftex-context-substring (&optional to-end)
;; Return up to 150 chars from point
;; When point is just after a { or [, limit string to matching parenthesis
(cond
(to-end
;; Environment - find next \end
(buffer-substring-no-properties
(point)
(min (+ (point) 150)
(save-match-data
;; FIXME: THis is not perfect
(if (re-search-forward "\\\\end{" nil t)
(match-beginning 0)
(point-max))))))
((or (= (preceding-char) ?\{)
(= (preceding-char) ?\[))
;; Inside a list - get only the list.

View File

@ -1,8 +1,9 @@
;;; reftex-ref.el - Code to create labels and references with RefTeX
;;; Version: 4.6
;;; Version: 4.9
;;;
;;; See main file reftex.el for licensing information
(eval-when-compile (require 'cl))
(provide 'reftex-ref)
(require 'reftex)
;;;
@ -561,9 +562,12 @@ When called with 2 C-u prefix args, disable magic word recognition."
(setq here-I-am here-I-am1)
(setq typekey (reftex-query-label-type)))
((eq key ?t)
;; toggle table of contents display
;; toggle table of contents display, or change depth
(reftex-erase-buffer)
(setq toc (not toc)))
(if current-prefix-arg
(setq reftex-toc-max-level (prefix-numeric-value
current-prefix-arg))
(setq toc (not toc))))
((eq key ?F)
;; toggle display of included file borders
(reftex-erase-buffer)

View File

@ -1,8 +1,9 @@
;;; reftex-sel.el - The selection modes for RefTeX
;;; Version: 4.6
;;; Version: 4.9
;;;
;;; See main file reftex.el for licensing information
(eval-when-compile (require 'cl))
(provide 'reftex-sel)
(require 'reftex)
;;;
@ -180,7 +181,8 @@ During a selection process, these are the local bindings.
((eq (car cell) 'toc)
;; a table of contents entry
(when toc
(when (and toc
(<= (nth 5 cell) reftex-toc-max-level))
(if (eq offset 'attention) (setq offset cell))
(setq reftex-active-toc cell)
(insert (concat toc-indent (nth 2 cell) "\n"))

View File

@ -1,8 +1,9 @@
;;; reftex-toc.el - RefTeX's table of contents mode
;;; Version: 4.6
;;; Version: 4.9
;;;
;;; See main file reftex.el for licensing information
(eval-when-compile (require 'cl))
(provide 'reftex-toc)
(require 'reftex)
;;;
@ -27,12 +28,16 @@ Here are all local bindings.
(use-local-map reftex-toc-map)
(set (make-local-variable 'revert-buffer-function) 'reftex-toc-revert)
(set (make-local-variable 'reftex-toc-include-labels-indicator) "")
(set (make-local-variable 'reftex-toc-include-index-indicator) "")
(set (make-local-variable 'reftex-toc-max-level-indicator)
(if (= reftex-toc-max-level 100)
"ALL"
(int-to-string reftex-toc-max-level)))
(setq mode-line-format
(list "---- " 'mode-line-buffer-identification
" " 'global-mode-string " (" mode-name ")"
" L<" 'reftex-toc-include-labels-indicator ">"
" I<" 'reftex-toc-include-index-indicator ">"
" T<" 'reftex-toc-max-level-indicator ">"
" -%-"))
(setq truncate-lines t)
(make-local-hook 'post-command-hook)
@ -49,6 +54,7 @@ Here are all local bindings.
(defvar reftex-last-window-height nil)
(defvar reftex-toc-include-labels-indicator nil)
(defvar reftex-toc-include-index-indicator nil)
(defvar reftex-toc-max-level-indicator nil)
(defvar reftex-toc-return-marker (make-marker)
"Marker which makes it possible to return from toc to old position.")
@ -63,6 +69,7 @@ RET Goto the location and hide the *toc* window (also on mouse-2).
C-c > Display Index. With prefix arg, restrict index to current section.
q / k Hide/Kill *toc* buffer, return to position of reftex-toc command.
l i c F Toggle display of [l]abels, [i]ndex, [c]ontext, [F]ile borders.
t Change maximum toc depth (e.g. `3 t' hides levels greater than 3).
f / g Toggle follow mode on and off / Refresh *toc* buffer.
r / C-u r Reparse the LaTeX document / Reparse entire LaTeX document.
. In other window, show position from where `reftex-toc' was called.
@ -281,6 +288,17 @@ Label context is only displayed when the labels are there as well."
(interactive)
(setq reftex-toc-include-context (not reftex-toc-include-context))
(reftex-toc-revert))
(defun reftex-toc-max-level (arg)
"Set the maximum level of toc lines in this buffer to value of prefix ARG.
When no prefix is given, set the max level to a large number, so that all
levels are shown. For eaxample, to set the level to 3, type `3 m'."
(interactive "P")
(setq reftex-toc-max-level (if arg
(prefix-numeric-value arg)
100))
(setq reftex-toc-max-level-indicator
(if arg (int-to-string reftex-toc-max-level) "ALL"))
(reftex-toc-revert))
(defun reftex-toc-view-line ()
"View document location in other window."
(interactive)
@ -473,7 +491,7 @@ With prefix arg 1, restrict index to the section at point."
(car
(rassq level
reftex-section-levels-all)))
"[[{]"))))
"[[{]?"))))
((or (not no-revisit)
(reftex-get-buffer-visiting file))
;; Marker is lost. Use the backup method.
@ -535,6 +553,7 @@ With prefix arg 1, restrict index to the section at point."
("F" . reftex-toc-toggle-file-boundary)
("i" . reftex-toc-toggle-index)
("l" . reftex-toc-toggle-labels)
("t" . reftex-toc-max-level)
("c" . reftex-toc-toggle-context)
("%" . reftex-toc-toggle-commented)
("x" . reftex-toc-external)

View File

@ -1,8 +1,9 @@
;;; reftex-vars.el - Configuration variables for RefTeX
;;; Version: 4.6
;;; Version: 4.9
;;;
;;; See main file reftex.el for licensing information
(eval-when-compile (require 'cl))
(provide 'reftex-vars)
;; Define the two constants which are needed during compilation
@ -151,18 +152,18 @@ The following conventions are valid for all alist entries:
(defconst reftex-index-macros-builtin
'((default "Default \\index and \\glossary macros"
(("\\index{*}" "idx" ?i "" nil)
("\\glossary{*}" "glo" ?g "" nil)))
(("\\index{*}" "idx" ?i "" nil t)
("\\glossary{*}" "glo" ?g "" nil t)))
(multind "The multind.sty package"
(("\\index{}{*}" 1 ?i "" nil)))
(("\\index{}{*}" 1 ?i "" nil t)))
(index "The index.sty package"
(("\\index[]{*}" 1 ?i "" nil)
("\\index*[]{*}" 1 ?I "" nil)))
(("\\index[]{*}" 1 ?i "" nil t)
("\\index*[]{*}" 1 ?I "" nil nil)))
(Index-Shortcut "index.sty with \\shortindexingon"
(("\\index[]{*}" 1 ?i "" nil)
("\\index*[]{*}" 1 ?I "" nil)
("^[]{*}" 1 ?^ "" texmathp)
("_[]{*}" 1 ?_ "" texmathp))))
(("\\index[]{*}" 1 ?i "" nil t)
("\\index*[]{*}" 1 ?I "" nil nil)
("^[]{*}" 1 ?^ "" texmathp t)
("_[]{*}" 1 ?_ "" texmathp nil))))
"Builtin stuff for reftex-index-macros.
Lower-case symbols correspond to a style file of the same name in the LaTeX
distribution. Mixed-case symbols are convenience aliases.")
@ -186,6 +187,14 @@ distribution. Mixed-case symbols are convenience aliases.")
"A multifile table of contents browser."
:group 'reftex)
(defcustom reftex-toc-max-level 100
"*The maximum level of toc entries which will be included in the TOC.
Section headings with a bigger level will be ignored. In RefTeX, chapters
are level 1, sections are level 2 etc.
This variable can be changed from within the *toc* buffer with the `t' key."
:group 'reftex-table-of-contents-browser
:type 'integer)
(defcustom reftex-toc-keep-other-windows t
"*Non-nil means, split the selected window to display the *toc* buffer.
This helps to keep the window configuration, but makes the *toc* small.
@ -284,7 +293,7 @@ The value of the variable must be a list of items. Each item is a list
itself and has the following structure:
(ENV-OR-MACRO TYPE-KEY LABEL-PREFIX REFERENCE-FORMAT CONTEXT-METHOD
(MAGIC-WORD ... ))
(MAGIC-WORD ... ) TOC-LEVEL)
Each list entry describes either an environment carrying a counter for use
with \\label and \\ref, or a LaTeX macro defining a label as (or inside)
@ -385,6 +394,14 @@ MAGIC-WORDS
strings are interpreted as regular expressions. RefTeX will add
a \"\\\\W\" to the beginning and other stuff to the end of the regexp.
TOC-LEVEL
The integer level at which this environment should be added to the
table of contents. See also `reftex-section-levels'. A positive
value will number the entries mixed with the sectioning commands of
the same level. A negative value will make unnumbered entries.
Useful only for theorem-like environments, will be ignored for macros.
When omitted or nil, no TOC entries will be made.
If the type indicator characters of two or more entries are the same, RefTeX
will use
- the first non-nil format and prefix
@ -425,7 +442,10 @@ list. However, builtin defaults should normally be set with the variable
(const :tag "Eqnarray-like" eqnarray-like)
(const :tag "Alignat-like" alignat-like)
(symbol :tag "Function" my-func))
(repeat :tag "Magic words" :extra-offset 2 (string)))
(repeat :tag "Magic words" :extra-offset 2 (string))
(option (choice :tag "Make TOC entry "
(const :tag "No entry" nil)
(integer :tag "Level" :value -3))))
(choice
:tag "Package"
:value AMSTeX
@ -982,7 +1002,7 @@ These correspond to the makeindex keywords LEVEL ENCAP ACTUAL QUOTE ESCAPE."
(defcustom reftex-index-macros nil
"Macros which define index entries. The structure is
(MACRO INDEX-TAG KEY PREFIX EXCLUDE)
(MACRO INDEX-TAG KEY PREFIX EXCLUDE REPEAT)
MACRO is the macro. Arguments should be denoted by empty braces like
\\index[]{*}. Use square brackets to denote optional arguments. The star
@ -1004,6 +1024,11 @@ EXCLUDE can be a function. If this function exists and returns a non-nil
value, the index entry at point is ignored. This was implemented to support
the (deprecated) `^' and `_' shortcuts in the LaTeX2e `index' package.
REPEAT, if non-nil, means the index macro does not typeset the entry in
the text, so that the text has to be repeated outside the index macro.
Needed for `reftex-index-selection-or-word' and for indexing from the
phrase buffer.
The final entry may also be a symbol if this entry has a association
in the variable `reftex-index-macros-builtin' to specify the main
indexing package you are using. Legal values are currently
@ -1021,13 +1046,14 @@ package here."
(repeat
:inline t
(list :value ("" "idx" ?a "" nil)
(string :tag "Macro with args")
(choice :tag "Index Tag "
(string :tag "Macro with args")
(choice :tag "Index Tag "
(string)
(integer :tag "Macro arg Nr" :value 1))
(character :tag "Access Key ")
(string :tag "Key Prefix ")
(symbol :tag "Exclusion hook ")))
(string :tag "Key Prefix ")
(symbol :tag "Exclusion hook ")
(boolean :tag "Repeat Outside ")))
(option
:tag "Package:"
(choice :tag "Package"
@ -1039,25 +1065,21 @@ package here."
(nth 0 x)))
reftex-index-macros-builtin)))))
(defcustom reftex-index-default-macro '(?i "idx" t)
(defcustom reftex-index-default-macro '(?i "idx")
"The default index macro for \\[reftex-index-selection-or-word].
This is a list with (MACRO-KEY DEFAULT-TAG REPEAT-WORD).
This is a list with (MACRO-KEY DEFAULT-TAG).
MACRO-KEY: Character identifying an index macro - see `reftex-index-macros'.
DEFAULT-TAG: This is the tag to be used if the macro requires a TAG argument.
When this is nil and a TAG is needed, RefTeX will ask for it.
When this is the empty string and the TAG argument of the index
macro is optional, the TAG argument will be omitted.
REPEAT-WORD: Non-nil means, the index macro does not typeset the entry in
the text, so that the text has to be repeated outside the index
macro."
macro is optional, the TAG argument will be omitted."
:group 'reftex-index-support
:type '(list
(character :tag "Character identifying default macro")
(choice :tag "Default index tag "
(const nil)
(string))
(boolean :tag "Word needs to be repeated ")))
(string))))
(defcustom reftex-index-default-tag "idx"
"Default index tag.
@ -1085,6 +1107,80 @@ Requires the `texmathp.el' library which is part of AUCTeX."
:group 'reftex-index-support
:type 'string)
(defcustom reftex-index-phrases-logical-and-regexp " *&& *"
"Regexp matching the `and' operator for index arguments in phrases file.
When several index arguments in a phrase line are separated by this
operator, each part will generate an index macro. So each match of
the search phrase will produce *several* different index entries.
Note: make sure this does no match things which are not separators.
This logical `and' has higher priority than the logical `or' specified in
`reftex-index-phrases-logical-or-regexp'."
:group 'reftex-index-support
:type 'regexp)
(defcustom reftex-index-phrases-logical-or-regexp " *|| *"
"Regexp matching the `or' operator for index arguments in phrases file.
When several index arguments in a phrase line are separated by this
operator, the user will be asked to select one of them at each match
of the search phrase. The first index arg will be the default - a
number key 1-9 must be pressed to switch to another.
Note: make sure this does no match things which are not separators.
The logical `and' specified in `reftex-index-phrases-logical-or-regexp'
has higher priority than this logical `or'."
:group 'reftex-index-support
:type 'regexp)
(defcustom reftex-index-phrases-search-whole-words t
"*Non-nil means phrases search will look for whole words, not subwords.
This works by requiring word boundaries at the beginning and end of
the search string. When the search phrase already has a non-word-char
at one of these points, no word boundary is required there."
:group 'reftex-index-support
:type 'boolean)
(defcustom reftex-index-phrases-case-fold-search t
"*Non-nil means, searching for index phrases will ignore case."
:group 'reftex-index-support
:type 'boolean)
(defcustom reftex-index-phrases-skip-indexed-matches nil
"*Non-nil means, skip matches which appear to be indexed already.
When doing global indexing from the phrases buffer, searches for some
phrases may match at places where that phrase was already indexed. In
particular when indexing an already processed document again, this
will even be the norm. When this variable is non-nil, RefTeX checks if
the match is an index macro argument, or if an index macro is directly
before or after the phrase. If that is the case, that match will
be ignored."
:group 'reftex-index-support
:type 'boolean)
(defcustom reftex-index-phrases-wrap-long-lines nil
"*Non-nil means, when indexing from the phrases buffer, wrap lines.
Inserting indexing commands in a line makes the line longer - often
so long that it does not fit onto the screen. When this variable is
non-nil, newlines will be added as necessary before and/or after the
indexing command to keep lines short. However, the matched text
phrase and its index command will always end up on a single line.")
(defcustom reftex-index-phrases-sort-prefers-entry nil
"*Non-nil means when sorting phrase lines, the explicit index entry is used.
Phrase lines in the phrases buffer contain a search phrase, and
sorting is normally based on these. Some phrase lines also have
an explicit index argument specified. When this variable is non-nil,
the index argument will be used for sorting."
:group 'reftex-index-support
:type 'boolean)
(defcustom reftex-index-phrases-sort-in-blocks t
"*Non-nil means, empty and comment lines separate phrase buffer into blocks.
Sorting will then preserve blocks, so that lines are re-arranged only
within blocks."
:group 'reftex-index-support
:type 'boolean)
(defcustom reftex-index-section-letters "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"The letters which denote sections in the index.
Usually these are all capital letters. Don't use any downcase letters.

View File

@ -1,8 +1,9 @@
;;; reftex-vcr.el - Viewing cross references and citations with RefTeX
;;; Version: 4.6
;;; Version: 4.9
;;;
;;; See main file reftex.el for licensing information
(eval-when-compile (require 'cl))
(provide 'reftex-vcr)
(require 'reftex)
;;;

View File

@ -2,7 +2,7 @@
;; Copyright (c) 1997, 1998, 1999 Free Software Foundation, Inc.
;; Author: Carsten Dominik <dominik@strw.LeidenUniv.nl>
;; Version: 4.6
;; Version: 4.9
;; Keywords: tex
;; This file is not part of GNU Emacs.
@ -32,6 +32,7 @@
;; - Labels are created semi-automatically.
;; - Definition context of labels is provided when creating a reference.
;; - Citations are simplified with efficient database lookup.
;; - Text phrases can be collected in a file, for later global indexing.
;; - The index preview buffer helps to check and edit index entries.
;;
;;
@ -67,6 +68,43 @@
;;
;;---------------------------------------------------------------------------
;;
;; Introduction
;; ************
;;
;; RefTeX is a specialized package for support of labels, references,
;; citations, and the index in LaTeX. RefTeX wraps itself round 4 LaTeX
;; macros: `\label', `\ref', `\cite', and `\index'. Using these macros
;; usually requires looking up different parts of the document and
;; searching through BibTeX database files. RefTeX automates these
;; time-consuming tasks almost entirely. It also provides functions to
;; display the structure of a document and to move around in this
;; structure quickly.
;;
;; *Note Imprint::, for information about who to contact for help, bug
;; reports or suggestions.
;;
;; Environment
;; ===========
;;
;; RefTeX needs to access all files which are part of a multifile
;; document, and the BibTeX database files requested by the
;; `\bibliography' command. To find these files, RefTeX will require a
;; search path, i.e. a list of directories to check. Normally this list
;; is stored in the environment variables `TEXINPUTS' and `BIBINPUTS'
;; which are also used by RefTeX. However, on some systems these
;; variables do not contain the full search path. If RefTeX does not work
;; for you because it cannot find some files, read *Note Finding Files::.
;;
;; Entering RefTeX Mode
;; ====================
;;
;; To turn RefTeX Mode on and off in a particular buffer, use `M-x
;; reftex-mode'. To turn on RefTeX Mode for all LaTeX files, add the
;; following lines to your `.emacs' file:
;;
;; (add-hook 'LaTeX-mode-hook 'turn-on-reftex) ; with AUCTeX LaTeX mode
;; (add-hook 'latex-mode-hook 'turn-on-reftex) ; with Emacs latex mode
;;
;; RefTeX in a Nutshell
;; ====================
;;
@ -107,7 +145,7 @@
;; Typing `C-c [' (`reftex-citation') will let you specify a regular
;; expression to search in current BibTeX database files (as
;; specified in the `\bibliography' command) and pull out a list of
;; matches for you to choose from. The list is *formatted* and
;; matches for you to choose from. The list is _formatted_ and
;; sorted. The selected article is referenced as `\cite{KEY}' (see
;; the variable `reftex-cite-format' if you want to insert different
;; macros).
@ -121,21 +159,22 @@
;; are supported.
;;
;; * Creating Index Entries
;; Type `C-c /' (`reftex-index-selection-or-word') to index the
;; current selection or the word at the cursor with the default
;; macro (see the variable `reftex-index-default-macro').
;; Type `C-c <' (`reftex-index') to insert a general index macro.
;; RefTeX will offer a list of available macros and provide
;; completion for the index tag (used to identify one of
;; multiple indices) and for the entry itself (useful with
;; subentries).
;; To index the current selection or the word at point, type
;; `C-c /' (`reftex-index-selection-or-word'). The default macro
;; `reftex-index-default-macro' will be used. For a more
;; complex entry type `C-c <' (`reftex-index'), select any of
;; the index macros and enter the arguments with completion.
;;
;; * Displaying the Index
;; * The Index Phrases File (Delayed Indexing)
;; Type `C-c \' (`reftex-index-phrase-selection-or-word') to add
;; the current word or selection to a special _index phrase
;; file_. RefTeX can later search the document for occurrences
;; of these phrases and let you interactively index the matches.
;;
;; * Displaying and Editing the Index
;; To display the compiled index in a special buffer, type `C-c
;; >' (`reftex-display-index'). From that buffer you can check
;; and edit all entries. The index can be restricted to those
;; entries defined in a single document section or in a user
;; defined region.
;; and edit all entries.
;;
;; 5. Viewing Cross-References
;; When point is on the KEY argument of a cross-referencing macro
@ -193,9 +232,10 @@
;; Go ahead and use RefTeX. Use its menus until you have picked up
;; the key bindings. For an overview of what you can do in each of
;; the different special buffers, press `?'. Read the manual if you
;; get stuck. The first part of the manual explains in a tutorial
;; way how to use and customize RefTeX. The second part is a command
;; and variable reference.
;; get stuck, of if you are curious what else might be available.
;; The first part of the manual explains in a tutorial way how to use
;; and customize RefTeX. The second part is a command and variable
;; reference.
;;
;;---------------------------------------------------------------------------
;;
@ -219,9 +259,10 @@
;;
;; Fran Burstall, Alastair Burt, Soren Dayton, Stephen Eglen,
;; Karl Eichwalder, Peter Galbraith, Dieter Kraft, Kai Grossjohann,
;; Adrian Lanz, Rory Molinari, Stefan Monnier, Laurent Mugnier,
;; Sudeep Kumar Palat, Daniel Polani, Robin Socha, Richard Stanton,
;; Allan Strand, Jan Vroonhof, Christoph Wedler, Alan Williams.
;; Frank Harrell, Adrian Lanz, Rory Molinari, Stefan Monnier,
;; Laurent Mugnier, Sudeep Kumar Palat, Daniel Polani, Robin Socha,
;; Richard Stanton, Allan Strand, Jan Vroonhof, Christoph Wedler,
;; Alan Williams.
;;
;; Finally thanks to Uwe Bolick who first got me (some years ago) into
;; supporting LaTeX labels and references with an editor (which was
@ -259,7 +300,7 @@
;;; Define the formal stuff for a minor mode named RefTeX.
;;;
(defconst reftex-version "RefTeX version 4.6"
(defconst reftex-version "RefTeX version 4.9"
"Version string for RefTeX.")
(defvar reftex-mode nil
@ -828,7 +869,7 @@ This enforces rescanning the buffer on next use."
entry env-or-mac typekeychar typekey prefix context word
fmt reffmt labelfmt wordlist qh-list macros-with-labels
nargs nlabel opt-args cell sum i
macro verify nindex tag key)
macro verify repeat nindex tag key toc-level toc-levels)
(setq reftex-words-to-typekey-alist nil
reftex-typekey-list nil
@ -856,7 +897,8 @@ This enforces rescanning the buffer on next use."
prefix (nth 1 entry)
fmt (nth 2 entry)
context (nth 3 entry)
wordlist (nth 4 entry))
wordlist (nth 4 entry)
toc-level (nth 5 entry))
(if (stringp wordlist)
;; This is before version 2.04 - convert to new format
(setq wordlist (nthcdr 4 entry)))
@ -901,7 +943,11 @@ This enforces rescanning the buffer on next use."
((string= env-or-mac ""))
((string= env-or-mac "section"))
(t
(add-to-list 'reftex-label-env-list env-or-mac)))))
(add-to-list 'reftex-label-env-list env-or-mac)
(if toc-level
(let ((string (format "begin{%s}" env-or-mac)))
(or (assoc string toc-levels)
(push (cons string toc-level) toc-levels))))))))
;; Translate some special context cases
(when (assq context reftex-default-context-regexps)
(setq context
@ -996,15 +1042,24 @@ This enforces rescanning the buffer on next use."
key (nth 2 entry)
prefix (or (nth 3 entry) "")
verify (nth 4 entry)
all-index (cdr all-index))
;; For repeat, we need to be compatible with older code
;; This information used to be given only for the default macro,
;; but later we required to have it for *every* index macro
repeat (cond ((> (length entry) 5) (nth 5 entry))
((and (eq key (car reftex-index-default-macro))
(> (length reftex-index-default-macro) 2))
;; User has old setting - respect it
(nth 2 reftex-index-default-macro))
(t t))
all-index (cdr all-index))
(let ((result (reftex-parse-args macro)))
(setq macro (or (first result) macro)
nargs (second result)
nindex (third result)
opt-args (fourth result))
(unless (member macro reftex-macros-with-index)
;; 0 1 2 3 4 5 6
(push (list macro tag prefix verify nargs nindex opt-args)
;; 0 1 2 3 4 5 6 7
(push (list macro tag prefix verify nargs nindex opt-args repeat)
reftex-index-macro-alist)
(or (assoc key reftex-key-to-index-macro-alist)
(push (list key macro) reftex-key-to-index-macro-alist))
@ -1030,7 +1085,8 @@ This enforces rescanning the buffer on next use."
;; Make the full list of section levels
(setq reftex-section-levels-all
(append (get reftex-docstruct-symbol 'reftex-section-levels)
(append toc-levels
(get reftex-docstruct-symbol 'reftex-section-levels)
reftex-section-levels))
;; Calculate the regular expressions
@ -1040,7 +1096,7 @@ This enforces rescanning the buffer on next use."
(section-re
(concat wbol "\\\\\\("
(mapconcat 'car reftex-section-levels-all "\\|")
"\\)\\*?\\(\\[[^]]*\\]\\)?{"))
"\\)\\*?\\(\\[[^]]*\\]\\)?{?"))
(appendix-re (concat wbol "\\(\\\\appendix\\)"))
(macro-re
(if macros-with-labels
@ -1581,10 +1637,14 @@ When DIE is non-nil, throw an error if file not found."
"Query for an index macro and insert it along with its argments." t)
(autoload 'reftex-index-selection-or-word "reftex-index"
"Put selection or the word near point into the default index macro." t)
(autoload 'reftex-index-globally "reftex-index"
"Copy index entry at point to other occurrences of this word." t)
(autoload 'reftex-index-phrase-selection-or-word "reftex-index"
"Put selection or the word near point into Index Phrases File." t)
(autoload 'reftex-display-index "reftex-index"
"Display a buffer with an index compiled from the current document." t)
(autoload 'reftex-index-visit-phrases-buffer "reftex-index"
"Visit the Index Phrases File." t)
(autoload 'reftex-index-phrases-mode "reftex-index"
"Major mode for managing the Index phrases of a LaTeX document." t)
(autoload 'reftex-index-complete-tag "reftex-index")
(autoload 'reftex-index-complete-key "reftex-index")
(autoload 'reftex-index-show-entry "reftex-index")
@ -1638,6 +1698,7 @@ When DIE is non-nil, throw an error if file not found."
(autoload 'reftex-toggle-plug-into-AUCTeX "reftex-auc"
"Toggle Interface between AUCTeX and RefTeX on and off." t)
(autoload 'reftex-add-label-environments "reftex-auc")
(autoload 'reftex-add-to-label-alist "reftex-auc")
(autoload 'reftex-add-section-levels "reftex-auc")
(autoload 'reftex-notice-new-section "reftex-auc")
@ -1702,6 +1763,11 @@ When DIE is non-nil, throw an error if file not found."
(progn (skip-chars-backward class) (point))
(progn (skip-chars-forward class) (point)))))
(defun reftex-number (n unit &optional ending)
(if (and (integerp n) (stringp unit))
(format "%d %s%s" n unit (if (= n 1) "" (or ending "s")))
""))
(defun reftex-all-assq (key list)
;; Return a list of all associations of KEY in LIST. Comparison with eq.
(let (rtn)
@ -2227,14 +2293,16 @@ IGNORE-WORDS List of words which should be removed from the string."
;; The default bindings in the mode map.
(loop for x in
'(("\C-c=" . reftex-toc)
("\C-c(" . reftex-label)
("\C-c)" . reftex-reference)
("\C-c[" . reftex-citation)
("\C-c<" . reftex-index)
("\C-c>" . reftex-display-index)
("\C-c/" . reftex-index-selection-or-word)
("\C-c&" . reftex-view-crossref))
'(("\C-c=" . reftex-toc)
("\C-c(" . reftex-label)
("\C-c)" . reftex-reference)
("\C-c[" . reftex-citation)
("\C-c<" . reftex-index)
("\C-c>" . reftex-display-index)
("\C-c/" . reftex-index-selection-or-word)
("\C-c\\" . reftex-index-phrase-selection-or-word)
("\C-c|" . reftex-index-visit-phrases-buffer)
("\C-c&" . reftex-view-crossref))
do (define-key reftex-mode-map (car x) (cdr x)))
;; Bind `reftex-mouse-view-crossref' only when the key is still free
@ -2279,11 +2347,17 @@ IGNORE-WORDS List of words which should be removed from the string."
["\\label" reftex-label t]
["\\ref" reftex-reference t]
["\\cite" reftex-citation t]
["\\index" reftex-index t]
["\\index{THIS}" reftex-index-selection-or-word t]
["View Crossref" reftex-view-crossref t]
("\\index"
["\\index" reftex-index t]
["\\index{THIS}" reftex-index-selection-or-word t]
"--"
["Add THIS to Index Phrases" reftex-index-phrase-selection-or-word t]
["Visit Phrase Buffer" reftex-index-visit-phrases-buffer t]
["Apply Phrases to Region" reftex-index-phrases-apply-to-region t]
"--"
["Display the Index" reftex-display-index t])
"--"
["Index Buffer" reftex-display-index t]
["View Crossref" reftex-view-crossref t]
"--"
("Parse Document"
["One File" reftex-parse-one reftex-enable-partial-scans]
@ -2302,8 +2376,6 @@ IGNORE-WORDS List of words which should be removed from the string."
["Change Label and Refs" reftex-change-label t]
["Renumber Simple Labels" reftex-renumber-simple-labels t]
"--"
["Index Globally" reftex-index-globally t]
"--"
["Create TAGS File" reftex-create-tags-file t]
"--"
["Save Document" reftex-save-all-document-buffers t])
@ -2408,11 +2480,12 @@ IGNORE-WORDS List of words which should be removed from the string."
(require 'finder)
(finder-commentary "reftex.el"))
(defun reftex-info ()
"Read documentation for RefTeX in the info system."
(defun reftex-info (&optional node)
"Read documentation for RefTeX in the info system.
With optional NODE, go directly to that node."
(interactive)
(require 'info)
(Info-goto-node "(reftex)"))
(Info-goto-node (format "(reftex)%s" (or node ""))))
;;; Install the kill-buffer and kill-emacs hooks ------------------------------
@ -2431,3 +2504,4 @@ IGNORE-WORDS List of words which should be removed from the string."
;;;============================================================================
;;; reftex.el ends here