From: "rgb" <rbielaws@i1.net>
Subject: Re: undo custom delete
Date: 5 Oct 2005 07:23:18 -0700 [thread overview]
Message-ID: <1128522198.322768.196970@o13g2000cwo.googlegroups.com> (raw)
In-Reply-To: <1128503329.733223.304600@g14g2000cwa.googlegroups.com>
> but this does raise another question... is there a way to undo deletion
> of a complete word in the same way that undo would undo the typing of a
> complete word? surely it must be do-able, the logic being something
> recursive like "if (last action was delete char) and (char not
> whitespace), then (undo last action) and (repeat this loop), else
> (break)".
The only possibility is to change how undo elements appear on
buffer-undo-list. Since undoing an insert involves deleting the
inserted character the undo list doesn't record what character
was inserted. Only when you delete something does the original
content need to be saved so it can be re-inserted during undo.
So a special-undo could not tell when to stop undoing unless it
looked at the buffer contents at the point where undo list says
delete something.
Hmm, so it could tell... Anyway...
Undo normally undoes elements on the list until it reaches a
undo-boundary element. A nil.
You could create a pre command hook or remap word constituent
characters to an intermediate function. Either way the
function would decide if it wanted to remove the car of
buffer-undo-list (if it's an undo-boundary element (nil)).
This has the effect of making the next action belong to the
previous group of keystrokes and all will be undone at once.
next prev parent reply other threads:[~2005-10-05 14:23 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-10-04 16:03 undo custom delete Shug Boabby
2005-10-04 17:29 ` rgb
2005-10-05 9:08 ` Shug Boabby
2005-10-05 14:23 ` rgb [this message]
2005-10-05 14:36 ` Shug Boabby
2005-10-05 15:17 ` Johan Bockgård
2005-10-05 16:47 ` Shug Boabby
2005-10-05 17:49 ` Johan Bockgård
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=1128522198.322768.196970@o13g2000cwo.googlegroups.com \
--to=rbielaws@i1.net \
/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.
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).