I'm trying to display some highlighted text in the Emacs minibuffer. I know it's possible because SLIME does it when displaying argument hints. However, I can't see how it's being accomplished by looking at slime.el. Based on what I'm reading there, the displayed text shouldn't be highlighted (relevant section starts at line 3615).
I've tried
(message "%s" (propertize "test" 'face 'highlight))
(overlay-put (make-overlay (point-min) (point-min)) 'before-string (propertize "test" 'face 'highlight))
(with-current-buffer (window-buffer (minibuffer-window)) (insert (propertize "test" 'face 'highlight)))
That last one seems closest to what I want, but the displayed text appears and disappears sporadically as I move point
, and it has to be manually removed later. I've also tested the solution given here, and it doesn't seem to work for me either. The non-working solutions all do the same thing; display the text
#("test" 0 4 (face highlight))
in the minibuffer.
In case it matters, I'm running Emacs 23.4.1 on Debian Wheezy.
You're victim of testing with M-:
which additionally to running the code, displays the returned value in the minibuffer, thus immediately overwriting whatever your code has done.