From 58d096ff3cd0a32de4f8ed50392e2ed6f0a0f326 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Wed, 5 Jan 2022 18:41:41 -0600 Subject: Fix :setup and :setup-when Now we have better warnings and messages too --- lisp/+setup.el | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'lisp') diff --git a/lisp/+setup.el b/lisp/+setup.el index fbd9d61..6c8e31e 100644 --- a/lisp/+setup.el +++ b/lisp/+setup.el @@ -24,6 +24,10 @@ (require 'setup) (require 'straight) +(defun +setup-warn (message &rest args) + "Warn the user that something bad happened in `setup'." + (display-warning 'setup (format message args))) + (setup-define :face (lambda (face spec) `(custom-set-faces '(,face ,spec 'now "Customized by `setup'."))) @@ -48,6 +52,7 @@ (setup-define :straight (lambda (recipe) `(unless (ignore-errors (straight-use-package ',recipe) t) + (+setup-warn ":straight error: %S" ',recipe) ,(setup-quit))) :documentation "Install RECIPE with `straight-use-package'. @@ -62,8 +67,11 @@ first RECIPE's package." (setup-define :straight-when (lambda (recipe condition) - `(unless (and ,condition - (ignore-errors (straight-use-package ',recipe) t)) + `(if ,condition + (unless (ignore-errors (straight-use-package ',recipe) t) + (+setup-warn ":straight error: %S" ',recipe) + ,(setup-quit)) + (message "Setup: :straight-when returned nil %S" ',recipe) ,(setup-quit))) :documentation "Install RECIPE with `straight-use-package' when CONDITION is met. -- cgit 1.4.1-21-gabe81