Subject: bug#33341: closed (Re: bug#33341: 27.0.50; Undo log merging and change groups)

From: [email-masked] (GNU bug Tracking System)
Date: Fri, 27 Nov 2020 17:44:02 +0000

Your bug report

#33341: 27.0.50; Undo log merging and change groups

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
33341: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=33341
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#33341: 27.0.50; Undo log merging and change groups
From: Michael Heerdegen <[email-masked]>
To: Stefan Monnier <[email-masked]>
Cc: [email-masked], Lars Ingebrigtsen <[email-masked]>
Date: Fri, 27 Nov 2020 18:43:09 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

Stefan Monnier <[email-masked]> writes:

> diff --git a/lisp/subr.el b/lisp/subr.el
> index e009dcc2b9..1cf3a49fe4 100644
> --- a/lisp/subr.el
> +++ b/lisp/subr.el
> [...]
> +	(undo-boundary)))))

Confirmed that it's fixed with that commit.

Thanks!

Michael.

Subject: 27.0.50; Undo log merging and change groups
From: Michael Heerdegen <[email-masked]>
To: [email-masked]
Cc: Stefan Monnier <[email-masked]>
Date: Sun, 11 Nov 2018 08:50:43 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

Hello,

I have been playing with the undo change group functions.  I found
`cancel-change-group' does not always work as expected.  For example, if
you define

(defun my-test-change-groups ()
  (interactive)
  (insert "0\n")
  (let ((g (prepare-change-group)))
    (activate-change-group g)
    (insert "b\n")
    (insert "c\n")
    (cancel-change-group g)))

and call that command in some random buffer, the final
`cancel-change-group' has no effect (i.e. nothing is reverted).  In
other, similar examples, `cancel-change-group' seems to revert more than
it should.

To cite (CC'd) Stefan's remark in emacs-help, "the undo entries for
(insert "0\n"), (insert "b\n"), and (insert "c\n") are merged into a
single entry in the undo log (as a form of optimization).  The
change-group code should prevent such a merge, e.g. by adding some dummy
undo element which will work like a "fence"".

Thanks,

Michael.

In GNU Emacs 27.0.50 (build 8, x86_64-pc-linux-gnu, GTK+ Version 3.24.1)
 of 2018-11-11 built on drachen
Repository revision: c1095b03a933d55fe1cd357881f1ca6e16e06362
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12003000
System Description: Debian GNU/Linux buster/sid