changeset 4761:b604d235f028

Synchronize window point with current point of old buffer. 2009-10-16 Michael Sperber <mike@xemacs.org> * buffer.c (set_buffer_internal): Synchronize the window point with the current point when switching to another buffer.
author Mike Sperber <sperber@deinprogramm.de>
date Sun, 22 Nov 2009 11:31:36 +0100
parents 217abcf015c4
children 53f27fcd3cd9
files src/ChangeLog src/buffer.c
diffstat 2 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Thu Nov 19 18:21:06 2009 -0500
+++ b/src/ChangeLog	Sun Nov 22 11:31:36 2009 +0100
@@ -476,6 +476,11 @@
 	On Darwin, use realpath(3)'s case correction to get the canonical
 	case for a file; thank you Robert Delius Royar!
 
+2009-10-16  Michael Sperber  <mike@xemacs.org>
+
+	* buffer.c (set_buffer_internal): Synchronize the window point
+	with the current point when switching to another buffer.
+
 2009-10-11  Michael Sperber  <mike@xemacs.org>
 
 	* event-stream.c (post_command_hook): Run `post-command-hook'
--- a/src/buffer.c	Thu Nov 19 18:21:06 2009 -0500
+++ b/src/buffer.c	Sun Nov 22 11:31:36 2009 +0100
@@ -1512,6 +1512,12 @@
 
   if (old_buf)
     {
+      /* synchronize window point */
+      Lisp_Object current_window = Fselected_window (Qnil);
+      if (!NILP (current_window)
+	  && EQ(Fwindow_buffer (current_window), wrap_buffer (old_buf)))
+	Fset_window_point (current_window, make_int (BUF_PT (old_buf)));
+
       /* Put the undo list back in the base buffer, so that it appears
 	 that an indirect buffer shares the undo list of its base.  */
       if (old_buf->base_buffer)