[SVN] Conditionally insert the value of a variable in a snippet ?

Fredrik Karlsson dargosch at gmail.com
Wed Mar 17 13:04:33 UTC 2010


Dear list,

I just started working on a bundle of snippets for ROBOdoc, and I have
a couple of questions that would help me extend it to more languages
(supported by ROBOdoc):

1) How do I insert a variable + som eother text if another one is
empty? I tried using this:

${TM_SELECTED_TEXT/^.+$/${TM_COMMENT_START} SOURCE\n\n$0/}

which produces

${TM_COMMENT_START} SOURCE

and not
# SOURCE

which would be appropriate for Tcl.

2) What would be the best way to set up comment characters? There
seems to be a number of approaches here, so I am a bit confused hwo do
do this:

- The Tcl bundle defines TM_COMMENT_START, which is what ROBOdoc expects
- The C bundle (being more flexible when it commes to commenting) also
defines TM_COMMENT_START_2 and a TM_COMMENT_END_2 for the /* */ style
of comments, which ROBOdoc expects.

So now, I need to test for the presence of TM_COMMENT_START_2 and
output that, or TM_COMMENT_START, depending on what is available. What
would you do (in a beginner language, please).

/Fredrik




-- 
"Life is like a trumpet - if you don't put anything into it, you don't
get anything out of it."



More information about the textmate-dev mailing list