branch: externals/setup
commit 028d3da386ec8f9b72af87fde4c21a901618f3bb
Author: Philip Kaludercic <[email protected]>
Commit: Philip Kaludercic <[email protected]>
Add :if-require macro
---
setup.el | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/setup.el b/setup.el
index 55e12ba..eeb337b 100644
--- a/setup.el
+++ b/setup.el
@@ -498,6 +498,16 @@ the first PACKAGE."
:repeatable t
:shorthand #'cadr)
+(setup-define :if-require
+ (lambda (feature)
+ `(unless (require ',feature nil t)
+ (throw 'setup-exit nil)))
+ :documentation "If FEATURE cannot be required, stop evaluating the body.
+This macro can be used as HEAD, and it will replace itself with
+the first PACKAGE."
+ :repeatable t
+ :shorthand #'cadr)
+
(setup-define :if-host
(lambda (hostname)
`(unless (string= (system-name) ,hostname)