branch: externals/dash
commit bf85b21eb21de486a31aca47be21e01aba906642
Author: Matus Goljer <[email protected]>
Commit: Matus Goljer <[email protected]>
Change &optional branches to &rest branches in `-if-let`s
---
dash.el | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/dash.el b/dash.el
index bb9defa..2e695d5 100644
--- a/dash.el
+++ b/dash.el
@@ -821,31 +821,31 @@ body."
(when it
,@body)))
-(defmacro -if-let (var-val then &optional else)
+(defmacro -if-let (var-val then &rest else)
"If VAL evaluates to non-nil, bind it to VAR and do THEN,
otherwise do ELSE. VAR-VAL should be a (VAR VAL) pair."
(let ((var (car var-val))
(val (cadr var-val)))
`(let ((,var ,val))
- (if ,var ,then ,else))))
+ (if ,var ,then ,@else))))
-(defmacro -if-let* (vars-vals then &optional else)
+(defmacro -if-let* (vars-vals then &rest else)
"If all VALS evaluate to true, bind them to their corresponding
VARS and do THEN, otherwise do ELSE. VARS-VALS should be a list
of (VAR VAL) pairs (corresponding to the bindings of `let*')."
(let ((first-pair (car vars-vals))
(rest (cdr vars-vals)))
(if (= (length vars-vals) 1)
- `(-if-let ,first-pair ,then ,else)
+ `(-if-let ,first-pair ,then ,@else)
`(-if-let ,first-pair
- (-if-let* ,rest ,then ,else)
- ,else))))
+ (-if-let* ,rest ,then ,@else)
+ ,@else))))
-(defmacro --if-let (val then &optional else)
+(defmacro --if-let (val then &rest else)
"If VAL evaluates to non-nil, bind it to `it' and do THEN,
otherwise do ELSE."
`(let ((it ,val))
- (if it ,then ,else)))
+ (if it ,then ,@else)))
(put '-when-let 'lisp-indent-function 1)
(put '-when-let* 'lisp-indent-function 1)