From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Suvayu Ali Newsgroups: gmane.emacs.help Subject: Re: How to execute code on cursor move Date: Sat, 13 Jul 2013 15:28:38 +0200 Message-ID: <20130713132838.GB11006@kuru.dyndns-at-home.com> References: <20130713103903.GA11006@kuru.dyndns-at-home.com> <83vc4e4t8a.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1373722138 22367 80.91.229.3 (13 Jul 2013 13:28:58 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 13 Jul 2013 13:28:58 +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 15:28:59 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 1Uxzsg-0007HQ-La for geh-help-gnu-emacs@m.gmane.org; Sat, 13 Jul 2013 15:28:58 +0200 Original-Received: from localhost ([::1]:56937 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uxzsg-0004Je-4l for geh-help-gnu-emacs@m.gmane.org; Sat, 13 Jul 2013 09:28:58 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40864) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UxzsS-0004JO-Et for help-gnu-emacs@gnu.org; Sat, 13 Jul 2013 09:28:47 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UxzsR-0005f3-8c for help-gnu-emacs@gnu.org; Sat, 13 Jul 2013 09:28:44 -0400 Original-Received: from mail-ee0-x22c.google.com ([2a00:1450:4013:c00::22c]:55258) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UxzsR-0005eo-10 for help-gnu-emacs@gnu.org; Sat, 13 Jul 2013 09:28:43 -0400 Original-Received: by mail-ee0-f44.google.com with SMTP id c13so6702929eek.17 for ; Sat, 13 Jul 2013 06:28:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=fQ+8m3Q58bGlZCuRgQZzXEKPbrj/6WUL4eLnLCNTmrA=; b=YZMxPgIBqbhiGwW0+BMRK4elauemczdaZ6ZAh/Q9D/d2jxqNozRC6i3nXOj1Q3Nl8h 2rPNv7jgkP9b7ufQLeLmh/14QQI630zRHkpQBaXEnDM6xRZf5oGAP5Ns46o31KYGo1I8 B8+ZJ1aSgSclyr5HfykMmksCN7Jyf3r/EH+BrS3N46p9xO5EwMtLj6mffLX7kMkKj5Xs pc4P1AH1IEQJ3i05XYcEEuHnFcvLwXy2PS30I+9rPOPyFJ+kKQeJX8T5VFyreWKhNipn rGFnFvuuzcoW/19FCq0aT7lCig2/QrQPRzbinJUH9CEJyYymvrklhV8NJvhGwTOVpIkp YBjg== X-Received: by 10.14.209.197 with SMTP id s45mr51893107eeo.108.1373722122178; Sat, 13 Jul 2013 06:28:42 -0700 (PDT) Original-Received: from kuru.dyndns-at-home.com (sd44012d5.adsl.online.nl. [212.64.18.213]) by mx.google.com with ESMTPSA id i2sm87131360eeu.4.2013.07.13.06.28.40 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sat, 13 Jul 2013 06:28:41 -0700 (PDT) Content-Disposition: inline In-Reply-To: <83vc4e4t8a.fsf@gnu.org> User-Agent: Mutt/1.5.21 (2012-12-30) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4013:c00::22c 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:92105 Archived-At: Hi Eli, On Sat, Jul 13, 2013 at 02:03:33PM +0300, Eli Zaretskii wrote: > > 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). [...chomp...chomp...chomp...] > > Is using the post-command-hook a good idea? > > No, because it slows down Emacs's _every_ command. Thank you, I had a feeling that is the case. > > 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. I have the following snippet based on what you say above: ----------8<--------------------8<---------- ;; Text for testing ;; some text description some more ;; setup: add tooltip (add-text-properties 34 45 '(help-echo "tooltip")) ;; test above setup: tooltip b/w 34-45 (get-text-property 40 'help-echo) ;; add special properties (defun sa-echo-tooltip (old new) (display-message-or-buffer (or (get-text-property new 'help-echo) ""))) (add-text-properties 34 45 '(point-left sa-echo-tooltip point-entered sa-echo-tooltip)) ----------8<--------------------8<---------- Now to convert this to something workable I guess I would have to add the point-left and point-entered properties to all org-links. I'm not sure how I can do that, but I guess asking on the Org mode list will be best. Thanks a lot! -- Suvayu Open source is the future. It sets us free.