If a QuickfixCmdPost clears the qflist after a :make, a E42 "No
Errors" diagnosic is issued. This is because vim (7.3.102) doesn't
recheck the size of the list after the autocommands run. A possible
patch is attached. It affects the non-autocommand case slightly, and
might be overly conservative (I don't understand the list lifetime;
the listcount check may be unnecessary). Thanks!

== To Reproduce ==
vim -u NONE

:function QfRemoveInvalid()
    let qflist = filter(getqflist(), 'v:val.valid')
    call setqflist(qflist)
endfunction

:au QuickfixCmdPost make call QfRemoveInvalid()

:set efm=bad
:set makeprg=echo\ good
:make

-- 
You received this message from the "vim_dev" 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
From 256ca1d0d7017973e9bfa17de02bafbb95a491af Mon Sep 17 00:00:00 2001
From: Mike Lundy <m...@fluffypenguin.org>
Date: Wed, 2 Feb 2011 15:06:28 -0800
Subject: [PATCH] fix E42 due to QuickFixCmdPost clearing quickfix list

Vim does not recheck the size of the qflist after it runs the
autocommand, even though the size can be changed. This can result in an
unwarranted E42 diagnostic ("No Errors") if the list is cleared.
---
 vim73/src/quickfix.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/vim73/src/quickfix.c b/vim73/src/quickfix.c
index c67397a..3446d29 100644
--- a/vim73/src/quickfix.c
+++ b/vim73/src/quickfix.c
@@ -2819,17 +2819,22 @@ ex_make(eap)
 					   (eap->cmdidx != CMD_grepadd
 					    && eap->cmdidx != CMD_lgrepadd),
 					   *eap->cmdlinep);
+    if (wp != NULL)
+	qi = GET_LOC_LIST(wp);
+
 #ifdef FEAT_AUTOCMD
     if (au_name != NULL)
+    {
 	apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name,
 					       curbuf->b_fname, TRUE, curbuf);
+	if (qi->qf_curlist < qi->qf_listcount)
+	    res = qi->qf_lists[qi->qf_curlist].qf_count;
+	else
+	    res = 0;
+    }
 #endif
     if (res > 0 && !eap->forceit)
-    {
-	if (wp != NULL)
-	    qi = GET_LOC_LIST(wp);
 	qf_jump(qi, 0, 0, FALSE);		/* display first error */
-    }
 
     mch_remove(fname);
     vim_free(fname);
-- 
1.7.4.rc3

Reply via email to