branch: externals/dash
commit 9ec1a0229b3a23e55350a914d393799d17ad9810
Author: Matus Goljer <[email protected]>
Commit: Matus Goljer <[email protected]>
[-let] Abstract the _ test into a function
---
dash.el | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/dash.el b/dash.el
index 5abfe54..a6d1a3b 100644
--- a/dash.el
+++ b/dash.el
@@ -1174,6 +1174,11 @@ otherwise do ELSE."
`(let ((it ,val))
(if it ,then ,@else)))
+(defun dash--match-ignore-place-p (symbol)
+ "Return non-nil if SYMBOL is a symbol and starts with _."
+ (and (symbolp symbol)
+ (eq (aref (symbol-name symbol) 0) ?_)))
+
(defun dash--match-cons-skip-cdr (skip-cdr source)
"Helper function generating idiomatic shifting code."
(cond
@@ -1248,8 +1253,7 @@ SOURCE is a proper or improper list."
((and (symbolp (car match-form))
(eq (car match-form) '&keys))
(dash--match-kv (cons '&plist (cdr match-form))
(dash--match-cons-get-cdr skip-cdr source)))
- ((and (symbolp (car match-form))
- (eq (aref (symbol-name (car match-form)) 0) ?_))
+ ((dash--match-ignore-place-p (car match-form))
(dash--match-cons-1 (cdr match-form) source
(plist-put props :skip-cdr (1+ skip-cdr))))
(t