diff src/undo.c @ 7395:99e9c133a752

(record_delete): Record the old point value only right after a boundary. (record_delete): Test last_point_position_buffer.
author Richard M. Stallman <rms@gnu.org>
date Sat, 07 May 1994 08:38:28 +0000
parents cd81dba38a49
children 31d444fcae24
line wrap: on
line diff
--- a/src/undo.c	Sat May 07 05:31:39 1994 +0000
+++ b/src/undo.c	Sat May 07 08:38:28 1994 +0000
@@ -89,6 +89,7 @@
      int beg, length;
 {
   Lisp_Object lbeg, lend, sbeg;
+  int at_boundary;
 
   if (EQ (current_buffer->undo_list, Qt))
     return;
@@ -101,6 +102,9 @@
     Fundo_boundary ();
   XSET (last_undo_buffer, Lisp_Buffer, current_buffer);
 
+  at_boundary = (CONSP (current_buffer->undo_list)
+		 && NILP (XCONS (current_buffer->undo_list)->car));
+
   if (MODIFF <= current_buffer->save_modified)
     record_first_change ();
 
@@ -111,8 +115,11 @@
   XFASTINT (lbeg) = beg;
   XFASTINT (lend) = beg + length;
 
-  /* If point wasn't at start of deleted range, record where it was.  */
-  if (last_point_position != XFASTINT (sbeg))
+  /* 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 != XFASTINT (sbeg)
+      && current_buffer == XBUFFER (last_point_position_buffer))
     current_buffer->undo_list
       = Fcons (make_number (last_point_position), current_buffer->undo_list);