On 05/10/2011 11:43 PM, Bram Moolenaar wrote:

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

Hello Bram Moolenaar,

Yes, I think we should keep using the global value instead of the local value. Since cgetexpr does nothing with current buffer often.

Regards,
H Xu
05/11/2011

--
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