Subject: bug#23785: Emacs 25: "Undo" overdoes things.

From: Óscar Fuentes <[email-masked]>
Date: Fri, 17 Jun 2016 23:49:52 +0200

Alan Mackenzie <[email-masked]> writes:

> I don't think it's all that minor an issue.  `undo' can no longer be
> depended upon to restore a buffer to its unchanged state.
>
> I've suffered several similar annoyances with `undo' in the emacs-25
> branch.

Me too, although I'm not sure about Emacs being the culprit. I use Evil
and it adds some heuristics on top of Emacs'.

> Each buffer changing command is meant to have its own undo boundary
> (with the exception of self-insert-command and the single character
> deleting command).
>
> And having to undo/redo command sequences by hand is _very_ irritating
> when testing.

Only when testing? :-)

I've observed cases where sequences of char inserts were undone one at a
time and cases where entire edit sessions across multiple areas of the
file vanished with one `undo'.

> I think there's a case to be made for fixing this bug for Emacs 25.1.

FWIW, this is the change that enabled keeping the undo log after
revert-buffer (a feature I asked for, BTW):

commit 22513e526eba97bd1014e4bacde0a8649fbe7870
Author: Stefan Monnier <[email-masked]>
Date:   Tue May 28 21:07:53 2013 -0400

    * src/fileio.c (Finsert_file_contents): Preserve undo info when reverting
    a buffer.
    
    Fixes: debbugs:8447