all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Tassilo Horn <tsdh@gnu.org>
To: Raffaele Ricciardi <rfflrccrd@gmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Adding a tooltip to text that matches a regexp?
Date: Fri, 21 Nov 2014 09:30:42 +0100	[thread overview]
Message-ID: <878uj5551p.fsf@thinkpad-t440p.tsdh.org> (raw)
In-Reply-To: <87vbm957gh.fsf@thinkpad-t440p.tsdh.org> (Tassilo Horn's message of "Fri, 21 Nov 2014 08:38:38 +0100")

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



  reply	other threads:[~2014-11-21  8:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-20 18:29 Adding a tooltip to text that matches a regexp? Raffaele Ricciardi
2014-11-21  7:38 ` Tassilo Horn
2014-11-21  8:30   ` Tassilo Horn [this message]
     [not found]   ` <mailman.14226.1416558662.1147.help-gnu-emacs@gnu.org>
2014-11-22 12:48     ` Raffaele Ricciardi
2014-11-22 13:47       ` Tassilo Horn
2014-11-22 14:34       ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878uj5551p.fsf@thinkpad-t440p.tsdh.org \
    --to=tsdh@gnu.org \
    --cc=help-gnu-emacs@gnu.org \
    --cc=rfflrccrd@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.