emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Face text property for `minor-mode-alist` item.


From: Narendra Joshi
Subject: Face text property for `minor-mode-alist` item.
Date: Sun, 27 Dec 2020 16:13:02 +0100

Hi everyone,

I am trying to understand the following behaviour regarding
`mode-line-format' rendering the `:lighter` for `flycheck-mode'. I
wanted to have the flycheck lighter display different colors for the
error count and the warning count as `flymake` does.

The following doesn't work. The face property of the first character of
the string returned by `flycheck-mode-line-status-text' is used for the
whole string in this case.  

--8<---------------cut here---------------start------------->8---

(setq flycheck-mode-line '(:eval (flycheck-mode-line-status-text))
(defun flycheck-mode-line-status-text ()
    ... returns a single string with substrings propertized,
    e.g. #("some string" 1 2 ('face 'error) 2 3 ('face 'warning)))

--8<---------------cut here---------------end--------------->8---

If I change it to something like this: 

--8<---------------cut here---------------start------------->8---

(setq flycheck-mode-line '(:eval (flycheck-mode-line-status-text))
(defun flycheck-mode-line-status-text ()
    ... returns a (list ... part_1_with_face_1  part_2_with_face_2 ...))

--8<---------------cut here---------------end--------------->8---

This seems to work as expected and the parts have their respective faces
applied to them in the mode-line. 

Is this a bug in Emacs or is this expected behaviour?

Best regards,
-- 
Narendra Joshi



reply via email to

[Prev in Thread] Current Thread [Next in Thread]