[TxMt] Re: Save and strip whitespace

Martin Kühl martin.kuehl at gmail.com
Fri Feb 10 10:33:05 UTC 2012


On Fri, Feb 10, 2012 at 09:48, John Yeates <textmate2 at warmvomit.co.uk> wrote:
> On Thursday February 09 2012, Martin Kühl <martin.kuehl at 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?

That's correct. The idea is to replace default ⌘S behaviour does with
the command.

> 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 see. Those are definitely not possible with TM1; maybe Allan will
consider adding the necessary hooks to TM2, but designing a good hooking
system takes time.

Martin


More information about the textmate mailing list