From 3ecc116303da6dc0200f55c28d002aa4f21e7a0c Mon Sep 17 00:00:00 2001 From: Martin Rudalics Date: Mon, 22 Sep 2008 15:40:20 +0000 Subject: [PATCH] (record_point): Don't call Fundo_boundary for first change. (Bug#731) --- src/ChangeLog | 5 +++++ src/undo.c | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/ChangeLog b/src/ChangeLog index c53dd35e2d2..e2505f5dfb7 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2008-09-22 Martin Rudalics + + * undo.c (record_point): Don't call Fundo_boundary for first + change. (Bug#731) + 2008-09-22 Juanma Barranquero * emacs.c (Fdaemonp): Doc fix. diff --git a/src/undo.c b/src/undo.c index 63daf1fdb68..d29ba17fde5 100644 --- a/src/undo.c +++ b/src/undo.c @@ -79,7 +79,13 @@ record_point (pt) if (NILP (pending_boundary)) pending_boundary = Fcons (Qnil, Qnil); - if (current_buffer != last_undo_buffer) + if ((current_buffer != last_undo_buffer) + /* Don't call Fundo_boundary for the first change. Otherwise we + risk overwriting last_boundary_position in Fundo_boundary with + PT of the current buffer and as a consequence not insert an + undo boundary because last_boundary_position will equal pt in + the test at the end of the present function (Bug#731). */ + && (MODIFF > SAVE_MODIFF)) Fundo_boundary (); last_undo_buffer = current_buffer; -- 2.39.5