[TxMt] Re: Save and strip whitespace

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


On Thu, Feb 9, 2012 at 20:55, Steve King <sking at arbor.net> wrote:
> On 2012-02-09 14:03, Martin Kühl wrote:
>>
>> On Thu, Feb 9, 2012 at 18:50, Andrew Appleton<andrew at mintdigital.com>
>>  wrote:
>>>
>>> Are there plans to add an option to strip trailing whitespace on save?
>>>
>>> I had this set up in TM1 like
>>> this http://blogobaggins.com/2009/03/31/waging-war-on-whitespace.html and
>>> it
>>> would be great to get ti as a feature of TM2.
>>
>> 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".
>
>
> That doesn't quite work.  The file gets saved before the command is applied,
> not after.  But the file is not marked as changed after applying the
> command!  You can quit TM2 and lose the changes made by the command.  It's
> not a big deal for trailing whitespace, but this behavior for other commands
> could lead to real data loss.

Darn, you're right. We could try a command that saves, then modifies the
contents of $TM_FILEPATH, but that sounds rather brittle and assumes
TM_FILEPATH is even set _before_ the command script runs.

Given that, I second the original feature request. :-)

Martin


More information about the textmate mailing list