1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-11-24 07:20:29 +00:00

org-bibtex-yank: Fix bibtex parser not initialized in temp buffer

* lisp/ol-bibtex.el (org-bibtex-yank): Make sure that we parse bibtex
entry from the kill ring in a `bibtex-mode' buffer.  Otherwise,
calling `org-bibtex-read' (that calls `bibtex-parse-entry') may err
because some Bibtex parser variables are not initialized.

Reported-by: J. G. <jerzor@pacbell.net>
Link: https://orgmode.org/list/1939460027.3272000.1691771671040@mail.yahoo.com
This commit is contained in:
Ihor Radchenko 2023-08-13 18:41:59 +03:00
parent 168ba7e6cf
commit 99cc9619c5
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B

View File

@ -761,7 +761,10 @@ drawer."
"If kill ring holds a bibtex entry yank it as an Org headline."
(interactive)
(let (entry)
(with-temp-buffer (yank 1) (setf entry (org-bibtex-read)))
(with-temp-buffer
(yank 1)
(bibtex-mode)
(setf entry (org-bibtex-read)))
(if entry
(org-bibtex-write)
(error "Yanked text does not appear to contain a BibTeX entry"))))