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 09:30:42 +0100 Message-ID: <878uj5551p.fsf@thinkpad-t440p.tsdh.org> References: <87vbm957gh.fsf@thinkpad-t440p.tsdh.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1416558677 780 80.91.229.3 (21 Nov 2014 08:31:17 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 21 Nov 2014 08:31:17 +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 09:31:11 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 1XrjcU-00045A-UV for geh-help-gnu-emacs@m.gmane.org; Fri, 21 Nov 2014 09:31:11 +0100 Original-Received: from localhost ([::1]:39105 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XrjcU-0008KY-Gi for geh-help-gnu-emacs@m.gmane.org; Fri, 21 Nov 2014 03:31:10 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59185) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XrjcF-0008KL-Ih for help-gnu-emacs@gnu.org; Fri, 21 Nov 2014 03:31:01 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XrjcA-0007ao-2Z for help-gnu-emacs@gnu.org; Fri, 21 Nov 2014 03:30:55 -0500 Original-Received: from out4-smtp.messagingengine.com ([66.111.4.28]:58063) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xrjc9-0007aK-Ee for help-gnu-emacs@gnu.org; Fri, 21 Nov 2014 03:30:49 -0500 Original-Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id C727B204D7 for ; Fri, 21 Nov 2014 03:30:48 -0500 (EST) Original-Received: from frontend1 ([10.202.2.160]) by compute3.internal (MEProxy); Fri, 21 Nov 2014 03:30:48 -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=z/8YYuyy8DoOdULbqxldIVPpXBU=; b=ujTi9j8x5wd4vTAXDbSH 5YUV6bI5pTevaCpLQ67di425m90azCoFwcy2OhHLe/QoPDfYmY466sb46uzZXX9E 1nyyMwYMH66lqN9tjCpVqsTkhIUAoDCu2yh181vGFiojTHPYRAT5ytIao4EHU5P7 DGaj0cpvct9R9iosHQfW9I0= X-Sasl-enc: 4Ajfzl0gVmoPt4372SvNvANJ+X4rj+QXCh6idjQrguOt 1416558648 Original-Received: from thinkpad-t440p.tsdh.org (unknown [2.163.251.229]) by mail.messagingengine.com (Postfix) with ESMTPA id D4EB6C0000E; Fri, 21 Nov 2014 03:30:47 -0500 (EST) Mail-Followup-To: Raffaele Ricciardi , help-gnu-emacs@gnu.org In-Reply-To: <87vbm957gh.fsf@thinkpad-t440p.tsdh.org> (Tassilo Horn's message of "Fri, 21 Nov 2014 08:38:38 +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:101094 Archived-At: Tassilo Horn 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