[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#33341: 27.0.50; Undo log merging and change groups
From: |
Michael Heerdegen |
Subject: |
bug#33341: 27.0.50; Undo log merging and change groups |
Date: |
Fri, 27 Nov 2020 02:11:23 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
Stefan Monnier <monnier@iro.umontreal.ca> writes:
> Could you check why it breaks in the absence of an undo-boundary?
I have edebugged `org-entry-get'. Short version: it is as it seems.
Here is the example again:
#+begin_src emacs-lisp
(defun my-test-change-groups ()
(interactive)
(insert "0\n")
;; (undo-boundary)
(let ((g (prepare-change-group)))
(activate-change-group g)
(insert "b\n")
(insert "c\n")
(cancel-change-group g)))
#+end_src
Without the boundary, all changes are combined into one (1 . 10) undo
entry. And then these code lines
#+begin_src emacs-lisp
;; Temporarily truncate the undo log at ELT.
(when (consp elt)
(setcar elt nil) (setcdr elt nil))
#+end_src
cause that were the undo should happen:
#+begin_src emacs-lisp
;; Undo it all.
(save-excursion
(while (listp pending-undo-list) (undo-more 1)))
#+end_src
nothing is undone.
With the boundary, we have two undo entries, and the truncated log still
contains the entry for the first `insert' call.
Regards,
Michael.