CVSROOT: /sources/auctex Module name: auctex Changes by: Tassilo Horn <tsdh> 12/09/13 10:14:19
Index: latex.el =================================================================== RCS file: /sources/auctex/auctex/latex.el,v retrieving revision 5.470 retrieving revision 5.471 diff -u -b -r5.470 -r5.471 --- latex.el 7 Aug 2011 15:32:42 -0000 5.470 +++ latex.el 13 Sep 2012 10:14:18 -0000 5.471 @@ -1212,13 +1212,37 @@ (, (concat "\\\\bibitem{\\(" token "[^, \n\r\t%\"#'()={}]*\\)}") 1 LaTeX-auto-bibitem) (, (concat "\\\\bibitem\\[[^][\n\r]+\\]{\\(" token "[^, \n\r\t%\"#'()={}]*\\)}") 1 LaTeX-auto-bibitem) - ("\\\\bibliography{\\([^#}\\\\\n\r]+\\)}" 1 LaTeX-auto-bibliography))) + ("\\\\bibliography{\\([^#}\\\\\n\r]+\\)}" 1 LaTeX-auto-bibliography) + ("\\\\addbibresource\\(?:\\[[^]]+\\]\\)?{\\([^#}\\\\\n\r\.]+\\)\\..+}" 1 LaTeX-auto-bibliography) + ("\\\\add\\(?:global\\|section\\)bib\\(?:\\[[^]]+\\]\\)?{\\([^#}\\\\\n\r\.]+\\)\\(?:\\..+\\)?}" 1 LaTeX-auto-bibliography) + ("\\\\newrefsection\\[\\([^]]+\\)\\]" 1 LaTeX-split-bibs) + ("\\\\begin{refsection}\\[\\([^]]+\\)\\]" 1 LaTeX-split-bibs) + ("backend=\\(biber\\)" 1 LaTeX-biber) + ("\\\\ExecuteBibliographyOptions\\(?:\\[[^]]+\\]\\)?{.*?backend=\\(biber\\)}" 1 LaTeX-using-Biber))) LaTeX-auto-class-regexp-list LaTeX-auto-label-regexp-list LaTeX-auto-index-regexp-list LaTeX-auto-minimal-regexp-list) "List of regular expression matching common LaTeX macro definitions.") +;; Either the user has set a global use biber flag or we detect it from the file +(defun LaTeX-biber (match) + (if (or LaTeX-always-use-Biber + (string= "biber" (TeX-match-buffer match))) + (setq LaTeX-using-Biber t) + (setq LaTeX-using-Biber nil))) + +(defun LaTeX-split-bibs (match) + (let ((bibs (TeX-split-string " *, *" (TeX-match-buffer match)))) + (dolist (bib bibs) + (LaTeX-add-bibliographies (replace-regexp-in-string + (concat "\\(?:\\." + (mapconcat 'regexp-quote + BibTeX-Biber-file-extensions + "\\|\\.") + "\\)") + "" bib))))) + (defun LaTeX-auto-prepare () "Prepare for LaTeX parsing." (setq LaTeX-auto-arguments nil @@ -1248,7 +1272,7 @@ (defun LaTeX-auto-cleanup () "Cleanup after LaTeX parsing." - ;; Cleanup BibTeX files + ;; Cleanup BibTeX/Biber files (setq LaTeX-auto-bibliography (apply 'append (mapcar (lambda (arg) (TeX-split-string "," arg)) @@ -1384,6 +1408,12 @@ (setq LaTeX-environment-menu nil) (setq LaTeX-environment-modify-menu nil)) +;;; Biber support +;;; Need a variable to say if we're using biber - certain things need consitionalising on this + +(defvar LaTeX-using-Biber nil "Used to track whether we detected Biber in use") +(defvar LaTeX-always-use-Biber nil "Global override for biber usage") + ;;; BibTeX ;;;###autoload @@ -1679,7 +1709,7 @@ TeX-file-extensions) (docs "${TEXDOCS}" ("doc/") TeX-doc-extensions) (graphics "${TEXINPUTS}" ("tex/") LaTeX-includegraphics-extensions) - (bibinputs "${BIBINPUTS}" ("bibtex/bib/") BibTeX-file-extensions) + (bibinputs "${BIBINPUTS}" ("bibtex/bib/") BibTeX-Biber-file-extensions) (bstinputs "${BSTINPUTS}" ("bibtex/bst/") BibTeX-style-extensions)) "Alist of filetypes with locations and file extensions. Each element of the alist consists of a symbol expressing the @@ -1777,27 +1807,27 @@ BibTeX-global-style-files)) optional)) -(defvar BibTeX-global-files nil - "Association list of BibTeX files. +(defvar BibTeX-Biber-global-files nil + "Association list of BibTeX/Biber files. -Initialized once at the first time you prompt for an BibTeX file. +Initialized once at the first time you prompt for an BibTeX/Biber file. May be reset with `\\[universal-argument] \\[TeX-normal-mode]'.") (defun TeX-arg-bibliography (optional &optional prompt) - "Prompt for a BibTeX database file. + "Prompt for a BibTeX/Biber database file. If OPTIONAL is non-nil, insert the resulting value as an optional argument, otherwise as a mandatory one. Use PROMPT as the prompt string." - (message "Searching for BibTeX files...") - (or BibTeX-global-files - (setq BibTeX-global-files + (message "Searching for BibTeX/Biber files...") + (or BibTeX-Biber-global-files + (setq BibTeX-Biber-global-files (mapcar 'list (TeX-search-files-by-type 'bibinputs 'global t t)))) (let ((styles (multi-prompt "," t - (TeX-argument-prompt optional prompt "BibTeX files") + (TeX-argument-prompt optional prompt "BibTeX/Biber files") (append (mapcar 'list (TeX-search-files-by-type 'bibinputs 'local t t)) - BibTeX-global-files)))) + BibTeX-Biber-global-files)))) (apply 'LaTeX-add-bibliographies styles) (TeX-argument-insert (mapconcat 'identity styles ",") optional))) @@ -5260,6 +5290,7 @@ '("nocite" TeX-arg-cite) '("bibliographystyle" TeX-arg-bibstyle) '("bibliography" TeX-arg-bibliography) + '("addbibresource" TeX-arg-bibliography) '("footnote" (TeX-arg-conditional TeX-arg-footnote-number-p ([ "Number" ]) nil) t) _______________________________________________ auctex-diffs mailing list auctex-di...@gnu.org https://lists.gnu.org/mailman/listinfo/auctex-diffs