emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-bibtex does not recognise @Comment
@ 2021-07-09  8:37 Colin Baxter
  2021-08-28 13:32 ` [PATCH] " Ihor Radchenko
  0 siblings, 1 reply; 7+ messages in thread
From: Colin Baxter @ 2021-07-09  8:37 UTC (permalink / raw)
  To: emacs-orgmode


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; -*-

Bib files with any @Comment line are similarly rejected.

This is rather unfortunate.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] Re: org-bibtex does not recognise @Comment
  2021-07-09  8:37 org-bibtex does not recognise @Comment Colin Baxter
@ 2021-08-28 13:32 ` Ihor Radchenko
  2021-08-28 16:38   ` Colin Baxter
  2021-09-26  6:57   ` Bastien
  0 siblings, 2 replies; 7+ messages in thread
From: Ihor Radchenko @ 2021-08-28 13:32 UTC (permalink / raw)
  To: Colin Baxter; +Cc: emacs-orgmode

[-- 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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] Re: org-bibtex does not recognise @Comment
  2021-08-28 13:32 ` [PATCH] " Ihor Radchenko
@ 2021-08-28 16:38   ` Colin Baxter
  2021-08-28 16:59     ` Ihor Radchenko
  2021-09-26  6:57   ` Bastien
  1 sibling, 1 reply; 7+ messages in thread
From: Colin Baxter @ 2021-08-28 16:38 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode

Hello Ihor,

>>>>> Ihor Radchenko <yantar92@gmail.com> writes:

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

I've applied your patch to my local git branch of org-mode and it works
very nicely. I can live with the write fail you mentioned. Will you
apply it to the master branch of org-mode?

Thank you.

Best wishes,

Colin.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Re: org-bibtex does not recognise @Comment
  2021-08-28 16:38   ` Colin Baxter
@ 2021-08-28 16:59     ` Ihor Radchenko
  2021-08-28 18:54       ` Colin Baxter
  0 siblings, 1 reply; 7+ messages in thread
From: Ihor Radchenko @ 2021-08-28 16:59 UTC (permalink / raw)
  To: Colin Baxter; +Cc: emacs-orgmode

Colin Baxter <m43cap@yandex.com> writes:

>     > 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.
>
> I've applied your patch to my local git branch of org-mode and it works
> very nicely. I can live with the write fail you mentioned.

Let me clarify. On my side, org-bibtex-read-file did not throw any error
on a .bib file with comment. Is it any different for you?

The patch is supposed to fix org-bibtex-write -- the only problem I was
able to see following your email.

> Will you apply it to the master branch of org-mode?

Nope. We need to wait for the maintainers with write access to apply it.

Best,
Ihor


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Re: org-bibtex does not recognise @Comment
  2021-08-28 16:59     ` Ihor Radchenko
@ 2021-08-28 18:54       ` Colin Baxter
  0 siblings, 0 replies; 7+ messages in thread
From: Colin Baxter @ 2021-08-28 18:54 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode

>>>>> Ihor Radchenko <yantar92@gmail.com> writes:

    > Colin Baxter <m43cap@yandex.com> writes:
    >> > 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.
    >> 
    >> I've applied your patch to my local git branch of org-mode and it
    >> works very nicely. I can live with the write fail you mentioned.

    > Let me clarify. On my side, org-bibtex-read-file did not throw any
    > error on a .bib file with comment. Is it any different for you?

Sorry, my first reply was garbled. No there is no difference,
org-bibtex-read-file and org-bibtex-import-from-file now do not give any
errors for me.

Thanks again.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Re: org-bibtex does not recognise @Comment
  2021-08-28 13:32 ` [PATCH] " Ihor Radchenko
  2021-08-28 16:38   ` Colin Baxter
@ 2021-09-26  6:57   ` Bastien
  2021-09-26 10:43     ` Colin Baxter
  1 sibling, 1 reply; 7+ messages in thread
From: Bastien @ 2021-09-26  6:57 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Colin Baxter, emacs-orgmode

Hi Ihor,

Ihor Radchenko <yantar92@gmail.com> writes:

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

Applied, thanks!

-- 
 Bastien


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Re: org-bibtex does not recognise @Comment
  2021-09-26  6:57   ` Bastien
@ 2021-09-26 10:43     ` Colin Baxter
  0 siblings, 0 replies; 7+ messages in thread
From: Colin Baxter @ 2021-09-26 10:43 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode, Ihor Radchenko

>>>>> Bastien  <bzg@gnu.org> writes:

    > Hi Ihor, Ihor Radchenko <yantar92@gmail.com> writes:

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

    > Applied, thanks!

    > -- Bastien

Great! Thanks Bastien.



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-09-26 10:43 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-09  8:37 org-bibtex does not recognise @Comment Colin Baxter
2021-08-28 13:32 ` [PATCH] " Ihor Radchenko
2021-08-28 16:38   ` 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

Code repositories for project(s) associated with this public 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).