From 1d9b102181455710860bb7ddc07d86f1eb7f260c Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 19 Mar 2024 20:31:00 -0400 Subject: [PATCH] fix: shut up site-lisp One various OSes, Emacs ships with site-lisp files that load OS/architecture-specific config (like native-comp config), or load-lines for Emacs packages installed via your OS package manager (like mu4e). Output from these are rarely suppressed, for some reason, which causes noise in *Messages* at startup, which triggers a redraw, which can be very expensive during startup, depending on your window system. --- lisp/doom.el | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lisp/doom.el b/lisp/doom.el index 74ca41754..f695a1a67 100644 --- a/lisp/doom.el +++ b/lisp/doom.el @@ -489,10 +489,24 @@ users).") inhibit-message nil) (redraw-frame)) (add-hook 'after-init-hook #'doom--reset-inhibited-vars-h) + + ;; PERF,UX: An annoying aspect of site-lisp files is that they're often + ;; noisy (they emit load messages or other output to stdout). These + ;; queue unnecessary redraws at startup, cost startup time, and pollute + ;; the logs. I get around it by suppressing it until we can load it + ;; manually, later (in the `startup--load-user-init-file' advice below). + (put 'site-run-file 'initial-value site-run-file) + (setq site-run-file nil) + (define-advice startup--load-user-init-file (:around (fn &rest args) undo-inhibit-vars) (let (--init--) (unwind-protect (progn + (when (setq site-run-file (get 'site-run-file 'initial-value)) + (let ((inhibit-startup-screen inhibit-startup-screen)) + (letf! (defun load (file &optional noerror _nomessage &rest args) + (apply load file noerror t args)) + (load site-run-file t t)))) (apply fn args) (setq --init-- t)) (when (or (not --init--) init-file-had-error)