* bug#74523: 31.0.50; `apply` elements screw up undo in region
@ 2024-11-25 6:19 Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-25 15:19 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 2+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-11-25 6:19 UTC (permalink / raw)
To: 74523; +Cc: monnier
Package: Emacs
Version: 31.0.50
We currently don't support `apply` undo-elements very well (if at all)
in the undo-in-region feature.
Those elements used to be rare, but now that `comment-region` and other
users of `combine-change-calls` generate them, it's not as rare.
The following test fails because of that:
(ert-deftest simple-tests--undo-apply ()
(with-temp-buffer
(modula-2-mode) ;; A simple mode with non-LF terminated comments.
(buffer-enable-undo)
(insert "foo\n\n")
(let ((midbeg (point-marker))
(_ (insert "midmid"))
(midend (point-marker)))
(insert "\n\nbar")
(undo-boundary)
(goto-char (+ midbeg 3))
(insert "\n")
(undo-boundary)
(comment-region (point-min) midbeg)
(undo-boundary)
(comment-region midend (point-max))
(undo-boundary)
(progn
(goto-char midbeg)
(set-mark midend)
(setq last-command 'something-else) ;Not `undo', so we start a new run.
(undo '(4))
(should (equal (buffer-substring midbeg midend) "midmid")))
)))
- Stefan
^ permalink raw reply [flat|nested] 2+ messages in thread
* bug#74523: 31.0.50; `apply` elements screw up undo in region
2024-11-25 6:19 bug#74523: 31.0.50; `apply` elements screw up undo in region Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-11-25 15:19 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 0 replies; 2+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-11-25 15:19 UTC (permalink / raw)
To: 74523
> We currently don't support `apply` undo-elements very well (if at all)
> in the undo-in-region feature.
> Those elements used to be rare, but now that `comment-region` and other
> users of `combine-change-calls` generate them, it's not as rare.
I pushed a patch which fixes the test I sent, but `apply` elements are
still never included in undo-in-region.
Fixing that won't be easy in general: we have no way for
`undo-adjust-elt` to handle them correctly.
Stefan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-11-25 15:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-25 6:19 bug#74523: 31.0.50; `apply` elements screw up undo in region Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-25 15:19 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
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).