From 68ed4e629855af66e0032e468fdb7b4d7a2c2c1a Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Thu, 25 Nov 2021 01:17:42 +0100 Subject: [PATCH] tweak: suppress 'Loading X...' messages at startup From site-files, particularly. This *might* fix the white flash while Emacs is starting up in some scenarios. --- early-init.el | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/early-init.el b/early-init.el index da91ba904..6317c3e93 100644 --- a/early-init.el +++ b/early-init.el @@ -49,7 +49,19 @@ (lambda () (setq-default inhibit-redisplay nil inhibit-message nil) - (redisplay)))) + (redisplay))) + + ;; Site files tend to use `load-file', which emits "Loading X..." messages in + ;; the echo area, which in turn triggers a redisplay. Redisplays can have a + ;; substantial effect on startup times and in this case happens so early that + ;; Emacs may flash white while starting up. + (define-advice load-file (:override (file) silence) + (load file nil 'nomessage)) + + ;; Undo our `load-file' advice above, to limit the scope of any edge cases it + ;; may introduce down the road. + (define-advice startup--load-user-init-file (:before (&rest _) init-doom) + (advice-remove #'load-file #'load-file@silence))) ;;