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

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

[elpa] externals/setup 0bf5c62 09/17: Add :with-feature macro


From: Stefan Monnier
Subject: [elpa] externals/setup 0bf5c62 09/17: Add :with-feature macro
Date: Sat, 13 Mar 2021 18:15:13 -0500 (EST)

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

    Add :with-feature macro
---
 setup.el | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/setup.el b/setup.el
index 8a65486..8370fc2 100644
--- a/setup.el
+++ b/setup.el
@@ -102,14 +102,10 @@ The following local macros are defined in a `setup' 
body:\n\n"
       (when shorthand
         (push name body)
         (setq name (funcall shorthand name)))))
-  (let ((mode (if (string-match-p "-mode\\'" (symbol-name name))
-                  name
-                (intern (format "%s-mode" name)))))
-    `(let ((setup-name ',name))
-       (ignore setup-name)
-       (cl-macrolet ,setup-macros
-         (catch 'setup-exit
-           (:with-mode ,mode ,@body))))))
+  `(cl-macrolet ,setup-macros
+     (catch 'setup-exit
+       (:with-feature ,name ,@body)
+       t)))
 
 ;;;###autoload
 (put 'setup 'function-documentation '(setup-make-docstring))
@@ -170,6 +166,18 @@ A documentation string."
 
 ;;; definitions of `setup' keywords
 
+(setup-define :with-feature
+  (lambda (name &rest body)
+    `(let ((setup-name ',name))
+       (ignore setup-name)
+       (:with-mode ,(if (string-match-p "-mode\\'" (symbol-name name))
+                        name
+                      (intern (format "%s-mode" name)))
+         ,@body)))
+  :signature '(SYSTEM &body BODY)
+  :documentation "Change the SYSTEM that BODY is configuring."
+  :indent 1)
+
 (setup-define :with-mode
   (lambda (mode &rest body)
     `(let ((setup-mode ',mode)



reply via email to

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