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: Tassilo Horn
Subject: Re: Adding a tooltip to text that matches a regexp?
Date: Fri, 21 Nov 2014 08:38:38 +0100
User-agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/25.0.50 (gnu/linux)

Raffaele Ricciardi <rfflrccrd@gmail.com> writes:

Hi Raffaele,

>     (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"))))

HTH,
Tassilo



reply via email to

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