From 003550c5e3239fc7a09c1ef4d397fc985a94a7aa Mon Sep 17 00:00:00 2001 From: Gerd Moellmann Date: Thu, 6 Sep 2001 08:49:34 +0000 Subject: [PATCH] (undo): Remove positions from buffer-undo-list up to the next undo boundary only. --- lisp/ChangeLog | 5 +++++ lisp/simple.el | 25 ++++++++++++++++++------- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c769848d773..3a82065ceb5 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2001-09-06 Gerd Moellmann + + * simple.el (undo): Remove positions from buffer-undo-list up to + the next undo boundary only. + 2001-09-06 Eli Zaretskii * makefile.nt (install): Don't copy sc.el. Reported by Richard diff --git a/lisp/simple.el b/lisp/simple.el index 8d2a5707898..e276b1dea32 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -961,13 +961,24 @@ as an argument limits undo to changes within the current region." ;; Don't specify a position in the undo record for the undo command. ;; Instead, undoing this should move point to where the change is. (let ((tail buffer-undo-list) - done) - (while (and tail (not done) (not (null (car tail)))) - (if (integerp (car tail)) - (progn - (setq done t) - (setq buffer-undo-list (delq (car tail) buffer-undo-list)))) - (setq tail (cdr tail)))) + (prev nil)) + (while (car tail) + (when (integerp (car tail)) + (let ((pos (car tail))) + (if (null prev) + (setq buffer-undo-list (cdr tail)) + (setcdr prev (cdr tail))) + (setq tail (cdr tail)) + (while (car tail) + (if (eq pos (car tail)) + (if prev + (setcdr prev (cdr tail)) + (setq buffer-undo-list (cdr tail))) + (setq prev tail)) + (setq tail (cdr tail))) + (setq tail nil))) + (setq prev tail tail (cdr tail)))) + (and modified (not (buffer-modified-p)) (delete-auto-save-file-if-necessary recent-save))) ;; If we do get all the way thru, make this-command indicate that. -- 2.39.2