Bram,
this patch allows to directly set the w:quickfix_title using 
setqflist()/setloclist() functions. Since the w:quickfix_title is 
already stored inside each quickfix list, it makes sense to have it also 
being settable using VimL functions. This allows plugin writers to 
handle existing quickfix lists better (e.g. they can use the 
w:quickfix_title variable to tag and identify quickfix lists).


regards,
Christian

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

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


diff --git a/src/eval.c b/src/eval.c
--- a/src/eval.c
+++ b/src/eval.c
@@ -8067,10 +8067,10 @@
     {"setbufvar",	3, 3, f_setbufvar},
     {"setcmdpos",	1, 1, f_setcmdpos},
     {"setline",		2, 2, f_setline},
-    {"setloclist",	2, 3, f_setloclist},
+    {"setloclist",	2, 4, f_setloclist},
     {"setmatches",	1, 1, f_setmatches},
     {"setpos",		2, 2, f_setpos},
-    {"setqflist",	1, 2, f_setqflist},
+    {"setqflist",	1, 3, f_setqflist},
     {"setreg",		2, 3, f_setreg},
     {"settabvar",	3, 3, f_settabvar},
     {"settabwinvar",	4, 4, f_settabwinvar},
@@ -16385,21 +16385,23 @@
 	appended_lines_mark(lcount, added);
 }
 
-static void set_qf_ll_list __ARGS((win_T *wp, typval_T *list_arg, typval_T *action_arg, typval_T *rettv));
+static void set_qf_ll_list __ARGS((win_T *wp, typval_T *list_arg, typval_T *action_arg, typval_T *title_arg, typval_T *rettv));
 
 /*
  * Used by "setqflist()" and "setloclist()" functions
  */
     static void
-set_qf_ll_list(wp, list_arg, action_arg, rettv)
+set_qf_ll_list(wp, list_arg, action_arg, title_arg, rettv)
     win_T	*wp UNUSED;
     typval_T	*list_arg UNUSED;
     typval_T	*action_arg UNUSED;
+    typval_T	*title_arg UNUSED;
     typval_T	*rettv;
 {
 #ifdef FEAT_QUICKFIX
     char_u	*act;
     int		action = ' ';
+    char_u	*title = NULL;
 #endif
 
     rettv->vval.v_number = -1;
@@ -16419,9 +16421,16 @@
 	    if (*act == 'a' || *act == 'r')
 		action = *act;
 	}
-
-	if (l != NULL && set_errorlist(wp, l, action,
-	       (char_u *)(wp == NULL ? "setqflist()" : "setloclist()")) == OK)
+	if (title_arg->v_type == VAR_STRING)
+	{
+	    title = get_tv_string_chk(title_arg);
+	    if (title == NULL)
+		return;		/* type error; errmsg already given */
+	}
+	if (title == NULL)
+	    title =  (char_u*)(wp == NULL ? "setqflist()" : "setloclist()");
+
+	if (l != NULL && set_errorlist(wp, l, action, title) == OK)
 	    rettv->vval.v_number = 0;
     }
 #endif
@@ -16441,7 +16450,7 @@
 
     win = find_win_by_nr(&argvars[0], NULL);
     if (win != NULL)
-	set_qf_ll_list(win, &argvars[1], &argvars[2], rettv);
+	set_qf_ll_list(win, &argvars[1], &argvars[2], &argvars[3], rettv);
 }
 
 /*
@@ -16556,7 +16565,7 @@
     typval_T	*argvars;
     typval_T	*rettv;
 {
-    set_qf_ll_list(NULL, &argvars[0], &argvars[1], rettv);
+    set_qf_ll_list(NULL, &argvars[0], &argvars[1], &argvars[2], rettv);
 }
 
 /*
diff --git a/src/quickfix.c b/src/quickfix.c
--- a/src/quickfix.c
+++ b/src/quickfix.c
@@ -915,11 +915,11 @@
     vim_memset(&qi->qf_lists[qi->qf_curlist], 0, (size_t)(sizeof(qf_list_T)));
     if (qf_title != NULL)
     {
-	char_u *p = alloc((int)STRLEN(qf_title) + 2);
+	char_u *p = alloc((int)STRLEN(qf_title) + 1);
 
 	qi->qf_lists[qi->qf_curlist].qf_title = p;
 	if (p != NULL)
-	    sprintf((char *)p, ":%s", (char *)qf_title);
+	    sprintf((char *)p, "%s", (char *)qf_title);
     }
 }
 
@@ -3132,6 +3132,8 @@
     char_u	*dirname_start = NULL;
     char_u	*dirname_now = NULL;
     char_u	*target_dir = NULL;
+    char_u	title[130] = ":";
+    char_u      *q = vim_strnsave(*eap->cmdlinep, 128);
 #ifdef FEAT_AUTOCMD
     char_u	*au_name =  NULL;
 
@@ -3209,7 +3211,7 @@
 	 eap->cmdidx != CMD_vimgrepadd && eap->cmdidx != CMD_lvimgrepadd)
 					|| qi->qf_curlist == qi->qf_listcount)
 	/* make place for a new list */
-	qf_new_list(qi, *eap->cmdlinep);
+	qf_new_list(qi, (char_u *)STRNCAT(title, q, (size_t) 128));
     else if (qi->qf_lists[qi->qf_curlist].qf_count > 0)
 	/* Adding to existing list, find last entry. */
 	for (prevp = qi->qf_lists[qi->qf_curlist].qf_start;
@@ -3311,7 +3313,7 @@
 	    if (idx == LISTCOUNT)
 	    {
 		/* List cannot be found, create a new one. */
-		qf_new_list(qi, *eap->cmdlinep);
+		qf_new_list(qi, (char_u *)STRNCAT(title, q, (size_t) 128));
 		cur_qf_start = qi->qf_lists[qi->qf_curlist].qf_start;
 	    }
 	}
@@ -3489,6 +3491,7 @@
     vim_free(dirname_start);
     vim_free(target_dir);
     vim_free(regmatch.regprog);
+    vim_free(q);
 }
 
 /*
@@ -4027,6 +4030,7 @@
 #ifdef FEAT_AUTOCMD
     char_u	*au_name =  NULL;
 #endif
+    char_u	title[130] = ":";
 
 #ifdef FEAT_MULTI_LANG
     /* Check for a specified language */
@@ -4089,7 +4093,7 @@
 #endif
 
 	/* create a new quickfix list */
-	qf_new_list(qi, *eap->cmdlinep);
+	qf_new_list(qi, (char_u*)STRNCAT(title, *eap->cmdlinep, (size_t) 128));
 
 	/* Go through all directories in 'runtimepath' */
 	p = p_rtp;

Raspunde prin e-mail lui