[TxMt] ^Q and the Mail bundle

Eric Peden eric at ericpeden.com
Sat Jul 8 08:02:48 UTC 2006


On Sat, Jul 08, 2006 at 09:01:50AM +0200, Allan Odgaard wrote:
>On 8/7/2006, at 8:18, Eric Peden wrote:
>
>>[...] Here's my hacked Mail language grammar, which also includes a  
>>new firstLineMatch so that the correct language is picked when  
>>composing from mutt
>
>This is nice! However, for this to be added to the default I need the  
>match to be more strict. Both MultiMarkdown and the blogging  
>templates also has a “header” on the first line.

Yeah, my firstLineMatch was awfully broad. It suited my needs and I
neglected to review it before posting.

>So ideally it should match ‘(From|To): (?=.*«email»)|Subject: .*’ or  
>similar. Is mutt consistent with which header it puts first for new  
>letters and replies?

mutt appears to be consistent; I've yet to see it put anything other
than the "From:" header first. However, when directly editing an
existing message, the special "From " line, i.e. the one that isn't
really a header and so doesn't include a colon, generally comes
first. These *usually* look like this:

  From ???@??? Sat Jul  9 13:15:50 2006

but I have a couple of examples where the address doesn't contain an '@'.

>>[...] Mail bundle maintainer(s), whoever you are, please feel free  
>>to appropriate any or all of these modifications.
>
>Thanks, I will role it in -- it seems you were using the previous  
>revision of the Mail language grammar. Only change though was that I  
>removed the include to text.plain and copied over the URL matching  
>rule, so should be easy to merge/re-do.

Oops. I'll have to re-sync with the official version once the
modifications have been included there.

Since I have your attention, though: lately I've found myself wanting
access to some of the Markdown and Textile bundles' features when I'm
writing emails. The bulleted/numbered list snippets, "bolding" text by
wrapping it in asterisks, and similar niceties work well in e-mails
even if you don't convert the markup into HTML. I added an "include =
'text.html.markdown'" to the meta.paragraph.mail rule in the modified
Mail grammar:

  {	name = 'meta.paragraph.mail';
  	begin = '^(?=\S)';
  	end = '^(?:\s*$|(?=\s*>))';
  	include = 'text.html.markdown';
  },

and this at least gives me syntax highlighting for the markup.
Unfortunately, this still doesn't bring the message under the
text.html.textile/markdown scopes the snippets I want are attached to.

I could change the scope selector to include text.plain.mail for all
of the snippets I want to use or make custom snippets for the mail
bundle. Is there a better way to accomplish this, though? Maybe making
a pattern in the Mail grammar that matches the entire document and
assigns a scope of 'text.html.markdown,' and then including the existing
patterns within that scope?

-- 
eric



More information about the textmate mailing list