branch: externals/auctex commit b2f69e18ba103bf4ca42cd9bd9f6a4536688d242 Author: Mosè Giordano <m...@gnu.org> Commit: Mosè Giordano <m...@gnu.org>
Fix detection of bibliography files with dots in path * latex.el (LaTeX-auto-regexp-list): Remove dot from the list of excluded characters in addbibresource's regexp. * tests/latex/latex-test.el (LaTeX-addbibresource): New test for addbibresource. --- latex.el | 2 +- tests/latex/latex-test.el | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/latex.el b/latex.el index 5a699f8..a82a136 100644 --- a/latex.el +++ b/latex.el @@ -1607,7 +1607,7 @@ This is necessary since index entries may contain commands and stuff.") (, (concat "\\\\bibitem\\[[^][\n\r]+\\]{\\(" token "[^, \n\r\t%\"#'()={}]*\\)}") 1 LaTeX-auto-bibitem) ("\\\\bibliography{\\([^#}\\\\\n\r]+\\)}" 1 LaTeX-auto-bibliography) - ("\\\\addbibresource\\(?:\\[[^]]+\\]\\)?{\\([^#}\\\\\n\r\.]+\\)\\..+}" + ("\\\\addbibresource\\(?:\\[[^]]+\\]\\)?{\\([^#}\\\\\n\r]+\\)\\..+}" 1 LaTeX-auto-bibliography) ("\\\\add\\(?:global\\|section\\)bib\\(?:\\[[^]]+\\]\\)?{\\([^#}\\\\\n\r\.]+\\)\\(?:\\..+\\)?}" 1 LaTeX-auto-bibliography) ("\\\\newrefsection\\[\\([^]]+\\)\\]" 1 LaTeX-split-bibs) diff --git a/tests/latex/latex-test.el b/tests/latex/latex-test.el index 69939cf..02b1894 100644 --- a/tests/latex/latex-test.el +++ b/tests/latex/latex-test.el @@ -1,6 +1,6 @@ ;;; latex-test.el --- tests for LaTeX mode -;; Copyright (C) 2014--2016 Free Software Foundation, Inc. +;; Copyright (C) 2014--2017 Free Software Foundation, Inc. ;; This file is part of AUCTeX. @@ -141,4 +141,19 @@ line and from another directory." (LaTeX-mode) (buffer-string))))) +(ert-deftest LaTeX-addbibresource () + "Check parsing of bibliography files added with addbibresource. + +In particular, make sure dots are treated correctly and only the +last extension is stripped." + (should + (equal + (with-temp-buffer + (insert "\\addbibresource{../foo-1.bar_2.qux3.ext}") + (LaTeX-mode) + (let ((TeX-parse-self t)) + (TeX-update-style t)) + (LaTeX-bibliography-list)) + '(("../foo-1.bar_2.qux3"))))) + ;;; latex-test.el ends here