diff src/fileio.c @ 92243:c03d2269686e

(Finsert_file_contents): Don't reset undo_list if no change is made to the buffer.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Wed, 27 Feb 2008 04:10:15 +0000
parents f991f10f15ec
children d999f30304bc
line wrap: on
line diff
--- a/src/fileio.c	Tue Feb 26 21:35:04 2008 +0000
+++ b/src/fileio.c	Wed Feb 27 04:10:15 2008 +0000
@@ -3716,6 +3716,7 @@
   struct stat st;
   register int fd;
   int inserted = 0;
+  int nochange = 0;
   register int how_much;
   register int unprocessed;
   int count = SPECPDL_INDEX ();
@@ -4281,7 +4282,10 @@
 	{
 	  specpdl_ptr--;
 	  /* Truncate the buffer to the size of the file.  */
-	  del_range_byte (same_at_start, same_at_end, 0);
+	  if (same_at_start == same_at_end)
+	    nochange = 1;
+	  else
+	    del_range_byte (same_at_start, same_at_end, 0);
 	  inserted = 0;
 
 	  unbind_to (this_count, Qnil);
@@ -4628,7 +4632,7 @@
 
   if (!NILP (visit))
     {
-      if (!EQ (current_buffer->undo_list, Qt))
+      if (!EQ (current_buffer->undo_list, Qt) && !nochange)
 	current_buffer->undo_list = Qnil;
 
       if (NILP (handler))