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 @   WendellYih  阅读(2752)  评论(0编辑  收藏  举报
编辑推荐:
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
阅读排行:
· Ollama——大语言模型本地部署的极速利器
· 使用C#创建一个MCP客户端
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· Windows编程----内核对象竟然如此简单?
· ollama系列1:轻松3步本地部署deepseek,普通电脑可用
点击右上角即可分享
微信分享提示