all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@posteo.net>
To: Ihor Radchenko <yantar92@gmail.com>
Cc: Kaushal Modi <kaushal.modi@gmail.com>,
	 emacs-org list <emacs-orgmode@gnu.org>
Subject: [PATCH] Re: oc-basic "Wrong value for ENTRY-OR-KEY" error on emacs master (29.x) [Was: Bibliographies on export with ox-context and ox-epub]
Date: Sat, 22 Oct 2022 06:38:46 +0000	[thread overview]
Message-ID: <87mt9o1hxl.fsf@localhost> (raw)
In-Reply-To: <87o804jo6w.fsf@localhost>

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

Ihor Radchenko <yantar92@gmail.com> writes:

> Note that apart from the problem on Emacs side, there appears to be a
> problem with org-cite-basic-export-bibliography.
>
> org-cite-basic-export-bibliography uses org-cite-basic--print-entry,
> which fails to print keys, which are not in .bib files. As a result,
> #+print_bibliography: appears to fail all the time when the document
> contains invalid cite keys.
>
> I consider this as a bug. At least org-cite-basic-export-bibliography
> could provide a more useful error message. Or maybe even skip the
> invalid keys. Or, similar to LaTeX, print ???. I am not sure which way
> will be more canonical according to general oc.el design.

I am suggesting to merge the attached patch.
It will simply skip keys that are not in the bibliography when printing
it.

WDYT?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-cite-basic-export-bibliography-Skip-missing-bibl.patch --]
[-- Type: text/x-patch, Size: 1730 bytes --]

From 943b070b7e0f2b6d0bed261f831589fb918c214f Mon Sep 17 00:00:00 2001
Message-Id: <943b070b7e0f2b6d0bed261f831589fb918c214f.1666420664.git.yantar92@posteo.net>
From: Ihor Radchenko <yantar92@posteo.net>
Date: Sat, 22 Oct 2022 14:32:17 +0800
Subject: [PATCH] org-cite-basic-export-bibliography: Skip missing bibliography
 keys

* lisp/oc-basic.el (org-cite-basic-export-bibliography): Ignore
citation keys that are not present in bibliography.  Previously, an
error was thrown.
---
 lisp/oc-basic.el | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/lisp/oc-basic.el b/lisp/oc-basic.el
index f1b7c8263..3ef7a37e3 100644
--- a/lisp/oc-basic.el
+++ b/lisp/oc-basic.el
@@ -713,15 +713,17 @@ (defun org-cite-basic-export-bibliography (keys _files style _props backend info
 style, as a string.  BACKEND is the export back-end, as a symbol.  INFO is the
 export state, as a property list."
   (mapconcat
-   (lambda (k)
-     (let ((entry (org-cite-basic--get-entry k info)))
-       (org-export-data
-        (org-cite-make-paragraph
-         (and (org-export-derived-backend-p backend 'latex)
-              (org-export-raw-string "\\noindent\n"))
-         (org-cite-basic--print-entry entry style info))
-        info)))
-   (org-cite-basic--sort-keys keys info)
+   (lambda (entry)
+     (org-export-data
+      (org-cite-make-paragraph
+       (and (org-export-derived-backend-p backend 'latex)
+            (org-export-raw-string "\\noindent\n"))
+       (org-cite-basic--print-entry entry style info))
+      info))
+   (delq nil
+         (mapcar
+          (lambda (k) (org-cite-basic--get-entry k info))
+          (org-cite-basic--sort-keys keys info)))
    "\n"))
 
 \f
-- 
2.35.1


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

  reply	other threads:[~2022-10-22  6:42 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-24  7:22 Bibliographies on export with ox-context and ox-epub juh
2021-11-24  8:43 ` Denis Maier
2021-11-24  9:32   ` juh
2021-11-24 10:59     ` Denis Maier
2021-11-24 11:36       ` juh
2021-11-24 19:29         ` András Simonyi
2021-11-25 11:19           ` juh
2021-11-25 12:49             ` András Simonyi
2021-11-25 13:53               ` juh
2021-12-01 13:42                 ` Nicolas Goaziou
2021-12-01 14:44                   ` juh
2021-12-01 14:57                     ` juh
2021-12-01 15:01                       ` Eric S Fraga
2021-12-02  8:11                         ` juh
2021-12-02 15:46                           ` Jason Ross
2021-12-01 15:06                     ` Nicolas Goaziou
2022-01-11 20:41                       ` juh
2022-01-12 14:53                         ` Nicolas Goaziou
2022-01-12 16:38                           ` juh
2022-01-12 16:39                           ` juh
2022-01-12 17:00                             ` Bruce D'Arcus
2022-01-12 17:05                             ` John Kitchin
2022-05-09 14:21             ` oc-basic "Wrong value for ENTRY-OR-KEY" error on emacs master (29.x) [Was: Bibliographies on export with ox-context and ox-epub] Kaushal Modi
2022-05-09 21:33               ` Kaushal Modi
2022-05-09 21:44                 ` Kaushal Modi
2022-05-10 15:10                   ` Kaushal Modi
2022-05-11 11:36                     ` Ihor Radchenko
2022-10-22  6:38                       ` Ihor Radchenko [this message]
2022-11-06  7:47                         ` [PATCH] " Ihor Radchenko
2021-11-24  9:59   ` Bibliographies on export with ox-context and ox-epub Colin Baxter 😺
2021-11-24 10:51     ` Denis Maier
2021-11-24 11:13     ` Eric S Fraga
2021-11-24 11:58       ` Colin Baxter 😺
2021-11-24 18:14 ` John Kitchin

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

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

  git send-email \
    --in-reply-to=87mt9o1hxl.fsf@localhost \
    --to=yantar92@posteo.net \
    --cc=emacs-orgmode@gnu.org \
    --cc=kaushal.modi@gmail.com \
    --cc=yantar92@gmail.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.