bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Phillip Lord
Subject: bug#23785: Emacs 25: "Undo" overdoes things.
Date: Fri, 17 Jun 2016 22:23:51 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.95 (gnu/linux)

Alan Mackenzie <acm@muc.de> writes:

> Hello, Eli.
>
> On Fri, Jun 17, 2016 at 08:15:18PM +0300, Eli Zaretskii wrote:
>> > Date: Fri, 17 Jun 2016 15:02:45 +0000
>> > From: Alan Mackenzie <acm@muc.de>
>
>> > Summary: `undo' is broken in Emacs 25.
>
>> > In GNU Emacs 25.0.94.2 (x86_64-unknown-linux-gnu, GTK+ Version 3.18.7)
>> >  of 2016-06-07 built on acm
>> > Repository revision: 9d5ccebeba0506f7280662630f0ee85a52c8a327
>> > Configured using:
>> >  'configure --with-tiff=no --with-gif=no --with-gpm'
>
>> > 1. emacs -Q
>> > 2. C-x C-f decls-6.cc    ; file is attached.
>> > 3. Move point to BOL 17.
>> > 4. C-o, and insert the line "Type var = init;".  Call this line 16½.
>> > 5. M-x revert-buffer.
>> > 6. Move point to "[" on L16, and use C-M-k to delete "[3 * peq]".
>> > 7. C-_.  This restores "[3 * peq]" (correctly) but also reinserts line
>> >    16½ (which is a bug).
>
>> Why does this minor issue deserve to declare 'undo' "broken"?  Looks
>> like an exaggeration to me.
>
> 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.

If you report them, then I will look at them, and I would appreciate if
you do report them. I changed undo in a way that *was* supposed to
change its semantics, and this may have had negative side effects. Or my
changes may have caused unexpected changes in semantics that I did not
intend.


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


The problem in this case seems to be specific to revert-buffer. A much
simpler test case is as follows

1) Open a file with a single line in it
2) Add a new line at the start
3) M-x revert-buffer

Look at buffer-undo-list



*** Before undo changes

(nil
 ("\n" . -1)
 (#<marker at 1 in simple-example.txt> . -1)
 (#<marker at 1 in simple-example.txt> . -1)
 (#<marker in no buffer> . -1)
 nil
 (1 . 2)
 (t 22372 26717 127527 392000))

*** After undo changes

(("\n" . -1)
 (#<marker at 1 in simple-example.txt> . -1)
 (#<marker at 1 in simple-example.txt> . -1)
 nil
 (1 . 2)
 (t 22372 26717 127527 392000))


So, the issue seems to be specific to M-x revert-buffer. After my
changes, the list no longer has a undo-boundary as its first element.
Got to be honest, I am surprised that M-x revert-buffer maintains the
undo-list; I'd have expected it to blitz the whole list, but it doesn't.

No idea why, although I suspect that it's the same issue Stefan found
with viper -- undo-boundary no longer gets called after all commands
only those that change the buffer.

I will investigate.

Phil





reply via email to

[Prev in Thread] Current Thread [Next in Thread]