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: Stefan Monnier
Subject: bug#23632: 25.1.50; Gratuitous undo boundary in latex-insert-block
Date: Fri, 03 Jun 2016 13:00:03 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

> 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.  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)))


-- Stefan





reply via email to

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