diff options
author | Case Duckworth | 2022-01-05 18:41:41 -0600 |
---|---|---|
committer | Case Duckworth | 2022-01-05 18:42:02 -0600 |
commit | 58d096ff3cd0a32de4f8ed50392e2ed6f0a0f326 (patch) | |
tree | 772500c77b6461ad1a2004ffa172c4a5322381eb | |
parent | Immediately load custom-file (diff) | |
download | emacs-58d096ff3cd0a32de4f8ed50392e2ed6f0a0f326.tar.gz emacs-58d096ff3cd0a32de4f8ed50392e2ed6f0a0f326.zip |
Fix :setup and :setup-when
Now we have better warnings and messages too
-rw-r--r-- | lisp/+setup.el | 12 |
1 files changed, 10 insertions, 2 deletions
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 @@ | |||
24 | (require 'setup) | 24 | (require 'setup) |
25 | (require 'straight) | 25 | (require 'straight) |
26 | 26 | ||
27 | (defun +setup-warn (message &rest args) | ||
28 | "Warn the user that something bad happened in `setup'." | ||
29 | (display-warning 'setup (format message args))) | ||
30 | |||
27 | (setup-define :face | 31 | (setup-define :face |
28 | (lambda (face spec) | 32 | (lambda (face spec) |
29 | `(custom-set-faces '(,face ,spec 'now "Customized by `setup'."))) | 33 | `(custom-set-faces '(,face ,spec 'now "Customized by `setup'."))) |
@@ -48,6 +52,7 @@ | |||
48 | (setup-define :straight | 52 | (setup-define :straight |
49 | (lambda (recipe) | 53 | (lambda (recipe) |
50 | `(unless (ignore-errors (straight-use-package ',recipe) t) | 54 | `(unless (ignore-errors (straight-use-package ',recipe) t) |
55 | (+setup-warn ":straight error: %S" ',recipe) | ||
51 | ,(setup-quit))) | 56 | ,(setup-quit))) |
52 | :documentation | 57 | :documentation |
53 | "Install RECIPE with `straight-use-package'. | 58 | "Install RECIPE with `straight-use-package'. |
@@ -62,8 +67,11 @@ first RECIPE's package." | |||
62 | 67 | ||
63 | (setup-define :straight-when | 68 | (setup-define :straight-when |
64 | (lambda (recipe condition) | 69 | (lambda (recipe condition) |
65 | `(unless (and ,condition | 70 | `(if ,condition |
66 | (ignore-errors (straight-use-package ',recipe) t)) | 71 | (unless (ignore-errors (straight-use-package ',recipe) t) |
72 | (+setup-warn ":straight error: %S" ',recipe) | ||
73 | ,(setup-quit)) | ||
74 | (message "Setup: :straight-when returned nil %S" ',recipe) | ||
67 | ,(setup-quit))) | 75 | ,(setup-quit))) |
68 | :documentation | 76 | :documentation |
69 | "Install RECIPE with `straight-use-package' when CONDITION is met. | 77 | "Install RECIPE with `straight-use-package' when CONDITION is met. |