diff options
| -rw-r--r-- | lisp/subr.el | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/lisp/subr.el b/lisp/subr.el index 937a0506826..2c0be204e0a 100644 --- a/lisp/subr.el +++ b/lisp/subr.el | |||
| @@ -2535,26 +2535,27 @@ This finishes the change group by reverting all of its changes." | |||
| 2535 | ;; Widen buffer temporarily so if the buffer was narrowed within | 2535 | ;; Widen buffer temporarily so if the buffer was narrowed within |
| 2536 | ;; the body of `atomic-change-group' all changes can be undone. | 2536 | ;; the body of `atomic-change-group' all changes can be undone. |
| 2537 | (widen) | 2537 | (widen) |
| 2538 | (let ((old-car | 2538 | (let ((old-car (car-safe elt)) |
| 2539 | (if (consp elt) (car elt))) | 2539 | (old-cdr (cdr-safe elt))) |
| 2540 | (old-cdr | 2540 | (unwind-protect |
| 2541 | (if (consp elt) (cdr elt)))) | 2541 | (progn |
| 2542 | ;; Temporarily truncate the undo log at ELT. | 2542 | ;; Temporarily truncate the undo log at ELT. |
| 2543 | (when (consp elt) | 2543 | (when (consp elt) |
| 2544 | (setcar elt nil) (setcdr elt nil)) | 2544 | (setcar elt nil) (setcdr elt nil)) |
| 2545 | (unless (eq last-command 'undo) (undo-start)) | 2545 | (unless (eq last-command 'undo) (undo-start)) |
| 2546 | ;; Make sure there's no confusion. | 2546 | ;; Make sure there's no confusion. |
| 2547 | (when (and (consp elt) (not (eq elt (last pending-undo-list)))) | 2547 | (when (and (consp elt) (not (eq elt (last pending-undo-list)))) |
| 2548 | (error "Undoing to some unrelated state")) | 2548 | (error "Undoing to some unrelated state")) |
| 2549 | ;; Undo it all. | 2549 | ;; Undo it all. |
| 2550 | (save-excursion | 2550 | (save-excursion |
| 2551 | (while (listp pending-undo-list) (undo-more 1))) | 2551 | (while (listp pending-undo-list) (undo-more 1))) |
| 2552 | ;; Reset the modified cons cell ELT to its original content. | 2552 | ;; Revert the undo info to what it was when we grabbed |
| 2553 | (when (consp elt) | 2553 | ;; the state. |
| 2554 | (setcar elt old-car) | 2554 | (setq buffer-undo-list elt)) |
| 2555 | (setcdr elt old-cdr)) | 2555 | ;; Reset the modified cons cell ELT to its original content. |
| 2556 | ;; Revert the undo info to what it was when we grabbed the state. | 2556 | (when (consp elt) |
| 2557 | (setq buffer-undo-list elt)))))) | 2557 | (setcar elt old-car) |
| 2558 | (setcdr elt old-cdr)))))))) | ||
| 2558 | 2559 | ||
| 2559 | ;;;; Display-related functions. | 2560 | ;;;; Display-related functions. |
| 2560 | 2561 | ||