]> git.eshelyaron.com Git - emacs.git/commitdiff
Allow multiple bibliographies when BibLaTeX is used rathen than
authorTassilo Horn <tsdh@gnu.org>
Fri, 1 Nov 2013 10:27:21 +0000 (11:27 +0100)
committerTassilo Horn <tsdh@gnu.org>
Fri, 1 Nov 2013 10:27:21 +0000 (11:27 +0100)
BibTeX.
* textmodes/reftex-parse.el (reftex-using-biblatex-p): New function.
(reftex-locate-bibliography-files): Us it.

lisp/ChangeLog
lisp/textmodes/reftex-parse.el

index fd8e77c9c5389f9982ef89e7fe55f3bbc43c8598..1493945af383298254abec58a234299c59ae87a4 100644 (file)
@@ -1,3 +1,10 @@
+2013-11-01  Tassilo Horn  <tsdh@gnu.org>
+
+       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.
+
 2013-11-01  Claudio Bley  <claudio.bley@googlemail.com>
 
        * image.el (image-type-header-regexps): Fix the 'pbm' part to
index a99791e5427c1dafeaaad99917a44380cb23656c..ffabb134c83a4f78aa3c9db777551ddd8e530bf3 100644 (file)
@@ -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