[TxMt] Re: Save and strip whitespace
Steve King
sking at arbor.net
Thu Feb 9 19:55:59 UTC 2012
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.
To reproduce:
1) Set the "Remove Trailing Spaces" command to save the current
document. Be sure to save the bundle.
2) Load a document.
3) Add trailing whitespace to some lines.
4) Save the document.
5) Make a change to the document. The "modified" indicator in the tab
shows the file is changed.
6) Run "Remove Trailing Spaces." The "modified" indicator now shows the
file is unchanged.
7) Quit TM2. You are not asked to save the document.
8) Start TM2.
9) Load the document. You will see the change you made in step 5, but
the trailing whitespace is still there.
--
Steve King
Sr. Software Engineer
Arbor Networks
+1 734 821 1461
www.arbornetworks.com <http://www.arbornetworks.com/>
More information about the textmate
mailing list