Emacs的undo与redo

在Emacs的手册16.1节中有这样一句话,

Any command other than an undo command breaks the sequence of undo commands. Starting from that moment, the entire sequence of undo commands that you have just performed are themselves placed into the undo record, as a single set of changes. Therefore, to re-apply changes you have undone, type C-f or any other command that harmlessly breaks the sequence of undoing; then type C-/ to undo the undo command.

每个缓冲区都有一个undo记录,每次更改缓冲区都会放入这个undo记录中,我们可以通过连续的c-_进行undo,如果在连续的undo命令序列中插入其他命令比如文档中提到的C-f或者是C-g,那么前面的连续的undo操作都会被作为单独的修改集合放入undo记录中,从而可以重新应用刚才被undo的操作。

如果undo记录如下面这样,

操作1 操作2 操作3

当使用C-_undo到“操作1”了,我们使用了命令C-g,那么undo记录就会变成,

操作1 操作2 操作3 undo操作3 undo操作2 undo操作1

此时我们如果连续使用C-_3命令次,文档的状态就会恢复到没有进行undo操作的状态。

posted @ 2013-08-29 21:29  WendellYih  阅读(2742)  评论(0编辑  收藏  举报