[TxMt] Editing emails with TM

Graham Ashton graham.ashton at gmail.com
Sun Nov 20 16:41:44 UTC 2005


On Tuesday 15 November, Allan Odgaard wrote:

> On 14/11/2005, at 6.09, Graham Ashton wrote:
> 
> >I'm specifically wondering whether it's possible to turn the  
> >following on when opening in some kind of "email mode":
> >
> >   * highlighting of quoted text (i.e. different colour)
> 
> If you can give your emails a unique (file) extension, then in the  
> bundle editor make a new language that marks up quoted text, and let  
> it have two rules like this (not tested):
> 
>     {   name = "meta.quoted-text.email";
>         match = "^\s*>\s.*$\n?"; // make the newline part of the  
> match, if any
>     },
>     {   include = "text.plain"; }, // just include the text.plain rules

I added this to my new language:

{	scopeName = 'text.email';
	fileTypes = ( 'email' );
	patterns = ( 
		{	name = 'meta.quoted-text.email';
			match = '^\s*>\s.*$\n?';
			include = 'text.plain';
		}
	);
}

> Then quoted text should have scope ?meta.quoted-text.email? which you
> can assign a visual style to in Preferences / Fonts & Colors.

I suspect this is the bit I'm getting wrong. I added a new element to the
list and called it "quoted email". Then I set it's scope to
"meta.quoted-text.email", but after having selected Email as the language
the quoted text hasn't changed colour. Simplifying the regex didn't help
here either.

Is there much to know about syntax highlighting on a freshly defined
scope? It seems like it should be very simple, so I suspect I've omitted
something straightforward.

Thanks,

Graham

-- 
Graham Ashton
graham.ashton at gmail.com



More information about the textmate mailing list