From 02fa5f74db922365504d9571d998d818ebbcc16f Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Sun, 20 Sep 2020 11:38:48 -0700 Subject: [PATCH] Only attempt to get the line height if the display is a graphic one So that the height calculation doesn't interfere with the startup of the Emacs daemon, only try to calculate the height of the image when we're dealing with a graphical display. --- mode-icons.el | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/mode-icons.el b/mode-icons.el index b56d3fa..4f61df1 100644 --- a/mode-icons.el +++ b/mode-icons.el @@ -510,9 +510,14 @@ ACTIVE tells if current window is active." "Gets the height in pixels of WINDOW's mode-line font. This function also adjusts the line height by `mode-icons-line-height-adjust'. If WINDOW is nil, it defaults to -the current window" - (+ mode-icons-line-height-adjust - (aref (font-info (face-font 'mode-line) (window-frame window)) 3))) +the current window. + +This function returns nil if the current display isn’t a graphic +one. This is to make sure that things still work when dealing +with, for example, a starting daemon." + (when (display-graphic-p) + (+ mode-icons-line-height-adjust + (aref (font-info (face-font 'mode-line) (window-frame window)) 3)))) (defun mode-icons-get-icon-display (icon type &optional face active) "Get the value for the display property of ICON having TYPE.