Subject: bug#34405: 26.1; 2-line patch

From: Braun Gábor <[email-masked]>
Date: Fri, 20 Dec 2019 09:11:28 +0100

Hi,

Please find below a small patch to the problem, which works for me in 
Emacs 26.1.
Instead of calling undo-start, it binds pending-undo-list so that its 
value is restored after canceling an atomic change group.  Presumably this 
restoration is what the original code meant to do.

(Feel free to reorder the bindings in let if you don't like
pending-undo-list between old-car and old-cdr.)

Best wishes,

	Gábor

--- lisp/subr.el
+++ lisp/subr.el
@@ -2664,13 +2664,13 @@ cancel-change-group
 	;; the body of `atomic-change-group' all changes can be undone.
 	(widen)
 	(let ((old-car (car-safe elt))
+	      (pending-undo-list buffer-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))
-                (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"))