Hong Xu wrote:

> I was testing under windows with MinGW.
> 
> 
> Here is a C source file:
> 
> #include <stdio.h>
> 
> int main(void)
> {
> 
>      eturn 0;
> }
> 
> It includes a syntax error. I use the following commands to compile it:
> 
> :compiler gcc
> :set makeprg=gcc
> :mak %
> 
> I got the following in my qflist:
> 
> || ex.c: In function 'main':
> ex.c|6 error| 'eturn' undeclared (first use in this function)
> ex.c|6 error| expected ';' before numeric constant
> 
> 
> Then I did this:
> 
> C:\path\to\src> gcc ex.c >out.tmp 2>&1
> 
> :compiler gcc
> :cgetexpr readfile('out.tmp')
> 
> Then I got the following in my qflist:
> 
> || ex.c: In function 'main':
> ex.c|6| error: 'eturn' undeclared (first use in this function)
> ex.c|6| error: (Each undeclared identifier is reported only once
> ex.c|6| error: for each function it appears in.)
> ex.c|6| error: expected ';' before numeric constant
> 
> It seems that cgetexpr didn't use the errorformat.
> 
> Then I tried G95 fortran compiler, there are also different results, 
> which indicated that cgetexpr doesn't use the 'errorformat'. Have I done 
> something wrong or this is a problem existing in vim?

It looks like this is an intentional choice:

    /* Use the local value of 'errorformat' if it's set. */
    if (errorformat == p_efm && tv == NULL && *buf->b_p_efm != NUL)
        efm = buf->b_p_efm;
    else
        efm = errorformat;

When using an expression "tv" is not NULL.  Thus the global value of
'errorformat' is used instead of the buffer-local one.
I'm not sure if we should change that.

So you can make it work by setting the global value of 'errorformat' to
the local value:

        :let &g:errorformat = &l:errorformat

-- 
hundred-and-one symptoms of being an internet addict:
85. Choice between paying Compuserve bill and paying for kids education
    is a no brainer -- although a bit painful for your kids.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
You received this message from the "vim_use" 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

Reply via email to