Subject: bug#34405: bug#26061: 26.0.50; cancel-change-group fails with "unrelated state" error if used after an undo

From: Braun Gábor <[email-masked]>
Date: Mon, 16 Aug 2021 14:01:01 +0200

> I can reproduce this problem in Emacs 26.1, but it seems to be gone in
> Emacs 27.1 (and 28), so I'm going to go ahead and guess that this has
> been fixed

I can see the fix in the following snippet of `cancel-change-group' in 
Emacs 27.1 code.  The faulty logic with `last-command' and `undo-start' 
has been gone.  (... denotes omitted code.)

    (let (...
	      ;; Use `pending-undo-list' temporarily since `undo-more' needs
	      ;; it, but restore it afterwards so as not to mess with an
	      ;; ongoing sequence of `undo's.
	      (pending-undo-list
	       ;; Use `buffer-undo-list' unconditionally (bug#39680).
	       buffer-undo-list))

Thank you for checking in recent Emacs versions.

Best wishes,

	Gábor