emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/setup 2f4a33b7a9 2/3: Add :and macro


From: ELPA Syncer
Subject: [elpa] externals/setup 2f4a33b7a9 2/3: Add :and macro
Date: Tue, 15 Feb 2022 07:58:06 -0500 (EST)

branch: externals/setup
commit 2f4a33b7a941684fefffd90391b76fbafa0ed212
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 52434f2dd3..f3560e3f29 100644
--- a/setup.el
+++ b/setup.el
@@ -642,6 +642,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
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]