From 248a594fb89820a6ee2ca5782f98502851c9a315 Mon Sep 17 00:00:00 2001 Message-Id: <248a594fb89820a6ee2ca5782f98502851c9a315.1630157370.git.yantar92@gmail.com> From: Ihor Radchenko Date: Sat, 28 Aug 2021 21:23:43 +0800 Subject: [PATCH] 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 --- lisp/ol-bibtex.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/ol-bibtex.el b/lisp/ol-bibtex.el index 4970be9c4..e70d847b4 100644 --- a/lisp/ol-bibtex.el +++ b/lisp/ol-bibtex.el @@ -677,7 +677,8 @@ (defun org-bibtex-read () (_ 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'. -- 2.31.1