unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#33341: 27.0.50; Undo log merging and change groups
@ 2018-11-11  7:50 Michael Heerdegen
  2020-11-26 12:34 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 9+ messages in thread
From: Michael Heerdegen @ 2018-11-11  7:50 UTC (permalink / raw)
  To: 33341; +Cc: Stefan Monnier


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






^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-11-27 17:43 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-11  7:50 bug#33341: 27.0.50; Undo log merging and change groups Michael Heerdegen
2020-11-26 12:34 ` Lars Ingebrigtsen
2020-11-26 14:16   ` Michael Heerdegen
2020-11-26 14:49     ` Michael Heerdegen
2020-11-26 20:26       ` Michael Heerdegen
2020-11-26 20:55         ` Stefan Monnier
2020-11-27  1:11           ` Michael Heerdegen
2020-11-27 14:44             ` Stefan Monnier
2020-11-27 17:43               ` Michael Heerdegen

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