[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How can I be notified whenever point of a buffer changed?
From: |
Ender |
Subject: |
Re: How can I be notified whenever point of a buffer changed? |
Date: |
17 Apr 2007 00:39:17 -0700 |
User-agent: |
G2/1.0 |
On Apr 13, 6:25 pm, Kai Grossjohann <k...@emptydomain.de> wrote:
> Perhaps you have to go for post-command-hook (or pre-command-hook).
> The function would record the last seen value of point, look whether
> point has changed, and do its thing if so. (Obviously, you would also
> have to update the last seen value of point.)
>
> (defvar kai-last-point nil)
> (make-variable-buffer-local 'kai-last-point)
>
> (defun kai-motion-hook ()
> (unless (equal (point) kai-last-point)
> (setq kai-last-point (point))
> ... do stuff here ...))
>
> (add-hook 'post-command-hook 'kai-motion-hook)
>
> This is untested.
>
> Kai
Thank you very much, It works! And thanks for your patience to replay
newbie's question although the question is stupid sometimes :)