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: Thu, 02 Jun 2016 21:08:46 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.94 (gnu/linux)

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> What worries me is that it just deals with the minibuffer.  I wonder
>> whether there are other circumstances where a recursive edit is going to
>> break things.
>
> I guess we could introduce a new var (call it
> `undo-auto-current-buffer-only' or `undo-auto-ignore-other-buffers' or
> what have you) which packages could let-bind around recursive edits.
> We could also change the minibuf.c code to bind this var, so you could
> check the var instead of hard-coding (minibufferp) in your patch.
>
> The main use-case I can think of would be debug/edebug.
>
> This said, if the changes in other buffers are due to process-filters,
> then they still should get an undo-boundary during
> minibuffer/recursive edits.  So maybe instead of "only push
> undo-boundaries in current-buffer", we should have a variable holding
> a list of buffers where we shouldn't push undo-boundaries (unless
> they're the current-buffer).
>
> Or an alternative would be to do what Viper does (well, did): keep
> pushing boundaries as before, but when we return from the minibuffer,
> remove any boundaries that were inserted into the current-buffer's
> undo-list during the recursive edit.

What I dislike about this is that other packages are responsible for
getting things right.

What about this

1) undo-auto--undoably-changed-buffers becomes an alist

 ((0 . (buffers*))
  (1 . (buffers*))
  (2 . (buffers*)))

where the key is the return of (recursion-depth)

2) undo-auto--boundaries operates only on buffers at the
current-recursion-depth. Or, probably, at the current of greater
recursion depth, to ensure that undo-buffers happens when a recursive
edit exits.

This way, process buffers will still get an undo-boundary if they change
during the recursive edit.



>> Incidentally, this is a nightmare to debug.  Emacs needs to be able to
>> write to standard out, so I could log without changing any buffers!
>
> What I do is to push to a variable, and then observe the var from M-x
> ielm or some such.

That's a good idea -- I've been doing the former, then using C-hv.

Phil





reply via email to

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