unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: scame <laszlomail@protonmail.com>
To: "emacs-devel@gnu.org" <emacs-devel@gnu.org>
Subject: Undo complex command
Date: Tue, 23 Mar 2021 07:05:50 +0000	[thread overview]
Message-ID: <MvD82KE1nYu2NFwlxKgDbCR5c6auULKfoFtsS1B84-FhgScDHbhlg1UhiqAN-EqxplXB6ZtTl9EoBBiR4upBrZF9KlRjhubG95rtbjd-MmM=@protonmail.com> (raw)

I use repeat complex command often (BTW, why doesn't the built in
version have completion? It's much better that way.) and
sometimes I want to undo them.

Imagine I replaced foo with bar in the whole buffer. I do various
other changes and then it occurs to me the foo/bar replacement
was a mistake and I want to undo it. These words occur many times
in the buffer, so it's not just a matter of selecting a region
and undo that.

What if after complex operations which change the buffer
significantly (e.g. touching many lines or something) emacs
stored the diff of the changes in memory? (With some limits,
of course, e.g. number of past diffs stored, size limit, etc.)

Then if I want to revert a particular change, I could say
M-x undo-complex-change, select a command from the undo
list and then I'd get its diff in a buffer and then I
could revert any hunk or the whole diff altogether. (Like
with regular diffs the diff can be applied as long as the
text did not change significantly since then.)

What do you think? Could it be a useful feature?




             reply	other threads:[~2021-03-23  7:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-23  7:05 scame [this message]
2021-03-23 13:55 ` Undo complex command Stefan Monnier
2021-03-29 23:09   ` Michael Heerdegen
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='MvD82KE1nYu2NFwlxKgDbCR5c6auULKfoFtsS1B84-FhgScDHbhlg1UhiqAN-EqxplXB6ZtTl9EoBBiR4upBrZF9KlRjhubG95rtbjd-MmM=@protonmail.com' \
    --to=laszlomail@protonmail.com \
    --cc=emacs-devel@gnu.org \
    /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).