From 8015d65c3f20541c502dee3068e515f3a5a074f5 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Fri, 6 Sep 2024 15:23:37 +0300 Subject: [fix] edit-update-note: Adjust for null clozes. * Previous change would cause breakage for null clozes in a list. * Update docs as well. --- gnosis.el | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'gnosis.el') diff --git a/gnosis.el b/gnosis.el index 4619fa9..022f5d8 100644 --- a/gnosis.el +++ b/gnosis.el @@ -1989,7 +1989,8 @@ SUSPEND: Suspend note, 0 for unsuspend, 1 for suspend" (cl-assert (and (listp tags) (cl-every #'stringp tags)) nil "Tags must be a list of strings") (cl-assert (and (listp gnosis) (length= gnosis 3) (cl-every #'floatp gnosis)) nil "gnosis must be a list of 3 floats") - (cl-assert (or (stringp options) (and (listp options) (cl-every #'stringp options))) + (cl-assert (or (stringp options) (and (listp options) (cl-every #'(lambda (x) (or (stringp x) (null x))) + options))) nil "Options must be a string or a list of strings") (cl-assert (and (numberp suspend) (or (= suspend 0) (= suspend 1))) nil "Suspend must be either 0 or 1") (when (and (string= (gnosis-get-type id) "cloze") @@ -2030,14 +2031,14 @@ SUSPEND: Suspend note, 0 for unsuspend, 1 for suspend" (memq (nth 0 entry) '(:deck :tag)) (stringp (nth 1 entry)) (listp (nth 2 entry))) ; Ensure the third element is a plist - (error "Each entry should a :deck or :tag keyword, a string, and a plist of custom values")) + (error "Each entry should a have :deck or :tag keyword, a string, and a plist of custom values")) (let ((proto (plist-get (nth 2 entry) :proto)) (anagnosis (plist-get (nth 2 entry) :anagnosis)) (epignosis (plist-get (nth 2 entry) :epignosis)) (agnoia (plist-get (nth 2 entry) :agnoia)) (amnesia (plist-get (nth 2 entry) :amnesia)) (lethe (plist-get (nth 2 entry) :lethe))) - (unless (listp proto) + (unless (and (listp proto) (cl-every #'integerp proto)) (error "Proto must be a list of interval integer values")) (unless (or (null anagnosis) (integerp anagnosis)) (error "Anagnosis should be an integer")) -- cgit v1.2.3