HI all
I may be missing something entirely obvious, but when I have a document's language set to Mail and hit ^Q I seem to get the behaviour from Text->Reformat Paragraph, rather than Mail->Reformat Quoted Text. Can anyone give me a hint as to what I'm missing, or is this a bug?
Thanks! Grahame
On Jul 3, 2006, at 12:16 PM, Grahame Bowland wrote:
HI all
I may be missing something entirely obvious, but when I have a document's language set to Mail and hit ^Q I seem to get the behaviour from Text->Reformat Paragraph, rather than Mail->Reformat Quoted Text. Can anyone give me a hint as to what I'm missing, or is this a bug?
According to its scope, it is only supposed to work in quoted text. What text are you trying it at?
Thanks! Grahame
Haris
Ah, right! Thanks, I just change the scope and I get the behaviour I want :-) I wanted to be able to write paragraphs and have them formatted to 72 columns nicely for me.
According to Charilaos Skiadas:
According to its scope, it is only supposed to work in quoted text. What text are you trying it at?
I just tried it on quote with "> " in front of it and every time I try, the quoted text just disappear... Any idea?
On Jul 4, 2006, at 9:01 AM, Ollivier Robert wrote:
According to Charilaos Skiadas:
According to its scope, it is only supposed to work in quoted text. What text are you trying it at?
I just tried it on quote with "> " in front of it and every time I try, the quoted text just disappear... Any idea?
works fine here. Can you provide an example?
-- Ollivier ROBERT -=- FreeBSD: The Power to Serve! -=- roberto@keltia.freenix.fr Darwin snuadh.freenix.org Kernel Version 7.9.0: Wed Mar 30 20:11:17 PST 2005
Haris
According to Charilaos Skiadas:
works fine here. Can you provide an example?
I will try again tomorrow with Mail.app, my minimalistic test worked fine...
On Mon, Jul 03, 2006 at 12:23:43PM -0500, Charilaos Skiadas wrote:
On Jul 3, 2006, at 12:16 PM, Grahame Bowland wrote:
I may be missing something entirely obvious, but when I have a document's language set to Mail and hit ^Q I seem to get the behaviour from Text->Reformat Paragraph, rather than Mail->Reformat Quoted Text. Can anyone give me a hint as to what I'm missing, or is this a bug?
According to its scope, it is only supposed to work in quoted text. What text are you trying it at?
I find it extremely useful to be able to reformat non-quoted mail paragraphs as well as quoted portions of text. Here's my hacked Mail language grammar, which also includes a new firstLineMatch so that the correct language is picked when composing from mutt, as well as scope assignments for headers:
✂------✂------✂------✂------✂------✂------✂------✂------✂------✂------ { scopeName = 'text.plain.mail'; firstLineMatch = '^(From |[-A-Za-z0-9_]+:\s+)\w+'; fileTypes = ( 'mail' ); patterns = ( { name = 'meta.header.mail'; begin = '^(?=From |[-A-Za-z0-9_]+:\s+)'; end = '^(?=\s*)$'; patterns = ( { include = '#header'; } ); }, { name = 'markup.quote.mail'; match = '^(> ?)(> ?)(>(?: ?.*)?$\n?)'; captures = { 1 = { name = 'markup.quote.mail.single'; }; 2 = { name = 'markup.quote.mail.double'; }; 3 = { name = 'markup.quote.mail.many'; }; }; }, { name = 'markup.quote.mail'; match = '^(> ?)(>(?: ?.*)?$\n?)'; captures = { 1 = { name = 'markup.quote.mail.single'; }; 2 = { name = 'markup.quote.mail.double'; }; }; }, { name = 'markup.quote.mail.single'; match = '^>(?: ?.*)?$\n?'; }, { name = 'meta.separator.signature.mail'; match = '^-- $\n'; }, { name = 'meta.paragraph.mail'; begin = '^(?=\S)'; end = '^(?:\s*$|(?=\s*>))'; }, { include = 'text.plain'; }, ); repository = { header = { patterns = ( { match = '^(Subject:\s+)(.*)$'; captures = { 1 = { name = 'entity.name.header'; }; 2 = { name = 'string.other.header.subject'; }; }; }, { name = 'entity.name.header'; match = '^([-A-Za-z0-9_]+:\s+)'; }, { name = 'string.other.header.value'; match = '.+[\n$]'; }, ); }; }; } ✂------✂------✂------✂------✂------✂------✂------✂------✂------✂------
With the modified grammar in place, you can set the scope for the Reformat Paragraph command to "text.plain.mail markup.quote, text.plain.mail meta.paragraph". Now you can press ⌃Q anywhere in a paragraph to rewrap that paragraph. It will even work on partially-wrapped paragraphs (such as when you wrap and then go back later to add text in the middle of the paragraph).
Mail bundle maintainer(s), whoever you are, please feel free to appropriate any or all of these modifications.
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.
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?
[...] 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.
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?
On 8/7/2006, at 10:02, Eric Peden wrote:
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 also just ate diff file recognition for me ;)
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 '@'.
Coincidentally I recently stumbled upon this (via John Gruber): http://www.jwz.org/doc/content-length.html
[...] I've found myself wanting access to some of the Markdown and Textile bundles' features when I'm writing emails [...] 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?
Have a look at the ‘Blog — Markdown’ grammar. It has a section for headers, and one for content, where the latter is scoped as text.html.markdown.
I think that would be the proper thing to do for mail, perhaps create a new language grammar called ‘Mail (Markdown)’ to indicate that this is the Markdown-flavor of email.
Or we could perhaps just assume that everyone is fine with having emails appear as being in markdown.
On 2006, Jul 08, at 04:42, Allan Odgaard wrote:
Or we could perhaps just assume that everyone is fine with having emails appear as being in markdown.
I suspect this is unlikely to upset anyone; Markdown is largely based on conventions that appeared in e-mail in the first place.
[Gruber][1] says: “While Markdown’s syntax has been influenced by several existing text-to-HTML filters, the single biggest source of inspiration for Markdown’s syntax is the format of plain text email.”
Or we could perhaps just assume that everyone is fine with having emails appear as being in markdown.
I suspect this is unlikely to upset anyone; Markdown is largely based on conventions that appeared in e-mail in the first place.
[Gruber][1] says: “While Markdown’s syntax has been influenced by several existing text-to-HTML filters, the single biggest source of inspiration for Markdown’s syntax is the format of plain text email.”
Probably he more specifically means setext and Tidbits, though it's used to various extents elsewhere.
http://en.wikipedia.org/wiki/Setext http://docutils.sourceforge.net/mirror/setext.html
Tidbits still uses setext for it's newsletter, and if you look at the two you'll notice a lot of similarities in design.