aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2020-11-07 15:55:38 -0700
committerSean Whitton <spwhitton@spwhitton.name>2020-11-07 17:10:50 -0700
commit84b50eb38f6ffe2c454998318ca6e36a3123a3d5 (patch)
tree09ec0b5d0fb6c6a937b055f2b6bd82f258171c32
parentcfbd4ae7343733b508feaf453b91facd1d0fb44d (diff)
downloadorg-d20-84b50eb38f6ffe2c454998318ca6e36a3123a3d5.tar.gz
avoid using s-blank?
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
-rw-r--r--org-d20.el18
1 files changed, 11 insertions, 7 deletions
diff --git a/org-d20.el b/org-d20.el
index 1aa4b7c..29bc283 100644
--- a/org-d20.el
+++ b/org-d20.el
@@ -417,13 +417,17 @@ the best N of them, e.g., 4d6k3."
;; Concat b onto a as a signed term, where a is possibly empty
(defun org-d20--rolls-concat (sign a b)
- (if (>= sign 0)
- (if (s-blank? a)
- b
- (concat a " + " b))
- (if (s-blank? a)
- (concat "- " b)
- (concat a " - " b))))
+ (let (strings)
+ (if (or (null a) (string= "" a))
+ (unless (>= sign 0)
+ (push " - " strings))
+ (push a strings)
+ (push (if (>= sign 0)
+ " + "
+ " - ")
+ strings))
+ (push b strings)
+ (apply #'concat (nreverse strings))))
;; Bracket a number so it looks a bit like a dice roll result
(defun org-d20--rolls-bracket (sides roll)