mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2025-01-27 19:31:38 +00:00
* lisp/subr.el (cancel-change-group): Fix bug#39680
Don't re-use an existing `pending-undo-list` even if (eq last-command 'undo) since there might have been changes to the buffer since that `undo` command and the `pending-undo-list` can hence be invalid for the current buffer contents.
This commit is contained in:
parent
ef5744a988
commit
c1ce9fa7f2
@ -2964,13 +2964,18 @@ This finishes the change group by reverting all of its changes."
|
||||
;; the body of `atomic-change-group' all changes can be undone.
|
||||
(widen)
|
||||
(let ((old-car (car-safe elt))
|
||||
(old-cdr (cdr-safe elt)))
|
||||
(old-cdr (cdr-safe elt))
|
||||
;; Use `pending-undo-list' temporarily since `undo-more' needs
|
||||
;; it, but restore it afterwards so as not to mess with an
|
||||
;; ongoing sequence of `undo's.
|
||||
(pending-undo-list
|
||||
;; Use `buffer-undo-list' unconditionally (bug#39680).
|
||||
buffer-undo-list))
|
||||
(unwind-protect
|
||||
(progn
|
||||
;; Temporarily truncate the undo log at ELT.
|
||||
(when (consp elt)
|
||||
(setcar elt nil) (setcdr elt nil))
|
||||
(unless (eq last-command 'undo) (undo-start))
|
||||
;; Make sure there's no confusion.
|
||||
(when (and (consp elt) (not (eq elt (last pending-undo-list))))
|
||||
(error "Undoing to some unrelated state"))
|
||||
|
Loading…
Reference in New Issue
Block a user