[TxMt] Deriving Bundles

Jeremy Bernstein listorama at expr-i0.net
Thu Sep 7 06:30:28 UTC 2006


Hi -

New to TextMate and this list and very impressed so far with both.

I am experimenting with extending existing Language Grammars, and  
I've run into a problem. I wonder if this is my problem or not, or  
simply a problem in understanding the system:

It appears that some pattern definitions override or erase others.  
For instance, I've added a feature to grab a reference to a  
particular email in Mail.app and create a tag called "emaillink" in  
my GTDalt document. Specifically, I want to add these emaillinks to  
the notes fields in my GTDalt document (I mention this as it becomes  
important below). I decided to make a new Language Grammar, based on  
GTDalt, and wrote the following:

{	scopeName = 'text.gtdalt.jb';
	fileTypes = ( 'gtd', 'gtdlog' );
	foldingStartMarker = '^\s*project';
	foldingStopMarker = '^\s*end\s*$';
	patterns = (
		{	name = 'meta.jb';
			match = '\bmy_emailllnk_tag\b';
		},
		{	include = 'text.gtdalt'; },
	);
}

Seems like it should work, but it doesn't. This appears to be because  
the definition of the notes field (in the text.gtdalt Language  
Grammar) erases my scope tag.

I see this, too, when I try to extend the C Language Grammar to  
include color markup of the API I am using. In many cases, wherever  
the text was in Scope source.c, it works. But as soon as the term in  
question appears within a function declaration or a similar parsed  
structure, my scope tag is eliminated in favor of the parsed one. The  
position of the "include" line doesn't appear to make a difference.

It seems like there should be a way to have persistent scope tags,  
for exactly this purpose -- color-coding particular terms or  
rendering particular strings a certain way, potentially regardless of  
local context. But if not, could someone suggest a workaround?

Thanks very much
jb



More information about the textmate mailing list