[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/setup 046c75cdef 2/5: Add :and macro
From: |
ELPA Syncer |
Subject: |
[elpa] externals/setup 046c75cdef 2/5: Add :and macro |
Date: |
Sun, 12 Jun 2022 16:58:01 -0400 (EDT) |
branch: externals/setup
commit 046c75cdef0becf1da89b8bbaebadabf5f7b1f03
Author: Philip Kaludercic <philipk@posteo.net>
Commit: Philip Kaludercic <philipk@posteo.net>
Add :and macro
---
setup.el | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/setup.el b/setup.el
index 6adb13f00c..88216bd898 100644
--- a/setup.el
+++ b/setup.el
@@ -629,6 +629,22 @@ yourself."
:after-loaded t
:indent 0)
+(setup-define :and
+ (lambda (&rest conds)
+ `(if (and ,@(butlast conds))
+ ,@(last conds)
+ ,(setup-quit)))
+ :documentation "Abort evaluation of CONDS are not all true.
+The expression of the last condition is used to deduce the
+feature context."
+ :shorthand
+ (lambda (head)
+ (unless (cdr head)
+ (error ":and requires at least one condition"))
+ (let ((shorthand (get (caar (last head)) 'setup-shorthand)))
+ (and shorthand (funcall shorthand (car (last head))))))
+ :debug '(setup))
+
;;; Obsoleted code