Hi everyone. I just started using TextMate today and I've run into a little problem. I've noticed that my Shell Variables (as set in the Preferences) aren't loaded properly when I use templates. For example, I'd kind of like to mimic Xcode's built-in templates. To do this, I've modified the Java Class template to look more like:
// // ${TM_NEW_FILE_BASENAME}.java // // Created by ${TM_USERNAME} on ${TM_DATE}. // Copyright (c) ${TM_YEAR} ${TM_ORGANIZATION_NAME}. All rights reserved. // ...
and I've updated the script associated with that template to look like this:
export TM_YEAR=`date +%Y` export TM_DATE=`python -c 'import datetime now = datetime.datetime.now() print "%s/%s/%s" % (now.day, now.month, now.year) '` export TM_USERNAME=`niutil -readprop / /users/$USER realname` perl -pe 's/${([^}]*)}/$ENV{$1}/g' \ < class-insert.java > "$TM_NEW_FILE"
All of this works fine, except ${TM_ORGANIZATION_NAME} isn't being replaced correctly. It works fine for Code Snippets, but not in Templates. If I add
env >> "$TM_NEW_FILE"
to the end of the script, TM_ORGANIZATION_NAME isn't listed. Is this a bug or a known issue? I've searched Google, TextMate's bug list, and the list archives, but I can't find any mention of the issue. I would appreciate any help in resolving the problem... it's a minor nuisance to an otherwise great application.
-Prachi
On 5/6/2006, at 7:36, Prachi Gauriar wrote:
Hi everyone. I just started using TextMate today and I've run into a little problem. I've noticed that my Shell Variables (as set in the Preferences) aren't loaded properly when I use templates [...]
Is this the public TextMate 1.5.1 (948)? Templates have since been changed, but I don’t think there have been the problems you mention -- the TM_ORGANIZATION_NAME variable was explicitly made for use in templates and has existed since 1.0.
Is this when using New From Template or New in a project?
On Jun 6, 2006, at 5:52 AM, Allan Odgaard wrote:
On 5/6/2006, at 7:36, Prachi Gauriar wrote:
Hi everyone. I just started using TextMate today and I've run into a little problem. I've noticed that my Shell Variables (as set in the Preferences) aren't loaded properly when I use templates [...]
Is this the public TextMate 1.5.1 (948)? Templates have since been changed, but I don’t think there have been the problems you mention -- the TM_ORGANIZATION_NAME variable was explicitly made for use in templates and has existed since 1.0.
It's with TextMate 1.5.1, New With Template. I was able to narrow it down to when you don't have the "Create [Untitled Document] at startup and re-activation" preference selected. Once this option is selected, the bug continues to occur until the TextMate is relaunched. I filed a bug with the specifics: ticket 09E676B9.
That said, I just found the "cutting edge" updates. The error no longer occurs in build 1060.
BTW, TextMate is an amazing app. I've been telling my friends about it: "It's like Emacs, if it were designed today with a GUI in mind and without Emacs Lisp or the cruft of 20 years of development."
Thanks.
-Prachi