From 20cd3579bd4252ccb091ce0b73c3fa6c8806fbd7 Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Tue, 20 Aug 2002 10:42:52 +0000 Subject: [PATCH] Update to RefTeX 4.18 --- lisp/ChangeLog | 14 +++++++++++++ lisp/textmodes/reftex-cite.el | 38 +++++++++++++++++++++++++++++------ lisp/textmodes/reftex-dcr.el | 9 ++++++--- lisp/textmodes/reftex.el | 2 +- 4 files changed, 53 insertions(+), 10 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c95de2c48ec..82540e6539b 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,17 @@ +2002-08-20 Carsten Dominik + + * textfiles/reftex-cite.el (reftex-bib-or-thebib): New function + which determines on a per-file-basis if BibTeX is being used + locally for citations. + (reftex-offer-bib-menu): Use `reftex-bib-or-thebib' for better + cooperation with chapterbib. + (reftex-bibtex-selection-callback): Use `reftex-bib-or-thebib' for + better cooperation with chapterbib. + + * textfiles/reftex-dcr.el (reftex-view-cr-cite): Use + `reftex-bib-or-thebib' for better cooperation with chapterbib. + + 2002-08-20 Kim F. Storm * kmacro.el: Major rework based on discussions with RMS. diff --git a/lisp/textmodes/reftex-cite.el b/lisp/textmodes/reftex-cite.el index 39d8f26a9a6..d4d5b508eef 100644 --- a/lisp/textmodes/reftex-cite.el +++ b/lisp/textmodes/reftex-cite.el @@ -74,6 +74,26 @@ reftex-default-bibliography)) (get 'reftex-default-bibliography :reftex-expanded)) +(defun reftex-bib-or-thebib () + ;; Tests if BibTeX or \begin{tehbibliography} should be used for the + ;; citation + ;; Find the bof of the current file + (let* ((docstruct (symbol-value reftex-docstruct-symbol)) + (rest (or (member (list 'bof (buffer-file-name)) docstruct) + docstruct)) + (bib (assq 'bib rest)) + (thebib (assq 'thebib rest)) + (bibmem (memq bib rest)) + (thebibmem (memq thebib rest))) + (when (not (or thebib bib)) + (setq bib (assq 'bib docstruct) + thebib (assq 'thebib docstruct) + bibmem (memq bib docstruct) + thebibmem (memq thebib docstruct))) + (if (> (length bibmem) (length thebibmem)) + (if bib 'bib nil) + (if thebib 'thebib nil)))) + (defun reftex-get-bibfile-list () ;; Return list of bibfiles for current document. ;; When using the chapterbib or bibunits package you should either @@ -736,17 +756,20 @@ While entering the regexp, completion on knows citation keys is possible. (defun reftex-offer-bib-menu () ;; Offer bib menu and return list of selected items - (let (found-list rtn key data selected-entries) + (let ((bibtype (reftex-bib-or-thebib)) + found-list rtn key data selected-entries) (while (not (catch 'done ;; Scan bibtex files (setq found-list (cond - ((assq 'bib (symbol-value reftex-docstruct-symbol)) + ((eq bibtype 'bib) +; ((assq 'bib (symbol-value reftex-docstruct-symbol)) ;; using BibTeX database files. (reftex-extract-bib-entries (reftex-get-bibfile-list))) - ((assq 'thebib (symbol-value reftex-docstruct-symbol)) + ((eq bibtype 'thebib) +; ((assq 'thebib (symbol-value reftex-docstruct-symbol)) ;; using thebibliography environment. (reftex-extract-bib-entries-from-thebibliography (reftex-uniquify @@ -987,15 +1010,18 @@ While entering the regexp, completion on knows citation keys is possible. ;; recommended for follow mode. It works OK for individual lookups. (let ((win (selected-window)) (key (reftex-get-bib-field "&key" data)) - bibfile-list item) + bibfile-list item bibtype) (catch 'exit (save-excursion (set-buffer reftex-call-back-to-this-buffer) + (setq bibtype (reftex-bib-or-thebib)) (cond - ((assq 'bib (symbol-value reftex-docstruct-symbol)) + ((eq bibtype 'bib) +; ((assq 'bib (symbol-value reftex-docstruct-symbol)) (setq bibfile-list (reftex-get-bibfile-list))) - ((assq 'thebib (symbol-value reftex-docstruct-symbol)) + ((eq bibtype 'thebib) +; ((assq 'thebib (symbol-value reftex-docstruct-symbol)) (setq bibfile-list (reftex-uniquify (mapcar 'cdr diff --git a/lisp/textmodes/reftex-dcr.el b/lisp/textmodes/reftex-dcr.el index d7419ad49cc..6f9577473d4 100644 --- a/lisp/textmodes/reftex-dcr.el +++ b/lisp/textmodes/reftex-dcr.el @@ -116,13 +116,16 @@ to the functions `reftex-view-cr-cite' and `reftex-view-cr-ref'." (put 'reftex-auto-view-crossref 'last-window-conf (current-window-configuration))) - (let (files size item (pos (point)) (win (selected-window)) pop-win) + (let (files size item (pos (point)) (win (selected-window)) pop-win + (bibtype (reftex-bib-or-thebib))) ;; Find the citation mode and the file list (cond - ((assq 'bib (symbol-value reftex-docstruct-symbol)) +; ((assq 'bib (symbol-value reftex-docstruct-symbol)) + ((eq bibtype 'bib) (setq item nil files (reftex-get-bibfile-list))) - ((assq 'thebib (symbol-value reftex-docstruct-symbol)) +; ((assq 'thebib (symbol-value reftex-docstruct-symbol)) + ((eq bibtype 'thebib) (setq item t files (reftex-uniquify (mapcar 'cdr diff --git a/lisp/textmodes/reftex.el b/lisp/textmodes/reftex.el index c99551fbad2..877352d4f2e 100644 --- a/lisp/textmodes/reftex.el +++ b/lisp/textmodes/reftex.el @@ -1665,7 +1665,7 @@ When DIE is non-nil, throw an error if file not found." (autoload 'reftex-citation "reftex-cite" "Make a citation using BibTeX database files." t) (autoload 'reftex-default-bibliography "reftex-cite") - +(autoload 'reftex-bib-or-thebib "reftex-cite") ;;; ========================================================================= ;;; -- 2.39.5