diff --git a/bin/doom b/bin/doom index b3244794d..a4bb4d3a6 100755 --- a/bin/doom +++ b/bin/doom @@ -230,7 +230,7 @@ SEE ALSO: (dolist (file loads) (load (doom-path (cdr file)) (not (equal (car file) "--strict-load")) - (not doom-debug-p) t)) + (not init-file-debug) t)) (dolist (form evals) (eval (read (cdr form)) t))) diff --git a/core/autoload/debug.el b/core/autoload/debug.el index 0ee4892fc..1d6a6ebd5 100644 --- a/core/autoload/debug.el +++ b/core/autoload/debug.el @@ -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) diff --git a/core/autoload/print.el b/core/autoload/print.el index 73b4fd2e1..11e361d03 100644 --- a/core/autoload/print.el +++ b/core/autoload/print.el @@ -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 diff --git a/core/autoload/projects.el b/core/autoload/projects.el index d36a12176..4df7dad85 100644 --- a/core/autoload/projects.el +++ b/core/autoload/projects.el @@ -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 diff --git a/core/autoload/sandbox.el b/core/autoload/sandbox.el index 1dab32279..3f059d917 100644 --- a/core/autoload/sandbox.el +++ b/core/autoload/sandbox.el @@ -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) diff --git a/core/autoload/scratch.el b/core/autoload/scratch.el index 645d26e68..31a95ec96 100644 --- a/core/autoload/scratch.el +++ b/core/autoload/scratch.el @@ -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)) diff --git a/core/cli/autoloads.el b/core/cli/autoloads.el index 4cad1a251..39603a7d5 100644 --- a/core/cli/autoloads.el +++ b/core/cli/autoloads.el @@ -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 diff --git a/core/cli/compile.el b/core/cli/compile.el index d01559fc4..3737d6b0c 100644 --- a/core/cli/compile.el +++ b/core/cli/compile.el @@ -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) diff --git a/core/cli/doctor.el b/core/cli/doctor.el index 261a779e6..9ffac3010 100644 --- a/core/cli/doctor.el +++ b/core/cli/doctor.el @@ -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) diff --git a/core/cli/env.el b/core/cli/env.el index f2bcc5b71..8fb6216ef 100644 --- a/core/cli/env.el +++ b/core/cli/env.el @@ -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" diff --git a/core/cli/packages.el b/core/cli/packages.el index 2a704677a..45725eadc 100644 --- a/core/cli/packages.el +++ b/core/cli/packages.el @@ -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 diff --git a/core/core-cli-lib.el b/core/core-cli-lib.el index 5881bb564..849116303 100644 --- a/core/core-cli-lib.el +++ b/core/core-cli-lib.el @@ -1009,7 +1009,7 @@ shown." (seconds (- duration (* hours 60 60) (* minutes 60))) (standard-output (if (and (/= doom-cli--exit-code 0) - (or doom-debug-p + (or init-file-debug (eq (doom-cli-prop cli :benchmark) t) (and (eq (doom-cli-prop cli :benchmark :null) :null) (not (doom-cli-context-pipe-p context 'out t)) @@ -1100,7 +1100,7 @@ Emacs' batch library lacks an implementation of the exec system call." (insert "#!/usr/bin/env sh\n" "trap _doomcleanup EXIT\n" "_doomcleanup() {\n" - " rm -" (if doom-debug-p "v" "") "f " + " rm -" (if init-file-debug "v" "") "f " (combine-and-quote-strings (delq nil (list script-file context-file))) "\n}\n" "_doomrun() {\n " command "\n}\n" @@ -1195,7 +1195,7 @@ ARGS are options passed to less. If DOOMPAGER is set, ARGS are ignored." (append (if doom-print-backend '("-r")) ; process ANSI codes (or (delq nil args) '("+g")))) (shell-quote-argument tmpfile) - (if doom-debug-p "v" "") + (if init-file-debug "v" "") (shell-quote-argument tmpfile)) context))))) diff --git a/core/core-editor.el b/core/core-editor.el index 3c9b63194..0750367f8 100644 --- a/core/core-editor.el +++ b/core/core-editor.el @@ -484,7 +484,7 @@ files, so this replace calls to `pp' with the much faster `prin1'." (use-package! dtrt-indent ;; Automatic detection of indent settings - :when doom-interactive-p + :unless noninteractive ;; I'm not using `global-dtrt-indent-mode' because it has hard-coded and rigid ;; major mode checks, so I implement it in `doom-detect-indentation-h'. :hook ((change-major-mode-after-body read-only-mode) . doom-detect-indentation-h) @@ -496,7 +496,7 @@ files, so this replace calls to `pp' with the much faster `prin1'." (memq major-mode doom-detect-indentation-excluded-modes) (member (substring (buffer-name) 0 1) '(" " "*"))) ;; Don't display messages in the echo area, but still log them - (let ((inhibit-message (not doom-debug-p))) + (let ((inhibit-message (not init-file-debug))) (dtrt-indent-mode +1)))) ;; Enable dtrt-indent even in smie modes so that it can update `tab-width', diff --git a/core/core-lib.el b/core/core-lib.el index 06de521cd..5c967bdf9 100644 --- a/core/core-lib.el +++ b/core/core-lib.el @@ -264,20 +264,20 @@ NAME, ARGLIST, and BODY are the same as `defun', `defun*', `defmacro', and This silences calls to `message', `load', `write-region' and anything that writes to `standard-output'. In interactive sessions this inhibits output to the echo-area, but not to *Messages*." - `(if doom-debug-p + `(if init-file-debug (progn ,@forms) - ,(if doom-interactive-p - `(let ((inhibit-message t) - (save-silently t)) - (prog1 ,@forms (message ""))) - `(letf! ((standard-output (lambda (&rest _))) - (defun message (&rest _)) - (defun load (file &optional noerror nomessage nosuffix must-suffix) - (funcall load file noerror t nosuffix must-suffix)) - (defun write-region (start end filename &optional append visit lockname mustbenew) - (unless visit (setq visit 'no-message)) - (funcall write-region start end filename append visit lockname mustbenew))) - ,@forms)))) + ,(if noninteractive + `(letf! ((standard-output (lambda (&rest _))) + (defun message (&rest _)) + (defun load (file &optional noerror nomessage nosuffix must-suffix) + (funcall load file noerror t nosuffix must-suffix)) + (defun write-region (start end filename &optional append visit lockname mustbenew) + (unless visit (setq visit 'no-message)) + (funcall write-region start end filename append visit lockname mustbenew))) + ,@forms) + `(let ((inhibit-message t) + (save-silently t)) + (prog1 ,@forms (message "")))))) (defmacro eval-if! (cond then &rest body) "Expands to THEN if COND is non-nil, to BODY otherwise. diff --git a/core/core-modules.el b/core/core-modules.el index e0ce97e54..47b2ccadb 100644 --- a/core/core-modules.el +++ b/core/core-modules.el @@ -66,7 +66,7 @@ syntax-checker modules obsolete. e.g. If :feature version-control is found in your `doom!' block, a warning is emitted before replacing it with :emacs vc and :ui vc-gutter.") -(defvar doom-inhibit-module-warnings doom-interactive-p +(defvar doom-inhibit-module-warnings (not noninteractive) "If non-nil, don't emit deprecated or missing module warnings at startup.") ;;; Custom hooks @@ -309,7 +309,7 @@ those directories. The first returned path is always `doom-private-dir'." :flags (if (listp m) (cdr m)) :path (if (stringp path) (file-truename path))) results))))))) - (unless doom-interactive-p + (when noninteractive (setq doom-inhibit-module-warnings t)) (nreverse results))) @@ -328,10 +328,10 @@ This value is cached. If REFRESH-P, then don't use the cached value." (autoload 'use-package "use-package-core" nil nil t) -(setq use-package-compute-statistics doom-debug-p - use-package-verbose doom-debug-p - use-package-minimum-reported-time (if doom-debug-p 0 0.1) - use-package-expand-minimally doom-interactive-p) +(setq use-package-compute-statistics init-file-debug + use-package-verbose init-file-debug + use-package-minimum-reported-time (if init-file-debug 0 0.1) + use-package-expand-minimally (not noninteractive)) ;; A common mistake for new users is that they inadvertently install their ;; packages with package.el, by copying over old `use-package' declarations with @@ -474,7 +474,7 @@ The overall load order of Doom is as follows: Module load order is determined by your `doom!' block. See `doom-modules-dirs' for a list of all recognized module trees. Order defines precedence (from most to least)." - `(unless doom-interactive-p + `(when noninteractive (doom-module-mplist-map (lambda (category module &rest plist) (if (plist-member plist :path) diff --git a/core/core-packages.el b/core/core-packages.el index af735c8e8..849d8ff64 100644 --- a/core/core-packages.el +++ b/core/core-packages.el @@ -120,7 +120,7 @@ uses a straight or package.el command directly).") "://github.com/" (or (plist-get recipe :repo) "radian-software/straight.el"))) (branch (or (plist-get recipe :branch) straight-repository-branch)) - (call (if doom-debug-p + (call (if init-file-debug (lambda (&rest args) (print! "%s" (cdr (apply #'doom-call-process args)))) (lambda (&rest args) diff --git a/core/core-projects.el b/core/core-projects.el index aac41b973..6eaa8a8bb 100644 --- a/core/core-projects.el +++ b/core/core-projects.el @@ -30,7 +30,7 @@ debian, and derivatives). On most it's 'fd'.") ;; Auto-discovery is slow to do by default. Better to update the list ;; when you need to (`projectile-discover-projects-in-search-path'). projectile-auto-discover nil - projectile-enable-caching doom-interactive-p + projectile-enable-caching (not noninteractive) projectile-globally-ignored-files '(".DS_Store" "TAGS") projectile-globally-ignored-file-suffixes '(".elc" ".pyc" ".o") projectile-kill-buffers-filter 'kill-only-files @@ -115,8 +115,7 @@ b) represent blacklisted directories that are too big, change too often or are private. (see `doom-projectile-cache-blacklist'), c) are not valid projectile projects." (when (and (bound-and-true-p projectile-projects-cache) - projectile-enable-caching - doom-interactive-p) + projectile-enable-caching) (setq projectile-known-projects (cl-remove-if #'projectile-ignored-project-p projectile-known-projects)) diff --git a/core/core.el b/core/core.el index 07254e602..195bf922f 100644 --- a/core/core.el +++ b/core/core.el @@ -115,18 +115,6 @@ (defconst doom-modules-version "22.06.0-dev" "Current version of Doom Emacs.") -(defvar doom-debug-p (or (getenv-internal "DEBUG") init-file-debug) - "If non-nil, Doom will log more. - -Use `doom-debug-mode' to toggle it. The --debug-init flag and setting the DEBUG -envvar will enable this at startup.") - -(defvar doom-init-p nil - "Non-nil if Doom has been initialized.") - -(defconst doom-interactive-p (not noninteractive) - "If non-nil, Emacs is in interactive mode.") - ;; ;;; Directory variables diff --git a/modules/config/literate/autoload.el b/modules/config/literate/autoload.el index 3af4fe3e6..18f6df895 100644 --- a/modules/config/literate/autoload.el +++ b/modules/config/literate/autoload.el @@ -69,8 +69,6 @@ "--eval" (prin1-to-string `(progn - (defvar doom-interactive-p nil) - (defvar doom-debug-p ,doom-debug-p) (require 'cl-lib) (require 'subr-x) (load ,(doom-path doom-core-dir "autoload/print")) @@ -111,10 +109,10 @@ (defun +literate-tangle-h () "Tangles `+literate-config-file' if it has changed. This is performed with an asyncronous Emacs process, except when -`doom-interactive-p' is non-nil." - (if doom-interactive-p - (+literate-tangle--async) - (+literate-tangle--sync))) +`noninteractive' is nil." + (if noninteractive + (+literate-tangle--sync) + (+literate-tangle--async))) ;;;###autoload (defun +literate-tangle-check-finished-h () diff --git a/modules/editor/evil/init.el b/modules/editor/evil/init.el index 55990d14c..d3134a070 100644 --- a/modules/editor/evil/init.el +++ b/modules/editor/evil/init.el @@ -19,7 +19,7 @@ ;; disable modules, and to reduce the effort required to maintain our copy of ;; `evil-collection-list' (now I can just copy it from time to time). -(when (and doom-interactive-p +(when (and (not noninteractive) (not doom-reloading-p) (featurep! +everywhere)) diff --git a/modules/editor/snippets/config.el b/modules/editor/snippets/config.el index 87816b590..0e90d3fe3 100644 --- a/modules/editor/snippets/config.el +++ b/modules/editor/snippets/config.el @@ -34,7 +34,7 @@ ;; Reduce verbosity. 3 is too chatty about initializing yasnippet. 2 is just ;; right (only shows errors). - (setq yas-verbosity (if doom-debug-p 3 0)) + (setq yas-verbosity (if init-file-debug 3 0)) ;; default snippets library, if available (add-to-list 'load-path +snippets-dir) diff --git a/modules/tools/lookup/config.el b/modules/tools/lookup/config.el index 0449bee7c..ac1721761 100644 --- a/modules/tools/lookup/config.el +++ b/modules/tools/lookup/config.el @@ -197,7 +197,7 @@ Dictionary.app behind the scenes to get definitions.") :init (add-hook '+lookup-documentation-functions #'+lookup-dash-docsets-backend-fn) :config - (setq dash-docs-enable-debugging doom-debug-p + (setq dash-docs-enable-debugging init-file-debug dash-docs-docsets-path (concat doom-etc-dir "docsets/") dash-docs-min-length 2 dash-docs-browser-func #'eww)