Hi. I've just started using Mutt as my primary mail reader on my Mac, and I'm having trouble relearning my emacs key bindings from my Linux days (Ctrl/Alt aren't quite the same!). So I thought I'd give TM a try as my default email editor.
Is there any support for editing emails out there? 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)
Thanks,
Graham
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&c2cof... +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
On Tuesday 15 November, Allan Odgaard wrote:
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&c2cof... +site%3Alists.macromates.com&btnG=Search
[snip detailed instructions]
Thanks Allan, that looks to be just the ticket. I've not tried it yet, but will do so when I get home from work tonight.
Graham
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
On 20/11/2005, at 17:41, Graham Ashton wrote:
{ 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: [...] { name = 'meta.quoted-text.email'; match = '^\s*>\s.*$\n?'; include = 'text.plain'; }
You collapsed two rules into one.
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.
If you fix the rule above, it should work. You can press ctrl-shift P with the caret on quoted text to see what it is marked up as.
On Tuesday 15 November, Allan Odgaard wrote:
On 14/11/2005, at 6.09, Graham Ashton wrote:
Is there any support for editing emails out there?
If you can give your emails a unique (file) extension, then in the bundle editor make a new language that marks up quoted text, ...
Mutt calls it's temporary files mutt-hostname-123-123456-12, or similar. The fileTypes dictionary key in the Bundle editor doesn't appear to support this kind of format (i.e. "mutt-hostname*" doesn't work).
I've been through the Mutt manual and have been unable to find anything that will allow me to control the file extension of temporary files. I checked the help for mate and it doesn't seem to support setting the language when opening the file.
Is there anything else I could do to automate the selection of the language?
Thanks. Sorry to keep banging on about this...
Graham