summaryrefslogtreecommitdiff
path: root/gnosis.el
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2024-03-03 02:20:01 +0200
committerThanos Apollo <[email protected]>2024-03-03 02:20:01 +0200
commit1ea40b35feb7fd710c7621058bb25bd14356e80a (patch)
treee37cc542648c6d81cd52ee09d2e91ec3d107a0bd /gnosis.el
parentd04392c8b41b7b1add7a6eeb6f4686673b61f308 (diff)
Add gnosis-assert-int-or-nil
Diffstat (limited to 'gnosis.el')
-rw-r--r--gnosis.el5
1 files changed, 5 insertions, 0 deletions
diff --git a/gnosis.el b/gnosis.el
index dcdb964..6913cdf 100644
--- a/gnosis.el
+++ b/gnosis.el
@@ -1237,6 +1237,11 @@ Insert deck values `ef-increase', `ef-decrease', `ef-threshold', `failure-factor
(insert (format "\n:id %s\n:name \"%s\"\n:ef-increase %s\n:ef-decrease %s\n:ef-threshold %s\n:failure-factor %s"
id name ef-increase ef-decrease ef-threshold failure-factor))))
+(defun gnosis-assert-int-or-nil (value description)
+ "Assert that VALUE is an integer or nil."
+ (unless (or (null value) (integerp value))
+ (error "Invalid value: %s, %s" value description)))
+
(cl-defun gnosis-edit-save-exit (&optional deck-edit (exit-func 'exit-recursive-edit) &rest args)
"Save edits and exit.