GNU bug report logs - #26061
26.0.50; cancel-change-group fails with "unrelated state" error if used after an undo

Previous Next

Package: emacs;

Reported by: Andreas Politz <politza <at> hochschule-trier.de>

Date: Sat, 11 Mar 2017 18:02:01 UTC

Severity: normal

Merged with 26287, 34405

Found in versions 26.0.50, 26.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 26061 in the body.
You can then email your comments to 26061 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#26061; Package emacs. (Sat, 11 Mar 2017 18:02:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Andreas Politz <politza <at> hochschule-trier.de>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 11 Mar 2017 18:02:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Andreas Politz <politza <at> hochschule-trier.de>
To: bug-gnu-emacs <at> gnu.org
Subject: 26.0.50;
 cancel-change-group fails with "unrelated state" error if used after
 an undo
Date: Sat, 11 Mar 2017 19:01:28 +0100
Save the following in some file foo.el:

#+BEGIN_SRC emacs-lisp
(defun bug ()
  (interactive)
  (catch 'done
    (atomic-change-group
      (insert "bug")
      (throw 'done nil))))

(setq debug-on-error t)
(switch-to-buffer (get-buffer-create "*bug*"))
(setq unread-command-events
      (list
       ;; insert abc
       ?a ?b ?c
       ;; undo once
       ?\C-/
       ;; call bug
       ?\M-x ?b ?u ?g ?\C-j))
#+END_SRC

, then start Emacs like this:

$ emacs -Q -l foo.el

Debugger entered--Lisp error: (error "Undoing to some unrelated state")
  signal(error ("Undoing to some unrelated state"))
  error("Undoing to some unrelated state")
  cancel-change-group(((#<buffer *bug*> nil)))

--

-ap




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26061; Package emacs. (Thu, 21 Nov 2019 09:54:02 GMT) Full text and rfc822 format available.

Message #8 received at 26061 <at> debbugs.gnu.org (full text, mbox):

From: Braun Gábor <braungb88 <at> gmail.com>
To: 26061 <at> debbugs.gnu.org
Subject: Consider merging with 26287 and 34405
Date: Thu, 21 Nov 2019 10:53:09 +0100
This seems to be a candidate to merge with 26287 and 34405,
the latter two being already merged.

All three bugs have similar Lisp code
(catch ... (atomic-change-group ... (throw ...)))
producing an "unrelated state" error after undo.

Best wishes,

	Gábor







Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26061; Package emacs. (Thu, 21 Nov 2019 11:48:02 GMT) Full text and rfc822 format available.

Message #11 received at 26061 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Braun Gábor <braungb88 <at> gmail.com>
Cc: 26061 <at> debbugs.gnu.org
Subject: Re: bug#26061: Consider merging with 26287 and 34405
Date: Thu, 21 Nov 2019 12:47:38 +0100
Braun Gábor <braungb88 <at> gmail.com> writes:

> This seems to be a candidate to merge with 26287 and 34405,
> the latter two being already merged.
>
> All three bugs have similar Lisp code
> (catch ... (atomic-change-group ... (throw ...)))
> producing an "unrelated state" error after undo.

Yup; I've merged the bugs now.

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




Forcibly Merged 26061 26287 34405. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Thu, 21 Nov 2019 11:48:04 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26061; Package emacs. (Sat, 14 Aug 2021 13:59:01 GMT) Full text and rfc822 format available.

Message #16 received at 26061 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Braun Gábor <braungb88 <at> gmail.com>
Cc: 34405 <at> debbugs.gnu.org, 26061 <at> debbugs.gnu.org
Subject: Re: bug#26061: 26.0.50; cancel-change-group fails with "unrelated
 state" error if used after an undo
Date: Sat, 14 Aug 2021 15:58:41 +0200
Braun Gábor <braungb88 <at> gmail.com> 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




bug closed, send any further explanations to 26061 <at> debbugs.gnu.org and Andreas Politz <politza <at> hochschule-trier.de> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 14 Aug 2021 14:00:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26061; Package emacs. (Mon, 16 Aug 2021 12:02:02 GMT) Full text and rfc822 format available.

Message #21 received at 26061 <at> debbugs.gnu.org (full text, mbox):

From: Braun Gábor <braungb88 <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 34405 <at> debbugs.gnu.org, 26061 <at> debbugs.gnu.org
Subject: Re: bug#26061: 26.0.50;
 cancel-change-group fails with "unrelated state" error if used after
 an undo
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







bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 14 Sep 2021 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 224 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.