[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 09:30:42 +0100 |
User-agent: |
Gnus/5.130012 (Ma Gnus v0.12) Emacs/25.0.50 (gnu/linux) |
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