emacs-devel
[Top][All Lists]
Advanced

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

Re: [Emacs-diffs] fix/no-undo-boundary-on-secondary-buffer-change c7a660


From: Phillip Lord
Subject: Re: [Emacs-diffs] fix/no-undo-boundary-on-secondary-buffer-change c7a6601 1/5: undo-size can count number of boundaries.
Date: Tue, 22 Sep 2015 11:45:15 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Stefan Monnier <address@hidden> writes:

>> Because I am using it to provide a backdrop, default, automatically add
>> a boundary heuristic.  Waiting for a boundary to be added defeats the point.
>
> I think we're misunderstanding each other.
>
> What I'm suggesting is to replace:
>
>    if(NILP (Vundo_buffer_undoably_changed)){
>      Fset (Qundo_buffer_undoably_changed,Qt);
>      safe_run_hooks (Qundo_first_undoable_change_hook);
>    }
>
> with
>
>    if (NILP (CAR (BVAR (current_buffer, undo_list)))
>      safe_run_hooks (Qundo_first_undoable_change_hook);
>
> and do it right before we add something to the undo-list (so the test of
> undo_list indeed tells us if this is the first new change pushed since
> the last boundary).  It should give us the same behavior but without the
> need for that variable.

Because, that triggers the hook only after a boundary. With
"undo-buffer-undoably-changed", the hook is triggered after
undo-buffer-undoably-changed is set to nil which may or may not relate
to the addition of a boundary. And actually, currently it doesn't.

Anyway, my code is current safe but doesn't work (I didn't realise that
the GC buffer compaction normally leaves the first element in the
buffer-undo-list), so I need to fix that which is going to take a couple
of days. Hopefully, it will all make sense once it's finished!

Phil



reply via email to

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