summaryrefslogtreecommitdiff
path: root/gnosis.el
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2024-09-06 15:23:37 +0300
committerThanos Apollo <[email protected]>2024-09-06 15:26:54 +0300
commit8015d65c3f20541c502dee3068e515f3a5a074f5 (patch)
tree6a2cc972c6980ea3de1cab9a2dc4eab94a0e6511 /gnosis.el
parent8308ff516584dae073d4e8f78e0f58d5363b48de (diff)
[fix] edit-update-note: Adjust for null clozes.
* Previous change would cause breakage for null clozes in a list. * Update docs as well.
Diffstat (limited to 'gnosis.el')
-rw-r--r--gnosis.el7
1 files changed, 4 insertions, 3 deletions
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"))