summaryrefslogtreecommitdiff
path: root/lisp/textmodes
diff options
context:
space:
mode:
authorTassilo Horn <tsdh@gnu.org>2013-11-01 11:27:21 +0100
committerTassilo Horn <tsdh@gnu.org>2013-11-01 11:27:21 +0100
commit9bc236c8263bc81f1b540579a9f98d872ab2da46 (patch)
treefd1de8e04bc968ab5024963c0007555ee5f63109 /lisp/textmodes
parent82bd64d838c7e5c0b2243b2499bd5053e2741a71 (diff)
downloademacs-9bc236c8263bc81f1b540579a9f98d872ab2da46.tar.gz
Allow multiple bibliographies when BibLaTeX is used rathen than
BibTeX. * textmodes/reftex-parse.el (reftex-using-biblatex-p): New function. (reftex-locate-bibliography-files): Us it.
Diffstat (limited to 'lisp/textmodes')
-rw-r--r--lisp/textmodes/reftex-parse.el38
1 files changed, 28 insertions, 10 deletions
diff --git a/lisp/textmodes/reftex-parse.el b/lisp/textmodes/reftex-parse.el
index a99791e5427..ffabb134c83 100644
--- a/lisp/textmodes/reftex-parse.el
+++ b/lisp/textmodes/reftex-parse.el
@@ -350,20 +350,38 @@ of master file."
;; Return the list
docstruct))
+(defun reftex-using-biblatex-p ()
+ "Return non-nil iff we are using biblatex rather than bibtex."
+ (if (boundp 'TeX-active-styles)
+ ;; the sophisticated AUCTeX way
+ (member "biblatex" TeX-active-styles)
+ ;; poor-man's check...
+ (save-excursion
+ (re-search-forward "^[^%]*\\\\usepackage.*{biblatex}" nil t))))
+
(defun reftex-locate-bibliography-files (master-dir &optional files)
- "Scan buffer for bibliography macro and return file list."
+ "Scan buffer for bibliography macros and return file list."
(unless files
(save-excursion
(goto-char (point-min))
- (if (re-search-forward
- (concat
-; "\\(\\`\\|[\n\r]\\)[^%]*\\\\\\("
- "\\(^\\)[^%\n\r]*\\\\\\("
- (mapconcat 'identity reftex-bibliography-commands "\\|")
- "\\)\\(\\[.+?\\]\\)?{[ \t]*\\([^}]+\\)") nil t)
- (setq files
- (split-string (reftex-match-string 4)
- "[ \t\n\r]*,[ \t\n\r]*")))))
+ ;; when biblatex is used, multiple \bibliography or
+ ;; \addbibresource macros are allowed. With plain bibtex, only
+ ;; the first is used.
+ (let ((using-biblatex (reftex-using-biblatex-p))
+ (again t))
+ (while (and again
+ (re-search-forward
+ (concat
+ ;; "\\(\\`\\|[\n\r]\\)[^%]*\\\\\\("
+ "\\(^\\)[^%\n\r]*\\\\\\("
+ (mapconcat 'identity reftex-bibliography-commands "\\|")
+ "\\)\\(\\[.+?\\]\\)?{[ \t]*\\([^}]+\\)") nil t))
+ (setq files
+ (append files
+ (split-string (reftex-match-string 4)
+ "[ \t\n\r]*,[ \t\n\r]*")))
+ (unless using-biblatex
+ (setq again nil))))))
(when files
(setq files
(mapcar