[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Re: org-bibtex does not recognise @Comment

From: Ihor Radchenko
Subject: [PATCH] Re: org-bibtex does not recognise @Comment
Date: Sat, 28 Aug 2021 21:32:00 +0800

Colin Baxter <m43cap@yandex.com> writes:

> I've noticed that "org-bibtex-import-from-file" will not import from bib files
> which begin with the standard bibtex mode-line heading of
> @Comment -*- mode: bibtex; -*-

Well. It will import the files. However, org-bibtex-write will indeed
fail. If I got it wrong, please provide more details.


The fix is attached.


>From 248a594fb89820a6ee2ca5782f98502851c9a315 Mon Sep 17 00:00:00 2001
From: Ihor Radchenko <yantar92@gmail.com>
Date: Sat, 28 Aug 2021 21:23:43 +0800
Subject: [PATCH] org-bibtex-read: Do not add nil when there is no entry at

* 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'.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]