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

@ -64,7 +64,7 @@ one wants that.")
doom-autoloads-excluded-files
'literal)
;; TODO Uncomment when profile system is implemented
;; `((if doom-interactive-p (require 'core-start)))
;; `((unless noninteractive (require 'core-start)))
)
(print! (start "Byte-compiling autoloads file..."))
(doom-autoloads--compile-file file)
@ -91,7 +91,7 @@ one wants that.")
(defun doom-autoloads--compile-file (file)
(condition-case-unless-debug e
(let ((byte-compile-warnings (if doom-debug-p byte-compile-warnings)))
(let ((byte-compile-warnings (if init-file-debug byte-compile-warnings)))
(and (byte-compile-file file)
(load (byte-compile-dest-file file) nil t)))
(error

View file

@ -95,8 +95,7 @@ If RECOMPILE-P is non-nil, only recompile out-of-date files."
;; But first we must be sure that Doom and your private config have been
;; fully loaded. Which usually aren't so in an noninteractive session.
(let ((load-prefer-newer t)
(noninteractive t)
doom-interactive-p)
(noninteractive t))
(require 'core-start)
(quiet! (doom-initialize-packages))
(quiet! (doom-initialize-modules))))
@ -198,7 +197,7 @@ module. This does not include your byte-compiled, third party packages.'"
(print-group!
(cl-loop with default-directory = doom-emacs-dir
with success = 0
with esc = (if doom-debug-p "" "\033[1A")
with esc = (if init-file-debug "" "\033[1A")
for path
in (append (doom-glob doom-emacs-dir "*.elc")
(doom-files-in doom-private-dir :match "\\.elc$" :depth 1)

View file

@ -158,8 +158,7 @@ in."
(print! (start "Checking Doom Emacs..."))
(condition-case-unless-debug ex
(print-group!
(let ((doom-interactive-p 'doctor)
(noninteractive nil)
(let ((noninteractive nil)
kill-emacs-query-functions
kill-emacs-hook)
(defvar doom-reloading-p nil)

View file

@ -86,8 +86,6 @@ Why this over exec-path-from-shell?
"Regenerating"
"Generating"))
(print-group!
(when doom-interactive-p
(user-error "doom env: must be run on the command line, not an interactive session"))
(goto-char (point-min))
(insert
";; -*- mode: lisp-interaction; coding: utf-8-unix; -*-\n"

View file

@ -133,7 +133,7 @@ list remains lean."
nil (mapcar (doom-rpartial #'gethash straight--repo-cache)
(mapcar #'symbol-name straight-recipe-repositories)))
(recipe package type local-repo)
(let ((esc (unless doom-debug-p "\033[1A"))
(let ((esc (unless init-file-debug "\033[1A"))
(ref (straight-vc-get-commit type local-repo))
newref output)
(print! (start "\033[KUpdating recipes for %s...%s") package esc)
@ -401,7 +401,7 @@ declaration) or dependency thereof that hasn't already been."
(packages-to-rebuild (make-hash-table :test 'equal))
(repos-to-rebuild (make-hash-table :test 'equal))
(total (length recipes))
(esc (unless doom-debug-p "\033[1A"))
(esc (unless init-file-debug "\033[1A"))
(i 0)
errors)
(print! (start "Updating packages (this may take a while)..."))
@ -723,9 +723,9 @@ it doesn't make sense to slack."
(defadvice! doom-cli--straight-fallback-to-y-or-n-prompt-a (fn &optional prompt noprompt?)
:around #'straight-are-you-sure
(or noprompt?
(if doom-interactive-p
(funcall fn prompt)
(y-or-n-p (format! "%s" (or prompt ""))))))
(if noninteractive
(y-or-n-p (format! "%s" (or prompt "")))
(funcall fn prompt))))
(defun doom-cli--straight-recommended-option-p (prompt option)
(cl-loop for (prompt-re . opt-re) in doom-cli--straight-auto-options