lisp/ox-latex.el: fix `org-latex-guess-babel-language'

* (org-latex-guess-babel-language): If the user puts a string other
than AUTO as an argument to `\babelprovide', it gives an error when
exporting. For example:

`#+LaTeX_Header: \babelprovide[onchar=ids,import]{hebrew}'
This commit is contained in:
Juan Manuel Macias 2022-11-14 23:33:16 +01:00 committed by Ihor Radchenko
parent 9e62aaf5e4
commit fcf63fb31e
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
1 changed files with 7 additions and 6 deletions

View File

@ -1669,12 +1669,13 @@ Return the new header."
(if (not (string-match "\\\\babelprovide\\[.*\\]{\\(.+\\)}" header))
header
(let ((prov (match-string 1 header)))
(when (equal "AUTO" prov)
(replace-regexp-in-string (format
"\\(\\\\babelprovide\\[.*\\]\\)\\({\\)%s}" prov)
(format "\\1\\2%s}"
(or language language-ini-only))
header t))))))
(if (equal "AUTO" prov)
(replace-regexp-in-string (format
"\\(\\\\babelprovide\\[.*\\]\\)\\({\\)%s}" prov)
(format "\\1\\2%s}"
(or language language-ini-only))
header t)
header)))))
(defun org-latex-guess-polyglossia-language (header info)
"Set the Polyglossia language according to the LANGUAGE keyword.