From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.help Subject: Re: Keeping the point at the same position in multiple buffers Date: Fri, 22 Aug 2008 07:57:46 +0200 Message-ID: <48AE555A.5070204@gmx.at> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1219384840 15353 80.91.229.12 (22 Aug 2008 06:00:40 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 22 Aug 2008 06:00:40 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: coreyfoote@hotmail.com Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Aug 22 08:01:33 2008 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 1KWPiG-0007Ey-Ck for geh-help-gnu-emacs@m.gmane.org; Fri, 22 Aug 2008 08:01:32 +0200 Original-Received: from localhost ([127.0.0.1]:38093 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KWPhJ-0006VJ-1j for geh-help-gnu-emacs@m.gmane.org; Fri, 22 Aug 2008 02:00:33 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KWPgv-0006Us-G5 for help-gnu-emacs@gnu.org; Fri, 22 Aug 2008 02:00:09 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KWPgt-0006Uf-Ot for help-gnu-emacs@gnu.org; Fri, 22 Aug 2008 02:00:08 -0400 Original-Received: from [199.232.76.173] (port=41691 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KWPgt-0006Ub-IR for help-gnu-emacs@gnu.org; Fri, 22 Aug 2008 02:00:07 -0400 Original-Received: from mail.gmx.net ([213.165.64.20]:43095) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1KWPgs-0007rS-Ta for help-gnu-emacs@gnu.org; Fri, 22 Aug 2008 02:00:07 -0400 Original-Received: (qmail invoked by alias); 22 Aug 2008 06:00:04 -0000 Original-Received: from 62-47-38-34.adsl.highway.telekom.at (EHLO [62.47.38.34]) [62.47.38.34] by mail.gmx.net (mp033) with SMTP; 22 Aug 2008 08:00:04 +0200 X-Authenticated: #14592706 X-Provags-ID: V01U2FsdGVkX1+uQeUrE1KuAacwvWmJHBs93ifegu20ytzDHHRcBW XGYbNXGGrkPA2q User-Agent: Thunderbird 2.0.0.16 (Windows/20080708) Original-References: BLU105-W56DF6FC3774776FAF11825DA6B0@phx.gbl X-Y-GMX-Trusted: 0 X-FuHaFi: 0.75 X-detected-kernel: by monty-python.gnu.org: Linux 2.6, seldom 2.4 (older, 4) 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:56876 Archived-At: > When editing several files in Emacs, each in its own buffer, each buffer > has its own point location. I have Emacs displaying two buffers, each in > it's own window. I was wondering if there's an easy way to make it so > that each of these buffers will keep the point at the same place in both > buffers (or at least on the same line) even though this is not the > default behavior. You can try to add the untested snippet below to your .emacs. martin (defun synchronize-windows () (save-selected-window (condition-case nil (let ((pos (window-point)) (sel (selected-window)) (buf (window-buffer (selected-window)))) (dolist (frame (frame-list)) (dolist (window (window-list frame)) (when (and (eq (window-buffer window) buf) (not (eq window sel)) (/= (window-point window) pos)) (set-window-point window pos))))) (error nil)))) (add-hook 'post-command-hook 'synchronize-windows t)