From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.help Subject: Re: Adding a tooltip to text that matches a regexp? Date: Fri, 21 Nov 2014 08:38:38 +0100 Message-ID: <87vbm957gh.fsf@thinkpad-t440p.tsdh.org> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1416555560 22037 80.91.229.3 (21 Nov 2014 07:39:20 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 21 Nov 2014 07:39:20 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Raffaele Ricciardi Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Nov 21 08:39:14 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 1XrioC-0000KS-1j for geh-help-gnu-emacs@m.gmane.org; Fri, 21 Nov 2014 08:39:12 +0100 Original-Received: from localhost ([::1]:38806 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XrioB-00032p-Lg for geh-help-gnu-emacs@m.gmane.org; Fri, 21 Nov 2014 02:39:11 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49547) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xrins-00032a-Gb for help-gnu-emacs@gnu.org; Fri, 21 Nov 2014 02:38:58 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xrinm-0005Aj-4Z for help-gnu-emacs@gnu.org; Fri, 21 Nov 2014 02:38:52 -0500 Original-Received: from out4-smtp.messagingengine.com ([66.111.4.28]:33864) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xrinm-0005Af-0K for help-gnu-emacs@gnu.org; Fri, 21 Nov 2014 02:38:46 -0500 Original-Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id E067220572 for ; Fri, 21 Nov 2014 02:38:43 -0500 (EST) Original-Received: from frontend2 ([10.202.2.161]) by compute4.internal (MEProxy); Fri, 21 Nov 2014 02:38:43 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=x-sasl-enc:from:to:cc:subject:references :date:in-reply-to:message-id:mime-version:content-type; s= smtpout; bh=LMjPD2HU7pvh9kbMQ5tvrWNJPqo=; b=BQstef/IK1NXgLrmhpc+ B0q+y2nmV95l1Gwj7OpCsgiCo9Wawi3UkEoPjuNJrpBOVYVQuTsDMm0HY4y8e9dc m71qFqf1qRaV+EGJSMAxWjkO9NiEB5IvH0wJ61N81Umjo2f63z2JRKa29YBU1vvA GG3DUSB3aoIPpZAvkc0scYo= X-Sasl-enc: fIFXWR/nLli7sAvMiSuUjCgryg9gAfSVHWyPZzrR2BkQ 1416555523 Original-Received: from thinkpad-t440p.tsdh.org (unknown [2.163.251.229]) by mail.messagingengine.com (Postfix) with ESMTPA id E704A68009D; Fri, 21 Nov 2014 02:38:42 -0500 (EST) Mail-Followup-To: Raffaele Ricciardi , help-gnu-emacs@gnu.org In-Reply-To: (Raffaele Ricciardi's message of "Thu, 20 Nov 2014 19:29:07 +0100") User-Agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/25.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 66.111.4.28 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:101092 Archived-At: Raffaele Ricciardi 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