0

Imagine :make outputs the following messages:

       error during compilation: Evaluation Error: Error while evaluating a Resource Statement, Unknown resource type: 'dupa' (file: /home/kamil/ncbj/puppet/diz_zwierzak/spec/fixtures/modules/diz_zwierzak/manifests/gurobi.pp, line: 70, column: 3) on node leonidas.cis.gov.pl
       error during compilation: no parameter named 'enabled' (file: /home/kamil/ncbj/puppet/diz_zwierzak/spec/fixtures/modules/diz_zwierzak/manifests/zabbix_agent.pp, line: 15) on node leonidas.cis.gov.pl

(yes, with 8 leading spaces). You can save these messages for example to /tmp/1.txt and then set set makeprg=cat\ /tmp/1.txt for testing if errorformat is correct.

I want to match the message, the file and the line number from these error messages and also match the optional column from the messages with errorformat, so that they are nicely displayed in my vim quickfix window. When I do:

let &errorformat='       error during compilation: %m (file: %f\, line: %l) %.%#'

then first line not matched and the second line is matched, as expected. Great. When I do:

let &errorformat='       error during compilation: %m (file: %f\, line: %l\, column: %c) %.%#'

then first line is matched and second line is not matched, as expected. Also great.

But if I try to combine them, then only the first is used. So when I do:

let &errorformat='       error during compilation: %m (file: %f\, line: %l\, column: %c) %.%#'
let &errorformat.=',       error during compilation: %m (file: %f\, line: %l) %.%#'

then the first line matches and the second line does not and is not an error. When I do the other way round:

let &errorformat='       error during compilation: %m (file: %f\, line: %l) %.%#'
let &errorformat.=',       error during compilation: %m (file: %f\, line: %l\, column: %c) %.%#'

then the first line is not matched, but the second line is matched. I do not understand it. It seems as if the first one blocks the second one, but I do not understand why.

What would be the correct errorformat be, so that column: is also matched but not matched if it's not there?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.