Browse Source

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
Ihor Radchenko 3 years ago
parent
commit
f7d6db1bf6
1 changed files with 2 additions and 1 deletions
  1. 2 1
      lisp/ol-bibtex.el

+ 2 - 1
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'.