[TxMt] Re: "File->New From Template" shell script "issue"...
Allan Odgaard
mailinglist at textmate.org
Wed Feb 3 08:59:10 UTC 2010
On 2 Feb 2010, at 21:30, John Wiederhirn wrote:
> [...] unfortunately it's fairly easy to wind up with an "untitled.h"
> in your temp directory that then subsequently blocks all further
> generation of C/C++/Obj-C templates of any kind. The issue isn't
> tied to multi-file templates either, even single-file templates that
> check for file existence can trigger this problem.
It should only be for multi-file templates, as TextMate will do the
check for single-file templates, and “bump” the untitled counter until
there is a free spot. It can’t do that for multi-file templates
because it only knows the name of one of the files generated (so that
is the one it ensures does not already exist).
As for ‘fairly easy’ — with the default set of templates, only the
Objective-C singleton generates multiple file. You can use this
repeatedly w/o problems. What you have to do is use it, go into the
temp. folder and delete the *.mm file w/o deleting the *.h file *then*
a problem arise. But while easy, why would you do that? Why would you
use the template without a project in the first place?
If you use the template with a project, you are asked for a name in
advance, so the problem should not exist here, and IMO this template
mainly makes sense to use for projects.
> [...] but I still have to get work done in 1.x. It's not really
> different from any other bug in that regard, is it?
Sure it is: It doesn’t crash, it doesn’t lead to problems for 99.999%
of users, the problems it can cause (no templates generated) are non-
serious and easy to workaround (cleanup your temp. folder), at least
when you know the issue, the intended use of the template should
actually never lead to this problem, and finally, the “fix” is non-
trivial, because this is more of a design flaw than a bug, it requires
a rethought design which would likely break with the current template
system, hence why this is scheduled for 2.0, where it is more ok to
just drop support for the current templates.
> [...] The proposed "create file and insert template snippet"
> approach you've mentioned for 2.0 will face this same issue [...] it
> seems more like a general new file generation issue, and any
> solution can carry over into 2.0's code as well.
Shell commands (and hence disk files) will not be involved in “New
File [From Template]”, so there should be no such issue.
More information about the textmate
mailing list