Bob is likely referring to the undo-browse.el
package. According to the package's ub-introduction
command,
In ub terminology, the undo-history is seen as a movie, each step
being a frame of the movie. You can play (back/forth) the color-coded
movie-history of your document, or manually go back and forth, and
revert your document to the frame you like.
A little history...
The undo-browse.el
package is written by Deepak Goel whose name disappears from the Internet record around 2012. This is back in the Emacs 21 days, before ELPA became the standard. Deepak seems to have been quite active in the Emacs community and published a lot of Emacs lisp in the early 2000's. Unfortunately, it looks like undo-browse
, along with his many other packages, were never published to ELPA, MELPA, or Marmalade. His webpage is down and many links to his packages are now dead. I suspect his work is mostly forgotten because of this.
Clean Code was first published in 2009, before Deepak's disappearance. His packages would still have been available then. This leads me to believe Bob was using undo-browse
.
Running undo-browse
nowadays is a little tricky. Its implementation is...unconventional. I haven't had much luck getting it to work as described.
Here are a few ways to achieve playback-like behavior using more recent packages:
undo
You ought to be able to achieve the same result, at least in spirit, with the default undo
command (typically bound to C-/
). Press C-/
until there is nothing left to undo. Then, press C-f
. Now press C-/
repeatedly to redo.
The undo/redo will appear "chunky". This is because undo
tracks "inserts" and not individual commands. For a detailed explanation of how undo
works, see the Reddit post "How Emacs Undo Works".
undo-tree
You can achieve a fine-grain undo with undo-tree
. User lawlist1 provides code that modifies the default to provide key-for-key undo:
(require 'undo-tree)
(when (timerp undo-auto-current-boundary-timer)
(cancel-timer undo-auto-current-boundary-timer))
(fset 'undo-auto--undoable-change
(lambda () (add-to-list 'undo-auto--undoably-changed-buffers (current-buffer))))
(fset 'undo-auto-amalgamate 'ignore)
This will undo/redo character insertions, copy/paste, etc. You can navigate these easily with undo-tree-visualize
. However, undo-tree
doesn't record movements. It only tracks changes.
further commentary
The section quoted looks a lot like what displays in view-lossage
. Pressing C-h l
runs view-lossage
which shows the last 300 commands. Keystrokes can also be logged in raw form to a "dribble" file using (open-dribble-file FILE)
. I'm not aware of a way to "play back" lossage or a dribble, however.
Seeing which commands are most frequently used, the point Bob is emphasizing with his anecdote, can be achieved with keyfreq. Bin Chen's "How to be extremely efficient in Emacs" demonstrates its usage.
1If you like lawlist's snippet, give the post an upvote!