On Thursday February 09 2012, Martin Kühl martin.kuehl@gmail.com wrote:
You can basically do the same thing. There's a command for stripping trailing whitespace in the Text bundle, it's called "Remove Trailing Spaces in Document / Selection". Just duplicate that and set "Save" to "Current Document".
Doesn't that save the current document when the command is run, rather than running the command when the document is saved, though?
What I'm looking for is a way of hooking the Save command so that the whitespace stripper is run just before saving, regardless of whether I pressed Cmd-S, chose Save from the File menu, or selected Save in the dialog when closing a document with unsaved changes.
I'm sure I read something on a blog which suggested it was possible, but the article unfortunately assumed a greater familiarity with bundle writing than I have :)