> The value of buffer-undo-list is: > > (nil > (10 . 21) > (1 . 21) > (t 0 . 0)) The (1 . 21) entry is silly and obviously breaks undoing the prior (insert "Foo: bar\n"). Although EQ (XCAR (tem), lbeg) was not very intelligent, setting this to (XCAR (tem) == lbeg) doesn't seem to help either. Please try again with the attached patch. GDB doesn't work here currently, so I can't debug this. But could you try finding out in `insert-file-contents' (1) why the test in if (CONSP (tem) && INTEGERP (XCAR (tem)) && INTEGERP (XCDR (tem)) && (XCAR (tem) == lbeg)) /* In the non-visiting case record only the final insertion. */ current_buffer->undo_list = Fcons (Fcons (lbeg, lend), Fcdr (old_undo)); fails and (2) which value old_undo has here? Thanks in advance.