summaryrefslogtreecommitdiff
path: root/lisp/textmodes/reftex-cite.el
diff options
context:
space:
mode:
authorCarsten Dominik <dominik@science.uva.nl>2002-08-20 10:42:52 +0000
committerCarsten Dominik <dominik@science.uva.nl>2002-08-20 10:42:52 +0000
commit20cd3579bd4252ccb091ce0b73c3fa6c8806fbd7 (patch)
tree7bdbae404ace7b8588e972df3ddc89549ae27849 /lisp/textmodes/reftex-cite.el
parentbcaf8c79fbbde692f256fa2aef2dc2a78f25a44b (diff)
downloademacs-20cd3579bd4252ccb091ce0b73c3fa6c8806fbd7.tar.gz
Update to RefTeX 4.18
Diffstat (limited to 'lisp/textmodes/reftex-cite.el')
-rw-r--r--lisp/textmodes/reftex-cite.el38
1 files changed, 32 insertions, 6 deletions
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