elisp 中是否有函数可以将补丁应用于缓冲区?
我正在为审查工具开发 emacs 模式,并希望使用 ediff 来查看差异...问题是审查工具仅产生差异,而不是旧文件和新文件。我想将旧文件放入缓冲区并应用 diff,而不是复制文件,将 diff 作为子进程调用并将其加载到单独的缓冲区中。
不用自己写也能做到吗,有人知道吗?
I am working on an emacs mode for a review tool, and want to use ediff for viewing diffs... the problem is that the review tool only yields a diff, rather than old and new files. I'd like to put the old file in a buffer and apply a diff rather than copying the file, calling out to diff as a subprocess and loading it into a separate buffer.
Can this be done without writing it myself, does anyone know?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
ediff-patch-buffer 可用于在 ediff 模式下修补缓冲区
ediff-patch-buffer can be used to patch a buffer in ediff-mode
根据您的工作流程,这可能适用也可能不适用。
尝试
从中执行以下命令:
对我来说最直观的流程是
'diff-ediff-patch
。当您查看补丁时,运行Cc Ce,输入要补丁的文件名(例如
file.to.patch
)。然后,Emacs 将为您设置两个缓冲区file.to.patch.orig
和file.to.patch
的 ediff,其中包含原始文件和修补版本。然后您可以像平常一样使用 ediff。在流程结束时,您将获得所需文件名的修补版本。查看diff-mode 文档。
Depending on what your workflow is this may or may not apply.
Try
From which you can do commands like:
The most intuitive flow for me is the
'diff-ediff-patch
.When you're looking at a patch, run C-c C-e, enter the file name to patch (say
file.to.patch
). Emacs will then set you up with an ediff of two buffersfile.to.patch.orig
andfile.to.patch
containing the original file and the patched version. You then use ediff as you would regularly. At the end of the flow, you have the patched version in the filename you want.Check out the documentation for diff-mode.
还有 Mx epatch 请求包含补丁的缓冲区(例如 Gnus 邮件),然后请求要修补的文件/目录。非常方便。
There is also
M-x epatch
that asks for a buffer containing a patch (Gnus mail for example) and then asks for a file/directory to patch. Very handy.