diff options
author | Arash Esbati <arash@gnu.org> | 2022-05-02 14:31:19 +0200 |
---|---|---|
committer | Arash Esbati <arash@gnu.org> | 2022-05-02 14:31:19 +0200 |
commit | 7f81470250589dd0ca4b024a315c0103fce9bf84 (patch) | |
tree | 03c42c3ff7fa3bc3fe47c289d18f16274c338ec7 | |
parent | 7bf17ceee8c2d347917541e143ce25609e90ebbb (diff) | |
download | emacs-7f81470250589dd0ca4b024a315c0103fce9bf84.tar.gz |
Load multiple bibliographies with multibib package
* lisp/textmodes/reftex-parse.el (reftex-using-biblatex-p):
Recognize 'multibib' which allows multiple bibliography loading
macro calls.
(reftex-locate-bibliography-files): Prevent possible duplications
in bibliography database files.
-rw-r--r-- | lisp/textmodes/reftex-parse.el | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/lisp/textmodes/reftex-parse.el b/lisp/textmodes/reftex-parse.el index 016c9cf3990..bae455dd4d3 100644 --- a/lisp/textmodes/reftex-parse.el +++ b/lisp/textmodes/reftex-parse.el @@ -370,13 +370,18 @@ of master file." docstruct)) (defun reftex-using-biblatex-p () - "Return non-nil if we are using biblatex rather than bibtex." + "Return non-nil if we are using biblatex or other specific cite package. +biblatex and other packages like multibib allow multiple macro +calls to load a bibliography file. This packages should be +detected by this function." (if (boundp 'TeX-active-styles) ;; the sophisticated AUCTeX way - (member "biblatex" TeX-active-styles) + (or (member "biblatex" TeX-active-styles) + (member "multibib" TeX-active-styles)) ;; poor-man's check... (save-excursion - (re-search-forward "^[^%\n]*?\\\\usepackage.*{biblatex}" nil t)))) + (re-search-forward + "^[^%\n]*?\\\\usepackage\\(\\[[^]]*\\]\\)?{biblatex\\|multibib}" nil t)))) ;;;###autoload (defun reftex-locate-bibliography-files (master-dir &optional files) @@ -384,7 +389,7 @@ of master file." (unless files (save-excursion (goto-char (point-min)) - ;; when biblatex is used, multiple \bibliography or + ;; when biblatex or multibib are used, multiple \bibliography or ;; \addbibresource macros are allowed. With plain bibtex, only ;; the first is used. (let ((using-biblatex (reftex-using-biblatex-p)) @@ -392,7 +397,7 @@ of master file." (while (and again (re-search-forward (concat - ;; "\\(\\`\\|[\n\r]\\)[^%]*\\\\\\(" + ;; "\\(\\`\\|[\n\r]\\)[^%]*\\\\\\(" "\\(^\\)[^%\n\r]*\\\\\\(" (mapconcat #'identity reftex-bibliography-commands "\\|") "\\)\\(\\[.+?\\]\\)?{[ \t]*\\([^}]+\\)") @@ -415,7 +420,7 @@ of master file." ;; find the file (reftex-locate-file x "bib" master-dir))) files)) - (delq nil files))) + (delq nil (delete-dups files)))) (defun reftex-replace-label-list-segment (old insert &optional entirely) "Replace the segment in OLD which corresponds to INSERT. |