1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-29 07:58:28 +00:00

Merge from standalone RefTeX repository.

Here is the ChangeLog of the standalone version of RefTeX without
information about Makefiles and other auxiliary files.  The differences to
the Emacs repository are documented in the respective ChangeLog files.

2010-11-06  Ralf Angeli  <angeli@caeruleus.net>

	* lisp/reftex-cite.el (reftex-create-bibtex-file): Make sure that
	entries with whitespace at various places are found.
	(reftex-extract-bib-entries-from-thebibliography): Remove
	superfluous backslash.

2010-10-16  Ralf Angeli  <angeli@caeruleus.net>

	* lisp/reftex-cite.el
	(reftex-extract-bib-entries-from-thebibliography): Use
	`with-current-buffer'.

2010-09-14  Ralf Angeli  <angeli@caeruleus.net>

	* lisp/reftex-cite.el (reftex-do-citation): Make it possible again
	to insert non-existent entries.

2010-01-30  Ralf Angeli  <angeli@caeruleus.net>

	* lisp/reftex-base.el (reftex-syntax-table-for-bib, reftex-mode):
	Do not derive `reftex-syntax-table-for-bib' from
	`reftex-syntax-table' because parens have to retain their paren
	syntax in order for parsing of BibTeX entries like @book(...) to
	work.

2009-09-12  Ralf Angeli  <angeli@caeruleus.net>

	* lisp/reftex-vars.el (reftex-label-alist): Doc fix.

	* lisp/reftex-toc.el (reftex-re-enlarge): Call `enlarge-window'
	only if there is something to do because in Emacs the horizontal
	version throws an error even if the parameter is 0.

2009-08-08  Ralf Angeli  <angeli@caeruleus.net>

	* lisp/reftex-index.el: Suppress byte-compiler warnings.  Move
	provide statement to end of file.

	* lisp/reftex-dcr.el: Suppress byte-compiler warnings.  Move
	provide statement to end of file.

	* lisp/reftex-auc.el: Suppress byte-compiler warnings.

	* doc/reftex.texi (Imprint): Mention Wolfgang in list of
	contributors.

	* lisp/reftex-vars.el (reftex-plug-into-AUCTeX): Doc fix.

2009-07-05  Ralf Angeli  <angeli@caeruleus.net>

	* doc/reftex.texi (Creating Citations): Give a hint about how to
	auto-revert the BibTeX database file when using external editors.

	* lisp/reftex-cite.el (reftex-do-citation): Save match data when
	asking for optional arguments.

2009-04-29  Ralf Angeli  <angeli@caeruleus.net>

	* lisp/reftex-base.el (reftex-in-comment): Do not error out if
	`comment-start-skip' is not set.

2009-03-01  Wolfgang Mayer  <wmayer7@gmail.com>

	* lisp/reftex-cite.el (reftex-all-used-citation-keys):
	Fix regexp to correctly extract all citations in the same line.

2008-12-29  Ralf Angeli  <angeli@caeruleus.net>

	* lisp/reftex-vars.el (reftex-vref-is-default)
	(reftex-fref-is-default): Adapt doc string.
	(reftex-ref-style-default-list): New name for
	`reftex-ref-style-active-list'.  Use :set instead of :repeat.
	(reftex-vref-is-default, reftex-fref-is-default): Adapt to new
	name.

	* lisp/reftex-base.el (reftex-tie-multifile-symbols): Add doc
	string.
	(reftex-tie-multifile-symbols): Initialize
	`reftex-ref-style-list'.
	(reftex-untie-multifile-symbols): Add doc string.
	(reftex-add-index-macros): Doc fix.
	(reftex-ref-style-activate, reftex-ref-style-toggle)
	(reftex-ref-style-list): New functions.
	(reftex-mode-menu): Use them.

	* lisp/reftex-sel.el (reftex-select-cycle-ref-style-internal): Use
	`reftex-ref-style-list' function.

	* lisp/reftex-ref.el (reftex-reference): Use
	`reftex-ref-style-list' function.

	* doc/reftex.texi (Referencing Labels): Simplify section about
	reference macro cycling.
	(Reference Styles, Options (Referencing Labels)): Adapt to changed
	implementation.

2008-12-18  Ralf Angeli  <angeli@caeruleus.net>

	* lisp/reftex-base.el (reftex-in-comment): Deal correctly with
	escaped comment characters.

2008-11-30  Ralf Angeli  <angeli@caeruleus.net>

	* lisp/reftex-vars.el (reftex-ref-style-alist): Change structure
	so that it is not possible to use multiple different package names
	within a style.
	(reftex-ref-style-active-list): Adapt to new structure of
	`reftex-ref-style-alist'.

	* lisp/reftex-sel.el (reftex-select-cycle-active-ref-styles):
	Remove.
	(reftex-select-cycle-ref-style-internal): Adapt to new structure
	of `reftex-ref-style-alist'.

	* lisp/reftex-ref.el: Adapt creation of `reftex-<package>-<macro>'
	functions to new structure of `reftex-ref-style-alist'.
	(reftex-reference): Adapt to new structure of
	`reftex-ref-style-alist'.

	* lisp/reftex-base.el (reftex-mode-menu): Adapt to new structure
	of `reftex-ref-style-alist'.

	* doc/reftex.texi (Options (Referencing Labels)): Adapt to new
	structure of `reftex-ref-style-alist'.

2008-10-16  Ralf Angeli  <angeli@caeruleus.net>

	* doc/reftex.texi (Referencing Labels, Reference Styles): Document
	changes in the referencing functionality.

2008-10-15  Ralf Angeli  <angeli@caeruleus.net>

	* lisp/reftex-vars.el (reftex-ref-style-alist): Remove the symbols
	for symbols for macro type distinction.  Add characters for macro
	selection.
	(reftex-ref-macro-prompt): New variable.

	* lisp/reftex-sel.el (reftex-select-cycle-ref-style-internal):
	Remove code for testing macro type.
	(reftex-select-toggle-numref-pageref): Remove.
	(reftex-select-label-map): Remove binding for
	`reftex-select-toggle-numref-pageref'.

	* lisp/reftex-ref.el (reftex-reference): Prompt for a reference
	macro if `reftex-ref-macro-prompt' is non-nil.

	* lisp/reftex-base.el (reftex-select-with-char): Kill the RefTeX
	Select buffer when done.

2008-06-07  David Kastrup  <dak@gnu.org>

	* lisp/reftex-base.el (reftex-remove-if): Improve performance.

2008-06-07  Ralf Angeli  <angeli@caeruleus.net>

	* lisp/reftex-cite.el (reftex-get-string-refs): Use a regexp
	alternative for better performance.

	* doc/reftex.texi (Commands): Mention options for definition of
	header and footer in BibTeX files.
	(Options (Creating Citations)): Document
	`reftex-create-bibtex-header' and `reftex-create-bibtex-footer'.

	* lisp/reftex-cite.el (reftex-stringref-p): Remove.
	(reftex-get-string-refs): Do without `reftex-stringref-p' and use
	`reftex-remove-if' instead of the cl-based `remove-if'.
	(reftex-create-bibtex-file): Doc fix.

	* lisp/reftex-base.el (reftex-remove-if): New function.

2008-06-07  Wolfgang Mayer  <wmayer7@gmail.com>

	* lisp/reftex-vars.el (reftex-create-bibtex-header)
	(reftex-create-bibtex-footer): New variables.

	* lisp/reftex-cite.el (reftex-parse-bibtex-entry): Accept
	additional optional argument `raw' and keep quotes or braces if it
	is non-nil.
	(reftex-stringref-p, reftex-get-string-refs): New functions.
	(reftex-create-bibtex-file): Include entries that are
	cross-referenced from cited entries.  Include @String definitions
	in the resulting bib file.  Add header and footer defined in
	`reftex-create-bibtex-header' and `reftex-create-bibtex-footer'.

2008-05-03  Ralf Angeli  <angeli@caeruleus.net>

	* lisp/reftex-parse.el (reftex-parse-from-file): Move backward one
	char if a `\' was matched after a section macro.

	* lisp/reftex-global.el (reftex-isearch-switch-to-next-file): Use
	`reverse' instead of `nreverse' and `copy-list' in order to make
	the byte compiler happy.  Get rid of unused `orig-flist' variable.

	* lisp/reftex-base.el (reftex-compile-variables): Revert last
	change.  Match `\' after a section macro.
	(reftex-mapconcat-with-predicate): Remove.

2008-04-13  Ralf Angeli  <angeli@caeruleus.net>

	* lisp/reftex-base.el (reftex-mapconcat-with-predicate): New
	function.
	(reftex-compile-variables): Use it.  Treat environments and macros
	differently in the regexp for section matching.

	* lisp/reftex-parse.el (reftex-parse-from-file): Use beginning of
	match instead of end as bound.

	* lisp/reftex-sel.el (reftex-select-label-map): Changing binding
	of reference style toggling to "s" which is not already taken.

	* doc/reftex.texi (Reference Styles): Reflect change in key
	binding for toggling reference styles.  Some minor changes.

2008-03-27  Ralf Angeli  <angeli@caeruleus.net>

	* lisp/reftex-vars.el: Some whitespace, doc and checkdoc fixes.

2008-03-16  Ralf Angeli  <angeli@caeruleus.net>

	* lisp/reftex-index.el (reftex-index-selection-or-word): Use
	`reftex-region-active-p'.
	(reftex-index-show-entry)
	(reftex-index-initialize-phrases-buffer)
	(reftex-index-phrases-apply-to-region): Sync with Emacs trunk.

	* lisp/reftex-dcr.el (reftex-start-itimer-once): Silence the byte
	compiler.

	* lisp/reftex-auc.el: Move `provide' call to bottom of file.

	* lisp/reftex-base.el: Require easymenu and define autoloads
	earlier to avoid compiler warnings.
	(reftex-region-active-p, reftex-select-with-char)
	(reftex-show-commentary): Sync with version in Emacs trunk.
	(reftex-make-overlay, reftex-overlay-put, reftex-move-overlay)
	(reftex-delete-overlay): Define in a way which hides the XEmacs
	symbols from the byte compiler.
	(reftex-info): Silence the byte compiler.  Use `reftex.info'
	instead of `reftex' in order to get the correct file.

2008-03-07  Ralf Angeli  <angeli@caeruleus.net>

	* lisp/reftex-cite.el (reftex-extract-bib-entries): Check if
	BibTeX file changed on disk and ask if it should be reread in case
	it did.

2008-03-02  Ralf Angeli  <angeli@caeruleus.net>

	* doc/reftex.texi: Lots of small fixes.
	(Reference Styles): New section.
	(varioref (LaTeX package), fancyref (LaTeX package)): Remove.
	(Options (Referencing Labels)): Remove descriptions of deprecated
	variables `reftex-vref-is-default' and `reftex-fref-is-default'.
	Add descriptions for `reftex-ref-style-alist' and
	`reftex-ref-style-active-list'.
	(Referencing Labels): Update regarding reference styles.

2008-02-17  Ralf Angeli  <angeli@caeruleus.net>

	* lisp/reftex-ref.el (reftex-format-special): Add third argument
	for refstyle possible to be passed, making the byte compiler
	happy.
	(reftex-reference): Pass refstyle to `reftex-format-special'.

	* lisp/reftex-vars.el (reftex-ref-style-active-list): Make
	creation of type compatible with Emacs 21.
	(reftex-format-ref-function): Mention third argument of special
	format function.

	* lisp/reftex-base.el (reftex-mode-menu): Make creation of
	Reference Style menu compatible with Emacs 21.

	* doc/reftex.texi: Fix some typos.

2008-01-27  Ralf Angeli  <angeli@caeruleus.net>

	* lisp/reftex-vars.el (reftex-ref-style-active-list): Doc fix.

	* lisp/reftex-base.el (reftex-erase-all-selection-and-index-buffers)
	(reftex-access-parse-file): Use `mapc' instead of `mapcar' where
	return value is not used.

	* lisp/reftex-ref.el (reftex-offer-label-menu): Use `mapc' instead
	of `mapcar' where return value is not used.

	* lisp/reftex-sel.el (reftex-select-item, reftex-select-unmark):
	Use `mapc' instead of `mapcar' where return value is not used.

	* lisp/reftex-vars.el (reftex-ref-style-alist)
	(reftex-ref-style-active-list): New variables.
	(reftex-vref-is-default, reftex-fref-is-default): Adapt doc string
	to new implementation.  Mark as obsolete.  Add compatibility code
	for honoring the variable values in case they are set.

	* lisp/reftex-base.el (reftex-mode-menu): Reference styles are now
	computed from `reftex-ref-style-alist'.  Fix typo.

	* lisp/reftex-ref.el (reftex-reference): Determine reference macro
	by looking at `reftex-ref-style-active-list' and
	`reftex-ref-style-alist'.  Use only one special format function.
	(reftex-varioref-vref, reftex-fancyref-fref)
	(reftex-fancyref-Fref): Remove definitions.  The functions are now
	generated from `reftex-ref-style-alist'.
	(reftex-format-vref, reftex-format-Fref, reftex-format-fref):
	Remove.
	(reftex-format-special): New function.

	* lisp/reftex-sel.el (reftex-select-toggle-varioref)
	(reftex-select-toggle-fancyref): Remove.
	(reftex-select-cycle-active-ref-styles)
	(reftex-select-cycle-ref-style-internal)
	(reftex-select-cycle-ref-style-forward)
	(reftex-select-cycle-ref-style-backward)
	(reftex-select-toggle-numref-pageref): New functions.
	(reftex-select-label-map): Use `v' and `V' for general cycling
	through reference styles.  Add `p' for switching between number
	and page reference types.

2008-01-06  Ralf Angeli  <angeli@caeruleus.net>

	* lisp/reftex-cite.el (reftex-pop-to-bibtex-entry)
	(reftex-extract-bib-entries-from-thebibliography): Match \bibitem
	entries with spaces or tabs in front of arguments.
	(reftex-insert-bib-matches): Use `mapc' instead of `mapcar'
	because return value is not used.

2008-01-05  Ralf Angeli  <angeli@caeruleus.net>

	* lisp/reftex-toc.el (reftex-make-separate-toc-frame): Hide
	non-operational call to `focus-frame' in Emacs for the compilers's
	sake.

2008-01-03  Ralf Angeli  <angeli@caeruleus.net>

	* lisp/reftex-dcr.el (reftex-mouse-view-crossref): Explain why
	point is set.

	* lisp/reftex-toc.el (reftex-toc-do-promote): Use `mapc' instead
	of `mapcar' because return value is not used.
	(reftex-toggle-auto-toc-recenter): Fix typo.

	* lisp/reftex-cite.el (reftex-do-citation): Use `mapc' instead of
	`mapcar' because return value is not used.

2007-10-10  Ralf Angeli  <angeli@caeruleus.net>

	* lisp/reftex-vars.el (reftex-cite-format-builtin)
	(reftex-bibliography-commands): Add support for ConTeXt.

	* doc/reftex.texi (Citation Styles): Mention support for ConTeXt.

2007-08-23  Ralf Angeli  <angeli@caeruleus.net>

	* doc/reftex.texi (Options (Defining Label Environments)): Fix
	typo.

2007-07-22  Ralf Angeli  <angeli@caeruleus.net>

	* lisp/reftex-base.el (reftex-set-cite-format): Autoload.
	(reftex-access-parse-file): Create parse file in a way that does
	not interfere with recentf mode.
	(reftex-access-parse-file): Do not risk destroying an existing
	buffer.

2007-07-07  Ralf Angeli  <angeli@caeruleus.net>

	* lisp/reftex-parse.el (reftex-nth-arg): Use `forward-comment'
	instead of `comment-forward'.  The latter is not always available
	and the former is sufficient for LaTeX.
	(reftex-nth-arg): Revert last change since moving over whitespace
	and comments is done by `reftex-move-to-next-arg'.

2007-05-20  Ralf Angeli  <angeli@caeruleus.net>

	* doc/reftex.texi (Citation Styles): Correct some mistakes.

2007-04-03  Ralf Angeli  <angeli@caeruleus.net>

	* lisp/reftex-cite.el: Delete trailing whitespace.
	(reftex-pop-to-bibtex-entry, reftex-extract-bib-entries)
	(reftex-parse-bibtex-entry, reftex-create-bibtex-file): Match
	entries containing numbers and symbol constituents.

2007-03-28  Ralf Angeli  <angeli@caeruleus.net>

	* doc/reftex.texi: Replace BibTeX by @BibTeX{} throughout the
	file.

2007-03-12  John Paul Wallington  <jpw@pobox.com>

	* lisp/reftex-vars.el (reftex-format-ref-function)
	(reftex-format-cite-function): Fix custom type.

2007-03-10  Ralf Angeli  <angeli@caeruleus.net>

	* lisp/reftex-base.el: Remove information in comment already in
	imprint or cluttering output of `finder-commentary'.
	Require reftex.el.

	* lisp/reftex.el: Remove.  Now generated from reftex.el.in.

	* lisp/reftex-dcr.el: Remove version info in header.  Add
	maintainer info.

	* lisp/reftex-global.el Remove version info in header.  Add
	maintainer info.

	* lisp/reftex-index.el Remove version info in header.  Add
	maintainer info.

	* lisp/reftex-parse.el Remove version info in header.  Add
	maintainer info.

	* lisp/reftex-ref.el Remove version info in header.  Add
	maintainer info.

	* lisp/reftex-sel.el Remove version info in header.  Add
	maintainer info.

	* lisp/reftex-toc.el Remove version info in header.  Add
	maintainer info.

	* lisp/reftex-vars.el Remove version info in header.  Add
	maintainer info.

2007-03-08  Ralf Angeli  <angeli@caeruleus.net>

	* doc/reftex.texi: Include macros.texi and version.texi.  Change
	maintainer and version information.  Express TeX, LaTeX, AUCTeX
	and RefTeX with macros.
	(Imprint): Change maintainer information.

2007-03-04  Ralf Angeli  <angeli@caeruleus.net>

	* lisp/reftex.el: Update.

	* lisp/reftex-base.el (reftex-show-commentary): Look in
	reftex-base.el.
	(reftex-report-bug): New function.

	* lisp/reftex.el: Move original content to reftex-base.el.  Add
	new header and automatically generated autoloads.

	* lisp/reftex-base.el: New file.  Insert original content of
	reftex.el.  Remove autoload for `reftex-index-phrases-mode'.
	Delete trailing whitespace.

2007-02-26  Ralf Angeli  <angeli@caeruleus.net>

	* lisp/reftex-index.el (reftex-index-visit-phrases-buffer): Set
	marker when visiting buffer.  This allows for returning from the
	phrases file to the file one was just editing instead of the file
	where the last phrases was added from.

2007-02-25  Ralf Angeli  <angeli@caeruleus.net>

	* lisp/reftex-index.el (reftex-index-phrases-syntax-table): New
	variable.  Give ?\" punctuation syntax as it usually is not used
	as string quote in TeX-related modes and may occur unmatched.  The
	change also prevents fontification of quoted content.
	(reftex-index-phrases-mode): Use it.

	* lisp/reftex-cite.el (reftex-parse-bibtex-entry): Match fields
	containing hyphens (besides word constituents).

2007-02-25  David Kastrup  <dak@gnu.org>

	* lisp/reftex.el (reftex-uniquify, reftex-uniquify-by-car):
	Replace O(n^2) algorithms with O(n log n).  Introduce optional
	argument SORT (not yet used).  TODO: figure out callers that can
	specify SORT, in order to further speed this up.

2007-02-25  Ralf Angeli  <angeli@caeruleus.net>

	* lisp/reftex-vars.el (reftex-cite-key-separator): New variable.

	* lisp/reftex-auc.el (reftex-arg-cite): Use
	`reftex-cite-key-separator'.

	* lisp/reftex-cite.el (reftex-do-citation)
	(reftex-figure-out-cite-format): Use `reftex-cite-key-separator'.

	* doc/reftex.texi (Options (Creating Citations)): Document
	`reftex-cite-key-separator'.

	* lisp/reftex-cite.el (reftex-do-citation): Return all keys, not
	just the first one.

	* lisp/reftex-auc.el (reftex-arg-cite): Correctly handle new
	value type returned by `reftex-citation'.

2007-02-24  Ralf Angeli  <angeli@caeruleus.net>

	* doc/reftex.texi: Set correct filename for standalone
	distribution.

2007-02-07  Ralf Angeli  <angeli@caeruleus.net>

	Create `reftex' module.
This commit is contained in:
Ralf Angeli 2012-09-30 22:30:13 +02:00
parent 440ba39593
commit 4f595e1504
14 changed files with 1605 additions and 1159 deletions

View File

@ -1,3 +1,34 @@
2012-09-30 Ralf Angeli <angeli@caeruleus.net>
Merge from standalone RefTeX repository.
* reftex.texi: Express TeX, LaTeX, AUCTeX, BibTeX and RefTeX
with macros.
(Imprint): Mention Wolfgang in list of contributors.
(Creating Citations): Give a hint about how to
auto-revert the BibTeX database file when using external editors.
(Referencing Labels): Simplify section about reference macro
cycling.
(Options (Referencing Labels)): Adapt to new structure of
`reftex-ref-style-alist'.
(Referencing Labels, Reference Styles): Document changes in the
referencing functionality.
(Commands): Mention options for definition of header and footer in
BibTeX files.
(Options (Creating Citations)): Document
`reftex-create-bibtex-header' and `reftex-create-bibtex-footer'.
(Reference Styles): New section.
(varioref (LaTeX package), fancyref (LaTeX package)): Remove.
(Options (Referencing Labels)): Remove descriptions of deprecated
variables `reftex-vref-is-default' and `reftex-fref-is-default'.
Add descriptions for `reftex-ref-style-alist' and
`reftex-ref-style-default-list'.
(Referencing Labels): Update regarding reference styles.
(Citation Styles): Mention support for ConTeXt.
(Options (Defining Label Environments)): Fix typo.
(Options (Creating Citations)): Document
`reftex-cite-key-separator'.
2012-09-30 Achim Gratz <Stromeko@Stromeko.DE> 2012-09-30 Achim Gratz <Stromeko@Stromeko.DE>
* org.texi: Add description of ORG_ADD_CONTRIB to info * org.texi: Add description of ORG_ADD_CONTRIB to info

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,146 @@
2012-09-30 Ralf Angeli <angeli@caeruleus.net>
Merge from standalone RefTeX repository.
The following ChangeLog entries are shortened versions of the
original ones with file paths adapted. A not so strongly edited
version of the original ChangeLog can be found in the commit log.
* textmodes/reftex-auc.el: Move `provide' call to bottom of file.
(reftex-arg-cite): Use `reftex-cite-key-separator'. Correctly
handle new value type returned by `reftex-citation'.
* textmodes/reftex-cite.el (reftex-create-bibtex-file): Make sure
that entries with whitespace at various places are found. Doc
fix. Include entries that are cross-referenced from cited entries.
Include @String definitions in the resulting bib file. Add header
and footer defined in `reftex-create-bibtex-header' and
`reftex-create-bibtex-footer'.
(reftex-do-citation): Make it possible again to insert
non-existent entries. Save match data when asking for optional
arguments. Return all keys, not just the first one.
(reftex-all-used-citation-keys): Fix regexp to correctly extract
all citations in the same line.
(reftex-parse-bibtex-entry): Accept additional optional argument
`raw' and keep quotes or braces if it is non-nil. Match fields
containing hyphens besides word constituents.
(reftex-get-string-refs): New function.
(reftex-extract-bib-entries): Check if BibTeX file changed on disk
and ask if it should be reread in case it did.
(reftex-pop-to-bibtex-entry)
(reftex-extract-bib-entries-from-thebibliography): Match \bibitem
entries with spaces or tabs in front of arguments.
(reftex-pop-to-bibtex-entry, reftex-extract-bib-entries)
(reftex-parse-bibtex-entry, reftex-create-bibtex-file): Match
entries containing numbers and symbol constituents.
(reftex-do-citation, reftex-figure-out-cite-format): Use
`reftex-cite-key-separator'.
* textmodes/reftex-dcr.el: Move provide statement to end of file.
(reftex-mouse-view-crossref): Explain why point is set.
* textmodes/reftex-global.el: Whitespace changes.
* textmodes/reftex-index.el: Move provide statement to end of
file.
(reftex-index-selection-or-word): Use `reftex-region-active-p'.
(reftex-index-visit-phrases-buffer): Set marker when visiting
buffer. This allows for returning from the phrases file to the
file one was just editing instead of the file where the last
phrases was added from.
(reftex-index-phrases-syntax-table): New variable. Give ?\"
punctuation syntax as it usually is not used as string quote in
TeX-related modes and may occur unmatched. The change also
prevents fontification of quoted content.
(reftex-index-phrases-mode): Use it.
* textmodes/reftex-parse.el (reftex-parse-from-file): Move
backward one char if a `\' was matched after a section macro.
(reftex-parse-from-file): Use beginning of match instead of end as
bound.
* textmodes/reftex-ref.el: Adapt creation of
`reftex-<package>-<macro>' functions to new structure of
`reftex-ref-style-alist'.
(reftex-reference): Use `reftex-ref-style-list' function. Adapt
to new structure of `reftex-ref-style-alist'. Prompt for a
reference macro if `reftex-ref-macro-prompt' is non-nil.
(reftex-reference): Pass refstyle to `reftex-format-special'.
Determine reference macro by looking at
`reftex-ref-style-default-list' and `reftex-ref-style-alist'. Use
only one special format function.
(reftex-varioref-vref, reftex-fancyref-fref)
(reftex-fancyref-Fref): Remove definitions. The functions are now
generated from `reftex-ref-style-alist'.
(reftex-format-vref, reftex-format-Fref, reftex-format-fref):
Remove.
(reftex-format-special): New function.
* textmodes/reftex-sel.el
(reftex-select-cycle-ref-style-internal): Adapt to new structure
of `reftex-ref-style-alist'. Remove code for testing macro type.
(reftex-select-toggle-varioref)
(reftex-select-toggle-fancyref): Remove.
(reftex-select-cycle-ref-style-internal)
(reftex-select-cycle-ref-style-forward)
(reftex-select-cycle-ref-style-backward): New functions.
(reftex-select-label-map): Use `v' and `V' for general cycling
through reference styles. Add `p' for switching between number
and page reference types.
* textmodes/reftex-toc.el (reftex-re-enlarge): Call
`enlarge-window' only if there is something to do because in Emacs
the horizontal version throws an error even if the parameter is 0.
* textmodes/reftex-vars.el (reftex-label-alist): Doc fix.
(reftex-plug-into-AUCTeX): Doc fix.
(reftex-vref-is-default, reftex-fref-is-default): Adapt doc
string. Adapt to new name.
(reftex-ref-style-alist): Change structure so that it is not
possible to use multiple different package names within a style.
Remove the symbols for symbols for macro type distinction. Add
characters for macro selection.
(reftex-ref-macro-prompt, reftex-create-bibtex-header)
(reftex-create-bibtex-footer): New variables.
(reftex-format-ref-function): Mention third argument of special
format function.
(reftex-ref-style-alist, reftex-ref-style-default-list): New
variables.
(reftex-vref-is-default, reftex-fref-is-default): Adapt doc string
to new implementation. Mark as obsolete. Add compatibility code
for honoring the variable values in case they are set.
(reftex-cite-format-builtin, reftex-bibliography-commands): Add
support for ConTeXt.
(reftex-format-ref-function, reftex-format-cite-function): Fix
custom type.
(reftex-cite-key-separator): New variable.
* textmodes/reftex.el (reftex-syntax-table-for-bib)
(reftex-mode): Do not derive `reftex-syntax-table-for-bib' from
`reftex-syntax-table' because parens have to retain their paren
syntax in order for parsing of BibTeX entries like @book(...) to
work.
(reftex-in-comment): Do not error out if `comment-start-skip' is
not set. Deal correctly with escaped comment characters.
(reftex-tie-multifile-symbols): Add doc string. Initialize
`reftex-ref-style-list'.
(reftex-untie-multifile-symbols): Add doc string.
(reftex-add-index-macros): Doc fix.
(reftex-ref-style-activate, reftex-ref-style-toggle)
(reftex-ref-style-list): New functions.
(reftex-mode-menu): Use them. Adapt to new structure of
`reftex-ref-style-alist'.
(reftex-select-with-char): Kill the RefTeX Select buffer when
done.
(reftex-remove-if): New function.
(reftex-erase-all-selection-and-index-buffers)
(reftex-mode-menu): Reference styles are now computed from
`reftex-ref-style-alist'. Fix typo.
(reftex-report-bug): New function.
(reftex-uniquify, reftex-uniquify-by-car): Replace O(n^2)
algorithms with O(n log n). Introduce optional argument SORT (not
yet used).
2012-09-30 Fabián Ezequiel Gallina <fgallina@cuca> 2012-09-30 Fabián Ezequiel Gallina <fgallina@cuca>
Enhancements for triple-quote string syntax. Enhancements for triple-quote string syntax.

View File

@ -4,8 +4,6 @@
;; Author: Carsten Dominik <dominik@science.uva.nl> ;; Author: Carsten Dominik <dominik@science.uva.nl>
;; Maintainer: auctex-devel@gnu.org ;; Maintainer: auctex-devel@gnu.org
;; Version: 4.31
;; Package: reftex
;; This file is part of GNU Emacs. ;; This file is part of GNU Emacs.
@ -27,21 +25,21 @@
;;; Code: ;;; Code:
(eval-when-compile (require 'cl)) (eval-when-compile (require 'cl))
(provide 'reftex-auc)
(require 'reftex)
;;;
(declare-function TeX-argument-insert "ext:tex" (name optional &optional prefix)) (require 'reftex)
(declare-function TeX-argument-prompt "ext:tex" (optional prompt default &optional complete))
(declare-function multi-prompt "ext:multi-prompt" (declare-function TeX-argument-prompt "ext:tex"
(separator (optional prompt default &optional complete))
unique prompt table (declare-function TeX-argument-insert "ext:tex"
&optional mp-predicate require-match initial history)) (name optional &optional prefix))
(declare-function LaTeX-add-index-entries "ext:tex" (&rest entries) t)
(declare-function LaTeX-add-labels "ext:tex" (&rest entries) t) (declare-function LaTeX-add-labels "ext:tex" (&rest entries) t)
(declare-function LaTeX-add-index-entries "ext:tex" (&rest entries) t)
(declare-function LaTeX-bibitem-list "ext:tex" () t) (declare-function LaTeX-bibitem-list "ext:tex" () t)
(declare-function LaTeX-index-entry-list "ext:tex" () t) (declare-function LaTeX-index-entry-list "ext:tex" () t)
(declare-function LaTeX-label-list "ext:tex" () t) (declare-function LaTeX-label-list "ext:tex" () t)
(declare-function multi-prompt "ext:multi-prompt"
(separator unique prompt table &optional
mp-predicate require-match initial history))
(defun reftex-plug-flag (which) (defun reftex-plug-flag (which)
;; Tell if a certain flag is set in reftex-plug-into-AUCTeX ;; Tell if a certain flag is set in reftex-plug-into-AUCTeX
@ -76,14 +74,15 @@ What is being used depends upon `reftex-plug-into-AUCTeX'."
(let (items) (let (items)
(cond (cond
((and (not definition) (reftex-plug-flag 3)) ((and (not definition) (reftex-plug-flag 3))
(setq items (list (or (reftex-citation t) "")))) (setq items (or (reftex-citation t) (list ""))))
(t (t
(setq prompt (concat (if optional "(Optional) " "") (setq prompt (concat (if optional "(Optional) " "")
(if prompt prompt "Add key") (if prompt prompt "Add key")
" (default none): ")) " (default none): "))
(setq items (multi-prompt "," t prompt (LaTeX-bibitem-list))))) (setq items (multi-prompt "," t prompt (LaTeX-bibitem-list)))))
(apply 'LaTeX-add-bibitems items) (apply 'LaTeX-add-bibitems items)
(TeX-argument-insert (mapconcat 'identity items ",") optional))) (TeX-argument-insert (mapconcat 'identity items reftex-cite-key-separator)
optional)))
(defun reftex-arg-index-tag (optional &optional prompt &rest args) (defun reftex-arg-index-tag (optional &optional prompt &rest args)
@ -223,4 +222,6 @@ of ENTRY-LIST is a list of cons cells (\"MACRONAME\" . LEVEL). See
(defun reftex-notice-new-section () (defun reftex-notice-new-section ()
(reftex-notice-new 1 'force)) (reftex-notice-new 1 'force))
(provide 'reftex-auc)
;;; reftex-auc.el ends here ;;; reftex-auc.el ends here

View File

@ -4,8 +4,6 @@
;; Author: Carsten Dominik <dominik@science.uva.nl> ;; Author: Carsten Dominik <dominik@science.uva.nl>
;; Maintainer: auctex-devel@gnu.org ;; Maintainer: auctex-devel@gnu.org
;; Version: 4.31
;; Package: reftex
;; This file is part of GNU Emacs. ;; This file is part of GNU Emacs.
@ -129,9 +127,10 @@
(let* ((re (let* ((re
(if item (if item
(concat "\\\\bibitem\\(\\[[^]]*\\]\\)?{" (regexp-quote key) "}") (concat "\\\\bibitem[ \t]*\\(\\[[^]]*\\]\\)?[ \t]*{"
(concat "@[a-zA-Z]+[ \t\n\r]*[{(][ \t\n\r]*" (regexp-quote key) (regexp-quote key) "}")
"[, \t\r\n}]"))) (concat "@\\(?:\\w\\|\\s_\\)+[ \t\n\r]*[{(][ \t\n\r]*"
(regexp-quote key) "[, \t\r\n}]")))
(buffer-conf (current-buffer)) (buffer-conf (current-buffer))
file buf pos oldpos) file buf pos oldpos)
@ -229,7 +228,13 @@
buffer (not reftex-keep-temporary-buffers)))) buffer (not reftex-keep-temporary-buffers))))
(if (not buffer1) (if (not buffer1)
(message "No such BibTeX file %s (ignored)" buffer) (message "No such BibTeX file %s (ignored)" buffer)
(message "Scanning bibliography database %s" buffer1)) (message "Scanning bibliography database %s" buffer1)
(unless (verify-visited-file-modtime buffer1)
(when (y-or-n-p
(format "File %s changed on disk. Reread from disk? "
(file-name-nondirectory
(buffer-file-name buffer1))))
(with-current-buffer buffer1 (revert-buffer t t)))))
(set-buffer buffer1) (set-buffer buffer1)
(reftex-with-special-syntax-for-bib (reftex-with-special-syntax-for-bib
@ -238,8 +243,8 @@
(while (re-search-forward first-re nil t) (while (re-search-forward first-re nil t)
(catch 'search-again (catch 'search-again
(setq key-point (point)) (setq key-point (point))
(unless (re-search-backward (unless (re-search-backward "\\(\\`\\|[\n\r]\\)[ \t]*\
"\\(\\`\\|[\n\r]\\)[ \t]*@\\([a-zA-Z]+\\)[ \t\n\r]*[{(]" nil t) @\\(\\(?:\\w\\|\\s_\\)+\\)[ \t\n\r]*[{(]" nil t)
(throw 'search-again nil)) (throw 'search-again nil))
(setq start-point (point)) (setq start-point (point))
(goto-char (match-end 0)) (goto-char (match-end 0))
@ -451,7 +456,8 @@
(setq names (replace-match " " nil t names))) (setq names (replace-match " " nil t names)))
(split-string names "\n"))) (split-string names "\n")))
(defun reftex-parse-bibtex-entry (entry &optional from to) (defun reftex-parse-bibtex-entry (entry &optional from to raw)
; if RAW is non-nil, keep double quotes/curly braces delimiting fields
(let (alist key start field) (let (alist key start field)
(save-excursion (save-excursion
(save-restriction (save-restriction
@ -463,41 +469,56 @@
(erase-buffer) (erase-buffer)
(insert entry)) (insert entry))
(widen) (widen)
(narrow-to-region from to)) (if (and from to) (narrow-to-region from to)))
(goto-char (point-min)) (goto-char (point-min))
(if (re-search-forward (if (re-search-forward "@\\(\\(?:\\w\\|\\s_\\)+\\)[ \t\n\r]*\
"@\\(\\w+\\)[ \t\n\r]*[{(][ \t\n\r]*\\([^ \t\n\r,]+\\)" nil t) \[{(][ \t\n\r]*\\([^ \t\n\r,]+\\)" nil t)
(setq alist (setq alist
(list (list
(cons "&type" (downcase (reftex-match-string 1))) (cons "&type" (downcase (reftex-match-string 1)))
(cons "&key" (reftex-match-string 2))))) (cons "&key" (reftex-match-string 2)))))
(while (re-search-forward "\\(\\w+\\)[ \t\n\r]*=[ \t\n\r]*" nil t) (while (re-search-forward "\\(\\(?:\\w\\|-\\)+\\)[ \t\n\r]*=[ \t\n\r]*"
nil t)
(setq key (downcase (reftex-match-string 1))) (setq key (downcase (reftex-match-string 1)))
(cond (cond
((= (following-char) ?{) ((= (following-char) ?{)
(forward-char 1) (cond
(setq start (point)) (raw
(condition-case nil (setq start (point))
(up-list 1) (forward-char 1))
(error nil))) (t
(forward-char 1)
(setq start (point))
(condition-case nil
(up-list 1)
(error nil)))))
((= (following-char) ?\") ((= (following-char) ?\")
(forward-char 1) (cond
(setq start (point)) (raw
(setq start (point))
(forward-char 1))
(t
(forward-char 1)
(setq start (point))))
(while (and (search-forward "\"" nil t) (while (and (search-forward "\"" nil t)
(= ?\\ (char-after (- (point) 2)))))) (= ?\\ (char-after (- (point) 2))))))
(t (t
(setq start (point)) (setq start (point))
(re-search-forward "[ \t]*[\n\r,}]" nil 1))) (re-search-forward "[ \t]*[\n\r,}]" nil 1)))
(setq field (buffer-substring-no-properties start (1- (point)))) ;; extract field value, ignore trailing comma if in RAW mode
(let ((stop (if (and raw (not (= (char-after (1- (point))) ?,)))
(point)
(1- (point))) ))
(setq field (buffer-substring-no-properties start stop)))
;; remove extra whitespace ;; remove extra whitespace
(while (string-match "[\n\t\r]\\|[ \t][ \t]+" field) (while (string-match "[\n\t\r]\\|[ \t][ \t]+" field)
(setq field (replace-match " " nil t field))) (setq field (replace-match " " nil t field)))
;; remove leading garbage ;; remove leading garbage
(if (string-match "^[ \t{]+" field) (if (string-match (if raw "^[ \t]+" "^[ \t{]+") field)
(setq field (replace-match "" nil t field))) (setq field (replace-match "" nil t field)))
;; remove trailing garbage ;; remove trailing garbage
(if (string-match "[ \t}]+$" field) (if (string-match (if raw "[ \t]+$" "[ \t}]+$") field)
(setq field (replace-match "" nil t field))) (setq field (replace-match "" nil t field)))
(push (cons key field) alist)))) (push (cons key field) alist))))
alist)) alist))
@ -638,15 +659,13 @@ While entering the regexp, completion on knows citation keys is possible.
(insert-entries selected-entries) (insert-entries selected-entries)
entry string cite-view) entry string cite-view)
(when (stringp selected-entries)
(error selected-entries))
(unless selected-entries (error "Quit")) (unless selected-entries (error "Quit"))
(if (stringp selected-entries) (if (stringp selected-entries)
;; Nonexistent entry ;; Nonexistent entry
(setq selected-entries nil (setq insert-entries (list (list selected-entries
insert-entries (list (list selected-entries (cons "&key" selected-entries)))
(cons "&key" selected-entries)))) selected-entries nil)
;; It makes sense to compute the cite-view strings. ;; It makes sense to compute the cite-view strings.
(setq cite-view t)) (setq cite-view t))
@ -654,7 +673,8 @@ While entering the regexp, completion on knows citation keys is possible.
;; All keys go into a single command - we need to trick a little ;; All keys go into a single command - we need to trick a little
;; FIXME: Unfortunately, this means that commenting does not work right. ;; FIXME: Unfortunately, this means that commenting does not work right.
(pop selected-entries) (pop selected-entries)
(let ((concat-keys (mapconcat 'car selected-entries ","))) (let ((concat-keys (mapconcat 'car selected-entries
reftex-cite-key-separator)))
(setq insert-entries (setq insert-entries
(list (list concat-keys (cons "&key" concat-keys)))))) (list (list concat-keys (cons "&key" concat-keys))))))
@ -675,8 +695,9 @@ While entering the regexp, completion on knows citation keys is possible.
(equal arg '(4)))) (equal arg '(4))))
(let ((start 0) (nth 0) value) (let ((start 0) (nth 0) value)
(while (setq start (string-match "\\[\\]" string start)) (while (setq start (string-match "\\[\\]" string start))
(setq value (read-string (format "Optional argument %d: " (setq value (save-match-data
(setq nth (1+ nth))))) (read-string (format "Optional argument %d: "
(setq nth (1+ nth))))))
(setq string (replace-match (concat "[" value "]") t t string)) (setq string (replace-match (concat "[" value "]") t t string))
(setq start (1+ start))))) (setq start (1+ start)))))
;; Should we cleanup empty optional arguments? ;; Should we cleanup empty optional arguments?
@ -725,7 +746,7 @@ While entering the regexp, completion on knows citation keys is possible.
(forward-char 1))) (forward-char 1)))
;; Return the citation key ;; Return the citation key
(car (car selected-entries)))) (mapcar 'car selected-entries)))
(defun reftex-figure-out-cite-format (arg &optional no-insert format-key) (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 ;; Check if there is already a cite command at point and change cite format
@ -744,9 +765,13 @@ While entering the regexp, completion on knows citation keys is possible.
(if (or (not arg) (not (listp arg))) (if (or (not arg) (not (listp arg)))
(setq format (setq format
(concat (concat
(if (member (preceding-char) '(?\{ ?,)) "" ",") (if (member (preceding-char) '(?\{ ?,))
""
reftex-cite-key-separator)
"%l" "%l"
(if (member (following-char) '(?\} ?,)) "" ","))) (if (member (following-char) '(?\} ?,))
""
reftex-cite-key-separator)))
(setq format "%l"))) (setq format "%l")))
(t (t
;; Figure out the correct format ;; Figure out the correct format
@ -1114,7 +1139,7 @@ While entering the regexp, completion on knows citation keys is possible.
(save-restriction (save-restriction
(widen) (widen)
(goto-char (point-min)) (goto-char (point-min))
(while (re-search-forward "^[^%\n\r]*\\\\\\(bibentry\\|[a-zA-Z]*cite[a-zA-Z]*\\)\\(\\[[^\\]]*\\]\\)?{\\([^}]+\\)}" nil t) (while (re-search-forward "\\(?:^\\|\\=\\)[^%\n\r]*?\\\\\\(bibentry\\|[a-zA-Z]*cite[a-zA-Z]*\\)\\(\\[[^\\]]*\\]\\)?{\\([^}]+\\)}" nil t)
(setq kk (match-string-no-properties 3)) (setq kk (match-string-no-properties 3))
(while (string-match "%.*\n?" kk) (while (string-match "%.*\n?" kk)
(setq kk (replace-match "" t t kk))) (setq kk (replace-match "" t t kk)))
@ -1125,18 +1150,35 @@ While entering the regexp, completion on knows citation keys is possible.
(reftex-kill-temporary-buffers) (reftex-kill-temporary-buffers)
keys)) keys))
(defun reftex-get-string-refs (alist)
"Return a list of BibTeX @string references that appear as values in ALIST."
(reftex-remove-if (lambda (x) (string-match "^\\([\"{]\\|[0-9]+$\\)" x))
;; get list of values, discard keys
(mapcar 'cdr
;; remove &key and &type entries
(reftex-remove-if (lambda (pair)
(string-match "^&" (car pair)))
alist))))
(defun reftex-create-bibtex-file (bibfile) (defun reftex-create-bibtex-file (bibfile)
"Create a new BibTeX database file with all entries referenced in document. "Create a new BibTeX database file with all entries referenced in document.
The command prompts for a filename and writes the collected entries to The command prompts for a filename and writes the collected
that file. Only entries referenced in the current document with entries to that file. Only entries referenced in the current
any \\cite-like macros are used. document with any \\cite-like macros are used. The sequence in
The sequence in the new file is the same as it was in the old database." the new file is the same as it was in the old database.
Entries referenced from other entries must appear after all
referencing entries.
You can define strings to be used as header or footer for the
created files in the variables `reftex-create-bibtex-header' or
`reftex-create-bibtex-footer' respectively."
(interactive "FNew BibTeX file: ") (interactive "FNew BibTeX file: ")
(let ((keys (reftex-all-used-citation-keys)) (let ((keys (reftex-all-used-citation-keys))
(files (reftex-get-bibfile-list)) (files (reftex-get-bibfile-list))
file key entries beg end entry) file key entries beg end entry string-keys string-entries)
(save-current-buffer (save-current-buffer
(while (setq file (pop files)) (dolist (file files)
(set-buffer (reftex-get-file-buffer-force file 'mark)) (set-buffer (reftex-get-file-buffer-force file 'mark))
(reftex-with-special-syntax-for-bib (reftex-with-special-syntax-for-bib
(save-excursion (save-excursion
@ -1156,14 +1198,54 @@ The sequence in the new file is the same as it was in the old database."
(when (member key keys) (when (member key keys)
(setq entry (buffer-substring beg end) (setq entry (buffer-substring beg end)
entries (cons entry entries) entries (cons entry entries)
keys (delete key keys))))))))) keys (delete key keys))
;; check for crossref entries
(let* ((attr-list (reftex-parse-bibtex-entry nil beg end))
(xref-key (cdr (assoc "crossref" attr-list))))
(if xref-key (pushnew xref-key keys)))
;; check for string references
(let* ((raw-fields (reftex-parse-bibtex-entry nil beg end t))
(string-fields (reftex-get-string-refs raw-fields)))
(dolist (skey string-fields)
(unless (member skey string-keys)
(push skey string-keys)))))))))))
;; second pass: grab @string references
(if string-keys
(save-current-buffer
(dolist (file files)
(set-buffer (reftex-get-file-buffer-force file 'mark))
(reftex-with-special-syntax-for-bib
(save-excursion
(save-restriction
(widen)
(goto-char (point-min))
(while (re-search-forward
"^[ \t]*@[Ss][Tt][Rr][Ii][Nn][Gg][ \t]*{[ \t]*\\([^ \t\r\n]+\\)"
nil t)
(setq key (match-string 1)
beg (match-beginning 0)
end (progn
(goto-char (match-beginning 1))
(condition-case nil
(up-list 1)
(error (goto-char (match-end 0))))
(point)))
(when (member key string-keys)
(setq entry (buffer-substring beg end)
string-entries (cons entry string-entries)
string-keys (delete key string-keys))))))))))
(find-file-other-window bibfile) (find-file-other-window bibfile)
(if (> (buffer-size) 0) (if (> (buffer-size) 0)
(unless (yes-or-no-p (unless (yes-or-no-p
(format "Overwrite non-empty file %s? " bibfile)) (format "Overwrite non-empty file %s? " bibfile))
(error "Abort"))) (error "Abort")))
(erase-buffer) (erase-buffer)
(if reftex-create-bibtex-header (insert reftex-create-bibtex-header "\n\n"))
(insert (mapconcat 'identity (reverse string-entries) "\n\n"))
(if string-entries (insert "\n\n\n"))
(insert (mapconcat 'identity (reverse entries) "\n\n")) (insert (mapconcat 'identity (reverse entries) "\n\n"))
(if reftex-create-bibtex-footer (insert "\n\n" reftex-create-bibtex-footer))
(goto-char (point-min)) (goto-char (point-min))
(save-buffer) (save-buffer)
(message "%d entries extracted and copied to new database" (message "%d entries extracted and copied to new database"

View File

@ -4,8 +4,6 @@
;; Author: Carsten Dominik <dominik@science.uva.nl> ;; Author: Carsten Dominik <dominik@science.uva.nl>
;; Maintainer: auctex-devel@gnu.org ;; Maintainer: auctex-devel@gnu.org
;; Version: 4.31
;; Package: reftex
;; This file is part of GNU Emacs. ;; This file is part of GNU Emacs.
@ -27,10 +25,10 @@
;;; Code: ;;; Code:
(eval-when-compile (require 'cl)) (eval-when-compile (require 'cl))
(provide 'reftex-dcr)
(provide 'reftex-vcr) (declare-function bibtex-beginning-of-entry "bibtex" ())
(require 'reftex) (require 'reftex)
;;;
(defun reftex-view-crossref (&optional arg auto-how fail-quietly) (defun reftex-view-crossref (&optional arg auto-how fail-quietly)
"View cross reference of macro at point. Point must be on the KEY "View cross reference of macro at point. Point must be on the KEY
@ -229,6 +227,7 @@ If it is a \\cite, show the BibTeX database entry.
If there is no such macro at point, search forward to find one. If there is no such macro at point, search forward to find one.
With argument, actually select the window showing the cross reference." With argument, actually select the window showing the cross reference."
(interactive "e") (interactive "e")
;; Make sure the referencing macro stays visible in the original window.
(mouse-set-point ev) (mouse-set-point ev)
(reftex-view-crossref current-prefix-arg)) (reftex-view-crossref current-prefix-arg))
@ -348,15 +347,14 @@ will display info in the echo area."
(message "Automatic display of crossref information was turned on"))) (message "Automatic display of crossref information was turned on")))
(defun reftex-start-itimer-once () (defun reftex-start-itimer-once ()
(and (featurep 'xemacs) reftex-mode (and (featurep 'xemacs)
reftex-mode
(not (itimer-live-p reftex-auto-view-crossref-timer)) (not (itimer-live-p reftex-auto-view-crossref-timer))
(setq reftex-auto-view-crossref-timer (setq reftex-auto-view-crossref-timer
(start-itimer "RefTeX Idle Timer" (start-itimer "RefTeX Idle Timer"
'reftex-view-crossref-when-idle 'reftex-view-crossref-when-idle
reftex-idle-time nil t)))) reftex-idle-time nil t))))
(declare-function bibtex-beginning-of-entry "bibtex" ())
(defun reftex-view-crossref-from-bibtex (&optional arg) (defun reftex-view-crossref-from-bibtex (&optional arg)
"View location in a LaTeX document which cites the BibTeX entry at point. "View location in a LaTeX document which cites the BibTeX entry at point.
Since BibTeX files can be used by many LaTeX documents, this function Since BibTeX files can be used by many LaTeX documents, this function
@ -481,4 +479,6 @@ Calling this function several times find successive citation locations."
(move-marker reftex-global-search-marker nil) (move-marker reftex-global-search-marker nil)
(error "All files processed")))) (error "All files processed"))))
(provide 'reftex-dcr)
;;; reftex-dcr.el ends here ;;; reftex-dcr.el ends here

View File

@ -4,8 +4,6 @@
;; Author: Carsten Dominik <dominik@science.uva.nl> ;; Author: Carsten Dominik <dominik@science.uva.nl>
;; Maintainer: auctex-devel@gnu.org ;; Maintainer: auctex-devel@gnu.org
;; Version: 4.31
;; Package: reftex
;; This file is part of GNU Emacs. ;; This file is part of GNU Emacs.
@ -407,7 +405,7 @@ Also checks if buffers visiting the files are in read-only mode."
(when flist (when flist
(if wrapp (if wrapp
(unless isearch-forward (unless isearch-forward
(setq flist (last flist))) (setq flist (last flist)))
(unless isearch-forward (unless isearch-forward
(setq flist (reverse flist))) (setq flist (reverse flist)))
(while (not (string= (car flist) cb)) (while (not (string= (car flist) cb))
@ -437,7 +435,8 @@ With no argument, this command toggles
(with-current-buffer crt-buf (with-current-buffer crt-buf
(when reftex-mode (when reftex-mode
(if (boundp 'multi-isearch-next-buffer-function) (if (boundp 'multi-isearch-next-buffer-function)
(set (make-local-variable 'multi-isearch-next-buffer-function) (set (make-local-variable
'multi-isearch-next-buffer-function)
'reftex-isearch-switch-to-next-file) 'reftex-isearch-switch-to-next-file)
(set (make-local-variable 'isearch-wrap-function) (set (make-local-variable 'isearch-wrap-function)
'reftex-isearch-wrap-function) 'reftex-isearch-wrap-function)

View File

@ -4,8 +4,6 @@
;; Author: Carsten Dominik <dominik@science.uva.nl> ;; Author: Carsten Dominik <dominik@science.uva.nl>
;; Maintainer: auctex-devel@gnu.org ;; Maintainer: auctex-devel@gnu.org
;; Version: 4.31
;; Package: reftex
;; This file is part of GNU Emacs. ;; This file is part of GNU Emacs.
@ -27,9 +25,9 @@
;;; Code: ;;; Code:
(eval-when-compile (require 'cl)) (eval-when-compile (require 'cl))
(provide 'reftex-index) (declare-function texmathp "ext:texmathp" ())
(require 'reftex) (require 'reftex)
;;;
;; START remove for XEmacs release ;; START remove for XEmacs release
(defvar mark-active) (defvar mark-active)
@ -37,8 +35,6 @@
(defvar TeX-master) (defvar TeX-master)
;; END remove for XEmacs release ;; END remove for XEmacs release
(declare-function texmathp "ext:texmathp" ())
(defun reftex-index-selection-or-word (&optional arg phrase) (defun reftex-index-selection-or-word (&optional arg phrase)
"Put selection or the word near point into the default index macro. "Put selection or the word near point into the default index macro.
This uses the information in `reftex-index-default-macro' to make an index This uses the information in `reftex-index-default-macro' to make an index
@ -52,9 +48,7 @@ which is part of AUCTeX, the string is first processed with the
(interactive "P") (interactive "P")
(let* ((use-default (not (equal arg '(16)))) ; check for double prefix (let* ((use-default (not (equal arg '(16)))) ; check for double prefix
;; check if we have an active selection ;; check if we have an active selection
(active (if (featurep 'xemacs) (active (reftex-region-active-p))
(and zmacs-regions (region-exists-p)) ; XEmacs
(and transient-mark-mode mark-active))) ; Emacs
(beg (if active (beg (if active
(region-beginning) (region-beginning)
(save-excursion (save-excursion
@ -1244,7 +1238,11 @@ This gets refreshed in every phrases command.")
map) map)
"Keymap used for *toc* buffer.") "Keymap used for *toc* buffer.")
(defvar reftex-index-phrases-syntax-table
(let ((table (make-syntax-table)))
(modify-syntax-entry ?\" "." table)
table)
"Syntax table for RefTeX Index Phrases mode.")
(defun reftex-index-phrase-selection-or-word (arg) (defun reftex-index-phrase-selection-or-word (arg)
"Add current selection or word at point to the phrases buffer. "Add current selection or word at point to the phrases buffer.
@ -1264,6 +1262,7 @@ You get a chance to edit the entry in the phrases buffer - finish with
"Switch to the phrases buffer, initialize if empty." "Switch to the phrases buffer, initialize if empty."
(interactive) (interactive)
(reftex-access-scan-info) (reftex-access-scan-info)
(set-marker reftex-index-return-marker (point))
(let* ((master (reftex-TeX-master-file)) (let* ((master (reftex-TeX-master-file))
(name (concat (file-name-sans-extension master) (name (concat (file-name-sans-extension master)
reftex-index-phrase-file-extension))) reftex-index-phrase-file-extension)))
@ -1371,6 +1370,7 @@ For more information see the RefTeX User Manual.
Here are all local bindings. Here are all local bindings.
\\{reftex-index-phrases-mode-map}" \\{reftex-index-phrases-mode-map}"
:syntax-table reftex-index-phrases-syntax-table
(set (make-local-variable 'font-lock-defaults) (set (make-local-variable 'font-lock-defaults)
reftex-index-phrases-font-lock-defaults) reftex-index-phrases-font-lock-defaults)
(easy-menu-add reftex-index-phrases-menu reftex-index-phrases-mode-map) (easy-menu-add reftex-index-phrases-menu reftex-index-phrases-mode-map)
@ -2093,5 +2093,6 @@ Does not do a save-excursion."
reftex-index-phrases-macro-data "\n")))) reftex-index-phrases-macro-data "\n"))))
(reftex-select-with-char prompt help delay))) (reftex-select-with-char prompt help delay)))
(provide 'reftex-index)
;;; reftex-index.el ends here ;;; reftex-index.el ends here

View File

@ -4,8 +4,6 @@
;; Author: Carsten Dominik <dominik@science.uva.nl> ;; Author: Carsten Dominik <dominik@science.uva.nl>
;; Maintainer: auctex-devel@gnu.org ;; Maintainer: auctex-devel@gnu.org
;; Version: 4.31
;; Package: reftex
;; This file is part of GNU Emacs. ;; This file is part of GNU Emacs.
@ -27,7 +25,7 @@
;;; Code: ;;; Code:
(eval-when-compile (require 'cl)) (eval-when-compile (require 'cl))
(provide 'reftex-parse)
(require 'reftex) (require 'reftex)
(defmacro reftex-with-special-syntax (&rest body) (defmacro reftex-with-special-syntax (&rest body)
@ -241,8 +239,17 @@ of master file."
((match-end 3) ((match-end 3)
;; It is a section ;; It is a section
(setq bound (point))
;; Use the beginning as bound and not the end
;; (i.e. (point)) because the section command might
;; be the start of the current environment to be
;; found by `reftex-label-info'.
(setq bound (match-beginning 0))
;; The section regexp matches a character at the end
;; we are not interested in. Especially if it is the
;; backslash of a following macro we want to find in
;; the next parsing iteration.
(when (eq (char-before) ?\\) (backward-char))
;; Insert in List ;; Insert in List
(setq toc-entry (reftex-section-info file)) (setq toc-entry (reftex-section-info file))
(when toc-entry (when toc-entry
@ -1072,4 +1079,6 @@ of master file."
nrest (- nrest i)))) nrest (- nrest i))))
string)) string))
(provide 'reftex-parse)
;;; reftex-parse.el ends here ;;; reftex-parse.el ends here

View File

@ -4,8 +4,6 @@
;; Author: Carsten Dominik <dominik@science.uva.nl> ;; Author: Carsten Dominik <dominik@science.uva.nl>
;; Maintainer: auctex-devel@gnu.org ;; Maintainer: auctex-devel@gnu.org
;; Version: 4.31
;; Package: reftex
;; This file is part of GNU Emacs. ;; This file is part of GNU Emacs.
@ -27,10 +25,9 @@
;;; Code: ;;; Code:
(eval-when-compile (require 'cl)) (eval-when-compile (require 'cl))
(provide 'reftex-ref)
(require 'reftex) (require 'reftex)
(require 'reftex-parse) (require 'reftex-parse)
;;;
(defun reftex-label-location (&optional bound) (defun reftex-label-location (&optional bound)
"Return the environment or macro which determines the label type at point. "Return the environment or macro which determines the label type at point.
@ -413,27 +410,54 @@ When called with 2 C-u prefix args, disable magic word recognition."
(interactive) (interactive)
;; check for active recursive edits ;; Check for active recursive edits
(reftex-check-recursive-edit) (reftex-check-recursive-edit)
;; Ensure access to scanning info and rescan buffer if prefix are is '(4) ;; Ensure access to scanning info and rescan buffer if prefix is '(4)
(reftex-access-scan-info current-prefix-arg) (reftex-access-scan-info current-prefix-arg)
(unless type (let ((reftex-refstyle (when (and (boundp 'reftex-refstyle) reftex-refstyle)
;; guess type from context reftex-refstyle))
(if (and reftex-guess-label-type (reftex-format-ref-function reftex-format-ref-function)
(setq type (reftex-guess-label-type))) (form "\\ref{%s}")
(setq cut (cdr type) label labels sep sep1 style-alist)
type (car type))
(setq type (reftex-query-label-type))))
(let* ((reftex-refstyle (unless reftex-refstyle
(cond ((reftex-typekey-check type reftex-vref-is-default) "\\vref") (if reftex-ref-macro-prompt
((reftex-typekey-check type reftex-fref-is-default) "\\fref") (progn
(t "\\ref"))) ;; Build a temporary list which handles more easily.
(reftex-format-ref-function reftex-format-ref-function) (dolist (elt reftex-ref-style-alist)
(form "\\ref{%s}") (when (member (car elt) (reftex-ref-style-list))
label labels sep sep1) (mapc (lambda (x)
(add-to-list 'style-alist (cons (cadr x) (car x)) t))
(nth 2 elt))))
;; Prompt the user for the macro.
(let ((key (reftex-select-with-char
"" (concat "SELECT A REFERENCE FORMAT\n\n"
(mapconcat
(lambda (x)
(format "[%c] %s %s" (car x)
(if (> (car x) 31) " " "")
(cdr x)))
style-alist "\n")))))
(setq reftex-refstyle (cdr (assoc key style-alist)))
(unless reftex-refstyle
(error "No reference macro associated with key `%c'" key))))
;; Get the first macro from `reftex-ref-style-alist' which
;; matches the first entry in the list of active styles.
(setq reftex-refstyle
(or (caar (nth 2 (assoc (car (reftex-ref-style-list))
reftex-ref-style-alist)))
;; Use the first entry in r-r-s-a as a last resort.
(caar (nth 2 (car reftex-ref-style-alist)))))))
(unless type
;; Guess type from context
(if (and reftex-guess-label-type
(setq type (reftex-guess-label-type)))
(setq cut (cdr type)
type (car type))
(setq type (reftex-query-label-type))))
;; Have the user select a label ;; Have the user select a label
(set-marker reftex-select-return-marker (point)) (set-marker reftex-select-return-marker (point))
@ -472,17 +496,13 @@ When called with 2 C-u prefix args, disable magic word recognition."
(member (preceding-char) '(?\ ?\t ?\n ?~))) (member (preceding-char) '(?\ ?\t ?\n ?~)))
(setq form (substring form 1))) (setq form (substring form 1)))
;; do we have a special format? ;; do we have a special format?
(setq reftex-format-ref-function (unless (string= reftex-refstyle "\\ref")
(cond (setq reftex-format-ref-function 'reftex-format-special))
((string= reftex-refstyle "\\vref") 'reftex-format-vref)
((string= reftex-refstyle "\\fref") 'reftex-format-fref)
((string= reftex-refstyle "\\Fref") 'reftex-format-Fref)
(t reftex-format-ref-function)))
;; ok, insert the reference ;; ok, insert the reference
(if sep1 (insert sep1)) (if sep1 (insert sep1))
(insert (insert
(if reftex-format-ref-function (if reftex-format-ref-function
(funcall reftex-format-ref-function label form) (funcall reftex-format-ref-function label form reftex-refstyle)
(format form label label))) (format form label label)))
;; take out the initial ~ for good ;; take out the initial ~ for good
(and (= ?~ (string-to-char form)) (and (= ?~ (string-to-char form))
@ -791,34 +811,31 @@ When called with 2 C-u prefix args, disable magic word recognition."
(run-hooks 'reftex-display-copied-context-hook) (run-hooks 'reftex-display-copied-context-hook)
(setq buffer-read-only t)))))) (setq buffer-read-only t))))))
(defun reftex-varioref-vref () ;; Generate functions for direct insertion of specific referencing
"Insert a reference using the `\\vref' macro from the varioref package." ;; macros. The functions are named `reftex-<package>-<macro>',
(interactive) ;; e.g. `reftex-varioref-vref'.
(let ((reftex-format-ref-function 'reftex-format-vref)) (dolist (elt reftex-ref-style-alist)
(reftex-reference))) (when (stringp (nth 1 elt))
(defun reftex-fancyref-fref () (dolist (item (nth 2 elt))
"Insert a reference using the `\\fref' macro from the fancyref package." (let ((macro (car item))
(interactive) (package (nth 1 elt)))
(let ((reftex-format-ref-function 'reftex-format-fref) (eval `(defun ,(intern (format "reftex-%s-%s" package
;;(reftex-guess-label-type nil) ;FIXME do we want this???? (substring macro 1 (length macro)))) ()
) ,(format "Insert a reference using the `%s' macro from the %s \
(reftex-reference))) package.\n\nThis is a generated function."
(defun reftex-fancyref-Fref () macro package)
"Insert a reference using the `\\Fref' macro from the fancyref package." (interactive)
(interactive) (let ((reftex-refstyle ,macro))
(let ((reftex-format-ref-function 'reftex-format-Fref) (reftex-reference))))))))
;;(reftex-guess-label-type nil) ;FIXME do we want this????
)
(reftex-reference)))
(defun reftex-format-vref (label fmt) (defun reftex-format-special (label fmt refstyle)
(while (string-match "\\\\ref{" fmt) "Apply selected reference style to format FMT and add LABEL.
(setq fmt (replace-match "\\vref{" t t fmt))) Replace any occurrences of \"\\ref\" with REFSTYLE."
(format fmt label label)) ;; Replace instances of \ref in `fmt' with the special reference
(defun reftex-format-Fref (label def-fmt) ;; style selected by the user.
(format "\\Fref{%s}" label)) (while (string-match "\\(\\\\ref\\)[ \t]*{" fmt)
(defun reftex-format-fref (label def-fmt) (setq fmt (replace-match refstyle t t fmt 1)))
(format "\\fref{%s}" label)) (format fmt label))
(defun reftex-goto-label (&optional other-window) (defun reftex-goto-label (&optional other-window)
"Prompt for a label (with completion) and jump to the location of this label. "Prompt for a label (with completion) and jump to the location of this label.
@ -847,5 +864,6 @@ Optional prefix argument OTHER-WINDOW goes to the label in another window."
(goto-char where)) (goto-char where))
(reftex-unhighlight 0))) (reftex-unhighlight 0)))
(provide 'reftex-ref)
;;; reftex-ref.el ends here ;;; reftex-ref.el ends here

View File

@ -4,8 +4,6 @@
;; Author: Carsten Dominik <dominik@science.uva.nl> ;; Author: Carsten Dominik <dominik@science.uva.nl>
;; Maintainer: auctex-devel@gnu.org ;; Maintainer: auctex-devel@gnu.org
;; Version: 4.31
;; Package: reftex
;; This file is part of GNU Emacs. ;; This file is part of GNU Emacs.
@ -27,9 +25,8 @@
;;; Code: ;;; Code:
(eval-when-compile (require 'cl)) (eval-when-compile (require 'cl))
(provide 'reftex-sel)
(require 'reftex) (require 'reftex)
;;;
;; Common bindings in reftex-select-label-mode-map ;; Common bindings in reftex-select-label-mode-map
;; and reftex-select-bib-mode-map. ;; and reftex-select-bib-mode-map.
@ -86,8 +83,8 @@
(loop for x in (loop for x in
'(("b" . reftex-select-jump-to-previous) '(("b" . reftex-select-jump-to-previous)
("z" . reftex-select-jump) ("z" . reftex-select-jump)
("v" . reftex-select-toggle-varioref) ("v" . reftex-select-cycle-ref-style-forward)
("V" . reftex-select-toggle-fancyref) ("V" . reftex-select-cycle-ref-style-backward)
("m" . reftex-select-mark) ("m" . reftex-select-mark)
("u" . reftex-select-unmark) ("u" . reftex-select-unmark)
("," . reftex-select-mark-comma) ("," . reftex-select-mark-comma)
@ -511,6 +508,7 @@ During a selection process, these are the local bindings.
(defvar last-data) (defvar last-data)
(defvar call-back) (defvar call-back)
(defvar help-string) (defvar help-string)
(defvar reftex-refstyle)
;; The selection commands ;; The selection commands
@ -604,23 +602,28 @@ Useful for large TOC's."
(setq reftex-last-follow-point -1) (setq reftex-last-follow-point -1)
(setq cb-flag (not cb-flag))) (setq cb-flag (not cb-flag)))
(defvar reftex-refstyle) ; from reftex-reference (defun reftex-select-cycle-ref-style-internal (&optional reverse)
"Cycle through macros used for referencing.
Cycle in reverse order if optional argument REVERSE is non-nil."
(let (list)
(dolist (style (reftex-ref-style-list))
(mapc (lambda (x) (add-to-list 'list (car x) t))
(nth 2 (assoc style reftex-ref-style-alist))))
(when reverse
(setq list (reverse list)))
(setq reftex-refstyle (or (cadr (member reftex-refstyle list)) (car list))))
(force-mode-line-update))
(defun reftex-select-toggle-varioref () (defun reftex-select-cycle-ref-style-forward ()
"Toggle the macro used for referencing the label between \\ref and \\vref." "Cycle forward through macros used for referencing."
(interactive) (interactive)
(if (string= reftex-refstyle "\\ref") (reftex-select-cycle-ref-style-internal))
(setq reftex-refstyle "\\vref")
(setq reftex-refstyle "\\ref")) (defun reftex-select-cycle-ref-style-backward ()
(force-mode-line-update)) "Cycle backward through macros used for referencing."
(defun reftex-select-toggle-fancyref ()
"Toggle the macro used for referencing the label between \\ref and \\vref."
(interactive) (interactive)
(setq reftex-refstyle (reftex-select-cycle-ref-style-internal t))
(cond ((string= reftex-refstyle "\\ref") "\\fref")
((string= reftex-refstyle "\\fref") "\\Fref")
(t "\\ref")))
(force-mode-line-update))
(defun reftex-select-show-insertion-point () (defun reftex-select-show-insertion-point ()
"Show the point from where selection was started in another window." "Show the point from where selection was started in another window."
(interactive) (interactive)
@ -721,7 +724,7 @@ Useful for large TOC's."
(if sep (if sep
(format "*%c%d* " sep (decf cnt)) (format "*%c%d* " sep (decf cnt))
(format "*%d* " (decf cnt))))) (format "*%d* " (decf cnt)))))
reftex-select-marked) reftex-select-marked)
(message "Entry no longer marked"))) (message "Entry no longer marked")))
(defun reftex-select-help () (defun reftex-select-help ()
@ -731,4 +734,6 @@ Useful for large TOC's."
(princ help-string)) (princ help-string))
(reftex-enlarge-to-fit "*RefTeX Help*" t)) (reftex-enlarge-to-fit "*RefTeX Help*" t))
(provide 'reftex-sel)
;;; reftex-sel.el ends here ;;; reftex-sel.el ends here

View File

@ -4,8 +4,6 @@
;; Author: Carsten Dominik <dominik@science.uva.nl> ;; Author: Carsten Dominik <dominik@science.uva.nl>
;; Maintainer: auctex-devel@gnu.org ;; Maintainer: auctex-devel@gnu.org
;; Version: 4.31
;; Package: reftex
;; This file is part of GNU Emacs. ;; This file is part of GNU Emacs.
@ -372,14 +370,14 @@ SPC=view TAB=goto RET=goto+hide [q]uit [r]escan [l]abels [f]ollow [x]r [?]Help
(error t))))) (error t)))))
(defun reftex-re-enlarge () (defun reftex-re-enlarge ()
;; Enlarge window to a remembered size. "Enlarge window to a remembered size."
(if reftex-toc-split-windows-horizontally (let ((count (if reftex-toc-split-windows-horizontally
(enlarge-window-horizontally (- (or reftex-last-window-width (window-width))
(max 0 (- (or reftex-last-window-width (window-width)) (window-width))
(window-width)))) (- (or reftex-last-window-height (window-height))
(enlarge-window (window-height)))))
(max 0 (- (or reftex-last-window-height (window-height)) (when (> count 0)
(window-height)))))) (enlarge-window count reftex-toc-split-windows-horizontally))))
(defun reftex-toc-dframe-p (&optional frame error) (defun reftex-toc-dframe-p (&optional frame error)
;; Check if FRAME is the dedicated TOC frame. ;; Check if FRAME is the dedicated TOC frame.

View File

@ -4,8 +4,6 @@
;; Author: Carsten Dominik <dominik@science.uva.nl> ;; Author: Carsten Dominik <dominik@science.uva.nl>
;; Maintainer: auctex-devel@gnu.org ;; Maintainer: auctex-devel@gnu.org
;; Version: 4.31
;; Package: reftex
;; This file is part of GNU Emacs. ;; This file is part of GNU Emacs.
@ -207,6 +205,11 @@ distribution. Mixed-case symbols are convenience aliases.")
(?p . "(%2a %y\\nocite{%l})"))) (?p . "(%2a %y\\nocite{%l})")))
(locally "Full info in parenthesis" (locally "Full info in parenthesis"
"(%2a %y, %j %v, %P, %e: %b, %u, %s %<)") "(%2a %y, %j %v, %P, %e: %b, %u, %s %<)")
(context
"ConTeXt bib module"
((?\C-m . "\\cite[%l]")
(?s . "\\cite[][%l]")
(?n . "\\nocite[%l]")))
) )
"Builtin versions of the citation format. "Builtin versions of the citation format.
The following conventions are valid for all alist entries: The following conventions are valid for all alist entries:
@ -239,7 +242,7 @@ distribution. Mixed-case symbols are convenience aliases.")
"LaTeX label and citation support." "LaTeX label and citation support."
:tag "RefTeX" :tag "RefTeX"
:link '(url-link :tag "Home Page" :link '(url-link :tag "Home Page"
"http://staff.science.uva.nl/~dominik/Tools/reftex/") "http://www.gnu.org/software/auctex/reftex.html")
:link '(emacs-commentary-link :tag "Commentary in reftex.el" "reftex.el") :link '(emacs-commentary-link :tag "Commentary in reftex.el" "reftex.el")
:link '(custom-manual "(reftex)Top") :link '(custom-manual "(reftex)Top")
:prefix "reftex-" :prefix "reftex-"
@ -261,8 +264,8 @@ by whitespace."
(defcustom reftex-max-section-depth 12 (defcustom reftex-max-section-depth 12
"Maximum depth of section levels in document structure. "Maximum depth of section levels in document structure.
Standard LaTeX needs default is 7, but there are packages for which this The default in standard LaTeX is 7, but there are packages for
needs to be larger." which this needs to be larger."
:group 'reftex-table-of-contents-browser :group 'reftex-table-of-contents-browser
:type 'integer) :type 'integer)
@ -329,7 +332,7 @@ recentering will work for any TOC window created during the session.
Value 'frame (the default) means, turn automatic recentering on only while the Value 'frame (the default) means, turn automatic recentering on only while the
dedicated TOC frame does exist, and do the recentering only in that frame. So dedicated TOC frame does exist, and do the recentering only in that frame. So
when creating that frame (with \"d\" key in an ordinary TOC window), the when creating that frame (with `d' key in an ordinary TOC window), the
automatic recentering is turned on. When the frame gets destroyed, automatic automatic recentering is turned on. When the frame gets destroyed, automatic
recentering is turned off again. recentering is turned off again.
@ -383,8 +386,8 @@ This flag can be toggled from within the *toc* buffer with the `i' key."
(defcustom reftex-toc-confirm-promotion 2 (defcustom reftex-toc-confirm-promotion 2
"Non-nil means, promotion/demotion commands first prompt for confirmation. "Non-nil means, promotion/demotion commands first prompt for confirmation.
When nil, the command is executed immediately. When this is an integer If nil, the command is executed immediately. If this is an integer N,
N, ask for confirmation only if N or more section commands are going to be ask for confirmation only if N or more section commands are going to be
changed." changed."
:group 'reftex-table-of-contents-browser :group 'reftex-table-of-contents-browser
:type '(choice :type '(choice
@ -408,7 +411,7 @@ This flag can be toggled from within the *toc* buffer with the `f' key."
(defcustom reftex-revisit-to-follow nil (defcustom reftex-revisit-to-follow nil
"Non-nil means, follow-mode will revisit files if necessary. "Non-nil means, follow-mode will revisit files if necessary.
When nil, follow-mode will be suspended for stuff in unvisited files." If nil, follow-mode will be suspended for stuff in unvisited files."
:group 'reftex-table-of-contents-browser :group 'reftex-table-of-contents-browser
:group 'reftex-referencing-labels :group 'reftex-referencing-labels
:type 'boolean) :type 'boolean)
@ -452,8 +455,8 @@ of options."
(defcustom reftex-label-alist nil (defcustom reftex-label-alist nil
"Alist with information on environments for \\label-\\ref use. "Alist with information on environments for \\label-\\ref use.
This docstring is easier to understand after reading the configuration This doc string is easier to understand after reading the configuration
examples in `reftex.el'. Looking at the builtin defaults in the constant examples in the manual. Looking at the builtin defaults in the constant
`reftex-label-alist-builtin' may also be instructive. `reftex-label-alist-builtin' may also be instructive.
Set this variable to define additions and changes to the default. The only Set this variable to define additions and changes to the default. The only
@ -481,12 +484,11 @@ ENV-OR-MACRO
Special names: `section' for section labels, `any' to define a group Special names: `section' for section labels, `any' to define a group
which contains all labels. which contains all labels.
This may also be a function to do local parsing and identify point This may also be a function to do local parsing and identify point to
to be in a non-standard label environment. The function must take be in a non-standard label environment. The function must take an
an argument BOUND and limit backward searches to this value. It argument BOUND and limit backward searches to this value. It should
should return either nil or a cons cell (FUNCTION . POSITION) with return either nil or the position where the special environment starts.
the function symbol and the position where the special environment See the Info documentation for an example.
starts. See the Info documentation for an example.
Finally this may also be nil if the entry is only meant to change Finally this may also be nil if the entry is only meant to change
some settings associated with the type indicator character (see below). some settings associated with the type indicator character (see below).
@ -500,7 +502,7 @@ TYPE-KEY
`equation' and `eqnarray'). `equation' and `eqnarray').
If the type indicator is nil and the macro has a label argument {*}, If the type indicator is nil and the macro has a label argument {*},
the macro defines neutral labels just like \\label. In this case the macro defines neutral labels just like \\label. In this case
the reminder of this entry is ignored. the remainder of this entry is ignored.
LABEL-PREFIX LABEL-PREFIX
Label prefix string, like \"tab:\". Label prefix string, like \"tab:\".
@ -516,8 +518,8 @@ LABEL-PREFIX
Example: In a file `intro.tex', \"eq:%f:\" will become \"eq:intro:\"). Example: In a file `intro.tex', \"eq:%f:\" will become \"eq:intro:\").
REFERENCE-FORMAT REFERENCE-FORMAT
Format string for reference insert in buffer. `%s' will be replaced by Format string for reference insertion in buffer. `%s' will be replaced
the label. by the label.
When the format starts with `~', the `~' will only be inserted if When the format starts with `~', the `~' will only be inserted if
there is not already a whitespace before point. there is not already a whitespace before point.
@ -533,7 +535,7 @@ CONTEXT-METHOD
- If an integer, use the nth argument of the macro. As a special case, - If an integer, use the nth argument of the macro. As a special case,
1000 means to get text after the last macro argument. 1000 means to get text after the last macro argument.
- If a string, use as regexp to search *backward* from the label. Context - If a string, use as regexp to search *backward* from the label. Context
is then the text following the end of the match. E.g. putting this to is then the text following the end of the match. E.g. setting this to
\"\\\\\\\\caption[[{]\" will use the caption in a figure or table \"\\\\\\\\caption[[{]\" will use the caption in a figure or table
environment. environment.
\"\\\\\\\\begin{eqnarray}\\\\|\\\\\\\\\\\\\\\\\" works for eqnarrays. \"\\\\\\\\begin{eqnarray}\\\\|\\\\\\\\\\\\\\\\\" works for eqnarrays.
@ -755,8 +757,7 @@ And here is the setup for RefTeX:
3. Tell RefTeX to use this function 3. Tell RefTeX to use this function
(setq reftex-special-environment-functions '(my-detect-linguex-list)) (setq reftex-special-environment-functions '(my-detect-linguex-list))"
"
:group 'reftex-defining-label-environments :group 'reftex-defining-label-environments
:type 'hook) :type 'hook)
@ -820,11 +821,13 @@ RefTeX's default function uses the variable `reftex-derive-label-parameters'."
:type 'symbol) :type 'symbol)
(defcustom reftex-translate-to-ascii-function 'reftex-latin1-to-ascii (defcustom reftex-translate-to-ascii-function 'reftex-latin1-to-ascii
"Filter function which will process a context string before it is used "Filter function to convert a string to ASCII.
to derive a label from it. The intended application is to convert ISO or The function is used to process a context string before it is
Mule characters into something valid in labels. The default function used to derive a label from it. The intended application is to
removes the accents from Latin-1 characters. X-Symbol (>=2.6) sets this convert ISO or Mule characters into something valid in labels.
variable to the much more general `x-symbol-translate-to-ascii'." The default function removes the accents from Latin-1 characters.
X-Symbol (>=2.6) sets this variable to the much more general
`x-symbol-translate-to-ascii'."
:group 'reftex-making-and-inserting-labels :group 'reftex-making-and-inserting-labels
:type 'symbol) :type 'symbol)
@ -947,28 +950,79 @@ This is used to string together whole reference sets, like
:group 'reftex-referencing-labels :group 'reftex-referencing-labels
:type '(repeat (cons (character) (string)))) :type '(repeat (cons (character) (string))))
(defcustom reftex-ref-style-alist
'(("Default" t
(("\\ref" ?\C-m) ("\\pageref" ?p)))
("Varioref" "varioref"
(("\\vref" ?v) ("\\vpageref" ?g) ("\\Vref" ?V) ("\\Ref" ?R)))
("Fancyref" "fancyref"
(("\\fref" ?f) ("\\Fref" ?F)))
("Hyperref" "hyperref"
(("\\autoref" ?a) ("\\autopageref" ?u))))
"Alist of reference styles.
Each element is a list of the style name, the name of the LaTeX
package associated with the style or t for any package, and an
alist of macros where the first entry of each item is the
reference macro and the second a key for selecting the macro when
the macro type is being prompted for. (See also
`reftex-ref-macro-prompt'.) The keys, represented as characters,
have to be unique."
:group 'reftex-referencing-labels
:type '(alist :key-type (string :tag "Style name")
:value-type (group (choice :tag "Package"
(const :tag "Any package" t)
(string :tag "Name"))
(repeat :tag "Macros"
(group (string :tag "Macro")
(character :tag "Key"))))))
(defcustom reftex-ref-macro-prompt t
"If non-nil, `reftex-reference' prompts for the reference macro."
:group 'reftex-referencing-labels
:type 'boolean)
(defcustom reftex-vref-is-default nil (defcustom reftex-vref-is-default nil
"Non-nil means, the varioref macro \\vref is used as default. "Non-nil means, the varioref reference style is used as default.
In the selection buffer, the `v' key toggles the reference macro between The value of this variable determines the default which is active
`\\ref' and `\\vref'. The value of this variable determines the default when entering the selection process. Instead of nil or t, this
which is active when entering the selection process. may also be a string of type letters indicating the label types
Instead of nil or t, this may also be a string of type letters indicating for which it should be true.
the label types for which it should be true."
This variable is obsolete, use `reftex-ref-style-default-list'
instead."
:group 'reftex-referencing-labels :group 'reftex-referencing-labels
:type `(choice :tag "\\vref is default macro" ,@reftex-tmp)) :type `(choice :tag "\\vref is default macro" ,@reftex-tmp))
;;;###autoload(put 'reftex-vref-is-default 'safe-local-variable (lambda (x) (or (stringp x) (symbolp x)))) ;;;###autoload(put 'reftex-vref-is-default 'safe-local-variable (lambda (x) (or (stringp x) (symbolp x))))
(defcustom reftex-fref-is-default nil (defcustom reftex-fref-is-default nil
"Non-nil means, the fancyref macro \\fref is used as default. "Non-nil means, the fancyref reference style is used as default.
In the selection buffer, the `V' key toggles the reference macro between The value of this variable determines the default which is active
`\\ref', `\\fref' and `\\Fref'. The value of this variable determines when entering the selection process. Instead of nil or t, this
the default which is active when entering the selection process. may also be a string of type letters indicating the label types
Instead of nil or t, this may also be a string of type letters indicating for which it should be true.
the label types for which it should be true."
This variable is obsolete, use `reftex-ref-style-default-list'
instead."
:group 'reftex-referencing-labels :group 'reftex-referencing-labels
:type `(choice :tag "\\fref is default macro" ,@reftex-tmp)) :type `(choice :tag "\\fref is default macro" ,@reftex-tmp))
;;;###autoload(put 'reftex-fref-is-default 'safe-local-variable (lambda (x) (or (stringp x) (symbolp x)))) ;;;###autoload(put 'reftex-fref-is-default 'safe-local-variable (lambda (x) (or (stringp x) (symbolp x))))
(defcustom reftex-ref-style-default-list '("Default")
"List of reference styles to be activated by default.
The order is significant and controls the order in which macros
can be cycled in the buffer for selecting a label. The entries
in the list have to match the respective reference style names
used in the variable `reftex-ref-style-alist'."
:group 'reftex-referencing-labels
:type `(set ,@(mapcar (lambda (x) (list 'const (car x)))
reftex-ref-style-alist)))
;; Compatibility with obsolete variables.
(when reftex-vref-is-default
(add-to-list 'reftex-ref-style-default-list "Varioref"))
(when reftex-fref-is-default
(add-to-list 'reftex-ref-style-default-list "Fancyref"))
(defcustom reftex-level-indent 2 (defcustom reftex-level-indent 2
"Number of spaces to be used for indentation per section level." "Number of spaces to be used for indentation per section level."
:group 'reftex-referencing-labels :group 'reftex-referencing-labels
@ -987,19 +1041,22 @@ a label type. If you set this variable to nil, RefTeX will always prompt."
(defcustom reftex-format-ref-function nil (defcustom reftex-format-ref-function nil
"Function which produces the string to insert as a reference. "Function which produces the string to insert as a reference.
Normally should be nil, because the format to insert a reference can Normally should be nil, because the format to insert a reference
already be specified in `reftex-label-alist'. can already be specified in `reftex-label-alist'.
This hook also is used by the special commands to insert `\\vref' and `\\fref'
references, so even if you set this, your setting will be ignored by This hook also is used by the special commands to insert
the special commands. e.g. `\\vref' and `\\fref' references, so even if you set this,
The function will be called with two arguments, the LABEL and the DEFAULT your setting will be ignored by the special commands.
FORMAT, which normally is `~\\ref{%s}'. The function should return the
string to insert into the buffer." The function will be called with three arguments, the LABEL, the
DEFAULT FORMAT, which normally is `~\\ref{%s}' and the REFERENCE
STYLE. The function should return the string to insert into the
buffer."
:group 'reftex-referencing-labels :group 'reftex-referencing-labels
:type 'function) :type '(choice (const nil) function))
(defcustom reftex-select-label-mode-hook nil (defcustom reftex-select-label-mode-hook nil
"Mode hook for reftex-select-label-mode." "Mode hook for `reftex-select-label-mode'."
:group 'reftex-referencing-labels :group 'reftex-referencing-labels
:type 'hook) :type 'hook)
@ -1009,7 +1066,8 @@ string to insert into the buffer."
"Support for referencing bibliographic data with BibTeX." "Support for referencing bibliographic data with BibTeX."
:group 'reftex) :group 'reftex)
(defcustom reftex-bibliography-commands '("bibliography" "nobibliography") (defcustom reftex-bibliography-commands
'("bibliography" "nobibliography" "setupbibtex\\[.*?database=")
"LaTeX commands which specify the BibTeX databases to use with the document." "LaTeX commands which specify the BibTeX databases to use with the document."
:group 'reftex-citation-support :group 'reftex-citation-support
:type '(repeat string)) :type '(repeat string))
@ -1114,7 +1172,7 @@ E.g.: (setq reftex-cite-format 'natbib)"
(defcustom reftex-cite-prompt-optional-args 'maybe (defcustom reftex-cite-prompt-optional-args 'maybe
"Non-nil means, prompt for empty optional arguments in cite macros. "Non-nil means, prompt for empty optional arguments in cite macros.
When an entry in `reftex-cite-format' ist given with square brackets to When an entry in `reftex-cite-format' is given with square brackets to
indicate optional arguments (for example \\cite[][]{%l}), RefTeX can indicate optional arguments (for example \\cite[][]{%l}), RefTeX can
prompt for values. Possible values are: prompt for values. Possible values are:
@ -1189,13 +1247,28 @@ The function will be called with two arguments, the CITATION KEY and the
DEFAULT FORMAT, which is taken from `reftex-cite-format'. The function DEFAULT FORMAT, which is taken from `reftex-cite-format'. The function
should return the string to insert into the buffer." should return the string to insert into the buffer."
:group 'reftex-citation-support :group 'reftex-citation-support
:type 'function) :type '(choice (const nil) function))
(defcustom reftex-select-bib-mode-hook nil (defcustom reftex-select-bib-mode-hook nil
"Mode hook for reftex-select-bib-mode." "Mode hook for reftex-select-bib-mode."
:group 'reftex-citation-support :group 'reftex-citation-support
:type 'hook) :type 'hook)
(defcustom reftex-cite-key-separator ","
"String to be used for separating several keys in a \\cite macro."
:group 'reftex-citation-support
:type 'string)
(defcustom reftex-create-bibtex-header nil
"Header to insert in BibTeX files generated by RefTeX."
:group 'reftex-citation-support
:type 'string)
(defcustom reftex-create-bibtex-footer nil
"Footer to insert in BibTeX files generated by RefTeX."
:group 'reftex-citation-support
:type 'string)
;; Index Support Configuration ;; Index Support Configuration
(defgroup reftex-index-support nil (defgroup reftex-index-support nil
@ -1223,7 +1296,9 @@ These correspond to the makeindex keywords LEVEL ENCAP ACTUAL QUOTE ESCAPE."
(string :tag "ESCAPE char "))) (string :tag "ESCAPE char ")))
(defcustom reftex-index-macros nil (defcustom reftex-index-macros nil
"Macros which define index entries. The structure is "Macros which define index entries.
The structure is
\(MACRO INDEX-TAG KEY PREFIX EXCLUDE REPEAT) \(MACRO INDEX-TAG KEY PREFIX EXCLUDE REPEAT)
@ -1456,7 +1531,7 @@ This flag can be toggled from within the *Index* buffer with the `f' key."
This is used when `reftex-view-crossref' is called with point in an This is used when `reftex-view-crossref' is called with point in an
argument of a macro. Note that crossref viewing for citations, argument of a macro. Note that crossref viewing for citations,
references (both ways) and index entries is hard-coded. This variable references (both ways) and index entries is hard-coded. This variable
is only to configure additional structures for which crossreference is only to configure additional structures for which cross-reference
viewing can be useful. Each entry has the structure viewing can be useful. Each entry has the structure
\(MACRO-RE SEARCH-RE HIGHLIGHT). \(MACRO-RE SEARCH-RE HIGHLIGHT).
@ -1499,15 +1574,17 @@ entries and for BibTeX database files with live associated buffers."
:type 'boolean) :type 'boolean)
(defcustom reftex-cache-cite-echo t (defcustom reftex-cache-cite-echo t
"Non-nil means, the information displayed in the echo area for cite macros "Non-nil means, echoed information for cite macros is cached.
is cached and even saved along with the parsing information. The cache The information displayed in the echo area for cite macros is
survives document scans. In order to clear it, use M-x reftex-reset-mode." cached and even saved along with the parsing information. The
cache survives document scans. In order to clear it, use M-x
reftex-reset-mode <RET>."
:group 'reftex-viewing-cross-references :group 'reftex-viewing-cross-references
:type 'boolean) :type 'boolean)
(defcustom reftex-display-copied-context-hook nil (defcustom reftex-display-copied-context-hook nil
"Normal Hook which is run before context is displayed anywhere. Designed "Normal hook which is run before context is displayed anywhere.
for X-Symbol, but may have other uses as well." Designed for X-Symbol, but may have other uses as well."
:group 'reftex-viewing-cross-references :group 'reftex-viewing-cross-references
:group 'reftex-referencing-labels :group 'reftex-referencing-labels
:type 'hook) :type 'hook)
@ -1690,7 +1767,7 @@ The file MASTER.rel in the same directory as MASTER.tex is used to save the
information. When this variable is t, information. When this variable is t,
- accessing the parsing information for the first time in an editing session - accessing the parsing information for the first time in an editing session
will read that file (if available) instead of parsing the document. will read that file (if available) instead of parsing the document.
- exiting Emacs or killing a buffer in reftex-mode will cause a new version - exiting Emacs or killing a buffer in `reftex-mode' will cause a new version
of the file to be written." of the file to be written."
:group 'reftex-optimizations-for-large-documents :group 'reftex-optimizations-for-large-documents
:type 'boolean) :type 'boolean)
@ -1855,22 +1932,13 @@ symbol indicating in what context the hook is called."
(defcustom reftex-extra-bindings nil (defcustom reftex-extra-bindings nil
"Non-nil means, make additional key bindings on startup. "Non-nil means, make additional key bindings on startup.
These extra bindings are located in the These extra bindings are located in the users `C-c letter' map."
`reftex-extra-bindings-map' map, bound to
`reftex-extra-bindings-prefix'."
:group 'reftex-miscellaneous-configurations
:type 'boolean)
;; below, default is C-c C-y because it is free in LaTeX mode.
(defcustom reftex-extra-bindings-prefix "\C-c\C-y"
"When `reftex-extra-bindings' is set to non-nil, use extra
bindings with this prefix bound to `reftex-extra-bindings-map'."
:group 'reftex-miscellaneous-configurations :group 'reftex-miscellaneous-configurations
:type 'boolean) :type 'boolean)
(defcustom reftex-plug-into-AUCTeX nil (defcustom reftex-plug-into-AUCTeX nil
"Plug-in flags for AUCTeX interface. "Plug-in flags for AUCTeX interface.
This variable is a list of 4 boolean flags. When a flag is non-nil, This variable is a list of 5 boolean flags. When a flag is non-nil,
RefTeX will RefTeX will
- supply labels in new sections and environments (flag 1) - supply labels in new sections and environments (flag 1)
@ -1900,8 +1968,7 @@ may require a restart of Emacs in order to become effective."
(boolean :tag "supply argument for macros like `\\label' ") (boolean :tag "supply argument for macros like `\\label' ")
(boolean :tag "supply argument for macros like `\\ref' ") (boolean :tag "supply argument for macros like `\\ref' ")
(boolean :tag "supply argument for macros like `\\cite' ") (boolean :tag "supply argument for macros like `\\cite' ")
(boolean :tag "supply argument for macros like `\\index' ") (boolean :tag "supply argument for macros like `\\index' "))))
)))
(defcustom reftex-allow-detached-macro-args nil (defcustom reftex-allow-detached-macro-args nil
"Non-nil means, allow arguments of macros to be detached by whitespace. "Non-nil means, allow arguments of macros to be detached by whitespace.

View File

@ -3,7 +3,6 @@
;; Author: Carsten Dominik <dominik@science.uva.nl> ;; Author: Carsten Dominik <dominik@science.uva.nl>
;; Maintainer: auctex-devel@gnu.org ;; Maintainer: auctex-devel@gnu.org
;; Version: 4.31
;; Keywords: tex ;; Keywords: tex
;; This file is part of GNU Emacs. ;; This file is part of GNU Emacs.
@ -21,10 +20,8 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
;;---------------------------------------------------------------------------
;;
;;; Commentary: ;;; Commentary:
;;
;; RefTeX is a minor mode with distinct support for \ref, \label, \cite, ;; RefTeX is a minor mode with distinct support for \ref, \label, \cite,
;; and \index commands in (multi-file) LaTeX documents. ;; and \index commands in (multi-file) LaTeX documents.
;; - A table of contents provides easy access to any part of a document. ;; - A table of contents provides easy access to any part of a document.
@ -34,243 +31,23 @@
;; - Text phrases can be collected in a file, for later global indexing. ;; - Text phrases can be collected in a file, for later global indexing.
;; - The index preview buffer helps to check and edit index entries. ;; - The index preview buffer helps to check and edit index entries.
;; ;;
;; ;; There is an extensive Texinfo document describing RefTeX in detail.
;; INSTALLATION
;; ------------
;;
;; - If this file is part of an X/Emacs distribution, it is installed.
;; - For XEmacs 21.x, you need to install the RefTeX plug-in package
;; available from the XEmacs distribution sites.
;; - If you have downloaded this file from the maintainers webpage, follow
;; the instructions in the INSTALL file of the distribution.
;;
;; To turn RefTeX Mode on and off in a buffer, use `M-x reftex-mode'.
;;
;; To turn on RefTeX Mode for all LaTeX files, add the following lines
;; to your init file:
;;
;; (add-hook 'LaTeX-mode-hook 'turn-on-reftex) ; AUCTeX LaTeX mode
;; (add-hook 'latex-mode-hook 'turn-on-reftex) ; Emacs latex mode
;;
;;
;; DOCUMENTATION
;; -------------
;;
;; See below for a short summary of how to use RefTeX.
;;
;; There is an extensive texinfo document describing RefTeX in detail.
;; One way to view this documentation is `M-x reftex-info RET'. ;; One way to view this documentation is `M-x reftex-info RET'.
;; ;;
;; The documentation in various formats is also available at ;; The documentation in various formats is also available at
;; ;;
;; http://zon.astro.uva.nl/~dominik/Tools/ ;; http://www.gnu.org/software/auctex/manual/reftex.index.html
;;
;;---------------------------------------------------------------------------
;;
;; 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 init 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
;; ====================
;;
;; 1. Table of Contents
;; Typing `C-c =' (`reftex-toc') will show a table of contents of the
;; document. This buffer can display sections, labels and index
;; entries defined in the document. From the buffer, you can jump
;; quickly to every part of your document. Press `?' to get help.
;;
;; 2. Labels and References
;; RefTeX helps to create unique labels and to find the correct key
;; for references quickly. It distinguishes labels for different
;; environments, knows about all standard environments (and many
;; others), and can be configured to recognize any additional labeled
;; environments you have defined yourself (variable
;; `reftex-label-alist').
;;
;; * Creating Labels
;; Type `C-c (' (`reftex-label') to insert a label at point.
;; RefTeX will either
;; - derive a label from context (default for section labels)
;; - prompt for a label string (default for figures and
;; tables) or
;; - insert a simple label made of a prefix and a number (all
;; other environments)
;;
;; Which labels are created how is configurable with the variable
;; `reftex-insert-label-flags'.
;;
;; * Referencing Labels
;; To make a reference, type `C-c )' (`reftex-reference'). This
;; shows an outline of the document with all labels of a certain
;; type (figure, equation,...) and some label context.
;; Selecting a label inserts a `\ref{LABEL}' macro into the
;; original buffer.
;;
;; 3. Citations
;; 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
;; sorted. The selected article is referenced as `\cite{KEY}' (see
;; the variable `reftex-cite-format' if you want to insert different
;; macros).
;;
;; 4. Index Support
;; RefTeX helps to enter index entries. It also compiles all entries
;; into an alphabetically sorted `*Index*' buffer which you can use
;; to check and edit the entries. RefTeX knows about the standard
;; index macros and can be configured to recognize any additional
;; macros you have defined (`reftex-index-macros'). Multiple indices
;; are supported.
;;
;; * Creating Index Entries
;; 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.
;;
;; * 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.
;;
;; 5. Viewing Cross-References
;; When point is on the KEY argument of a cross-referencing macro
;; (`\label', `\ref', `\cite', `\bibitem', `\index', and variations)
;; or inside a BibTeX database entry, you can press `C-c &'
;; (`reftex-view-crossref') to display corresponding locations in the
;; document and associated BibTeX database files.
;; When the enclosing macro is `\cite' or `\ref' and no other message
;; occupies the echo area, information about the citation or label
;; will automatically be displayed in the echo area.
;;
;; 6. Multifile Documents
;; Multifile Documents are fully supported. The included files must
;; have a file variable `TeX-master' or `tex-main-file' pointing to
;; the master file. RefTeX provides cross-referencing information
;; from all parts of the document, and across document borders
;; (`xr.sty').
;;
;; 7. Document Parsing
;; RefTeX needs to parse the document in order to find labels and
;; other information. It does it automatically once and updates its
;; list internally when `reftex-label' and `reftex-index' are used.
;; To enforce reparsing, call any of the commands described above
;; with a raw `C-u' prefix, or press the `r' key in the label
;; selection buffer, the table of contents buffer, or the index
;; buffer.
;;
;; 8. AUCTeX
;; If your major LaTeX mode is AUCTeX, RefTeX can cooperate with it
;; (see variable `reftex-plug-into-AUCTeX'). AUCTeX contains style
;; files which trigger appropriate settings in RefTeX, so that for
;; many of the popular LaTeX packages no additional customizations
;; will be necessary.
;;
;; 9. Useful Settings
;; To make RefTeX faster for large documents, try these:
;; (setq reftex-enable-partial-scans t)
;; (setq reftex-save-parse-info t)
;; (setq reftex-use-multiple-selection-buffers t)
;;
;; To integrate with AUCTeX, use
;; (setq reftex-plug-into-AUCTeX t)
;;
;; To make your own LaTeX macro definitions known to RefTeX,
;; customize the variables
;; `reftex-label-alist' (for label macros/environments)
;; `reftex-section-levels' (for sectioning commands)
;; `reftex-cite-format' (for `\cite'-like macros)
;; `reftex-index-macros' (for `\index'-like macros)
;; `reftex-index-default-macro' (to set the default macro)
;; If you have a large number of macros defined, you may want to write
;; an AUCTeX style file to support them with both AUCTeX and RefTeX.
;;
;; 10. Where Next?
;; 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, 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.
;;
;;---------------------------------------------------------------------------
;;
;; AUTHOR
;; ======
;;
;; Carsten Dominik <dominik@science.uva.nl>
;;
;; with contributions from Stephen Eglen
;; ;;
;; RefTeX is bundled with Emacs and available as a plug-in package for ;; RefTeX is bundled with Emacs and available as a plug-in package for
;; XEmacs 21.x. If you need to install it yourself, you can find a ;; XEmacs 21.x. If you need to install it yourself, you can find a
;; distribution at ;; distribution at
;; ;;
;; http://zon.astro.uva.nl/~dominik/Tools/ ;; http://www.gnu.org/software/auctex/reftex.html
;; ;;
;; THANKS TO: ;; RefTeX was written by Carsten Dominik <dominik@science.uva.nl> with
;; --------- ;; contributions from Stephen Eglen. It is currently maintained by
;; Thanks to the people on the Net who have used RefTeX and helped ;; the AUCTeX project.
;; developing it with their reports. In particular thanks to
;;
;; Fran Burstall, Alastair Burt, Soren Dayton, Stephen Eglen,
;; Karl Eichwalder, Peter Galbraith, Dieter Kraft, Kai Grossjohann,
;; 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
;; MicroEmacs at the time).
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;;;;;
;;; Code: ;;; Code:
(eval-when-compile (require 'cl)) (eval-when-compile (require 'cl))
@ -289,52 +66,13 @@
(set symbol value))) (set symbol value)))
;;; ========================================================================= ;; Configuration variables
;;;
;;; Configuration variables
(require 'reftex-vars) (require 'reftex-vars)
;;; ========================================================================= ;;; Autoloads
;;;
;;; Define the formal stuff for a minor mode named RefTeX.
;;;
(defconst reftex-version "RefTeX version 4.31"
"Version string for RefTeX.")
(defvar reftex-mode-map (make-sparse-keymap)
"Keymap for RefTeX mode.")
(defvar reftex-mode-menu nil)
(defvar reftex-syntax-table nil)
(defvar reftex-syntax-table-for-bib nil)
(unless reftex-syntax-table
(setq reftex-syntax-table (copy-syntax-table))
(modify-syntax-entry ?\( "." reftex-syntax-table)
(modify-syntax-entry ?\) "." reftex-syntax-table))
(unless reftex-syntax-table-for-bib
(setq reftex-syntax-table-for-bib
(copy-syntax-table reftex-syntax-table))
(modify-syntax-entry ?\' "." reftex-syntax-table-for-bib)
(modify-syntax-entry ?\" "." reftex-syntax-table-for-bib)
(modify-syntax-entry ?\[ "." reftex-syntax-table-for-bib)
(modify-syntax-entry ?\] "." reftex-syntax-table-for-bib))
;; The following definitions are out of place, but I need them here
;; to make the compilation of reftex-mode not complain.
(defvar reftex-auto-view-crossref-timer nil
"The timer used for auto-view-crossref.")
(defvar reftex-toc-auto-recenter-timer nil
"The idle timer used to recenter the toc window.")
;;; =========================================================================
;;;
;;; Parser functions
;; Parser functions
(autoload 'reftex-parse-one "reftex-parse" (autoload 'reftex-parse-one "reftex-parse"
"Re-parse this file." t) "Re-parse this file." t)
(autoload 'reftex-parse-all "reftex-parse" (autoload 'reftex-parse-all "reftex-parse"
@ -358,11 +96,7 @@
(autoload 'reftex-ensure-index-support "reftex-parse") (autoload 'reftex-ensure-index-support "reftex-parse")
(autoload 'reftex-everything-regexp "reftex-parse") (autoload 'reftex-everything-regexp "reftex-parse")
;; Labels and References
;;; =========================================================================
;;;
;;; Labels and References
(autoload 'reftex-label-location "reftex-ref") (autoload 'reftex-label-location "reftex-ref")
(autoload 'reftex-label-info-update "reftex-ref") (autoload 'reftex-label-info-update "reftex-ref")
(autoload 'reftex-label-info "reftex-ref") (autoload 'reftex-label-info "reftex-ref")
@ -381,10 +115,7 @@
(autoload 'reftex-goto-label "reftex-ref" (autoload 'reftex-goto-label "reftex-ref"
"Prompt for label name and go to that location." t) "Prompt for label name and go to that location." t)
;;; ========================================================================= ;; Table of contents
;;;
;;; Table of contents
(autoload 'reftex-toc "reftex-toc" (autoload 'reftex-toc "reftex-toc"
"Show the table of contents for the current document." t) "Show the table of contents for the current document." t)
(autoload 'reftex-toc-recenter "reftex-toc" (autoload 'reftex-toc-recenter "reftex-toc"
@ -392,10 +123,7 @@
(autoload 'reftex-toggle-auto-toc-recenter "reftex-toc" (autoload 'reftex-toggle-auto-toc-recenter "reftex-toc"
"Toggle automatic recentering of TOC window." t) "Toggle automatic recentering of TOC window." t)
;;; ========================================================================= ;; BibTeX citations.
;;;
;;; BibTeX citations.
(autoload 'reftex-citep "reftex-cite") (autoload 'reftex-citep "reftex-cite")
(autoload 'reftex-citet "reftex-cite") (autoload 'reftex-citet "reftex-cite")
(autoload 'reftex-make-cite-echo-string "reftex-cite") (autoload 'reftex-make-cite-echo-string "reftex-cite")
@ -409,10 +137,7 @@
(autoload 'reftex-bib-or-thebib "reftex-cite") (autoload 'reftex-bib-or-thebib "reftex-cite")
(autoload 'reftex-create-bibtex-file "reftex-cite") (autoload 'reftex-create-bibtex-file "reftex-cite")
;;; ========================================================================= ;; Selection
;;;
;;; Selection
(autoload 'reftex-select-label-mode "reftex-sel") (autoload 'reftex-select-label-mode "reftex-sel")
(autoload 'reftex-select-bib-mode "reftex-sel") (autoload 'reftex-select-bib-mode "reftex-sel")
(autoload 'reftex-find-start-point "reftex-sel") (autoload 'reftex-find-start-point "reftex-sel")
@ -420,11 +145,7 @@
(autoload 'reftex-get-offset "reftex-sel") (autoload 'reftex-get-offset "reftex-sel")
(autoload 'reftex-select-item "reftex-sel") (autoload 'reftex-select-item "reftex-sel")
;; Index support
;;; =========================================================================
;;;
;;; Index support
(autoload 'reftex-index "reftex-index" (autoload 'reftex-index "reftex-index"
"Query for an index macro and insert it along with its arguments." t) "Query for an index macro and insert it along with its arguments." t)
(autoload 'reftex-index-selection-or-word "reftex-index" (autoload 'reftex-index-selection-or-word "reftex-index"
@ -442,11 +163,7 @@
(autoload 'reftex-index-show-entry "reftex-index") (autoload 'reftex-index-show-entry "reftex-index")
(autoload 'reftex-index-select-tag "reftex-index") (autoload 'reftex-index-select-tag "reftex-index")
;; View cross references
;;; =========================================================================
;;;
;;; View cross references
(autoload 'reftex-view-crossref "reftex-dcr" (autoload 'reftex-view-crossref "reftex-dcr"
"View cross reference of \\ref or \\cite macro at point." t) "View cross reference of \\ref or \\cite macro at point." t)
(autoload 'reftex-mouse-view-crossref "reftex-dcr" (autoload 'reftex-mouse-view-crossref "reftex-dcr"
@ -455,11 +172,7 @@
(autoload 'reftex-view-crossref-from-bibtex "reftex-dcr" (autoload 'reftex-view-crossref-from-bibtex "reftex-dcr"
"View location in a LaTeX document which cites the BibTeX entry at point." t) "View location in a LaTeX document which cites the BibTeX entry at point." t)
;; Operations on entire Multifile documents
;;; =========================================================================
;;;
;;; Operations on entire Multifile documents
(autoload 'reftex-create-tags-file "reftex-global" (autoload 'reftex-create-tags-file "reftex-global"
"Create TAGS file by running `etags' on the current document." t) "Create TAGS file by running `etags' on the current document." t)
(autoload 'reftex-grep-document "reftex-global" (autoload 'reftex-grep-document "reftex-global"
@ -477,11 +190,7 @@
(autoload 'reftex-save-all-document-buffers "reftex-global" (autoload 'reftex-save-all-document-buffers "reftex-global"
"Save all documents associated with the current document." t) "Save all documents associated with the current document." t)
;; AUCTeX Interface
;;; =========================================================================
;;;
;;; AUCTeX Interface
(autoload 'reftex-arg-label "reftex-auc") (autoload 'reftex-arg-label "reftex-auc")
(autoload 'reftex-arg-cite "reftex-auc") (autoload 'reftex-arg-cite "reftex-auc")
(autoload 'reftex-arg-index-tag "reftex-auc") (autoload 'reftex-arg-index-tag "reftex-auc")
@ -494,6 +203,41 @@
(autoload 'reftex-add-section-levels "reftex-auc") (autoload 'reftex-add-section-levels "reftex-auc")
(autoload 'reftex-notice-new-section "reftex-auc") (autoload 'reftex-notice-new-section "reftex-auc")
;;; =========================================================================
;;;
;;; Define the formal stuff for a minor mode named RefTeX.
;;;
(defconst reftex-version emacs-version
"Version string for RefTeX.")
(defvar reftex-mode-map (make-sparse-keymap)
"Keymap for RefTeX mode.")
(defvar reftex-mode-menu nil)
(defvar reftex-syntax-table nil)
(defvar reftex-syntax-table-for-bib nil)
(unless reftex-syntax-table
(setq reftex-syntax-table (copy-syntax-table))
(modify-syntax-entry ?\( "." reftex-syntax-table)
(modify-syntax-entry ?\) "." reftex-syntax-table))
(unless reftex-syntax-table-for-bib
(setq reftex-syntax-table-for-bib (copy-syntax-table))
(modify-syntax-entry ?\' "." reftex-syntax-table-for-bib)
(modify-syntax-entry ?\" "." reftex-syntax-table-for-bib)
(modify-syntax-entry ?\[ "." reftex-syntax-table-for-bib)
(modify-syntax-entry ?\] "." reftex-syntax-table-for-bib))
;; The following definitions are out of place, but I need them here
;; to make the compilation of reftex-mode not complain.
(defvar reftex-auto-view-crossref-timer nil
"The timer used for auto-view-crossref.")
(defvar reftex-toc-auto-recenter-timer nil
"The idle timer used to recenter the toc window.")
;;;###autoload ;;;###autoload
(defun turn-on-reftex () (defun turn-on-reftex ()
"Turn on RefTeX mode." "Turn on RefTeX mode."
@ -503,13 +247,7 @@
(put 'reftex-mode :menu-tag "RefTeX Mode") (put 'reftex-mode :menu-tag "RefTeX Mode")
;;;###autoload ;;;###autoload
(define-minor-mode reftex-mode (define-minor-mode reftex-mode
"Toggle RefTeX mode. "Minor mode with distinct support for \\label, \\ref and \\cite in LaTeX.
With a prefix argument ARG, enable RefTeX mode if ARG is
positive, and disable it otherwise. If called from Lisp, enable
the mode if ARG is omitted or nil.
RefTeX mode is a buffer-local minor mode with distinct support
for \\label, \\ref and \\cite in LaTeX.
\\<reftex-mode-map>A Table of Contents of the entire (multifile) document with browsing \\<reftex-mode-map>A Table of Contents of the entire (multifile) document with browsing
capabilities is available with `\\[reftex-toc]'. capabilities is available with `\\[reftex-toc]'.
@ -559,8 +297,7 @@ on the menu bar.
(modify-syntax-entry ?\( "." reftex-syntax-table) (modify-syntax-entry ?\( "." reftex-syntax-table)
(modify-syntax-entry ?\) "." reftex-syntax-table) (modify-syntax-entry ?\) "." reftex-syntax-table)
(setq reftex-syntax-table-for-bib (setq reftex-syntax-table-for-bib (copy-syntax-table))
(copy-syntax-table reftex-syntax-table))
(modify-syntax-entry ?\' "." reftex-syntax-table-for-bib) (modify-syntax-entry ?\' "." reftex-syntax-table-for-bib)
(modify-syntax-entry ?\" "." reftex-syntax-table-for-bib) (modify-syntax-entry ?\" "." reftex-syntax-table-for-bib)
(modify-syntax-entry ?\[ "." reftex-syntax-table-for-bib) (modify-syntax-entry ?\[ "." reftex-syntax-table-for-bib)
@ -635,16 +372,15 @@ on the menu bar.
(incf reftex-multifile-index)) (incf reftex-multifile-index))
(defun reftex-tie-multifile-symbols () (defun reftex-tie-multifile-symbols ()
;; Tie the buffer-local symbols to globals connected with the master file. "Tie the buffer-local symbols to globals connected with the master file.
;; If the symbols for the current master file do not exist, they are created. If the symbols for the current master file do not exist, they are created."
(let* ((master (file-truename (reftex-TeX-master-file))) (let* ((master (file-truename (reftex-TeX-master-file)))
(index (assoc master reftex-master-index-list)) (index (assoc master reftex-master-index-list))
(symlist reftex-multifile-symbols) (symlist reftex-multifile-symbols)
symbol symname newflag) symbol symname newflag)
;; Find the correct index. ;; Find the correct index.
(if index (if index
;; symbols do exist ;; Symbols do exist
(setq index (cdr index)) (setq index (cdr index))
;; Get a new index and add info to the alist. ;; Get a new index and add info to the alist.
(setq index (reftex-next-multifile-index) (setq index (reftex-next-multifile-index)
@ -661,13 +397,15 @@ on the menu bar.
;; Initialize if new symbols. ;; Initialize if new symbols.
(when newflag (when newflag
(set (symbol-value symbol) nil) (set (symbol-value symbol) nil)
(put (symbol-value symbol) 'reftex-index-macros-style '(default)))) (put (symbol-value symbol) 'reftex-index-macros-style '(default))
(put (symbol-value symbol) 'reftex-ref-style-list
reftex-ref-style-default-list)))
;; Return t if the symbols did already exist, nil when we've made them. ;; Return t if the symbols did already exist, nil when we've made them.
(not newflag))) (not newflag)))
(defun reftex-untie-multifile-symbols () (defun reftex-untie-multifile-symbols ()
;; Remove ties from multifile symbols, so that next use makes new ones. "Remove ties from multifile symbols, so that next use makes new ones."
(let ((symlist reftex-multifile-symbols) (let ((symlist reftex-multifile-symbols)
(symbol nil)) (symbol nil))
(while symlist (while symlist
@ -761,7 +499,7 @@ for details.
This function makes it possible to support RefTeX from AUCTeX style files. This function makes it possible to support RefTeX from AUCTeX style files.
The entries in ENTRY-LIST will be processed after the user settings in The entries in ENTRY-LIST will be processed after the user settings in
`reftex-index-entries', and before the defaults. Any changes made to `reftex-index-entries', and before the defaults. Any changes made to
`reftex-label-alist-style' will raise a flag to the effect that `reftex-index-macros-style' will raise a flag to the effect that
the label information is recompiled on next use." the label information is recompiled on next use."
(unless reftex-docstruct-symbol (unless reftex-docstruct-symbol
(reftex-tie-multifile-symbols)) (reftex-tie-multifile-symbols))
@ -783,6 +521,52 @@ the label information is recompiled on next use."
(when changed (when changed
(put reftex-docstruct-symbol 'reftex-index-macros-style list))))) (put reftex-docstruct-symbol 'reftex-index-macros-style list)))))
(defun reftex-ref-style-activate (style)
"Activate the referencing style STYLE."
(reftex-ref-style-toggle style 'activate))
(defun reftex-ref-style-toggle (style &optional action)
"Activate or deactivate the referencing style STYLE.
With the optional argument ACTION a certain action can be forced.
The symbol `activate' will activate the style and `deactivate'
will deactivate it."
(unless reftex-docstruct-symbol
(reftex-tie-multifile-symbols))
(when (and reftex-docstruct-symbol
(symbolp reftex-docstruct-symbol))
(let ((list (get reftex-docstruct-symbol 'reftex-ref-style-list))
changed)
(cond ((eq action 'activate)
(unless (member style list)
(setq reftex-tables-dirty t
changed t)
(add-to-list 'list style t)))
((eq action 'deactivate)
(when (member style list)
(setq reftex-tables-dirty t
changed t)
(delete style list)))
(t
(if (member style list)
(delete style list)
(add-to-list 'list style t))
(setq reftex-tables-dirty t
changed t)))
(when changed
(put reftex-docstruct-symbol 'reftex-ref-style-list list)))))
(defun reftex-ref-style-list ()
"Return the list of referencing styles to be active at the moment."
;; Initialize the value of `reftex-ref-style-list' and tie it to the
;; docstruct symbol if necessary.
(unless reftex-docstruct-symbol
(reftex-tie-multifile-symbols))
(if (and reftex-docstruct-symbol
(symbolp reftex-docstruct-symbol)
(get reftex-docstruct-symbol 'reftex-ref-style-list))
(get reftex-docstruct-symbol 'reftex-ref-style-list)
reftex-ref-style-default-list))
;;; ========================================================================= ;;; =========================================================================
;;; ;;;
;;; Functions to compile the tables, reset the mode etc. ;;; Functions to compile the tables, reset the mode etc.
@ -1282,8 +1066,8 @@ This enforces rescanning the buffer on next use."
;; Calculate the regular expressions ;; Calculate the regular expressions
(let* ( (let* (
; (wbol "\\(\\`\\|[\n\r]\\)[ \t]*") ; (wbol "\\(\\`\\|[\n\r]\\)[ \t]*")
(wbol "\\(^\\)[ \t]*") ; Need to keep the empty group because (wbol "\\(^\\)[ \t]*") ; Need to keep the empty group because
;;; because match number are hard coded ; match numbers are hard coded
(label-re (concat "\\(?:" (label-re (concat "\\(?:"
;; Normal \label{...} ;; Normal \label{...}
"\\\\label{\\([^}]*\\)}" "\\\\label{\\([^}]*\\)}"
@ -1299,10 +1083,16 @@ This enforces rescanning the buffer on next use."
reftex-include-file-commands "\\|") reftex-include-file-commands "\\|")
"\\)[{ \t]+\\([^} \t\n\r]+\\)")) "\\)[{ \t]+\\([^} \t\n\r]+\\)"))
(section-re (section-re
;; Including `\' as a character to be matched at the end
;; of the regexp will allow stuff like
;; \begin{foo}\label{bar} to be matched. This will make
;; the parser to advance one char too much. Therefore
;; `reftex-parse-from-file' will step one char back if a
;; section is found.
(concat wbol "\\\\\\(" (concat wbol "\\\\\\("
(mapconcat (lambda (x) (regexp-quote (car x))) (mapconcat (lambda (x) (regexp-quote (car x)))
reftex-section-levels-all "\\|") reftex-section-levels-all "\\|")
"\\)\\*?\\(\\[[^]]*\\]\\)?[[{ \t\r\n]")) "\\)\\*?\\(\\[[^]]*\\]\\)?[[{ \t\r\n\\]"))
(appendix-re (concat wbol "\\(\\\\appendix\\)")) (appendix-re (concat wbol "\\(\\\\appendix\\)"))
(macro-re (macro-re
(if macros-with-labels (if macros-with-labels
@ -1780,9 +1570,18 @@ When DIE is non-nil, throw an error if file not found."
"In unfinished selection process. Finish, or abort with \\[abort-recursive-edit]")))) "In unfinished selection process. Finish, or abort with \\[abort-recursive-edit]"))))
(defun reftex-in-comment () (defun reftex-in-comment ()
"Return non-nil if point is in a comment."
(save-excursion (save-excursion
(skip-chars-backward "^%\n\r") (save-match-data
(eq (preceding-char) ?%))) (let ((pos (point)))
(beginning-of-line)
(re-search-forward
(or comment-start-skip
;; The parser may open files in fundamental mode if
;; `reftex-initialize-temporary-buffers' is nil, so here
;; is a default suitable for plain TeX and LaTeX.
"\\(\\(^\\|[^\\\n]\\)\\(\\\\\\\\\\)*\\)\\(%+[ \t]*\\)")
pos t)))))
(defun reftex-no-props (string) (defun reftex-no-props (string)
;; Return STRING with all text properties removed ;; Return STRING with all text properties removed
@ -1996,6 +1795,7 @@ When DIE is non-nil, throw an error if file not found."
(condition-case nil (scroll-down) (error nil)) (condition-case nil (scroll-down) (error nil))
(message "%s" prompt)) (message "%s" prompt))
(t (message "") (t (message "")
(reftex-kill-buffer "*RefTeX Select*")
(throw 'exit char))) (throw 'exit char)))
(setq char (read-char-exclusive))))))) (setq char (read-char-exclusive)))))))
@ -2123,25 +1923,95 @@ When DIE is non-nil, throw an error if file not found."
(setq list (cdr list))) (setq list (cdr list)))
(nreverse rtn))) (nreverse rtn)))
(defun reftex-uniquify (list) (defun reftex-uniquify (list &optional sort)
;; Return a list of all elements in LIST, but each only once, keeping order ;; Return a list of all strings in LIST, but each only once, keeping order
(let (new elm) ;; unless SORT is set (faster!).
(while list (setq list (copy-sequence list))
(setq elm (pop list)) (if sort
(unless (member elm new) (progn
(push elm new))) (setq list (sort list 'string<))
(nreverse new))) (let ((p list))
(while (cdr p)
(if (string= (car p) (car (cdr p)))
(setcdr p (cdr (cdr p)))
(setq p (cdr p)))))
list)
(let ((p list) lst elt)
;; push all sublists into lst in reverse(!) order
(while p
(push p lst)
(setq p (cdr p)))
;; sort all sublists
(setq lst (sort lst (lambda (x1 x2) (string< (car x1) (car x2)))))
(while (cdr lst)
(setq elt (car (car lst)))
;; for equal elements in the sorted sublist, replace the
;; last(!) original list member with nil
(when (string= elt (car (cadr lst)))
(setcar (pop lst) nil)
(while (and (cdr lst) (string= elt (car (cadr lst))))
(setcar (pop lst) nil)))
(pop lst)))
;; weed out all nils and return.
(delq nil list)))
(defun reftex-uniquify-by-car (alist &optional keep-list) (defun reftex-uniquify-by-car (alist &optional keep-list sort)
;; Return a list of all elements in ALIST, but each car only once. ;; Return a list of all elements in ALIST, but each car only once.
;; Elements of KEEP-LIST are not removed even if duplicate. ;; Elements of KEEP-LIST are not removed even if duplicate.
(let (new elm) ;; The order is kept unless SORT is set (faster!).
(while alist (setq keep-list (sort (copy-sequence keep-list) #'string<)
(setq elm (pop alist)) alist (copy-sequence alist))
(if (or (member (car elm) keep-list) (if sort
(not (assoc (car elm) new))) (let (lst elt)
(push elm new))) (setq alist (sort alist (lambda(a b) (string< (car a) (car b)))))
(nreverse new))) (setq lst alist)
(while (cdr lst)
(setq elt (car (car lst)))
(when (string= elt (car (cadr lst)))
(while (and keep-list (string< (car keep-list) elt))
(pop keep-list))
(if (and keep-list (string= elt (car keep-list)))
(progn
(pop lst)
(while (and (cdr lst)
(string= elt (car (cadr lst))))
(pop lst)))
(setcdr lst (cdr (cdr lst)))
(while (and (cdr lst)
(string= elt (car (cadr lst))))
(setcdr lst (cdr (cdr lst))))))
(pop lst))
alist)
(let ((p alist) lst elt)
(while p
(push p lst)
(setq p (cdr p)))
(setq lst (sort lst (lambda(a b) (string< (car (car a))
(car (car b))))))
(while (cdr lst)
(setq elt (car (car (car lst))))
(when (string= elt (car (car (cadr lst))))
(while (and keep-list (string< (car keep-list) elt))
(pop keep-list))
(if (and keep-list (string= elt (car keep-list)))
(progn
(pop lst)
(while (and (cdr lst)
(string= elt (car (car (cadr lst)))))
(pop lst)))
(setcar (pop lst) nil)
(while (and (cdr lst)
(string= elt (car (car (cadr lst)))))
(setcar (pop lst) nil))))
(pop lst)))
(delq nil alist)))
(defun reftex-remove-if (predicate list)
"Nondestructively remove all items from LIST which satisfy PREDICATE."
(let (result)
(dolist (elt list (nreverse result))
(unless (funcall predicate elt)
(push elt result)))))
(defun reftex-abbreviate-title (string) (defun reftex-abbreviate-title (string)
(reftex-convert-string string "[-~ \t\n\r,;]" nil t t (reftex-convert-string string "[-~ \t\n\r,;]" nil t t
@ -2243,6 +2113,7 @@ IGNORE-WORDS List of words which should be removed from the string."
((= (length text) 0) (make-string 1 ?\ )) ((= (length text) 0) (make-string 1 ?\ ))
(t text))) (t text)))
;;; ========================================================================= ;;; =========================================================================
;;; ;;;
;;; Fontification and Highlighting ;;; Fontification and Highlighting
@ -2390,28 +2261,20 @@ IGNORE-WORDS List of words which should be removed from the string."
"bibtex" "bibtex"
'(define-key bibtex-mode-map "\C-c&" 'reftex-view-crossref-from-bibtex)) '(define-key bibtex-mode-map "\C-c&" 'reftex-view-crossref-from-bibtex))
;; If the user requests so, she can have a few more bindings:
;; For most of these commands there are already bindings in place. ;; For most of these commands there are already bindings in place.
;; Setting `reftex-extra-bindings' really is only there to spare users ;; Setting `reftex-extra-bindings' really is only there to spare users
;; the hassle of defining bindings in the user space themselves. This ;; the hassle of defining bindings in the user space themselves. This
;; is why they violate the key binding recommendations. ;; is why they violate the key binding recommendations.
(defvar reftex-extra-bindings-map
(let ((map (make-sparse-keymap)))
(define-key map "t" 'reftex-toc)
(define-key map "l" 'reftex-label)
(define-key map "r" 'reftex-reference)
(define-key map "c" 'reftex-citation)
(define-key map "v" 'reftex-view-crossref)
(define-key map "g" 'reftex-grep-document)
(define-key map "s" 'reftex-search-document)
map)
"Reftex extra bindings map")
(when reftex-extra-bindings (when reftex-extra-bindings
(define-key reftex-mode-map (loop for x in
reftex-extra-bindings-prefix '(("\C-ct" . reftex-toc)
reftex-extra-bindings-map)) ("\C-cl" . reftex-label)
("\C-cr" . reftex-reference)
("\C-cc" . reftex-citation)
("\C-cv" . reftex-view-crossref)
("\C-cg" . reftex-grep-document)
("\C-cs" . reftex-search-document))
do (define-key reftex-mode-map (car x) (cdr x))))
;;; ========================================================================= ;;; =========================================================================
;;; ;;;
@ -2488,21 +2351,22 @@ IGNORE-WORDS List of words which should be removed from the string."
:style radio :selected (eq reftex-auto-view-crossref 'window)] :style radio :selected (eq reftex-auto-view-crossref 'window)]
"--" "--"
"MISC" "MISC"
["AUC TeX Interface" reftex-toggle-plug-into-AUCTeX ["AUCTeX Interface" reftex-toggle-plug-into-AUCTeX
:style toggle :selected reftex-plug-into-AUCTeX] :style toggle :selected reftex-plug-into-AUCTeX]
["isearch whole document" reftex-isearch-minor-mode ["isearch whole document" reftex-isearch-minor-mode
:style toggle :selected reftex-isearch-minor-mode]) :style toggle :selected reftex-isearch-minor-mode])
("Reference Style" ("Reference Style"
["Default" (setq reftex-vref-is-default nil ,@(let (list item)
reftex-fref-is-default nil) (dolist (elt reftex-ref-style-alist)
:style radio :selected (not (or reftex-vref-is-default (setq elt (car elt)
reftex-fref-is-default))] item (vector
["Varioref" (setq reftex-vref-is-default t elt
reftex-fref-is-default nil) `(reftex-ref-style-toggle ,elt)
:style radio :selected reftex-vref-is-default] :style 'toggle
["Fancyref" (setq reftex-fref-is-default t :selected `(member ,elt (reftex-ref-style-list))))
reftex-vref-is-default nil) (unless (member item list)
:style radio :selected reftex-fref-is-default]) (add-to-list 'list item t)))
list))
("Citation Style" ("Citation Style"
,@(mapcar ,@(mapcar
(lambda (x) (lambda (x)
@ -2568,6 +2432,9 @@ IGNORE-WORDS List of words which should be removed from the string."
(message "\"Ref\"-menu now contains full customization menu")) (message "\"Ref\"-menu now contains full customization menu"))
(error "Cannot expand menu (outdated version of cus-edit.el)"))) (error "Cannot expand menu (outdated version of cus-edit.el)")))
;;; Misc
(defun reftex-show-commentary () (defun reftex-show-commentary ()
"Use the finder to view the file documentation from `reftex.el'." "Use the finder to view the file documentation from `reftex.el'."
(interactive) (interactive)
@ -2579,6 +2446,36 @@ With optional NODE, go directly to that node."
(interactive) (interactive)
(info (format "(reftex)%s" (or node "")))) (info (format "(reftex)%s" (or node ""))))
(defun reftex-report-bug ()
"Report a bug in RefTeX.
Don't hesitate to report any problems or inaccurate documentation.
If you don't have setup sending mail from (X)Emacs, please copy the
output buffer into your mail program, as it gives us important
information about your RefTeX version and configuration."
(interactive)
(require 'reporter)
(let ((reporter-prompt-for-summary-p "Bug report subject: "))
(reporter-submit-bug-report
"bug-auctex@gnu.org"
reftex-version
(list 'window-system
'reftex-plug-into-AUCTeX)
nil nil
"Remember to cover the basics, that is, what you expected to happen and
what in fact did happen.
Check if the bug is reproducable with an up-to-date version of
RefTeX available from http://www.gnu.org/software/auctex/.
If the bug is triggered by a specific \(La\)TeX file, you should try
to produce a minimal sample file showing the problem and include it
in your report.
Your bug report will be posted to the AUCTeX bug reporting list.
------------------------------------------------------------------------")))
;;; Install the kill-buffer and kill-emacs hooks ------------------------------ ;;; Install the kill-buffer and kill-emacs hooks ------------------------------
(add-hook 'kill-buffer-hook 'reftex-kill-buffer-hook) (add-hook 'kill-buffer-hook 'reftex-kill-buffer-hook)
@ -2594,6 +2491,4 @@ With optional NODE, go directly to that node."
(setq reftex-tables-dirty t) ; in case this file is evaluated by hand (setq reftex-tables-dirty t) ; in case this file is evaluated by hand
(provide 'reftex) (provide 'reftex)
;;;============================================================================
;;; reftex.el ends here ;;; reftex.el ends here