Hi Dominique! On Mo, 16 Jan 2012, Dominique Pellé wrote:
> Bram Moolenaar <[email protected]> wrote: > > > Arno wrote: > > > >> Hi, > >> If I edit the attached file with > >> > >> set filetype=mail > >> set spell > >> set spelllang=fr > >> > >> the word "Subject" in the header file is underlined. It shouldn't because > >> it's > >> a header key. > > > > Isn't it highlighted as mailSubject? It's different from mailHeader by > > default. > > > Lines in email headers have syntax group "mailHeaderKey" for which > spell checking is disabled. But the line "Subject: yada yada yada" > has syntax group "mailSubject", for which spell checking is enabled. > That makes sense, except that the word "Subject" itself is a spelling > mistake in most languages other than English. So the word "Subject" > gets highlighted as a spelling mistake when 'spelllang' is set to fr > for example. > > To fix it, we'd need to have a different syntax group for "Subject:" (without > spelling checking) and for the actual text of the subject right after it (with > spell checking). Attached is a patch, that fixes it: regards, Christian -- Die Empfindlichkeit einer Mimose steht in keinem Verhältnis zur Empfindlichkeit eines Beamten. -- Edmund Kreuzner -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
diff --git a/runtime/syntax/mail.vim b/runtime/syntax/mail.vim --- a/runtime/syntax/mail.vim +++ b/runtime/syntax/mail.vim @@ -15,7 +15,7 @@ " also highlighted. " Syntax clusters -syn cluster mailHeaderFields contains=mailHeaderKey,mailSubject,mailHeaderEmail,@mailLinks +syn cluster mailHeaderFields contains=mailHeaderKey,mailSubject,mailSubjectContent,mailHeaderEmail,@mailLinks syn cluster mailLinks contains=mailURL,mailEmail syn cluster mailQuoteExps contains=mailQuoteExp1,mailQuoteExp2,mailQuoteExp3,mailQuoteExp4,mailQuoteExp5,mailQuoteExp6 @@ -40,7 +40,9 @@ syn region mailHeaderKey contained contains=mailHeaderEmail,mailEmail,@mailQuoteExps,@NoSpell start="\v(^(\> ?)*)@<=(to|b?cc):" skip=",$" end="$" syn match mailHeaderKey contained contains=mailHeaderEmail,mailEmail,@NoSpell "\v(^(\> ?)*)@<=(from|reply-to):.*$" fold syn match mailHeaderKey contained contains=@NoSpell "\v(^(\> ?)*)@<=date:" -syn match mailSubject contained "\v^subject:.*$" fold +syn match mailSubject contained contains=@NoSpell "^subject: " fold nextgroup=mailSubjectContent +"subject can span several lines +syn match mailSubjectContent contained "\v(subject: )@<=.*(\n\s.*)*$" fold syn match mailSubject contained contains=@NoSpell "\v(^(\> ?)+)@<=subject:.*$" " Anything in the header between < and > is an email address @@ -89,7 +91,8 @@ hi def link mailHeaderEmail mailEmail hi def link mailEmail Special hi def link mailURL String -hi def link mailSubject Title +hi def link mailSubject Statement +hi def link mailSubjectContent LineNR hi def link mailQuoted1 Comment hi def link mailQuoted3 mailQuoted1 hi def link mailQuoted5 mailQuoted1
