Remove redundancy

This commit is contained in:
Case Duckworth 2022-05-06 10:20:36 -05:00
parent 46487b4a33
commit bcf56eff21
2 changed files with 2 additions and 45 deletions

View File

@ -140,7 +140,7 @@ See `no-littering' for examples.")
;; Setup `setup'
(add-to-list 'setup-modifier-list 'setup-wrap-to-demote-errors)
(add-to-list 'setup-modifier-list '+setup-wrap-to-demote-errors)
(unless (memq debug-on-error '(nil init))
(define-advice setup (:around (fn head &rest args) +setup-report)
(+with-progress ((format "[Setup] %S..." head))

View File

@ -88,50 +88,7 @@ If PATH does not exist, abort the evaluation."
',recipe)
,(setup-quit))
(:success t)))
(defun setup--straight-handle-arg (arg var)
(cond
((and (boundp var) (symbol-value var)) t)
((keywordp arg) (set var t))
((functionp arg) (set var nil) (funcall arg))
((listp arg) (set var nil) (eval arg :lexical))))
(setup-define :straight
(lambda (recipe &rest predicates)
(let* ((skp (make-symbol "straight-keyword-p"))
(straight-use-p
(cl-every (lambda (f) (setup--straight-handle-arg f skp))
predicates))
(form `(unless (and ,straight-use-p
(condition-case e
(straight-use-package ',recipe)
(error
(+setup-warn ":straight error: %S"
',recipe)
,(setup-quit))
(:success t)))
,(setup-quit))))
;; Keyword arguments --- :quit is special and should short-circuit
(if (memq :quit predicates)
(setq form `,(setup-quit))
;; Otherwise, handle the rest of them ...
(when-let ((after (cadr (memq :after predicates))))
(setq form `(with-eval-after-load ,(if (eq after t)
(setup-get 'feature)
after)
,form))))
;; Finally ...
form))
:documentation "Install RECIPE with `straight-use-package'.
If PREDICATES are given, only install RECIPE if all of them return non-nil.
The following keyword arguments are also recognized:
- :quit --- immediately stop evaluating. Good for commenting.
- :after FEATURE --- only install RECIPE after FEATURE is loaded.
If FEATURE is t, install RECIPE after the current feature."
:repeatable nil
:indent 1
:shorthand (lambda (sexp)
(let ((recipe (cadr sexp)))
(or (car-safe recipe) recipe)))) ,(setup-quit))))
,(setup-quit))))
;; Keyword arguments --- :quit is special and should short-circuit
(if (memq :quit predicates)
(setq form `,(setup-quit))