[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to execute code on cursor move
From: |
Eli Zaretskii |
Subject: |
Re: How to execute code on cursor move |
Date: |
Sat, 13 Jul 2013 14:03:33 +0300 |
> Date: Sat, 13 Jul 2013 12:39:03 +0200
> From: Suvayu Ali <fatkasuvayu+linux@gmail.com>
>
> 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.