about summary refs log tree commit diff stats
path: root/lisp
diff options
context:
space:
mode:
authorCase Duckworth2022-05-06 10:20:36 -0500
committerCase Duckworth2022-05-06 10:20:36 -0500
commitbcf56eff2122f582fb4116b7c00f7754d94bbad7 (patch)
tree25135b57c273655143c3f971b5769925db17d284 /lisp
parentAdd find-script.el (diff)
downloademacs-bcf56eff2122f582fb4116b7c00f7754d94bbad7.tar.gz
emacs-bcf56eff2122f582fb4116b7c00f7754d94bbad7.zip
Remove redundancy
Diffstat (limited to 'lisp')
-rw-r--r--lisp/+setup.el45
1 files changed, 1 insertions, 44 deletions
diff --git a/lisp/+setup.el b/lisp/+setup.el index db59223..194baa8 100644 --- a/lisp/+setup.el +++ b/lisp/+setup.el
@@ -88,50 +88,7 @@ If PATH does not exist, abort the evaluation."
88 ',recipe) 88 ',recipe)
89 ,(setup-quit)) 89 ,(setup-quit))
90 (:success t))) 90 (:success t)))
91(defun setup--straight-handle-arg (arg var) 91 ,(setup-quit))))
92 (cond
93 ((and (boundp var) (symbol-value var)) t)
94 ((keywordp arg) (set var t))
95 ((functionp arg) (set var nil) (funcall arg))
96 ((listp arg) (set var nil) (eval arg :lexical))))
97
98(setup-define :straight
99 (lambda (recipe &rest predicates)
100 (let* ((skp (make-symbol "straight-keyword-p"))
101 (straight-use-p
102 (cl-every (lambda (f) (setup--straight-handle-arg f skp))
103 predicates))
104 (form `(unless (and ,straight-use-p
105 (condition-case e
106 (straight-use-package ',recipe)
107 (error
108 (+setup-warn ":straight error: %S"
109 ',recipe)
110 ,(setup-quit))
111 (:success t)))
112 ,(setup-quit))))
113 ;; Keyword arguments --- :quit is special and should short-circuit
114 (if (memq :quit predicates)
115 (setq form `,(setup-quit))
116 ;; Otherwise, handle the rest of them ...
117 (when-let ((after (cadr (memq :after predicates))))
118 (setq form `(with-eval-after-load ,(if (eq after t)
119 (setup-get 'feature)
120 after)
121 ,form))))
122 ;; Finally ...
123 form))
124 :documentation "Install RECIPE with `straight-use-package'.
125If PREDICATES are given, only install RECIPE if all of them return non-nil.
126The following keyword arguments are also recognized:
127- :quit --- immediately stop evaluating. Good for commenting.
128- :after FEATURE --- only install RECIPE after FEATURE is loaded.
129 If FEATURE is t, install RECIPE after the current feature."
130 :repeatable nil
131 :indent 1
132 :shorthand (lambda (sexp)
133 (let ((recipe (cadr sexp)))
134 (or (car-safe recipe) recipe)))) ,(setup-quit))))
135 ;; Keyword arguments --- :quit is special and should short-circuit 92 ;; Keyword arguments --- :quit is special and should short-circuit
136 (if (memq :quit predicates) 93 (if (memq :quit predicates)
137 (setq form `,(setup-quit)) 94 (setq form `,(setup-quit))