views:

59

answers:

1

Hi,

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.

Thanks in advance.

A: 

[A] shell script that traverses a directory structure and removes trailing whitespace from all Python source files (*.py) would suffice.

This should do it:

find . -name '*.py' | xargs sed -r -i -e 's/\s\s*$//'
Sean Bright
My hero... thanks! Hopefully someone will find a way of making this work within ediff-trees and my life will feel complete.
landstatic