From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ender Newsgroups: gmane.emacs.help Subject: Re: How can I be notified whenever point of a buffer changed? Date: 17 Apr 2007 00:39:17 -0700 Organization: http://groups.google.com Message-ID: <1176795557.162257.304090@y80g2000hsf.googlegroups.com> References: <1176350448.277558.178010@q75g2000hsh.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: sea.gmane.org 1176799006 27327 80.91.229.12 (17 Apr 2007 08:36:46 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 17 Apr 2007 08:36:46 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Apr 17 10:36:40 2007 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1HdjB2-0000h3-F9 for geh-help-gnu-emacs@m.gmane.org; Tue, 17 Apr 2007 10:36:40 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HdjFj-0006vz-KC for geh-help-gnu-emacs@m.gmane.org; Tue, 17 Apr 2007 04:41:31 -0400 Original-Path: shelby.stanford.edu!newshub.stanford.edu!postnews.google.com!y80g2000hsf.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 23 Original-NNTP-Posting-Host: 222.68.182.212 Original-X-Trace: posting.google.com 1176795557 30408 127.0.0.1 (17 Apr 2007 07:39:17 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Tue, 17 Apr 2007 07:39:17 +0000 (UTC) In-Reply-To: User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.3) Gecko/20060601 Firefox/2.0.0.3 (Ubuntu-edgy),gzip(gfe),gzip(gfe) X-HTTP-Via: 1.1 SHPROXY Complaints-To: groups-abuse@google.com Injection-Info: y80g2000hsf.googlegroups.com; posting-host=222.68.182.212; posting-account=6C-vRw0AAAAZJwEQEIgtFDLzbspLF35g Original-Xref: shelby.stanford.edu gnu.emacs.help:147139 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:42743 Archived-At: On Apr 13, 6:25 pm, Kai Grossjohann 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 :)