As I understand it, undo operations (namely
undo-only) are regular Emacs operations which add to the undo history.
An issue with this is undoing adds to the size of the undo data, which could cause some undo data to be freed.
Is there a way to reliably pause this while the user runs
undo-only, restoring the normal freeing behavior once a regular editing operation runs?
Recipe that exemplifies the issue
Run the following command:
emacs -Q --eval "(setq undo-limit 1 undo-outer-limit 10 undo-strong-limit 10)" newfile.txt
Type in 8 characters over 6 lines, so the document reads.
AAAAAAAA BBBBBBBB CCCCCCCC DDDDDDDD EEEEEEEE FFFFFFFF
C-_ until only the first line is present.
Now try redo by pressing
C-_ (keep pressing
The redo does not complete, it reaches 4 lines, then gives an error.
AAAAAAAA BBBBBBBB CCCCCCCC DDDDDDDD
With the warning
Warning (undo): Buffer ‘newfile.txt’ undo info was 32 bytes long. The undo info was discarded because it exceeded `undo-outer-limit'.
This is just to show that the undo history is freed while undoing.