From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Raffaele Ricciardi Newsgroups: gmane.emacs.help Subject: Adding a tooltip to text that matches a regexp? Date: Thu, 20 Nov 2014 19:29:07 +0100 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1416508233 322 80.91.229.3 (20 Nov 2014 18:30:33 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 20 Nov 2014 18:30:33 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Nov 20 19:30:26 2014 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XrWUp-0001Qn-2p for geh-help-gnu-emacs@m.gmane.org; Thu, 20 Nov 2014 19:30:23 +0100 Original-Received: from localhost ([::1]:36827 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XrWUo-0002lB-Lp for geh-help-gnu-emacs@m.gmane.org; Thu, 20 Nov 2014 13:30:22 -0500 Original-Path: usenet.stanford.edu!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 15 Original-X-Trace: individual.net Xqk+aDZQma1V2jVZ0022tg11VZ97fH9dm3hxYEqH35yjQYFFnX Cancel-Lock: sha1:n7eSc/lMhaoGbGd5RotMvkYi+tI= User-Agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 Original-Xref: usenet.stanford.edu gnu.emacs.help:208804 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:101084 Archived-At: 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.