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.
This commit is contained in:
Tom Willemse 2020-09-20 11:38:48 -07:00
parent 1541e08557
commit 02fa5f74db

View file

@ -510,9 +510,14 @@ ACTIVE tells if current window is active."
"Gets the height in pixels of WINDOW's mode-line font. "Gets the height in pixels of WINDOW's mode-line font.
This function also adjusts the line height by This function also adjusts the line height by
`mode-icons-line-height-adjust'. If WINDOW is nil, it defaults to `mode-icons-line-height-adjust'. If WINDOW is nil, it defaults to
the current window" the current window.
This function returns nil if the current display isnt 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 (+ mode-icons-line-height-adjust
(aref (font-info (face-font 'mode-line) (window-frame window)) 3))) (aref (font-info (face-font 'mode-line) (window-frame window)) 3))))
(defun mode-icons-get-icon-display (icon type &optional face active) (defun mode-icons-get-icon-display (icon type &optional face active)
"Get the value for the display property of ICON having TYPE. "Get the value for the display property of ICON having TYPE.