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

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

[elpa] externals/setup 903564b 21/24: Add if-package and if-feature macr


From: Stefan Monnier
Subject: [elpa] externals/setup 903564b 21/24: Add if-package and if-feature macros
Date: Thu, 25 Mar 2021 13:42:38 -0400 (EDT)

branch: externals/setup
commit 903564b2a1c9837132e69ee585daffe958f874f1
Author: Philip K <philipk@posteo.net>
Commit: Philip K <philipk@posteo.net>

    Add if-package and if-feature macros
---
 setup.el | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/setup.el b/setup.el
index c2f112b..01f035f 100644
--- a/setup.el
+++ b/setup.el
@@ -419,6 +419,26 @@ See `advice-add' for more details."
   :documentation "If EXECUTABLE is not in the path, stop here."
   :repeatable 1)
 
+(setup-define :if-package
+  (lambda (package)
+    `(unless (package-installed-p ',package)
+       (throw 'setup-exit nil)))
+  :documentation "If package is not installed, 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-feature
+  (lambda (feature)
+    `(unless (featurep ',feature)
+       (throw 'setup-exit nil)))
+  :documentation "If FEATURE is not available, 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 :only-if
   (lambda (condition)
     `(unless ,condition



reply via email to

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