changeset 67821:11268b0660c8

Depend on window.h. (record_point): Save old point from the correct window.
author Richard M. Stallman <rms@gnu.org>
date Mon, 26 Dec 2005 16:32:57 +0000
parents a9cbddeec059
children 125bb6d290df
files src/undo.c
diffstat 1 files changed, 12 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/undo.c	Mon Dec 26 16:31:36 2005 +0000
+++ b/src/undo.c	Mon Dec 26 16:32:57 2005 +0000
@@ -24,6 +24,7 @@
 #include "lisp.h"
 #include "buffer.h"
 #include "commands.h"
+#include "window.h"
 
 /* Limits controlling how much undo information to keep.  */
 
@@ -100,12 +101,19 @@
   /* If we are just after an undo boundary, and
      point wasn't at start of deleted range, record where it was.  */
   if (at_boundary
-      && last_point_position != pt
+      && BUFFERP (last_point_position_buffer)
       /* If we're called from batch mode, this could be nil.  */
-      && BUFFERP (last_point_position_buffer)
       && current_buffer == XBUFFER (last_point_position_buffer))
-    current_buffer->undo_list
-      = Fcons (make_number (last_point_position), current_buffer->undo_list);
+    {
+      /* If we have switched windows, use the point value
+	 from the window we are in.  */
+      if (! EQ (last_point_position_window, selected_window))
+	last_point_position = marker_position (XWINDOW (selected_window)->pointm);
+
+      if (last_point_position != pt)
+	current_buffer->undo_list
+	  = Fcons (make_number (last_point_position), current_buffer->undo_list);
+    }
 }
 
 /* Record an insertion that just happened or is about to happen,