]> code.delx.au - gnu-emacs/blobdiff - src/insdel.c
run_undoable_changes now called from insdel.
[gnu-emacs] / src / insdel.c
index 24807b1e8f49d650148e15ac5e30351a25b9ce15..8b08c1e59b74bd84faa1ca0da8a4705783b98fc8 100644 (file)
@@ -1765,6 +1765,18 @@ modify_text (ptrdiff_t start, ptrdiff_t end)
   bset_point_before_scroll (current_buffer, Qnil);
 }
 
+/* Signal that we are about to make a change that may result in new
+   undo information.
+ */
+static void
+run_undoable_change (void)
+{
+  if (EQ (BVAR (current_buffer, undo_list), Qt))
+    return;
+
+  call0 (Qundo_auto__undoable_change);
+}
+
 /* Check that it is okay to modify the buffer between START and END,
    which are char positions.
 
@@ -1786,6 +1798,8 @@ prepare_to_modify_buffer_1 (ptrdiff_t start, ptrdiff_t end,
   if (!NILP (BVAR (current_buffer, read_only)))
     Fbarf_if_buffer_read_only (temp);
 
+  run_undoable_change();
+
   bset_redisplay (current_buffer);
 
   if (buffer_intervals (current_buffer))
@@ -2187,6 +2201,8 @@ syms_of_insdel (void)
   combine_after_change_list = Qnil;
   combine_after_change_buffer = Qnil;
 
+  DEFSYM (Qundo_auto__undoable_change, "undo-auto--undoable-change");
+
   DEFVAR_LISP ("combine-after-change-calls", Vcombine_after_change_calls,
               doc: /* Used internally by the function `combine-after-change-calls' macro.  */);
   Vcombine_after_change_calls = Qnil;