From 90c2775f05adcc870758a5ac4ae7b8d51ce9d1d9 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Sun, 3 Mar 2024 02:20:18 +0200 Subject: Add gnosis-assert-float-or-nil --- gnosis.el | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gnosis.el b/gnosis.el index 6913cdf..fdf7516 100644 --- a/gnosis.el +++ b/gnosis.el @@ -1242,6 +1242,14 @@ Insert deck values `ef-increase', `ef-decrease', `ef-threshold', `failure-factor (unless (or (null value) (integerp value)) (error "Invalid value: %s, %s" value description))) +(defun gnosis-assert-float-or-nil (value description &optional less-than-1) + "Assert that VALUE is a float or nil." + (if less-than-1 + (unless (or (null value) (and (floatp value) (< value 1))) + (error "Invalid value: %s, %s" value description)) + (unless (or (null value) (floatp 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. -- cgit v1.2.3