[TxMt] Re: "File->New From Template" shell script "issue"...

Allan Odgaard mailinglist at textmate.org
Tue Feb 2 17:50:20 UTC 2010


On 16 Jan 2010, at 02:42, John Wiederhirn wrote:

> [ Instantiating Templates are done in TMPDIR with non-unique name ]
> It seems like there are a couple of obvious solutions:
>
> 1.  TextMate could populate a variable to indicate whether the  
> template is
> being run from the Project window (in which case $TM_NEW_FILE and  
> kin are
> properly populated, and should be unique), or from the "File->New From
> Template" menu item (in which case they are not, and you need to avoid
> collisions because all template scripts are dumping in the same tmp
> directory, using "untitled"-based names).

I think template commands already do too much (that TextMate should  
do), so having them resolve the conflict is clumsy.

> 2.  Alternately, in the "File->New From Template" case, TextMate  
> itself
> could initially provide a _unique_ $TM_NEW_FILE_BASENAME and friends  
> [...]

Problem with this is that several templates use the file name in the  
template, so using an (ugly) unique name would leak into the  
instantiated template (rather than just have the default class, HTML  
title, etc.) be ‘untitled’.

To be honest templates are pretty lousy and it is something I have  
previously said would be completely revamped in 2.0, the current  
system is broken and it needs to be retired and reinvented/unified  
with snippets, so it is not really an area I am eager to “fix” for 1.x  
(even if 2.0 is not here yet).




More information about the textmate mailing list