I'd like to get a tooltip that says "meow", whenever my mouse is on the word "Cat" in Emacs. I tried this snippet I put together, but didn't work. What's wrong with it?
(defun my-hi-lock ()
(interactive)
(highlight-regexp "Cat" '(help-echo "meow!"))
)
I'd like to put the associated tooltip message inside the highlight-regexp statement rather than define a font face at a different place because I won't reuse each tooltip message that I'm going to assign to different keywords.
highlight-regexpfor this (and you don't need font-lock either). Just put text-propertyhelp-echoon the buffer text for which you want the mouseover tooltip.help-echo(not font-lock, for example) that is responsible for the tooltip. See functionsput-text-property,add-text-properties, andset-text-properties.