diff src/quickfix.c @ 2847:45c536fe48db v7.3.197

updated for version 7.3.197 Problem: When a QuickfixCmdPost event removes all errors, Vim still tries to jump to the first error, resulting in E42. Solution: Get the number of error after the autocmd event. (Mike Lundy)
author Bram Moolenaar <bram@vim.org>
date Thu, 19 May 2011 17:42:59 +0200
parents 8bd38abda314
children 7d4e5e31d8c1
line wrap: on
line diff
--- a/src/quickfix.c
+++ b/src/quickfix.c
@@ -2813,17 +2813,21 @@ 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);