refactor(lib): replace doom-debugger with advice

Writing a debugger for Elisp is too much hassle. `debug` itself isn't
very customizable without a *lot* of boilerplate, so instead of writing
my own, it's more effective to advise debug instead. Certainly, I don't
do anything with it yet, but I will soon.
This commit is contained in:
Henrik Lissner 2022-09-10 17:54:32 +02:00
parent b66ccaeca0
commit d290152a8e
No known key found for this signature in database
GPG key ID: B60957CA074D39A3
3 changed files with 27 additions and 30 deletions

View file

@ -21,12 +21,7 @@
;; UX: Ensure errors are sufficiently verbose from this point on.
(when (setq init-file-debug (getenv-internal "DEBUG"))
(setq debug-on-error t
doom-print-level 'debug)
(message "Debug mode enabled"))
;; FIX: All output via `message' should be seen as debug output.
(setq doom-print-message-level 'debug)
(setq debug-on-error t))
;; HACK: Load `cl' and site files manually to prevent polluting logs and
;; stdout with deprecation and/or file load messages.
@ -70,7 +65,7 @@
;; more presentable, and write them to a file. Cleaner backtraces are better
;; UX than the giant wall of text the default debugger throws up.
(doom-require 'doom-lib 'debug)
(setq debugger #'doom-debugger)
(if init-file-debug (doom-debug-mode +1))
;; Then load the rest of Doom's libs eagerly, since autoloads may not be
;; generated/loaded yet.