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

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

Re: Adding a tooltip to text that matches a regexp?


From: Raffaele Ricciardi
Subject: Re: Adding a tooltip to text that matches a regexp?
Date: Sat, 22 Nov 2014 13:48:06 +0100
User-agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.2.0

On 21/11/14 09:30, Tassilo Horn wrote:
Tassilo Horn <tsdh@gnu.org> writes:

     (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`?

Yes, you can.

If so, how?

This adds a "Foo or Bar" tooltip to any occurences of the words foo or
bar in the current buffer.

   (font-lock-add-keywords nil
     '(("\\<\\(foo\\|bar\\)\\>" 1 '(face nil help-echo "Foo or Bar"))))

And I think you will want to add help-echo to
`font-lock-extra-managed-props'.

Bye,
Tassilo


Thank you.

Should I make `font-lock-extra-managed-props' buffer local?


reply via email to

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