*** fileio.c.~1.602.~ Thu Feb 14 20:41:44 2008 --- fileio.c Fri Feb 29 23:30:18 2008 *************** *** 3730,3735 **** --- 3730,3736 ---- int read_quit = 0; Lisp_Object old_Vdeactivate_mark = Vdeactivate_mark; int we_locked_file = 0; + Lisp_Object original_undo_list = current_buffer->undo_list; if (current_buffer->base_buffer && ! NILP (visit)) error ("Cannot do file visiting in an indirect buffer"); *************** *** 4589,4594 **** --- 4590,4610 ---- current_buffer->enable_multibyte_characters = Qnil; } + if (inserted > 0 + && CONSP (current_buffer->undo_list) + && (! NILP (XCAR (current_buffer->undo_list)))) + /* Insert an undo boundary unless there's one here. */ + current_buffer->undo_list = + Fcons (Qnil, current_buffer->undo_list); + else if (inserted > 0 + && (! EQ (original_undo_list, Qt)) + && (NILP (visit)) && (NILP (replace))) + /* Assure that the first insertion is counted as a change. */ + { + current_buffer->undo_list = Qnil; + record_first_change (); + } + coding.dst_multibyte = ! NILP (current_buffer->enable_multibyte_characters); if (CODING_MAY_REQUIRE_DECODING (&coding) && (inserted > 0 || CODING_REQUIRE_FLUSHING (&coding)))