diff options
| -rw-r--r-- | lisp/subr.el | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lisp/subr.el b/lisp/subr.el index 5b94343e499..a744cfddfd4 100644 --- a/lisp/subr.el +++ b/lisp/subr.el | |||
| @@ -2964,13 +2964,18 @@ This finishes the change group by reverting all of its changes." | |||
| 2964 | ;; the body of `atomic-change-group' all changes can be undone. | 2964 | ;; the body of `atomic-change-group' all changes can be undone. |
| 2965 | (widen) | 2965 | (widen) |
| 2966 | (let ((old-car (car-safe elt)) | 2966 | (let ((old-car (car-safe elt)) |
| 2967 | (old-cdr (cdr-safe elt))) | 2967 | (old-cdr (cdr-safe elt)) |
| 2968 | ;; Use `pending-undo-list' temporarily since `undo-more' needs | ||
| 2969 | ;; it, but restore it afterwards so as not to mess with an | ||
| 2970 | ;; ongoing sequence of `undo's. | ||
| 2971 | (pending-undo-list | ||
| 2972 | ;; Use `buffer-undo-list' unconditionally (bug#39680). | ||
| 2973 | buffer-undo-list)) | ||
| 2968 | (unwind-protect | 2974 | (unwind-protect |
| 2969 | (progn | 2975 | (progn |
| 2970 | ;; Temporarily truncate the undo log at ELT. | 2976 | ;; Temporarily truncate the undo log at ELT. |
| 2971 | (when (consp elt) | 2977 | (when (consp elt) |
| 2972 | (setcar elt nil) (setcdr elt nil)) | 2978 | (setcar elt nil) (setcdr elt nil)) |
| 2973 | (unless (eq last-command 'undo) (undo-start)) | ||
| 2974 | ;; Make sure there's no confusion. | 2979 | ;; Make sure there's no confusion. |
| 2975 | (when (and (consp elt) (not (eq elt (last pending-undo-list)))) | 2980 | (when (and (consp elt) (not (eq elt (last pending-undo-list)))) |
| 2976 | (error "Undoing to some unrelated state")) | 2981 | (error "Undoing to some unrelated state")) |