monnier pushed a commit to branch externals/auctex in repository elpa. commit 5fe7e5953fa9e7285affa0c2c3169e8dbb1d75ce Author: Tassilo Horn <t...@gnu.org> Date: Thu Mar 28 08:31:11 2013 +0000
* style/biblatex.el (LaTeX-biblatex-addbibresource-options): New variable. (LaTeX-arg-addbibresource): New function, based on current `TeX-arg-bibliography'. ("biblatex"): Add `addbibresource' macro. (LaTeX-biblatex-package-options): Use `TeX-read-key-val'. * latex.el (TeX-arg-bibliography): Remove `addbibresource' support. --- ChangeLog | 12 ++++++++++++ latex.el | 31 +++++++++++-------------------- style/biblatex.el | 44 +++++++++++++++++++++++++++++++++++++------- 3 files changed, 60 insertions(+), 27 deletions(-) diff --git a/ChangeLog b/ChangeLog index 897e913..d9cdd47 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2013-03-28 Mos� Giordano <giordano.m...@libero.it> + + * style/biblatex.el (LaTeX-biblatex-addbibresource-options): New + variable. + (LaTeX-arg-addbibresource): New function, based on current + `TeX-arg-bibliography'. + ("biblatex"): Add `addbibresource' macro. + (LaTeX-biblatex-package-options): Use `TeX-read-key-val'. + + * latex.el (TeX-arg-bibliography): Remove `addbibresource' + support. + 2013-03-27 Mos� Giordano <giordano.m...@libero.it> * tex.el (TeX-add-local-master): Remove trailing spaces from diff --git a/latex.el b/latex.el index 961e921..d34e465 100644 --- a/latex.el +++ b/latex.el @@ -1921,29 +1921,20 @@ Initialized once at the first time you prompt for an Biber file. May be reset with `\\[universal-argument] \\[TeX-normal-mode]'.") (defun TeX-arg-bibliography (optional &optional prompt) - "Prompt for a BibTeX or Biber database file. + "Prompt for a BibTeX 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." - (let (name files inputs styles) - (if LaTeX-using-Biber - (progn - (setq name "Biber" - files 'TeX-Biber-global-files - inputs 'biberinputs)) - (setq name "BibTeX" - files 'BibTeX-global-files - inputs 'bibinputs)) - (message "Searching for %s files..." name) - (or (symbol-value files) - (set files (mapcar 'list (TeX-search-files-by-type - 'biberinputs 'global t t)))) - (setq styles (multi-prompt - "," t - (TeX-argument-prompt optional prompt (concat name " files")) - (append (mapcar 'list (TeX-search-files-by-type - inputs 'local t t)) - (symbol-value files)))) + (message "Searching for BibTeX files...") + (or BibTeX-global-files + (setq BibTeX-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") + (append (mapcar 'list (TeX-search-files-by-type + 'bibinputs 'local t t)) + BibTeX-global-files)))) (apply 'LaTeX-add-bibliographies styles) (TeX-argument-insert (mapconcat 'identity styles ",") optional))) diff --git a/style/biblatex.el b/style/biblatex.el index cb5c138..98cb703 100644 --- a/style/biblatex.el +++ b/style/biblatex.el @@ -30,6 +30,38 @@ ;;; Code: +(defvar LaTeX-biblatex-addbibresource-options + '(("label") + ("location" ("local" "remote")) + ("type" ("file")) + ("datatype" ("bibtex" "ris" "zoterordfxml" "endnotexml"))) + "Key=value options for addbibresource macro of the biblatex package.") + +(defun LaTeX-arg-addbibresource (optional &optional prompt) + "Prompt for a BibLaTeX 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." + (let (files inputs database) + (if LaTeX-using-Biber + (setq files 'TeX-Biber-global-files + inputs 'biberinputs) + (setq files 'BibTeX-global-files + inputs 'bibinputs)) + (setq files 'TeX-Biber-global-files + inputs 'biberinputs) + (message "Searching for BibLaTeX files...") + (or (symbol-value files) + (set files (mapcar 'list (TeX-search-files-by-type + 'biberinputs 'global t nil)))) + (setq database (completing-read + (TeX-argument-prompt optional prompt "BibLaTeX files") + (append (mapcar 'list (TeX-search-files-by-type + inputs 'local t nil)) + (symbol-value files)))) + (LaTeX-add-bibliographies database) + (TeX-argument-insert database optional))) + (TeX-add-style-hook "biblatex" (lambda () @@ -46,7 +78,10 @@ "kvoptions" "logreq" "ifthen" - "url"))) + "url") + (TeX-add-symbols + '("addbibresource" [TeX-arg-key-val LaTeX-biblatex-addbibresource-options] + LaTeX-arg-addbibresource)))) (defvar LaTeX-biblatex-package-options-list '(;;; Load-time Options @@ -167,11 +202,6 @@ "authortitle-tcomp" "authortitle-ticomp" "verbose" "verbose-ibid" "verbose-note" "verbose-inote" "verbose-trad1" "verbose-trad2" "verbose-trad3" "reading" "draft" "debug")))) - ;; Can't use directly `TeX-arg-key-val' because that would insert an empty - ;; `[]' after `\usepackage' when `options' is empty. - (let ((options (multi-prompt-key-value - (TeX-argument-prompt optional "Options (k=v)" nil) - LaTeX-biblatex-package-options-list))) - options)) + (TeX-read-key-val t LaTeX-biblatex-package-options)) ;;; biblatex.el ends here