From 5775714506390d709ce75d33c112e83f7ff7d6f0 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 31 Mar 2020 16:30:30 -0400 Subject: [PATCH] Fix #2666: init indent-guides faces on first GUI frame --- modules/ui/indent-guides/config.el | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/modules/ui/indent-guides/config.el b/modules/ui/indent-guides/config.el index cd5cb5aeb..d8128a898 100644 --- a/modules/ui/indent-guides/config.el +++ b/modules/ui/indent-guides/config.el @@ -5,8 +5,20 @@ :init (setq highlight-indent-guides-method 'character) :config - (add-hook 'focus-in-hook #'highlight-indent-guides-auto-set-faces) - ;; `highlight-indent-guides' breaks in these modes + (defun +indent-guides-init-faces-h () + (when (display-graphic-p) + (highlight-indent-guides-auto-set-faces))) + + ;; HACK `highlight-indent-guides' calculates its faces from the current theme, + ;; but is unable to do so properly in terminal Emacs, where it only has + ;; access to 256 colors. So if the user uses a daemon we must wait for + ;; the first graphical frame to be available to do. + (add-hook (if (daemonp) + 'server-after-make-frame-hook + 'doom-load-theme-hook) + #'+indent-guides-init-faces-h) + + ;; `highlight-indent-guides' breaks when `org-indent-mode' is active (add-hook! 'org-indent-mode-hook (defun +indent-guides-disable-maybe-h () (when highlight-indent-guides-mode