diff options
author | Case Duckworth | 2022-05-06 10:20:46 -0500 |
---|---|---|
committer | Case Duckworth | 2022-05-06 10:20:46 -0500 |
commit | 144e5244d2076eac0e0216a0b09f39a21a9c8dbf (patch) | |
tree | 5c9c3446020789ac0294207144c0227d9a9de619 | |
parent | Remove redundancy (diff) | |
download | emacs-144e5244d2076eac0e0216a0b09f39a21a9c8dbf.tar.gz emacs-144e5244d2076eac0e0216a0b09f39a21a9c8dbf.zip |
Demote errors more better-er
-rw-r--r-- | lisp/+setup.el | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/lisp/+setup.el b/lisp/+setup.el index 194baa8..d5a3a77 100644 --- a/lisp/+setup.el +++ b/lisp/+setup.el | |||
@@ -29,23 +29,37 @@ | |||
29 | "Warn the user that something bad happened in `setup'." | 29 | "Warn the user that something bad happened in `setup'." |
30 | (display-warning 'setup (format message args))) | 30 | (display-warning 'setup (format message args))) |
31 | 31 | ||
32 | (defun +setup-wrap-to-demote-errors (body name) | ||
33 | "Wrap BODY in a `with-demoted-errors' block. | ||
34 | This behavior is prevented if `setup-attributes' contains the | ||
35 | symbol `without-error-demotion'. | ||
36 | |||
37 | This function differs from `setup-wrap-to-demote-errors' in that | ||
38 | it includes the NAME of the setup form in the warning output." | ||
39 | (if (memq 'without-error-demotion setup-attributes) | ||
40 | body | ||
41 | `(with-demoted-errors ,(format "Error in setup form on line %d (%s): %%S" | ||
42 | (line-number-at-pos) | ||
43 | name) | ||
44 | ,body))) | ||
45 | |||
32 | (setup-define :quit | 46 | (setup-define :quit |
33 | 'setup-quit | 47 | 'setup-quit |
34 | :documentation "Quit the current `setup' form. | 48 | :documentation "Quit the current `setup' form. |
35 | Good for commenting.") | 49 | Good for commenting.") |
36 | 50 | ||
37 | (setup-define :face | 51 | (setup-define :face |
38 | (lambda (face spec) | 52 | (lambda (face spec) |
39 | `(custom-set-faces (list ,face ,spec 'now "Customized by `setup'."))) | 53 | `(custom-set-faces (list ,face ,spec 'now "Customized by `setup'."))) |
40 | :documentation "Customize FACE with SPEC using `custom-set-faces'." | 54 | :documentation "Customize FACE with SPEC using `custom-set-faces'." |
41 | :repeatable t) | 55 | :repeatable t) |
42 | 56 | ||
43 | (setup-define :load-after | 57 | (setup-define :load-after |
44 | (lambda (&rest features) | 58 | (lambda (&rest features) |
45 | (let ((body `(require ',(setup-get 'feature)))) | 59 | (let ((body `(require ',(setup-get 'feature)))) |
46 | (dolist (feature (nreverse features)) | 60 | (dolist (feature (nreverse features)) |
47 | (setq body `(with-eval-after-load ',feature ,body))) | 61 | (setq body `(with-eval-after-load ',feature ,body))) |
48 | body)) | 62 | body)) |
49 | :documentation "Load the current feature after FEATURES.") | 63 | :documentation "Load the current feature after FEATURES.") |
50 | 64 | ||
51 | (setup-define :load-from | 65 | (setup-define :load-from |