From: Michael Heerdegen <michael_heerdegen@web.de>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: scame <laszlomail@protonmail.com>, emacs-devel@gnu.org
Subject: Re: Undo complex command
Date: Tue, 30 Mar 2021 01:09:25 +0200 [thread overview]
Message-ID: <87sg4dblqy.fsf@web.de> (raw)
In-Reply-To: <jwvy2eekmth.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Tue, 23 Mar 2021 09:55:42 -0400")
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.
next prev parent reply other threads:[~2021-03-29 23:09 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-23 7:05 Undo complex command scame
2021-03-23 13:55 ` Stefan Monnier
2021-03-29 23:09 ` Michael Heerdegen [this message]
2021-03-31 15:37 ` scame
2021-04-02 3:22 ` Stefan Monnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87sg4dblqy.fsf@web.de \
--to=michael_heerdegen@web.de \
--cc=emacs-devel@gnu.org \
--cc=laszlomail@protonmail.com \
--cc=monnier@iro.umontreal.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).