Bug in syntax highlighting for ft=mail

2 views
Skip to first unread message

Richard Hartmann

unread,
Jan 15, 2008, 12:38:19 PM1/15/08
to vim...@vim.org
Hi all,

when you start any line in a mail with 'From', you get highlighting as
if this was a header line even if there is a newline between the start
of the file and the line you write (i.e. when you are in the body of the
mail). The same is try for 'To:' and related words. Why 'From' and not
'From:' suffices to highlight a line, I do not know, I am not familiar
with the RFCs in question.

To reproduce

vim -u NONE -U NONE
:syntax on
:set ft=mail
i
Foo

From me to you

You will see the line starting with 'From' being highlighted.


Best regards,
Richard

Patrick Texier

unread,
Jan 15, 2008, 1:15:08 PM1/15/08
to vim...@googlegroups.com
On Tue, 15 Jan 2008 18:38:19 +0100, Richard Hartmann wrote:

> Why 'From' and not
> 'From:' suffices to highlight a line, I do not know, I am not familiar
> with the RFCs in question.

You have a From without ':' in the first message line in a Unix mailbox
file:

From richih.ma...@gmail.com Tue Jan 15 18:38:19 2008
[... and your mail with headers]

Bram Moolenaar

unread,
Jan 15, 2008, 3:38:13 PM1/15/08
to Richard Hartmann, vim...@vim.org

Richard Hartmann wrote:

Do you notice the extra ">" in the line above? I didn't add it. It's
because mail systems do handle these lines differently. It's from the
old days when multiple messages would be dumped into one file, called
mbox, and a line starting with "From" being used as a start-of-message
marker.

Nevertheless, most email programs know how to escape these lines (that's
what happened above), so they are not really special when editing a
message. Only when you actually edit the mbox file, but that's
uncommon. We could create a separate "mbox" filetype for that.

--
If an elephant is left tied to a parking meter, the parking fee has to be paid
just as it would for a vehicle.
[real standing law in Florida, United States of America]

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ download, build and distribute -- http://www.A-A-P.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

Patrick Texier

unread,
Jan 16, 2008, 3:41:56 AM1/16/08
to vim...@googlegroups.com, Gautam Iyer
[to Vim_Dev
cc to maintainer Gautam Iyer]

On Tue, 15 Jan 2008 21:38:13 +0100, Bram Moolenaar wrote:

> Nevertheless, most email programs know how to escape these lines (that's
> what happened above), so they are not really special when editing a
> message. Only when you actually edit the mbox file, but that's
> uncommon. We could create a separate "mbox" filetype for that.

Only "^From\s" is tested, but we have year at end of line.

I had fixed lines 27-28 and added Usenet header fields.
--
Patrick Texier,
Frulon, 36190 Orsennes, France (46°31'N, 01°41'E)
<http://www.genindre.org>
<http://www.genindre.org/cgi-bin/geneweb.cgi?b=pt>

mail.patch

Adri Verhoef

unread,
Jan 20, 2008, 6:48:08 AM1/20/08
to vim...@googlegroups.com
I saw the word "spend" being used and wondered why it wasn't being spelled as
"spent".

I decided to grep both words in all '.c' files I could find. Here is a sample of the
result:
$ find|grep \\.c$|xargs grep [^u]spend
./src/eval.c: proftime_T uf_tm_total; /* time spend in function + children */
./src/eval.c: proftime_T uf_tm_self; /* time spend in function itself */
./src/eval.c: proftime_T *uf_tml_total; /* time spend in a line + children */
./src/eval.c: proftime_T *uf_tml_self; /* time spend in a line itself */
./src/ex_cmds2.c: proftime_T sn_pr_total; /* time spend in script + children */
./src/ex_cmds2.c: proftime_T sn_pr_self; /* time spend in script itself */
./src/ex_cmds2.c: proftime_T sn_prl_total; /* time spend in a line + children */
./src/ex_cmds2.c: proftime_T sn_prl_self; /* time spend in a line itself */
./src/ex_cmds2.c: /* Grow the array before starting the timer, so that the time spend
$ find|grep \\.c$|xargs grep spent
./src/eval.c: proftime_T uf_tm_children; /* time spent in children this call */
./src/eval.c: proftime_T uf_tml_children; /* time spent in children for this line */
./src/eval.c: proftime_T prof_child; /* time spent in a child */
./src/eval.c: * Take care of time spent in a child.
./src/ex_cmds2.c: proftime_T sn_prl_children; /* time spent in children for this line */
./src/ex_cmds2.c: * Count time spent in children after invoking another script or function.
./src/syntax.c: * To reduce the time spent in keepend(), remember at which level in the state

IMO it is: To spend - spending - spent
It's not in a real bug in the program source, but ...

Adri

Bram Moolenaar

unread,
Jan 20, 2008, 9:01:01 AM1/20/08
to Adri Verhoef, vim...@googlegroups.com

Adri Verhoef wrote:

Yes, this was a typo. Thanks.

--
Corn oil comes from corn and olive oil comes from olives, so where
does baby oil come from?

Richard Hartmann

unread,
Jan 20, 2008, 4:35:18 PM1/20/08
to vim...@googlegroups.com
On Jan 20, 2008 12:48 PM, Adri Verhoef <a...@a3.xs4all.nl> wrote:

Note to self, try and read all mail on a given list before replying to
others.. :p


Richard

Christ van Willegen

unread,
Jan 21, 2008, 4:18:49 AM1/21/08
to vim...@googlegroups.com
(totally off-topic.... couldn't be more off-topic... really, I warned you!)

On Jan 20, 2008 3:01 PM, Bram Moolenaar <Br...@moolenaar.net> wrote:
> Corn oil comes from corn and olive oil comes from olives, so where
> does baby oil come from?

You can make this even worse by saying:

Corn oil comes from crushing corn and olive oil comes from crushing olives,


so where does baby oil come from?

Christ van Willegen
--
09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0

Reply all
Reply to author
Forward
0 new messages