summaryrefslogtreecommitdiff
path: root/lisp/subr.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2020-03-12 10:03:14 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2020-03-12 10:03:14 -0400
commitf253ff7b780c68bd4d1d12a978a1215af1971320 (patch)
tree5a465c49b4d6afafd3685e79040f528cbfe3171c /lisp/subr.el
parent4c3c175a63823d851c7e9326f4f70c81b9c0110e (diff)
downloademacs-f253ff7b780c68bd4d1d12a978a1215af1971320.tar.gz
* lisp/subr.el (cancel-change-group): Undo accidental change
Diffstat (limited to 'lisp/subr.el')
-rw-r--r--lisp/subr.el13
1 files changed, 3 insertions, 10 deletions
diff --git a/lisp/subr.el b/lisp/subr.el
index 359f51c0d0c..9c80c06a127 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -2987,14 +2987,13 @@ 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))
- (start-pul pending-undo-list))
+ (old-cdr (cdr-safe elt)))
(unwind-protect
(progn
;; Temporarily truncate the undo log at ELT.
(when (consp elt)
(setcar elt nil) (setcdr elt nil))
- (setq pending-undo-list buffer-undo-list)
+ (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"))
@@ -3007,13 +3006,7 @@ This finishes the change group by reverting all of its changes."
;; Reset the modified cons cell ELT to its original content.
(when (consp elt)
(setcar elt old-car)
- (setcdr elt old-cdr)))
- ;; Let's not break a sequence of undos just because we
- ;; tried to make a change and then undid it: preserve
- ;; the original `pending-undo-list' if it's still valid.
- (if (eq (undo--last-change-was-undo-p buffer-undo-list)
- start-pul)
- (setq pending-undo-list start-pul)))))))
+ (setcdr elt old-cdr))))))))
;;;; Display-related functions.