* [BUG] org-cite-insert fails to open json format bibliographies that contain entries for books with editors but no authors [9.6.6 (release_9.6.6 @ /snap/emacs/current/usr/share/emacs/29.1/lisp/org/)]
@ 2023-08-24 16:50 Margaret Patterson
2023-08-25 8:39 ` Ihor Radchenko
0 siblings, 1 reply; 4+ messages in thread
From: Margaret Patterson @ 2023-08-24 16:50 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 1884 bytes --]
Since upgrading to emacs 29.1 org-cite-insert no longer copes with
bibliography files in json format where there is an entry for a book
that has only editors and no author.
Expected behaviour:
Running org-cite-insert opens the bibliography file and allows me to
search for a citation and insert it in the org file I’m editing.
Actual behaviour:
Running org-cite-insert fails to open the bibliography file with the
following error:
org-cite-basic--key-completion-table: Wrong type argument: stringp,
(((family . "Asimov") (given . "Isaac")) ((family . "Greenberg") (given
. "Martin H.")))
(The exact error alters depending on the contents of the entry it fails on.)
Reproducing:
Attached are two bibliography files, citation-test-only-editor.json and
citation-test-author.json, the first of which has a single entry of a
book with two editors and no author, the second has the same book but
I’ve changed one editor to an author. Create an org file with
“#+bibliography: citation-test-only-editor.json” or “#+bibliography:
citation-test-author.json” at the top, and try running org-cite-insert.
Notes:
- The problem persists with emacs -Q.
- It is not a problem if I export my bibliography as a .bib file, just
when it’s a .json file.
- It worked as I expected in emacs 28.2.
- Other parts of using org-cite seem to be unaffected but I haven’t
exhaustively tested – I have just noted that manually typing in the
citation and exporting the org file with a #+print_bibliography: line
worked as expected and fontifying manually entered citations with
org-cite-csl-activate works as expected.
Best wishes,
Margaret Patterson.
Emacs : GNU Emacs 29.1 (build 2, x86_64-pc-linux-gnu, GTK+ Version
3.24.20, cairo version 1.16.0)
of 2023-08-04
Package: Org mode version 9.6.6 (release_9.6.6 @
/snap/emacs/current/usr/share/emacs/29.1/lisp/org/)
[-- Attachment #2: citation-test-author.json --]
[-- Type: application/json, Size: 563 bytes --]
[-- Attachment #3: citation-test-only-editor.json --]
[-- Type: application/json, Size: 552 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [BUG] org-cite-insert fails to open json format bibliographies that contain entries for books with editors but no authors [9.6.6 (release_9.6.6 @ /snap/emacs/current/usr/share/emacs/29.1/lisp/org/)]
2023-08-24 16:50 [BUG] org-cite-insert fails to open json format bibliographies that contain entries for books with editors but no authors [9.6.6 (release_9.6.6 @ /snap/emacs/current/usr/share/emacs/29.1/lisp/org/)] Margaret Patterson
@ 2023-08-25 8:39 ` Ihor Radchenko
2023-08-26 14:29 ` Margaret Patterson
0 siblings, 1 reply; 4+ messages in thread
From: Ihor Radchenko @ 2023-08-25 8:39 UTC (permalink / raw)
To: Margaret Patterson; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 297 bytes --]
Margaret Patterson <emacs-m@ninecats.org> writes:
> Since upgrading to emacs 29.1 org-cite-insert no longer copes with
> bibliography files in json format where there is an entry for a book
> that has only editors and no author.
Thanks for reporting!
Does the attached patch fix the problem?
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-lisp-oc-basic.el-Fix-parsing-editor-field-in-json-bi.patch --]
[-- Type: text/x-patch, Size: 1237 bytes --]
From 9ca03cfb827b5691665b472f3c7086a1c033ce0a Mon Sep 17 00:00:00 2001
Message-ID: <9ca03cfb827b5691665b472f3c7086a1c033ce0a.1692952720.git.yantar92@posteo.net>
From: Ihor Radchenko <yantar92@posteo.net>
Date: Fri, 25 Aug 2023 11:37:59 +0300
Subject: [PATCH] * lisp/oc-basic.el: Fix parsing "editor" field in json
bibliographies
(org-cite-basic--parse-json): Parse "editor" field, not "editors".
"editors" is a typo - the common field name is "editor". For example,
see https://www.bibtex.com/e/book-entry/.
---
lisp/oc-basic.el | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lisp/oc-basic.el b/lisp/oc-basic.el
index c4468e5a8..2b78d85d0 100644
--- a/lisp/oc-basic.el
+++ b/lisp/oc-basic.el
@@ -162,7 +162,7 @@ (defun org-cite-basic--parse-json ()
(puthash (cdr (assq 'id item))
(mapcar (pcase-lambda (`(,field . ,value))
(pcase field
- ((or 'author 'editors)
+ ((or 'author 'editor)
;; Author and editors are arrays of
;; objects, each of them designing a
;; person. These objects may contain
--
2.41.0
[-- Attachment #3: Type: text/plain, Size: 224 bytes --]
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [BUG] org-cite-insert fails to open json format bibliographies that contain entries for books with editors but no authors [9.6.6 (release_9.6.6 @ /snap/emacs/current/usr/share/emacs/29.1/lisp/org/)]
2023-08-25 8:39 ` Ihor Radchenko
@ 2023-08-26 14:29 ` Margaret Patterson
2023-08-26 16:19 ` Ihor Radchenko
0 siblings, 1 reply; 4+ messages in thread
From: Margaret Patterson @ 2023-08-26 14:29 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: emacs-orgmode
Thanks! Yes that seems to fix my problem.
I failed to apply the patch (perhaps because the file is in a different
place, /lisp/org/ instead of /lisp/ ) however making that change
manually and rebuilding fixed the problem.
For future reference is there a resource that explains how to apply
patches for testing? I have emacs installed via the snap package on
Ubuntu, and in the end (with a lot of help from my spouse) we built it
directly from source without installing it to test this, but is there a
more direct way to do this?
Best wishes,
Margaret.
On 25/08/2023 09:39, Ihor Radchenko wrote:
> Margaret Patterson <emacs-m@ninecats.org> writes:
>
>> Since upgrading to emacs 29.1 org-cite-insert no longer copes with
>> bibliography files in json format where there is an entry for a book
>> that has only editors and no author.
> Thanks for reporting!
> Does the attached patch fix the problem?
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [BUG] org-cite-insert fails to open json format bibliographies that contain entries for books with editors but no authors [9.6.6 (release_9.6.6 @ /snap/emacs/current/usr/share/emacs/29.1/lisp/org/)]
2023-08-26 14:29 ` Margaret Patterson
@ 2023-08-26 16:19 ` Ihor Radchenko
0 siblings, 0 replies; 4+ messages in thread
From: Ihor Radchenko @ 2023-08-26 16:19 UTC (permalink / raw)
To: Margaret Patterson; +Cc: emacs-orgmode
Margaret Patterson <emacs-m@ninecats.org> writes:
> Thanks! Yes that seems to fix my problem.
Fixed, on bugfix.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=7c929e9d8
> I failed to apply the patch (perhaps because the file is in a different
> place, /lisp/org/ instead of /lisp/ ) however making that change
> manually and rebuilding fixed the problem.
>
> For future reference is there a resource that explains how to apply
> patches for testing? I have emacs installed via the snap package on
> Ubuntu, and in the end (with a lot of help from my spouse) we built it
> directly from source without installing it to test this, but is there a
> more direct way to do this?
We develop Org mode separately from Emacs in a different git repository.
See https://orgmode.org/manual/Installation.html or "source code" link
in https://orgmode.org/
My patch was against Org repository, not Emacs.
Applying a patch is the same as with any other git repo. We might drop a
reference to some online documentation on how to use git, but (1) I am
not sure what should be the place to put such a reference; (2) If you
are unsure how to apply patches, you could ask, and I would offer another
way to test things.
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-08-26 16:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-24 16:50 [BUG] org-cite-insert fails to open json format bibliographies that contain entries for books with editors but no authors [9.6.6 (release_9.6.6 @ /snap/emacs/current/usr/share/emacs/29.1/lisp/org/)] Margaret Patterson
2023-08-25 8:39 ` Ihor Radchenko
2023-08-26 14:29 ` Margaret Patterson
2023-08-26 16:19 ` Ihor Radchenko
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).