From a718db0d64a31655ef3f0e60997cce3d465e312e Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Thu, 13 Nov 2025 12:04:54 -0600 Subject: feat: mode-line: defer network requests until after Emacs initialization Prevents mode-line from making network requests during Emacs startup. Network activity now deferred to after-init-hook when Emacs is not yet fully initialized, improving startup performance. --- wttrin.el | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/wttrin.el b/wttrin.el index b4dd697..8ea00b2 100644 --- a/wttrin.el +++ b/wttrin.el @@ -599,7 +599,13 @@ When enabled, shows weather for `wttrin-mode-line-favorite-location'." (progn (when (featurep 'wttrin-debug) (wttrin--debug-log "wttrin mode-line: Mode enabled")) - (wttrin--mode-line-start) + ;; Delay network activity until Emacs is fully initialized + (if (and (not after-init-time) (not noninteractive)) + (progn + (when (featurep 'wttrin-debug) + (wttrin--debug-log "wttrin mode-line: Deferring start until after-init-hook")) + (add-hook 'after-init-hook #'wttrin--mode-line-start)) + (wttrin--mode-line-start)) ;; Add modeline string to global-mode-string for custom modelines (if global-mode-string (add-to-list 'global-mode-string 'wttrin-mode-line-string 'append) -- cgit v1.2.3