[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Re: oc-basic "Wrong value for ENTRY-OR-KEY" error on emacs maste
From: |
Ihor Radchenko |
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 |
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?
>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"))
--
2.35.1
--
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>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [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],
Ihor Radchenko <=