branch: externals-release/org
commit f7d6db1bf6c479fa537f198c791851e248e5cdb1
Author: Ihor Radchenko <yanta...@gmail.com>
Commit: Bastien <b...@gnu.org>

    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....@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 6b59121..0c88de0 100644
--- a/lisp/ol-bibtex.el
+++ b/lisp/ol-bibtex.el
@@ -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'.

Reply via email to