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: Fri, 15 May 2015 20:49:42 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.0.0.0 (gnu/linux)

Stefan Monnier <address@hidden> writes:

>> That doesn't really make sense to me. Say I am editing a file in this
>> buffer while compiling something in that buffer. Why would I want an
>> update in the compilation buffer to force an undo-boundary in this buffer?
>
> It probably won't make any difference in "this buffer" because the
> process filter will be run *between* commands (at which point the
> read-eval command loop already inserts undo-boundaries anyway).
>
> The difference is in the compilation buffer where it'll insert undo
> boundaries every time you run a command in "this buffer".

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.

>
>> Sorry to be persistant about this, but at the moment, changing the code
>> in undo.c is the only good solution I can see to my problem.  It would be
>> different if explicitally called and automatic boundaries were
>> distinguishable, but they aren't.
>
> We could make them distinguishable, OTOH (e.g. using a (weak) hash-table where
> we insert every explicitly added undo-boundary).

I don't understand how that would that work. undo-boundaries are nil, so
surely they are all the same object?

Using symbols like:

'(boundary . user)
'(boundary . internal)

would enable this, I think. But it would break code like this:

  (while (or (null (car buffer-undo-list))
             (and discard-pos (integerp (car buffer-undo-list))))
    (setq buffer-undo-list (cdr buffer-undo-list)))

from undo-tree, and I would guess quite a lot of other places.


I have thought of a partial solution -- which is to add a symbol to
b-u-l in the pre-command-hook, the delete all the boundaries added since
that in the post-command-hook. That gets me to a clean "boundary at
every command" semantics. I couldn't work out how to do this before,
again, because boundaries are all the same object.


Phil



reply via email to

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