On 17 Mar 2010, at 14:04, Fredrik Karlsson wrote:
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.
I don’t follow. Why would you not expect it to insert $
{TM_COMMENT_START} when you explicitly put that in the replacement
string?
I am not sure what you want, but you do not need to use regexp
replacements for “fallback values”. The second example here shows the
syntax: http://manual.macromates.com/en/snippets#variables
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).
There is a few commands in the Source bundle that *read* these
variables.
You do not have to replicate the comment toggling functionality,
simply setup the variables for your language and the Source bundle
comment commands will work with those variables.
_______________________________________________
textmate-dev mailing list
[email protected]
http://lists.macromates.com/listinfo/textmate-dev