[TxMt] Editing emails with TM

Allan Odgaard throw-away-1 at macromates.com
Tue Nov 15 11:20:10 UTC 2005


On 14/11/2005, at 6.09, Graham Ashton wrote:

> Is there any support for editing emails out there?

A few seems to have made it for themselves, but nothing public:  
http://www.google.com/search?num=20&hl=en&lr=&safe=off&c2coff=1&q=mutt 
+site%3Alists.macromates.com&btnG=Search

> 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)
>    * automatically entering line wrap mode
>    * knowledge of how to wrap quoted paragraphs (i.e. with ">" at the
>      start of each line)

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

Then quoted text should have scope “meta.quoted-text.email” which you  
can assign a visual style to in Preferences / Fonts & Colors. I  
included the \n in the match, so if you change background for quoted  
text, it will extend to the right border, for the entire block of  
quoted text.

In addition, because the files have their own language, changing soft  
wrap will stick only to that language.

And since you also have a scope for quoted text, it's possible to  
e.g. overload ctrl-Q (reflow text) only for that scope -- the command  
would be a macro that first selects the paragraph (via regexp search)  
and then filter the text probably through “par” [1], this letter has  
a list of options to use with “par” for reflow of potential email- 
quoted text: http://lists.macromates.com/pipermail/textmate/2005- 
September/005762.html


[1] You'll need to install this from Darwin Ports or similar




More information about the textmate mailing list