Sunday, January 5, 2014

Re: How do I debug quickfix's errorformat problems?

On 2014-01-05, Lech Lorens wrote:
> On Saturday, January 4, 2014 7:11:28 PM UTC+1, ivan....@gmail.com wrote:
> > The directory stack of my quickfix is not working properly. The
> > directories are not getting prepended to the filename of the
> > relevant error messages.
> >
> > My build is done using GNU Make, which is displaying the
> > Entering and Leaving directory messages just fine. Here is an
> > example:
> >
> > || make[3]: Entering directory `/path/to/myfile'
> >
> > myfile.c|1836 col 2| error: #error force error
> >
> > How do I debug such problems?
>
> I would start by splitting the value of &efm to separate
> statements. This should place the expressions inside 'efm' below
> the first line, each on a separate line:
> call append(1, split(&efm, '\v\\@<!%(\\\\)*\zs,'))
>
> > Thanks in advance.
> >
> > Vim's version:
> >
>
> I already posted a fix on vim-dev a while ago but Bram hasn't been
> sending out any official patches for some time.
> To prevent problems caused by line wrapping I tried breaking this
> into separate statements. Hope I didn't break anything:
> set efm=[%\d%\+%\%.%\d%\+]%\ %f:%l%m
> set efm+=%*[^"]"%f"%*\D%l: %m
> set efm+="%f"%*\D%l: %m
> set efm+=%-G%f:%l: (Each undeclared identifier is reported only once
> set efm+=%-G%f:%l: for each function it appears in.)
> set efm+=%-GIn file included from %f:%l:%c:
> set efm+=%-GIn file included from %f:%l:%c\,
> set efm+=%-GIn file included from %f:%l:%c
> set efm+=%-GIn file included from %f:%l
> set efm+=%-G%*[ ]from %f:%l:%c
> set efm+=%-G%*[ ]from %f:%l:
> set efm+=%-G%*[ ]from %f:%l\,
> set efm+=%-G%*[ ]from %f:%l
> set efm+=%f:%l:%c:%m
> set efm+=%f(%l):%m
> set efm+=%f:%l:%m
> set efm+="%f"\, line %l%*\D%c%*[^ ] %m
> set efm+=%D%*\a[%*\d]: Entering directory %*[`']%f'
> set efm+=%X%*\a[%*\d]: Leaving directory %*[`']%f'
> set efm+=%D%*\a: Entering directory %*[`']%f'
> set efm+=%X%*\a: Leaving directory %*[`']%f'
> set efm+=%DMaking %*\a in %f
> set efm+=%f|%l| %m
> set efm+=#%\d%\+%\s%\+%m(%.%\+%\ at%\ %f:%l
> set efm+=#%\d%\+%\s%\+0x%\x%\+%\ in%\ %m(%.%\+%\ at%\ %f:%l
>
> Obviously, look at the lines containing "Entering directory" and
> "Leaving directory".

I agree that putting each 'efm' rule on a separate line makes the
option value much easier to read and to tinker with. You need to be
careful with the quoting of the values of :set, though. Some of the
:set commands above won't work because the spaces, double-quotes (")
and backslashes have not been escaped. See

:help option-backslash

You may find it easier to concatenate the rules using :let instead
of :set simply because the quoting is easier, e.g.,

let &efm .= ',%*[^"]"%f"%*\D%l: %m'

You will need to explicitly include the comma between rules when
using :let.

Patience helps. I seldom get the quoting of new 'efm' rules right
on the first attempt.

Regards,
Gary

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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: