unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Braun Gábor" <braungb88@gmail.com>
To: 34405@debbugs.gnu.org
Subject: bug#34405: 26.1; 2-line patch
Date: Fri, 20 Dec 2019 09:11:28 +0100	[thread overview]
Message-ID: <2345661.sRiDIh6uYh@gabor> (raw)
In-Reply-To: <1631063.cd5q6Ms6ql@gabor>

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"))








  parent reply	other threads:[~2019-12-20  8:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-09 15:49 bug#34405: 26.1; atomic change group after undo fails to cancel Braun Gábor
2019-11-12 17:05 ` bug#34405: 26.1; patch for cancel-change-group to work after undo Braun Gábor
2019-11-14 12:10   ` Eli Zaretskii
2019-11-14 23:00     ` Braun Gábor
2019-12-20  8:11 ` Braun Gábor [this message]
2021-08-14 13:58 ` bug#34405: bug#26061: 26.0.50; cancel-change-group fails with "unrelated state" error if used after an undo Lars Ingebrigtsen
2021-08-16 12:01   ` Braun Gábor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2345661.sRiDIh6uYh@gabor \
    --to=braungb88@gmail.com \
    --cc=34405@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).