删除 ediff-trees 会话中所有文件的尾随空格
我正在使用非常方便的 ediff-trees.el http:// /www.emacswiki.org/emacs/ediff-trees.el 来比较我的一个项目合作伙伴提供的一堆 Python 代码的两个版本。
不幸的是,这些人签入的代码中带有尾随空格(到处都有额外的选项卡......),这会产生大量误报差异,这使得识别更改并逐一修补它们变得不可行。
有谁知道一种巧妙的方法,使 emacs 在访问我在执行 Mx ediff-trees 期间比较的两个目录中的每个文件时自动从行中删除所有尾随空格。
如果这不能在 emacs 中自动实现,那么一个遍历目录结构并从所有 Python 源文件 (*.py) 中删除尾随空格的 shell 脚本就足够了。然后,我可以在执行差异之前在两个目录上运行它。
显然这些选项有助于缓解空白问题。
(setq ediff-diff-options "-w")
(setq-default ediff-ignore-similar-regions t)
但是,经过测试,他们似乎并没有解决问题。
另外,在我的 .emacs 配置中启用了以下功能:
;; Strip trailing whitespace
(require 'ws-trim)
(global-ws-trim-mode t)
(set-default 'ws-trim-level 2)
但这不会影响 ediff-tree 目录遍历中访问的文件。
I am using the very handy ediff-trees.el http://www.emacswiki.org/emacs/ediff-trees.el to compare two versions of a pile of Python code provided by one of my project partners.
Unfortunately, these guys are checkin in code with trailing whitespace (extra tabs here and there...) which is creating a ton of false positive diffs, which makes identifying the changes and patching them over one-by-one unworkable.
Does anyone know of a neat way of making emacs strip all trailing whitespace from lines automatically as it visits each of the files in the two directories I am comparing during the execution of M-x ediff-trees.
If this cannot be achieved auto-magically in emacs, a shell script that traverses a directory structure and removes trailing whitespace from all Python source files (*.py) would suffice. I can then run this on both directories before performing the diff.
Apparently these options help mitigate the whitespace issue.
(setq ediff-diff-options "-w")
(setq-default ediff-ignore-similar-regions t)
But, after testing they do not appear to solve the problem.
Also, the following is enabled in my .emacs configuration:
;; Strip trailing whitespace
(require 'ws-trim)
(global-ws-trim-mode t)
(set-default 'ws-trim-level 2)
But that is not effecting files visited within the ediff-tree directory traversal.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这应该可以做到:
This should do it: