emacs-devel
[Top][All Lists]
Advanced

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

Re: Undo complex command


From: Michael Heerdegen
Subject: Re: Undo complex command
Date: Tue, 30 Mar 2021 01:09:25 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

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

> 1- copy the current `buffer-string` along with the `buffer-undo-list` to
>    a new buffer.
> 2- save that buffer's content to a temp file.
> 3- call undo in that temp buffer
> 4- run a diff between the temp file and the current content of the temp buffer
> 5- display it to the user
> 6- if the user hits M-p (or something like that) you go back to 2.
> 7- else you try to apply that diff to the main buffer's contents
>    (e.g. using diff-apply-hunk).

"undo-tree.el" has implemented more or less that.  It uses it to provide
a way to display diffs for each change in the visualizer.  I don't
recall if has a separate command to diff with the current buffer state.

Michael.



reply via email to

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