From: Kai Grossjohann <kai@emptydomain.de>
To: help-gnu-emacs@gnu.org
Subject: Re: How can I be notified whenever point of a buffer changed?
Date: Fri, 13 Apr 2007 12:25:23 +0200 [thread overview]
Message-ID: <86hcrka7vw.fsf@ketchup.de.uu.net> (raw)
In-Reply-To: 1176350448.277558.178010@q75g2000hsh.googlegroups.com
"Ender" <oldcode@gmail.com> writes:
> I want a user defined function be called whenever point of a desired
> buffer was changed, how can I do this stuff? Any help will be
> appreciated.
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
next prev parent reply other threads:[~2007-04-13 10:25 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-12 4:00 How can I be notified whenever point of a buffer changed? Ender
2007-04-12 8:09 ` Kai Grossjohann
[not found] ` <mailman.1978.1176365678.7795.help-gnu-emacs@gnu.org>
2007-04-13 2:21 ` Ender
2007-04-13 10:22 ` Kai Grossjohann
2007-04-13 10:25 ` Kai Grossjohann [this message]
[not found] ` <mailman.2027.1176460480.7795.help-gnu-emacs@gnu.org>
2007-04-17 7:39 ` Ender
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86hcrka7vw.fsf@ketchup.de.uu.net \
--to=kai@emptydomain.de \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).