[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: |
Thu, 21 May 2015 12:15:12 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.4.0.0.0 (gnu/linux) |
Stefan Monnier <address@hidden> writes:
>> M-x fill-paragraph
> [...]
>> At my count it takes 8 undo operations to undo "fill-paragraph".
>
> Good example, thank you. But IIUC just removing the "undo-boundary on
> buffer-change" code still wouldn't give you the perfect behavior,
> because you still do want an undo-boundary in the second buffer, right?
Yes, you are right, the second buffer is an issue, although I am not
convinced that the behaviour is worse. Below I have described two tasks
both of which change another buffer on a-c-f. I'm comparing between an
Emacs 24.5 (as released, but built from git by me) and my own Emacs
(based on 24.4 actually) with the relevant sections of undo.c commented
out. Again, built by me.
With the existing logic I get a lot of undo boundaries. Without the
existing logic I get a sane number of boundaries. I do not get the same
undo-boundaries that I would have got in the other buffer if I had made
changes by typing commands rather than using a-c-f. But I could add
these programmatically with as much or as little fidelity as I choose.
The data I make these conclusions on is below.
Phil
* Noisy-change
** Task
Type "abcdef" into *scratch* with (setq noisy-change-log t), then check
buffer-undo-list in the created noisy-change-log buffer.
I pick this task because it's about as simple as it gets.
** With existing undo-boundary code
(nil
(402 . 439)
nil
(329 . 402)
nil
(256 . 329)
nil
(183 . 256)
nil
(110 . 183)
nil
(37 . 110)
nil
(1 . 37)
(t . 0))
** Without existing undo-boundary logic
(nil (1 . 439) (t . 0))
** Conclusion
The amalgamation of several events is working.
* lentic-view
** Task
Use "Create Lentic View" (this creates an exact clone, rather like an
indirect-buffer).
** With existing undo-boundary logic
(nil
(197 . 198)
nil
(196 . 197)
nil
(195 . 196)
nil
(194 . 195)
nil
(193 . 194)
nil
(192 . 193))
** Without existing undo-boundary logic
(nil (192 . 198))
** Conclusion
Same as last, but with a simpler set of events.
* Task 3
Use lentic-view, type in the entire alphabet
** Without existing undo-boundary logig
(nil (192 . 217) nil (1 . 192) (t . 0))
** Conclusion
The "undo-boundary every 20 self-insert-command"s logic is not working
or it should be something like this...
(nil (212 . 218) nil (192 . 212))
I could add this logic in, although it's a bit of pain and requires
effectively duplicating logic from cmds.c in lisp.
* Task 4
Using lentic view, type in
abcdefghijk
abcdefghijk
** In *scratch*
(nil (208 . 222) nil (206 . 208) nil (192 . 206))
** In "*lentic: scratch*"
(nil (192 . 222) nil (1 . 193) (t . 0))
** Conclusion
All of the insertion events have been amalgamated, so the undo is much too
"lumpy".
Again, I can add this logic in, but I have to duplicate the "add an
undo-boundary after
a command" logic from the command loop.
- Re: disabling undo boundaries, (continued)
- Re: disabling undo boundaries, Stefan Monnier, 2015/05/15
- Re: disabling undo boundaries, Phillip Lord, 2015/05/15
- Re: disabling undo boundaries, Stefan Monnier, 2015/05/15
- Re: disabling undo boundaries, Phillip Lord, 2015/05/16
- Re: disabling undo boundaries, Phillip Lord, 2015/05/19
- Re: disabling undo boundaries, Stefan Monnier, 2015/05/19
- Re: disabling undo boundaries, Phillip Lord, 2015/05/19
- Re: disabling undo boundaries, Stefan Monnier, 2015/05/19
- Re: disabling undo boundaries, Phillip Lord, 2015/05/20
- Re: disabling undo boundaries, Stefan Monnier, 2015/05/20
- Re: disabling undo boundaries,
Phillip Lord <=
- Re: disabling undo boundaries, Stefan Monnier, 2015/05/21
- Re: disabling undo boundaries, Phillip Lord, 2015/05/21
- Re: disabling undo boundaries, Phillip Lord, 2015/05/27