emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master f253ff7: * lisp/subr.el (cancel-change-group): Undo accidental ch


From: Stefan Monnier
Subject: master f253ff7: * lisp/subr.el (cancel-change-group): Undo accidental change
Date: Thu, 12 Mar 2020 10:03:20 -0400 (EDT)

branch: master
commit f253ff7b780c68bd4d1d12a978a1215af1971320
Author: Stefan Monnier <address@hidden>
Commit: Stefan Monnier <address@hidden>

    * lisp/subr.el (cancel-change-group): Undo accidental change
---
 lisp/subr.el | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/lisp/subr.el b/lisp/subr.el
index 359f51c..9c80c06 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.
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]