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: Tue, 19 May 2015 22:48:51 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Stefan Monnier <address@hidden> writes:
>> Just wanted to bump this. I am still not sure why this is a good
>> behaviour. My own feeling is that the "undo-boundary when a buffer
>> change happens" logic may not have been implemented for this reason, but
>> as a belts-and-braces way of detecting the end of a command -- after
>> all, buffer changes (followed by an undoable event) normally happen
>> between commands rather than within.
>
> For process filters, I think the "right way" would be to add an
> undo-boundary every N insertions.

"undo" for a process filter seems to be quite a difficult one to me. In
many cases ("M-x compile") undo is just switched off. For things like
M-x shell undo is on and makes sense. My initial guess would be that
"undo the last command and all the output from that command" would seem
the most intuitive.


>> I did start working on this, but haven't got it functional yet. One
>> problem is that if I record the cons cell at the head of
>> buffer-undo-list, I have to search the whole buffer-undo-list to see if
>> it is there (unless I get a match). A cons cell with a nil gets added
>> for every self-insert-command and then removed again, so this tends to
>> happen quite a lot.
>
> Sounds rather ugly.  Let's see how far we can go with the option of
> changing the current behavior rather than trying to add workarounds in
> your code.

Agreed. I'd rather fix the core Emacs behaviour than workaround it, so
it works better for everyone. Of course, I have to acknowledge that my
public spirited behaviour is partly motivated by the workaround being a
PITA.

> Could you describe the exact case that bothers you, so we could start by
> thinking what should be the ideal behavior for that one?


Yes. Any after-change-function that changes another buffer breaks undo.

My "noisy-change" package which just logs the before and
after-change-function args is an example of this.

https://raw.githubusercontent.com/phillord/lentic/master/noisy-change.el

My real use case is lentic.

Ideal behaviour: is just not to do it. Uncommenting all the
"undo_boundary" calls in undo.c seems to achieve this for me, although
obviously that's a blunt fix.

Phil




reply via email to

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