From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.help Subject: Re: How to execute code on cursor move Date: Sat, 13 Jul 2013 14:03:33 +0300 Message-ID: <83vc4e4t8a.fsf@gnu.org> References: <20130713103903.GA11006@kuru.dyndns-at-home.com> NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1373713429 9530 80.91.229.3 (13 Jul 2013 11:03:49 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 13 Jul 2013 11:03:49 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Jul 13 13:03:50 2013 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 1UxxcD-0006iP-FV for geh-help-gnu-emacs@m.gmane.org; Sat, 13 Jul 2013 13:03:49 +0200 Original-Received: from localhost ([::1]:42069 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UxxcD-000366-35 for geh-help-gnu-emacs@m.gmane.org; Sat, 13 Jul 2013 07:03:49 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37245) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uxxc3-00035o-L7 for help-gnu-emacs@gnu.org; Sat, 13 Jul 2013 07:03:40 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uxxc2-0001EC-TB for help-gnu-emacs@gnu.org; Sat, 13 Jul 2013 07:03:39 -0400 Original-Received: from mtaout20.012.net.il ([80.179.55.166]:38366) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uxxc2-0001E3-Ks for help-gnu-emacs@gnu.org; Sat, 13 Jul 2013 07:03:38 -0400 Original-Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0MPV00800FL3RR00@a-mtaout20.012.net.il> for help-gnu-emacs@gnu.org; Sat, 13 Jul 2013 14:03:35 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MPV008DAG1ZOX50@a-mtaout20.012.net.il> for help-gnu-emacs@gnu.org; Sat, 13 Jul 2013 14:03:35 +0300 (IDT) In-reply-to: <20130713103903.GA11006@kuru.dyndns-at-home.com> X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: Solaris 10 X-Received-From: 80.179.55.166 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:92103 Archived-At: > Date: Sat, 13 Jul 2013 12:39:03 +0200 > From: Suvayu Ali > > I want to check a text property and display in the minibuffer depending > on context (in my case, on an org-link). > > This is what I have so far (working): > > (add-hook 'post-command-hook > (lambda() > (if (eq (get-text-property (point) 'face) 'org-link) > (display-message-or-buffer > (get-text-property (point) 'help-echo))))) > > Is using the post-command-hook a good idea? No, because it slows down Emacs's _every_ command. > Is there something better? There are the 'point-entered' and 'point-left' text properties. Make sure they cover the buffer positions where you want to display the message in the echo area, and the rest should be easy.