perf: inhibit redisplay/echo area at startup

Unnecessary redraws can add 0.2-0.4s to startup times in some cases,
especially where site-files are involved (which spam *Messages* with
"Loading X..." messages; which force redraws).

May also indirectly fix #5643 by deferring redisplay (and therefore
window-buffer-change-functions, which triggers doom-init-ui-hook, which
triggers both Doom's dashboard and persp-mode).

Also removes a redundant set-language-environment call.

Ref #5643
This commit is contained in:
Henrik Lissner 2021-10-18 00:38:36 +02:00
parent 3106443707
commit 0ab6aba056

View file

@ -41,9 +41,15 @@
old-file-name-handler-alist)))) old-file-name-handler-alist))))
(add-hook 'emacs-startup-hook #'doom-reset-file-handler-alist-h 101)) (add-hook 'emacs-startup-hook #'doom-reset-file-handler-alist-h 101))
;; Contrary to what many Emacs users have in their configs, you don't need ;; Emacs really shouldn't be displaying anything until it has fully started
;; more than this to make UTF-8 the default coding system: ;; up. This saves a bit of time.
(set-language-environment "UTF-8")) (setq-default inhibit-redisplay t
inhibit-message t)
(add-hook 'window-setup-hook
(lambda ()
(setq-default inhibit-redisplay nil
inhibit-message nil)
(redisplay))))
;; ;;