Some of you reading this probably use TextMate. It is an excellent editor with two caveats. The first is that you can only see one file in the editing window (no screen split), the other is that there is no save hook. This latter gave me headaches since I can’t stand any trailing whitespace in source code and the easiest solution would have been to run a script to remove those when the file is saved.
Without further ado I’ll paste my solution below. Obviously this is not a difficult task to accomplish so the goal is to share not to show off. I use Git for SCM and the following solution parses out the files that have been modified and runs the whitespace eraser script for those. If you use something else (why do you?) you should obviously change the first building block:
1 2 3
1 2 3 4 5
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
And then you run it by typing:
If you decide to use this, it is more convenient to download the raw source
Hopefully I did my tiny bit to have less trailing whitespace in OS code.