help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Adding a tooltip to text that matches a regexp?


From: Raffaele Ricciardi
Subject: Adding a tooltip to text that matches a regexp?
Date: Thu, 20 Nov 2014 19:29:07 +0100
User-agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.2.0

I would like to add a tooltip to any text that matches a regexp. The buffer content is going to change, thus I can't do it once for all. Since such text is going to be highlighted by Font Lock, it seems that adding the tooltip in `font-lock-add-keywords` could be a solution. I know that I must set the `help-echo` property of the matching text, like this:

    (set-text-properties  (match-beginning 0) (match-end 0)
                          '(help-echo "Tooltip text"
                                      font-lock-face 'my-custom-face))

Can I do this in `font-lock-add-keywords`? If so, how? If not, are there alternative solutions?

Thank you.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]