refactor: remove unused core variables

doom-debug-p and doom-interactive-p have always been intentionally
redundant, because changing the variables they replaced had other
side-effects, which made writing tests for them difficult. Since our
new (yet unpublished) tests lean heavily toward integration testing more
than unit testing, this becomes an implementation detail.

And doom-init-p's only use was refactor out at some point in the past,
so it's no longer used.

Also done to reduce Doom's footprint, in general.
This commit is contained in:
Henrik Lissner 2022-06-24 21:15:31 +02:00
parent 74cc541597
commit 14b2395424
No known key found for this signature in database
GPG key ID: B60957CA074D39A3
22 changed files with 55 additions and 76 deletions

View file

@ -8,7 +8,6 @@
'(async-debug
debug-on-error
(debugger . doom-debugger)
doom-debug-p
(doom-print-level . debug)
garbage-collection-messages
gcmh-verbose
@ -33,7 +32,7 @@ symbol and CDR is the value to set it to when `doom-debug-mode' is activated.")
;;;###autoload
(define-minor-mode doom-debug-mode
"Toggle `debug-on-error' and `doom-debug-p' for verbose logging."
"Toggle `debug-on-error' and `init-file-debug' for verbose logging."
:init-value nil
:global t
(let ((enabled doom-debug-mode))
@ -246,7 +245,7 @@ ready to be pasted in a bug report on github."
. ,(mapcar
#'symbol-name
(delq
nil (list (cond ((not doom-interactive-p) 'batch)
nil (list (cond (noninteractive 'batch)
((display-graphic-p) 'gui)
('tty))
(if (daemonp) 'daemon)

View file

@ -110,13 +110,12 @@ Any of these classes can be called like functions from within `format!' and
(defvar doom-print-indent-increment 2
"Steps in which to increment `doom-print-indent' for consecutive levels.")
(defvar doom-print-backend
(if doom-interactive-p 'text-properties 'ansi)
(defvar doom-print-backend (if noninteractive 'ansi 'text-properties)
"Whether to print colors/styles with ANSI codes or with text properties.
Accepts `ansi' and `text-properties'. `nil' means don't render styles at all.")
(defvar doom-print-level (if doom-debug-p 'debug 'info)
(defvar doom-print-level (if init-file-debug 'debug 'info)
"The default level of messages to print.")
(defvar doom-print-logging-level 'debug
@ -178,7 +177,7 @@ Returns OUTPUT."
Does not emit the message in the echo area. This is a macro instead of a
function to prevent the potentially expensive execution of its arguments when
debug mode is off."
`(when (or doom-debug-p (not doom-interactive-p))
`(when (or init-file-debug noninteractive)
(let ((inhibit-message t))
(message
"%s" (propertize

View file

@ -6,7 +6,7 @@
;; while it is lexically bound, you get "Defining as dynamic an already
;; lexical var" errors in Emacs 28+).
;;;###autoload (defvar projectile-project-root nil)
;;;###autoload (defvar projectile-enable-caching doom-interactive-p)
;;;###autoload (defvar projectile-enable-caching (not noninteractive))
;;;###autoload (defvar projectile-require-project-root 'prompt)
;;;###autodef

View file

@ -60,7 +60,7 @@
forms
`(progn
;; doom variables
(setq doom-debug-p t
(setq init-file-debug t
doom-emacs-dir ,doom-emacs-dir
doom-cache-dir ,(expand-file-name "cache/" doom-sandbox-dir)
doom-etc-dir ,(expand-file-name "etc/" doom-sandbox-dir))
@ -71,7 +71,7 @@
;; emacs essential variables
(setq before-init-time (current-time)
after-init-time nil
init-file-debug doom-debug-p
init-file-debug init-file-debug
noninteractive nil
process-environment (get 'process-environment 'initial-value)
exec-path (get 'exec-path 'initial-value)

View file

@ -111,7 +111,7 @@ the first, fresh scratch buffer you create. This accepts:
(remove-hook 'doom-switch-buffer-hook #'doom-persist-scratch-buffers-after-switch-h)))
;;;###autoload
(when doom-interactive-p
(unless noninteractive
(add-hook 'kill-emacs-hook #'doom-persist-scratch-buffers-h))