I have a face, created this way:
(defface test-face
'((t . (:height 2.0)))
"A face for testing.")
I'd like to insert some text with that face. But these ways insert the text without the face:
(insert (propertize "text to insert" 'face 'test-face))
(let ((current-string "text to insert"))
(put-text-property 1 (length current-string) 'face 'test-face)
(insert current-string))
And even inserting the text first, then going back to put the face on it isn't working:
(progn
(insert "text to insert")
(add-text-properties
(save-excursion
(backward-word 3)
(point))
(point)
'(face test-face)))
The problem isn't the definition of the face, because if I go to customize it, it's already showing up with height twice as big. Even so, inlining the face also doesn't work:
(insert (propertize "to insert" 'face '(:height 2.0)))
So how can I put in some text with the specific face? I know I can use an overlay, but that seems like overkill because it's more verbose, requires the text to be inserted first (so we have to find out the size and position of the text to be overlaid) and requires making more garbage to be collected.