summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cond-let-tests.el11
-rw-r--r--cond-let.el2
2 files changed, 9 insertions, 4 deletions
diff --git a/cond-let-tests.el b/cond-let-tests.el
index 95efd57..4f5ae43 100644
--- a/cond-let-tests.el
+++ b/cond-let-tests.el
@@ -93,8 +93,7 @@
((e 5)
(_ (> e (+ c d))))
(throw ':cond-let*1 (progn (print e) e)))
- (when t
- (throw ':cond-let*1 (list c d))))))
+ (list c d))))
(cond-let-test--macroexpansion nil '(2 3)
(cond-let*
@@ -103,7 +102,10 @@
[[b 2]]
([c 3]
[_ (> 3 b)]
- (list b c)))
+ (list b c))
+ (t
+ (message "4")
+ b))
(catch ':cond-let*1
(cond-let--when-let ((a nil))
@@ -112,7 +114,8 @@
(cond-let--when-let*
((c 3)
(_ (> 3 b)))
- (throw ':cond-let*1 (list b c))))))
+ (throw ':cond-let*1 (list b c)))
+ (progn (message "4") b))))
(cond-let-test--macroexpansion nil '(1 2 3)
(cond-let*
diff --git a/cond-let.el b/cond-let.el
index 2df7670..7b1f3e2 100644
--- a/cond-let.el
+++ b/cond-let.el
@@ -109,6 +109,8 @@
(let ((a (gensym "anon")))
`(let ((,a ,(car clause)))
(when ,a (throw ',tag ,a)))))
+ ((and (eq (car clause) t) (not body))
+ (macroexp-progn (cdr clause)))
(t
`(when ,(pop clause)
(throw ',tag ,(macroexp-progn clause)))))