using the correct face for custom segments
mohkale opened this issue · comments
I've got a custom segment defined like this:
(spaceline-define-segment buffer-mode-icon
"an `all-the-icons' segment to show the mode of the current buffer"
(all-the-icons-icon-for-mode major-mode
:v-adjust -0.15
:face :inherit)
:enabled (all-the-icons-available-p))
where all-the-icons-available-p
is just an alias for display-graphic-p
.
This works... but it doesn't adjust to the introduction of new segments, such as anzu.
also, if emacs loses focus (such as when I) switch to a different program the segments face doesn't change.
I found this page on all-the-icon icons in spaceline & changed my segment to this, which works exactly as I expect it to:
(spaceline-define-segment
ati-mode-icon "An `all-the-icons' segment for the current buffer mode"
(let ((icon (all-the-icons-icon-for-buffer)))
(unless (symbolp icon) ;; This implies it's the major mode
(propertize icon
'help-echo (format "Major-mode: `%s`" major-mode)
'display '(raise 0.0)
'face `(:height 1.0 :family ,(all-the-icons-icon-family-for-buffer) :inherit)))))
I think using propertize directly, instead of indirectly through the all-the-icon methods is whats fixing it. If anyone could offer an explanation, I'll leave this issue open in the meantime.