I wrote a post-command-hook
that displays a small calendar whenever the point is on a date.
I generate the calendar by invoking calendar-generate-month
in a temp buffer, and I'd like to show that in the echo area.
The code I'm using is:
(with-temp-buffer (calendar-generate-month (car date) (nth 2 date) 6) (message "%s" (buffer-string))))
It works fine except for colors.
I see a nicely tabulated calendar in the echo/minibuffer area (while the point is on top of a date in the format I like...) but without colors. And colors are what make today stand out in the calendar, so the visual immediacy is lost.
If I insert
into a buffer the string I extract from the temporary buffer, I see that string displayed nicely with colors, so I know that the properties are preserved.
If I print
that string, I see all its properties represented textually, which offers additional confirmation I didn't lose them.
I read on stackoverflow that function message
supports faces but not font-lock-faces
, but I haven't found out how to convert the second into the first.
Help?