fix: ensure empty DEBUG envvar is ignored

Also ensures the envvar is removed if it's empty, and doesn't permeate
an empty DEBUG when executing doom/reload.

Amend: 8c7711920e
Close: #8310
Co-authored-by: AjaiKN <AjaiKN@users.noreply.github.com>
This commit is contained in:
Henrik Lissner
2025-03-12 18:21:39 -04:00
parent bf528be137
commit 71d9ceead4
3 changed files with 8 additions and 5 deletions

View File

@ -49,9 +49,12 @@
;; UX: Respect DEBUG envvar as an alternative to --debug-init, and to make
;; startup more verbose sooner.
(when (getenv-internal "DEBUG")
(let ((debug (getenv-internal "DEBUG")))
(when (stringp debug)
(if (string-empty-p debug)
(setenv "DEBUG" nil)
(setq init-file-debug t
debug-on-error t))
debug-on-error t))))
(let (;; FIX: Unset `command-line-args' in noninteractive sessions, to
;; ensure upstream switches aren't misinterpreted.

View File

@ -41,7 +41,7 @@ TYPE should be a keyword of any of the known doom-*-error errors (e.g. :font,
(defvar doom-log-level
(if init-file-debug
(if-let* ((level (getenv-internal "DEBUG"))
(level (string-to-number level))
(level (if (string-empty-p level) 1 (string-to-number level)))
((not (zerop level))))
level
2)

View File

@ -45,7 +45,7 @@
("EMACSDIR" doom-emacs-dir)
("DOOMDIR" doom-user-dir)
("DOOMLOCALDIR" doom-local-dir)
("DEBUG" (if doom-debug-mode (number-to-string doom-log-level) "")))
("DEBUG" (if doom-debug-mode (number-to-string doom-log-level))))
(with-current-buffer
(compile (format ,command (expand-file-name doom-bin doom-bin-dir)) t)
(let ((w (get-buffer-window (current-buffer))))