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

From: Lars Ingebrigtsen <[email-masked]>
Date: Sat, 14 Aug 2021 15:58:41 +0200

Braun Gábor <[email-masked]> writes:

> -------------------- File test.el ----------------------------------
> ;; -*- lexical-binding: t; -*-
> (defun test-fun ()
>   "Test atomic change group, no visible effect."
>   (interactive)
>   (catch 'test
>     (atomic-change-group
>       (save-excursion
>         (goto-char (point-min))
>         (insert "!!! TEST: you shouldn't see this !!!")
>         (throw 'test t)))))
>
> (global-set-key [(control c) ?a] #'test-fun)
> --------------------------------------------------------------------
>
> Start emacs by the command
>
> emacs -Q -l test.el
>
> Press the following keys: a C-_ C-c a
>
> A "!!! TEST: you shouldn't see this !!!" gets inserted at the top of
> buffer *scratch*, and the message "Undoing to some unrelated state"
> appears in the echo area.

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 in the years since this was reported, and I'm closing this
bug report.  If this is still a problem in recent Emacs versions, please
respond to the debbugs address and we'll reopen.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no