emacs-devel
[Top][All Lists]
Advanced

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

Re: disabling undo boundaries


From: Phillip Lord
Subject: Re: disabling undo boundaries
Date: Sat, 16 May 2015 14:31:49 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.0.0.0 (gnu/linux)

Stefan Monnier <address@hidden> writes:

>> Yes, I can see that. Although iff this is the reason for the
>> undo-boundary, it would still make more sense to me to have the process
>> code insert this. Aside from being a more discrete effect, it would also
>> avoid the current "do nothing now, but insert an undo-boundary before
>> the next change where ever that is" semantics.
>
> I don't claim it's the best solution, indeed.  It's just that if we
> remove it, we'll have to replace it with other mechanisms.
> So we need a clear description of the current cases that are considered
> misbehaviors and those that are considered good (tho not necessarily
> perfect).

I entirely agree with this, of course. This is why I am trying to find
positive behaviour.

So, I have tested this, and indeed commenting out that code does affect
undo behaviour. To test this, I wrote a "countdown" script which, well,
counts down, and then ran this in *shell*. Then I typed into *scratch*
at defined points. With the undo-boundary code, indeed, the typing in
*scratch* does add boundaries -- so that a countdown from 100 say, gets
split up into multiple undos. Without this code, the countdown gets
undone in one go.

So, while it clearly has an effect, I am not sure why this is better.
For example, if I launch two shell buffers, then run "countdown 20" in
both at the same time, then both buffers now undo in 20 steps, one
second at a time, because their output interleaves. Again, the "add an
undo boundary because of a change in another buffer" semantics does not
seem intuitive to me.


>> I don't understand how that would that work. undo-boundaries are nil, so
>> surely they are all the same object?
>
> No, we'd record put the cons cell in which the nil is placed.

Oh, yes, of course. That does assume, though, that any operations on
buffer-undo-list are destructive. For instance, if I filter the
buffer-undo-list with seq.el or dash, do I not get all new cons cells?
Still, most of the undo.c code seems to change in place, so I guess it
would work in most cases.

Phil




reply via email to

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