When I print messages using (message (propertize "text" 'face 'some-face))
properties get printed as text:
#("text" 0 4 (face some-face))
How can I have faces displayed properly?
Emacs Stack Exchange is a question and answer site for those using, extending or developing Emacs. It only takes a minute to sign up.
Sign up to join this communityNo they don't get printed as text. :-)
Evaluate the following function, then call M-x mes
. Doesn't it work?
(defun mes ()
"message me"
(interactive)
(message (propertize "text" 'face 'font-lock-warning-face)))
The problem, I imagine, is that you're evaluating your snippet with
something like eval-last-sexp
(C-x C-e
). This function (and its
brethren) prints the form's return value on the echo area, which is
what you're seeing (the message
function also returns the string it
prints).
Your test code is working, but the message in the mode-line is getting immediately replaced by the return value. That's why you can't see it.