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

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

bug#23632: 25.1.50; Gratuitous undo boundary in latex-insert-block


From: Phillip Lord
Subject: bug#23632: 25.1.50; Gratuitous undo boundary in latex-insert-block
Date: Fri, 03 Jun 2016 23:18:56 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.94 (gnu/linux)

Stefan Monnier <monnier@IRO.UMontreal.CA> writes:

>> Simple let binding would not give quite the same functionality, because
>> of the last part -- I also add a boundary to buffers with a greater
>> recursive depth; with a let binding, I think these would be unbound for
>> commands that lower the recursion depth.
>
> Ah, you mean that the value of undo-auto--undoably-changed-buffers needs
> to be propagated "out" when we leave the let-binding.

I *think* so -- I'm not entirely sure. It might make no difference.


> You're right. So instead of a simple `let', it needs to be something
> like:
>
>     (let ((tmp ()))
>       (unwind-protect
>           (let ((undo-auto--undoably-changed-buffers nil))
>             (unwind-protect
>                 <do-it-all>
>               (setq tmp undo-auto--undoably-changed-buffers)))
>         (setq undo-auto--undoably-changed-buffers
>               (append tmp undo-auto--undoably-changed-buffers))))
>
> Or
>
>     (let ((tmp undo-auto--undoably-changed-buffers))
>       (unwind-protect
>           (progn
>             (setq undo-auto--undoably-changed-buffers nil)
>             <do-it-all>)
>         (setq undo-auto--undoably-changed-buffers
>               (append undo-auto--undoably-changed-buffers tmp))))
>
> Maybe a simple alternative would be to do
>
>     (let ((undo-auto--undoably-changed-buffers nil))
>       (unwind-protect
>           <do-it-all>
>         (undo-auto--ensure-boundary undo-auto--undoably-changed-buffers)))

I use this variable in several different places in two different places
though -- once when we capture the undoable changes (which happens
often) and once on at the end of each command. I'd have to do this let
binding in the command loop?

My current solution seems simpler, even if it does feel like I have
created "recursion-level" local variables.

Or am I totally mis-understanding what you are suggesting? I'd be
happier with a simpler implementation if possible.

Phil







reply via email to

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