On Thursday, June 14, 2012 5:32:33 AM UTC-5, [email protected] wrote:
> On 14 Jun 2012 at 11:59, [email protected] wrote:
> >
> > TEST.PAS(1): Error 36: BEGIN expected.
> ....
> > I've first tried weaving my own errorformat string and prepend/append/
> > replace the built-in default, but it made no difference (if my format
> > string was correct) - apparently VIM contains some defaults that match
> > just fine.
> >
> Hmm... after a day of fiddling I wrote this, and just after clicking 
> "send", it occurred to me that maybe VIM is parsing the string 
> "Error" as a filename. So I tried again my custom efm string, and I 
> notice that the misbehavior is now different. 
> 
> My custom efm pattern setting command is
> 
> set efm=%f\(%l\):\ Error\ %n:\ %m
> 

You shouldn't need to escape the parentheses, this isn't a regex.

Probably you also need to tell it the type. Try this:

set efm=%f(%l):\ %trror\ %n:\ %m

> VIM now says this:
> 
> "TEST.PAS(1)^MTEST.PAS(1)^MTEST.PAS" [access denied]
> (3/5) error  36: BEGIN expected.
> 
> So now the %n and %m are parsed correctly, but the leading 
> TEST.PAS(1) does not get split into %f and %l , and there are some 
> carriage returns inserted (the resulting %f looks garbled).
> This is weird... any ideas?
> 

I have no idea where the carriage returns may have come from.

Two things I like to do while debugging errorformat:

1. use :copen to view the quickfix window to see exactly how Vim parsed it
2. somehow make a copy of the compiler output to see the full input to Vim.
   a) if you have a Unix-like "tee" application, you can use that as part of 
'makeprg' or 'shellpipe'
   b) or, you can do the compile externally to Vim, redirect to a file, and use 
:cfile instead of :make in Vim to read/parse the errors

If I create a file errors.txt with one line of text,

TEST.PAS(1): Error 36: BEGIN expected

and use the :set efm command I suggested, and use :cfile errors.txt, Vim jumps 
to a new buffer named TEST.PAS and the quickfix window shows:

TEST.PAS|1 error  36| BEGIN expected

This tells me Vim correctly parsed the error.

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