From: martin rudalics <rudalics@gmx.at>
To: coreyfoote@hotmail.com
Cc: help-gnu-emacs@gnu.org
Subject: Re: Keeping the point at the same position in multiple buffers
Date: Fri, 22 Aug 2008 07:57:46 +0200 [thread overview]
Message-ID: <48AE555A.5070204@gmx.at> (raw)
> 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)
next reply other threads:[~2008-08-22 5:57 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-22 5:57 martin rudalics [this message]
[not found] <mailman.17246.1219329568.18990.help-gnu-emacs@gnu.org>
2008-08-21 21:47 ` Keeping the point at the same position in multiple buffers Xah
2008-08-21 23:03 ` Andreas Politz
-- strict thread matches above, loose matches on Subject: below --
2008-08-21 14:39 Corey Foote
2008-08-21 16:04 ` Alex Bennee
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=48AE555A.5070204@gmx.at \
--to=rudalics@gmx.at \
--cc=coreyfoote@hotmail.com \
--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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.