[Top][All Lists]

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

undo by word

From: Michael J Downes
Subject: undo by word
Date: 22 Oct 2002 07:23:34 -0700

When typing plain text it would be in some sense more natural for undo
to undo a word at a time instead of twenty characters at a time.
Defining SPC to run something other than self-insert-command has the
side effect of putting in an undo boundary, but unfortunately the
results seems to be too many undo boundaries. After defining

  (defun space (arg)
    "*Insert a space in a way that creates an undo boundary."
    (interactive "*p")
    (self-insert-command arg))

  (global-set-key " " 'space)

and typing some words, one finds that repeated undo steps stop after
each space *and* after each word. (I was shooting for a way to undo a
word together with its preceding space(s) in a single undo step.)

I also tried using after-change-functions, with pretty good results,
but that approach seemed to end up being rather complicated.

Is there anyone else besides me who thinks it might be a good idea to
add an option for word-by-word undo in a future version of Emacs? I
didn't find
any previous discussion on this in Google (searching for
"undo-boundary", "word by word", "wordwise", etc.)

reply via email to

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