Speed up initialisation with hook on an idle timer

theme-magic was responsible for a significant portion of the startup
time ... no longer
This commit is contained in:
TEC 2020-12-25 01:29:45 +08:00
parent 099cab498d
commit 571d917499
Signed by: tec
GPG Key ID: 779591AFDB81F06C
1 changed files with 8 additions and 1 deletions

View File

@ -1682,8 +1682,15 @@ Let's make this suit me slightly better.
#+end_src
** Theme magic
Let's automatically update terminals on theme change (as long as ~pywal~ is available).
Unfortunately, as the theme is set on startup this causes the hook to be run
immediately. It would be nicer to /not/ have this add to our precious startup
time (around 0.4s last time I checked).
We can achieve this by deferring it with a short idle timer that should add the
hook /just after/ initialisation.
#+begin_src emacs-lisp :tangle (if (executable-find "wal") "yes" "no")
(add-hook 'doom-load-theme-hook 'theme-magic-from-emacs)
(run-with-idle-timer 0.1 nil (lambda () (add-hook 'doom-load-theme-hook 'theme-magic-from-emacs)))
#+end_src
** Tramp
Let's try to make tramp handle prompts better