emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r114894: Allow multiple bibliographies when BibLaTeX


From: Tassilo Horn
Subject: [Emacs-diffs] trunk r114894: Allow multiple bibliographies when BibLaTeX is used rathen than
Date: Fri, 01 Nov 2013 10:28:02 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 114894
revision-id: address@hidden
parent: address@hidden
committer: Tassilo Horn <address@hidden>
branch nick: trunk
timestamp: Fri 2013-11-01 11:27:21 +0100
message:
  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.
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/textmodes/reftex-parse.el 
reftexparse.el-20091113204419-o5vbwnq5f7feedwu-1334
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-11-01 09:10:13 +0000
+++ b/lisp/ChangeLog    2013-11-01 10:27:21 +0000
@@ -1,3 +1,10 @@
+2013-11-01  Tassilo Horn  <address@hidden>
+
+       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  <address@hidden>
 
        * image.el (image-type-header-regexps): Fix the 'pbm' part to

=== modified file 'lisp/textmodes/reftex-parse.el'
--- a/lisp/textmodes/reftex-parse.el    2013-06-12 12:42:35 +0000
+++ b/lisp/textmodes/reftex-parse.el    2013-11-01 10:27:21 +0000
@@ -350,20 +350,38 @@
     ;; 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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]