unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Re: Keeping the point at the same position in multiple buffers
@ 2008-08-22  5:57 martin rudalics
  0 siblings, 0 replies; 5+ messages in thread
From: martin rudalics @ 2008-08-22  5:57 UTC (permalink / raw)
  To: coreyfoote; +Cc: help-gnu-emacs

 > 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)





^ permalink raw reply	[flat|nested] 5+ messages in thread
* Keeping the point at the same position in multiple buffers
@ 2008-08-21 14:39 Corey Foote
  2008-08-21 16:04 ` Alex Bennee
  0 siblings, 1 reply; 5+ messages in thread
From: Corey Foote @ 2008-08-21 14:39 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 773 bytes --]


Hi everybody,

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.

So, for example, when I press C-n in the current buffer, the other buffer will also move it's point to the next line.

Any suggestions?

Thanks!

Corey Foote

_________________________________________________________________
See what people are saying about Windows Live.  Check out featured posts.
http://www.windowslive.com/connect?ocid=TXT_TAGLM_WL_connect2_082008

[-- Attachment #2: Type: text/html, Size: 969 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-08-22  5:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [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
2008-08-22  5:57 martin rudalics
  -- strict thread matches above, loose matches on Subject: below --
2008-08-21 14:39 Corey Foote
2008-08-21 16:04 ` Alex Bennee

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).