[TxMt] saving without trailing spaces and tabs...

Sean Schertell sean at datafly.net
Wed Mar 22 01:10:52 UTC 2006


Doh!  I just noticed that this is answered at the bottom of the email  
I just replied too.  It's morning here in Japan, I think I need to  
have some more coffee before firing off any more emails :-)

Sean


On Mar 22, 2006, at 10:08 AM, Sean Schertell wrote:

> Seems like a lot of work for such a basic code editing function :-(
>
> Are there any plans to add this command natively in a future release?
>
> Sean
>
>
>
> On Mar 22, 2006, at 7:06 AM, Allan Odgaard wrote:
>
>> On 21/3/2006, at 17:48, Dan Ridley wrote:
>>
>>> If you really want to get it into one command, you can use this:
>>>
>>> perl -pe 's/[\t ]+$//g' > "$TM_FILEPATH" && cat "$TM_FILEPATH"
>>>
>>>  (Input: Entire Document
>>>   Output: Replace Document)
>>>
>>> There are two problems with this, though:
>>>
>>>  * TextMate will not know that you've overwritten the file, so  
>>> while the file contents on disk will match the file contents in  
>>> TextMate, you'll still get the "unsaved" bullet on your tab, and  
>>> will be prompted to save on close.
>>>  * You'll be returned to the beginning of the current line when  
>>> you run it.
>>
>> If you set the command to save before, it will think the file is  
>> up-to-date (even though the command makes a second save), and if  
>> you set the output to discard, you should get rid of the latter  
>> problem (then also remove the » && cat "$TM_FILEPATH"«).
>>
>> It does however not handle the case where the file is untitled.
>>
>>
>>
>>
>>
>>
>> Just FYI (meant for the list) I am currently (amongst other)  
>> looking into extending commands to be used in various (callback)  
>> events, and directly on files (from the file browser). So long- 
>> term the way to strip trailing spaces (and similar) will be a  
>> method very similar to this (but with a slightly extended  
>> infrastructure to make it more graceful).
>>
>>
>> _____________________________________________________________________ 
>> _
>> For new threads USE THIS: textmate at lists.macromates.com
>> (threading gets destroyed and the universe will collapse if you  
>> don't)
>> http://lists.macromates.com/mailman/listinfo/textmate
>>
>>
>
> ::::  DataFly.Net  ::::
> Complete Web Services
> http://www.datafly.net
>
>
> ______________________________________________________________________
> For new threads USE THIS: textmate at lists.macromates.com
> (threading gets destroyed and the universe will collapse if you don't)
> http://lists.macromates.com/mailman/listinfo/textmate
>
>

::::  DataFly.Net  ::::
Complete Web Services
http://www.datafly.net




More information about the textmate mailing list