emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@gmail.com>
To: Colin Baxter <m43cap@yandex.com>
Cc: emacs-orgmode@gnu.org
Subject: [PATCH] Re: org-bibtex does not recognise @Comment
Date: Sat, 28 Aug 2021 21:32:00 +0800	[thread overview]
Message-ID: <878s0lu23z.fsf@localhost> (raw)
In-Reply-To: <874kd3288n.fsf@yandex.com>

[-- Attachment #1: Type: text/plain, Size: 389 bytes --]

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.

Confirmed

The fix is attached.

Best,
Ihor


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-bibtex-read-Do-not-add-nil-when-there-is-no-entr.patch --]
[-- Type: text/x-diff, Size: 1326 bytes --]

From 248a594fb89820a6ee2ca5782f98502851c9a315 Mon Sep 17 00:00:00 2001
Message-Id: <248a594fb89820a6ee2ca5782f98502851c9a315.1630157370.git.yantar92@gmail.com>
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
 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


  reply	other threads:[~2021-08-28 13:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-09  8:37 Colin Baxter
2021-08-28 13:32 ` Ihor Radchenko [this message]
2021-08-28 16:38   ` [PATCH] " Colin Baxter
2021-08-28 16:59     ` Ihor Radchenko
2021-08-28 18:54       ` Colin Baxter
2021-09-26  6:57   ` Bastien
2021-09-26 10:43     ` Colin Baxter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878s0lu23z.fsf@localhost \
    --to=yantar92@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=m43cap@yandex.com \
    --subject='[PATCH] Re: org-bibtex does not recognise @Comment' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Code repositories for project(s) associated with this inbox:

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).