ITADN

[Bug] Error on config reload

#812Closedskalyan91 创建于 2026-02-21
bug
S
skalyan91commented
### Thank you for the bug report - [x] I am using the latest version of `doom-modeline` related packages. - [x] I checked [FAQ](https://github.com/seagle0128/doom-modeline#faq). - [ ] You may also try reproduce the issue using clean environment and minimal configurations with the command `emacs -Q`. ### Bug description When I reload my config with `SPC h r r`, I get the error `(wrong-type-argument stringp nil)`, seemingly triggered by `(setq doom-modeline-icon nil)`, except that I get the same error if I use `(setq doom-modeline-icon t)`. I do not get this error when Emacs starts; only when I reload the config. ### Steps to reproduce Put the following lines in `config.el`: ``` (setq doom-modeline-height 36) (setq doom-modeline-icon nil) (setq doom-modeline-enable-word-count t) (setq doom-modeline-continuous-word-count-modes '(markdown-mode gfm-mode org-mode text-mode)) ``` Restart Emacs and run `SPC h r r`. ### Expected behavior I should not get an error upon running `SPC h r r`. ### OS MacOS ### Emacs Version 30 ### Emacs Configurations Doom Emacs ### Error callstack ```emacs-lisp Debugger entered--Lisp error: (wrong-type-argument stringp nil) doom-modeline-update-battery-status() #f(compiled-function (sym val op where) #<bytecode -0x11199c4cffa3f53a>)(doom-modeline-icon nil set nil) (setq doom-modeline-icon nil) load-with-code-conversion("/Users/sivakalyan/.doom.d/config.el" "/Users/sivakalyan/.doom.d/config.el" t t) load("/Users/sivakalyan/.doom.d/config" t nomessage) (condition-case e (load path noerror 'nomessage) ((debug doom-error) (signal (car e) (cdr e))) ((debug error) (setq path (locate-file path load-path (get-load-suffixes))) (if (not (and path (featurep 'doom))) (signal (car e) (cdr e)) (cl-loop for (err . dir) in (list (cons 'doom-cli-error (expand-file-name "cli" doom-core-dir)) (cons 'doom-core-error doom-core-dir) (cons 'doom-user-error doom-user-dir) (cons 'doom-profile-error doom-profile-dir) (cons 'doom-module-error doom-modules-dir)) if (file-in-directory-p path dir) do (signal err (list (file-relative-name path (expand-file-name "../" dir)) e)))))) doom-load("/Users/sivakalyan/.doom.d/config" t) (let ((doom-module-context (let ((key '(:user))) (if key (doom-module-context key) (let ((index nil) (key nil) (path nil) (flags nil) (features nil)) (record 'doom-module-context index key path flags features)))))) (if (and (not doom-inhibit-log) (or (not noninteractive) (<= 2 doom-log-level))) (progn (doom--log 2 ":context:module: =%s" doom-module-context))) (doom-load (file-name-concat doom-user-dir "config") t)) (let ((doom-context doom-context)) (doom-context-push 'config) (doom-run-hooks 'doom-before-modules-config-hook) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/input/chinese/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/input/japanese/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/completion/company/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/completion/helm/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/ui/deft/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/ui/doom/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/ui/doom-dashboard/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/ui/doom-quit/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/ui/hl-todo/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/ui/indent-guides/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/ui/minimap/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/ui/modeline/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/ui/ophints/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/ui/popup/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/ui/treemacs/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/ui/vc-gutter/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/ui/workspaces/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/ui/zen/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/editor/evil/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/editor/file-templates/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/editor/fold/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/editor/format/config" t)) ...) (let ((old-custom-file custom-file)) (let ((doom-context doom-context)) (doom-context-push 'init) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/config/use-package/init" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load (file-name-concat doom-core-dir "init") t)) (doom-run-hooks 'doom-before-modules-init-hook) (doom-run-hooks 'doom-after-modules-init-hook)) (let ((doom-context doom-context)) (doom-context-push 'config) (doom-run-hooks 'doom-before-modules-config-hook) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/input/chinese/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/input/japanese/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/completion/company/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/completion/helm/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/ui/deft/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/ui/doom/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/ui/doom-dashboard/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/ui/doom-quit/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/ui/hl-todo/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/ui/indent-guides/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/ui/minimap/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/ui/modeline/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/ui/ophints/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/ui/popup/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/ui/treemacs/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/ui/vc-gutter/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/ui/workspaces/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/ui/zen/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/editor/evil/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/editor/file-templates/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/editor/fold/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/editor/format/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/editor/multiple-cursors/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/editor/snippets/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/editor/word-wrap/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/emacs/dired/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/emacs/electric/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/emacs/undo/config" t)) ...) (if (eq custom-file old-custom-file) (progn (doom-load custom-file 'noerror)))) (let ((doom-context doom-context)) (doom-context-push 'module) (let ((old-custom-file custom-file)) (let ((doom-context doom-context)) (doom-context-push 'init) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/config/use-package/init" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load (file-name-concat doom-core-dir "init") t)) (doom-run-hooks 'doom-before-modules-init-hook) (doom-run-hooks 'doom-after-modules-init-hook)) (let ((doom-context doom-context)) (doom-context-push 'config) (doom-run-hooks 'doom-before-modules-config-hook) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/input/chinese/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/input/japanese/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/completion/company/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/completion/helm/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/ui/deft/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/ui/doom/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/ui/doom-dashboard/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/ui/doom-quit/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/ui/hl-todo/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/ui/indent-guides/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/ui/minimap/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/ui/modeline/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/ui/ophints/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/ui/popup/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/ui/treemacs/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/ui/vc-gutter/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/ui/workspaces/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/ui/zen/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/editor/evil/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/editor/file-templates/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/editor/fold/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/editor/format/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/editor/multiple-cursors/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/editor/snippets/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/editor/word-wrap/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/emacs/dired/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/emacs/electric/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/emacs/undo/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/emacs/vc/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/term/shell/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/term/term/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/term/vterm/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/checkers/syntax/config" t)) (let ((doom-module-context ...)) (if (and ... ...) (progn ...)) (doom-load "~/.config/emacs/modules/tools/docker/config" t)) ...) (if (eq custom-file old-custom-file) (progn (doom-load custom-file 'noerror))))) doom--startup-modules() (progn (doom--startup-vars) (doom--startup-loaddefs-doom) (doom--startup-loaddefs-packages) (doom--startup-modules)) (if (or (doom-context-p 'startup) (doom-context-p 'reload)) (progn (doom--startup-vars) (doom--startup-loaddefs-doom) (doom--startup-loaddefs-packages) (doom--startup-modules))) doom-startup() (let ((init-file-name (doom-profile-init-file doom-profile))) (setq user-init-file init-file-name) (setq load-history (delete (assoc init-file-name load-history) load-history)) (doom-startup)) (progn (let ((init-file-name (doom-profile-init-file doom-profile))) (setq user-init-file init-file-name) (setq load-history (delete (assoc init-file-name load-history) load-history)) (doom-startup))) (if init-file-user (progn (let ((init-file-name (doom-profile-init-file doom-profile))) (setq user-init-file init-file-name) (setq load-history (delete (assoc init-file-name load-history) load-history)) (doom-startup)))) (condition-case error (if init-file-user (progn (let ((init-file-name (doom-profile-init-file doom-profile))) (setq user-init-file init-file-name) (setq load-history (delete (assoc init-file-name load-history) load-history)) (doom-startup)))) ((debug error) (display-warning 'initialization (format-message "An error occurred while booting Doom Emacs:\n\n%s%s%s\n\nTo ensure normal operation, you should investigate and remove the\ncause of the error in your Doom config files. Start Emacs with\nthe `--debug-init' option to view a complete error backtrace." (get (car error) 'error-message) (if (cdr error) ": " "") (mapconcat #'(lambda (s) (prin1-to-string s t)) (cdr error) ", ")) :warning) (setq init-file-had-error t))) (let ((debug-on-error debug-on-error-initial)) (condition-case error (if init-file-user (progn (let ((init-file-name (doom-profile-init-file doom-profile))) (setq user-init-file init-file-name) (setq load-history (delete (assoc init-file-name load-history) load-history)) (doom-startup)))) ((debug error) (display-warning 'initialization (format-message "An error occurred while booting Doom Emacs:\n\n%s%s%s\n\nTo ensure normal operation, you should investigate and remove the\ncause of the error in your Doom config files. Start Emacs with\nthe `--debug-init' option to view a complete error backtrace." (get (car error) 'error-message) (if (cdr error) ": " "") (mapconcat #'(lambda ... ...) (cdr error) ", ")) :warning) (setq init-file-had-error t))) (or (eq debug-on-error debug-on-error-initial) (progn (setq debug-on-error-should-be-set t) (setq debug-on-error-from-init-file debug-on-error)))) (let ((debug-on-error-from-init-file nil) (debug-on-error-should-be-set nil) (debug-on-error-initial (if (eq init-file-debug t) 'startup init-file-debug)) (inhibit-null-byte-detection t)) (let ((debug-on-error debug-on-error-initial)) (condition-case error (if init-file-user (progn (let ((init-file-name ...)) (setq user-init-file init-file-name) (setq load-history (delete ... load-history)) (doom-startup)))) ((debug error) (display-warning 'initialization (format-message "An error occurred while booting Doom Emacs:\n\n%s%s%s\n\nTo ensure normal operation, you should investigate and remove the\ncause of the error in your Doom config files. Start Emacs with\nthe `--debug-init' option to view a complete error backtrace." (get (car error) 'error-message) (if (cdr error) ": " "") (mapconcat #'... (cdr error) ", ")) :warning) (setq init-file-had-error t))) (or (eq debug-on-error debug-on-error-initial) (progn (setq debug-on-error-should-be-set t) (setq debug-on-error-from-init-file debug-on-error)))) (if debug-on-error-should-be-set (progn (setq debug-on-error debug-on-error-from-init-file)))) startup--load-user-init-file@init-doom(nil) apply(startup--load-user-init-file@init-doom nil) #f(advice startup--load-user-init-file@init-doom :override #<subr startup--load-user-init-file> ((depth . 100) (name . init-doom)))(nil) apply(#f(advice startup--load-user-init-file@init-doom :override #<subr startup--load-user-init-file> ((depth . 100) (name . init-doom))) nil) (unwind-protect (apply fn args) (progn (set-default 'inhibit-message nil)) (advice-remove #'tool-bar-setup #'ignore) (let ((sym 'tool-bar-mode)) (defalias 'doom-transient-hook9 #'(lambda (&rest _) "Transient hook for tool-bar-mode" (tool-bar-setup) (let ((sym ...)) (cond (... ...) (... ...))) (unintern 'doom-transient-hook9 nil))) (cond ((functionp sym) (advice-add 'tool-bar-mode :before #'doom-transient-hook9)) ((symbolp sym) (put 'doom-transient-hook9 'permanent-local-hook t) (add-hook sym #'doom-transient-hook9 nil)))) (if (default-toplevel-value 'mode-line-format) nil (progn (set-default 'mode-line-format (get 'mode-line-format 'initial-value))))) startup--load-user-init-file@undo-hacks(#f(advice startup--load-user-init-file@init-doom :override #<subr startup--load-user-init-file> ((depth . 100) (name . init-doom))) nil) apply(startup--load-user-init-file@undo-hacks #f(advice startup--load-user-init-file@init-doom :override #<subr startup--load-user-init-file> ((depth . 100) (name . init-doom))) nil) startup--load-user-init-file(nil) (unwind-protect (startup--load-user-init-file nil) (general-auto-unbind-keys t)) (progn (general-auto-unbind-keys) (unwind-protect (startup--load-user-init-file nil) (general-auto-unbind-keys t))) (condition-case err (progn (general-auto-unbind-keys) (unwind-protect (startup--load-user-init-file nil) (general-auto-unbind-keys t))) ((debug error) (message "PRIVATE CONFIG ERROR: %s" err) nil)) (let ((doom-context doom-context)) (doom-context-push 'reload) (doom-run-hooks 'doom-before-reload-hook) (condition-case err (progn (general-auto-unbind-keys) (unwind-protect (startup--load-user-init-file nil) (general-auto-unbind-keys t))) ((debug error) (message "PRIVATE CONFIG ERROR: %s" err) nil)) (doom-run-hooks 'doom-after-reload-hook) (message "Config successfully reloaded!")) (progn (delete-window w) (let ((doom-context doom-context)) (doom-context-push 'reload) (doom-run-hooks 'doom-before-reload-hook) (condition-case err (progn (general-auto-unbind-keys) (unwind-protect (startup--load-user-init-file nil) (general-auto-unbind-keys t))) ((debug error) (message "PRIVATE CONFIG ERROR: %s" err) nil)) (doom-run-hooks 'doom-after-reload-hook) (message "Config successfully reloaded!"))) (if (equal status "finished\n") (progn (delete-window w) (let ((doom-context doom-context)) (doom-context-push 'reload) (doom-run-hooks 'doom-before-reload-hook) (condition-case err (progn (general-auto-unbind-keys) (unwind-protect (startup--load-user-init-file nil) (general-auto-unbind-keys t))) ((debug error) (message "PRIVATE CONFIG ERROR: %s" err) nil)) (doom-run-hooks 'doom-after-reload-hook) (message "Config successfully reloaded!"))) (user-error "Failed to reload your config")) #f(lambda (_buf status) [(w #<window 7>)] (if (equal status "finished\n") (progn (delete-window w) (let ((doom-context doom-context)) (doom-context-push 'reload) (doom-run-hooks 'doom-before-reload-hook) (condition-case err (progn (general-auto-unbind-keys) (unwind-protect (startup--load-user-init-file nil) (general-auto-unbind-keys t))) ((debug error) (message "PRIVATE CONFIG ERROR: %s" err) nil)) (doom-run-hooks 'doom-after-reload-hook) (message "Config successfully reloaded!"))) (user-error "Failed to reload your config")))(#<buffer *compilation*> "finished\n") compilation-handle-exit(exit 0 "finished\n") compilation-sentinel(#<process comint> "finished\n") ```
关闭于 2026-02-23 1 条评论