diff options
author | Case Duckworth | 2022-05-06 10:20:36 -0500 |
---|---|---|
committer | Case Duckworth | 2022-05-06 10:20:36 -0500 |
commit | bcf56eff2122f582fb4116b7c00f7754d94bbad7 (patch) | |
tree | 25135b57c273655143c3f971b5769925db17d284 | |
parent | Add find-script.el (diff) | |
download | emacs-bcf56eff2122f582fb4116b7c00f7754d94bbad7.tar.gz emacs-bcf56eff2122f582fb4116b7c00f7754d94bbad7.zip |
Remove redundancy
-rw-r--r-- | early-init.el | 2 | ||||
-rw-r--r-- | lisp/+setup.el | 45 |
2 files changed, 2 insertions, 45 deletions
diff --git a/early-init.el b/early-init.el index d2097b3..0f729c8 100644 --- a/early-init.el +++ b/early-init.el | |||
@@ -140,7 +140,7 @@ See `no-littering' for examples.") | |||
140 | 140 | ||
141 | ;; Setup `setup' | 141 | ;; Setup `setup' |
142 | 142 | ||
143 | (add-to-list 'setup-modifier-list 'setup-wrap-to-demote-errors) | 143 | (add-to-list 'setup-modifier-list '+setup-wrap-to-demote-errors) |
144 | (unless (memq debug-on-error '(nil init)) | 144 | (unless (memq debug-on-error '(nil init)) |
145 | (define-advice setup (:around (fn head &rest args) +setup-report) | 145 | (define-advice setup (:around (fn head &rest args) +setup-report) |
146 | (+with-progress ((format "[Setup] %S..." head)) | 146 | (+with-progress ((format "[Setup] %S..." head)) |
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'. | ||
125 | If PREDICATES are given, only install RECIPE if all of them return non-nil. | ||
126 | The 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)) |