emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals-release/org 0dc27a8837: oc-basic.el: Stringify year fro


From: ELPA Syncer
Subject: [elpa] externals-release/org 0dc27a8837: oc-basic.el: Stringify year from CSL-JSON date-parts
Date: Thu, 23 Jun 2022 09:57:50 -0400 (EDT)

branch: externals-release/org
commit 0dc27a8837b46cde036572ae94fa4fabdcea14ca
Author: David Lukes <dafydd.lukes@gmail.com>
Commit: Ihor Radchenko <yantar92@gmail.com>

    oc-basic.el: Stringify year from CSL-JSON date-parts
    
    * lisp/oc-basic.el (org-cite-basic--parse-json): Make sure year
    extracted from date-parts is returned as string.  Raise error if
    original type other than number or string.
    
    The stringifiation is motivated by errors like the following on Emacs 28
    with nativecomp:
    
    Error during redisplay: (jit-lock-function 544) signaled
    (wrong-type-argument "Argument is not a string or a secondary string:
    2007")
    
    Additionally, the type check will warn users about problems in their
    CSL-JSON bibliographies.
    
    Fixes https://list.orgmode.org/875ykv4k2q.fsf@localhost/T/#t
    
    TINYCHANGE
---
 lisp/oc-basic.el | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/lisp/oc-basic.el b/lisp/oc-basic.el
index 775690f176..9ed1b810fa 100644
--- a/lisp/oc-basic.el
+++ b/lisp/oc-basic.el
@@ -189,7 +189,14 @@ Return a hash table with citation references as keys and 
fields alist as values.
                                 (cons 'year
                                       (cond
                                        ((consp date)
-                                        (caar date))
+                                         (let ((year (caar date)))
+                                           (cond
+                                             ((numberp year) (number-to-string 
year))
+                                             ((stringp year) year)
+                                             (t
+                                               (error
+                                                 "First element of CSL-JSON 
date-parts should be a number or string, got %s: %S"
+                                                 (type-of year) year)))))
                                        ((stringp date)
                                         (replace-regexp-in-string
                                           (rx



reply via email to

[Prev in Thread] Current Thread [Next in Thread]