+ if (!EQ (Vthis_command, current_kboard->Vlast_command))
+ nonundocount = 0;
+
+ if (NILP (Vexecuting_kbd_macro)
+ && !EQ (minibuf_window, selected_window))
+ {
+ if (nonundocount <= 0 || nonundocount >= 20)
+ {
+ remove_boundary = 0;
+ nonundocount = 0;
+ }
+ nonundocount++;
+ }
+
+ if (remove_boundary
+ && CONSP (current_buffer->undo_list)
+ && NILP (XCAR (current_buffer->undo_list)))
+ /* Remove the undo_boundary that was just pushed. */
+ current_buffer->undo_list = XCDR (current_buffer->undo_list);
+