org-bibtex-read: Do not add nil when there is no entry at point

* lisp/ol-bibtex.el (org-bibtex-read): Previously, when there is no
entry at point, `nil' would be added to `org-bibtex-entries' causing
errors later, i.e. upon calling org-bibtex-write.  Now, nil is never
pushed to `org-bibtex-entries'.

Fixes https://orgmode.org/list/874kd3288n.fsf@yandex.com
This commit is contained in:
Ihor Radchenko 2021-08-28 21:23:43 +08:00 committed by Bastien
parent dbbb93dfdf
commit f7d6db1bf6
1 changed files with 2 additions and 1 deletions

View File

@ -674,7 +674,8 @@ This uses `bibtex-parse-entry'."
(_ field)))
(funcall clean-space (funcall strip-delim (cdr pair)))))
(save-excursion (bibtex-beginning-of-entry) (bibtex-parse-entry)))
org-bibtex-entries)))
org-bibtex-entries)
(unless (car org-bibtex-entries) (pop org-bibtex-entries))))
(defun org-bibtex-read-buffer (buffer)
"Read all bibtex entries in BUFFER and save to `org-bibtex-entries'.