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

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

[elpa] externals/setup 028d3da 3/4: Add :if-require macro


From: Stefan Monnier
Subject: [elpa] externals/setup 028d3da 3/4: Add :if-require macro
Date: Wed, 2 Jun 2021 18:28:49 -0400 (EDT)

branch: externals/setup
commit 028d3da386ec8f9b72af87fde4c21a901618f3bb
Author: Philip Kaludercic <philipk@posteo.net>
Commit: Philip Kaludercic <philipk@posteo.net>

    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)



reply via email to

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