I have updated the patch to work with current master/tip: https://github.com/blueyed/vim/compare/setqflist_title_2
The patch can be seen also by adding ".patch" to the URL: https://github.com/blueyed/vim/compare/setqflist_title_2.patch It did not apply cleanly anymore and after fixing the conflict, "test10" was failing: there were two colons instead of one in the quickfix title ("::cf" vs. ":cf"). This patch is shorter than the previous one, mainly because the handling of ":" gets done in a central place now, and it has been removed from `ex_make` etc. Regards, Daniel. Am Freitag, 4. Juli 2014 12:22:39 UTC+2 schrieb Daniel Hahler: > Am Samstag, 15. Februar 2014 22:48:15 UTC+1 schrieb Christian Brabandt: > > On Fr, 14 Feb 2014, Daniel Hahler wrote: > > > > Another update, that fixes failure of test10. > > > > This patch changes the default title (?) from ":setloclist()" to > > > "setloclist()". > > > The reason for leaving out the colon was so that it wouldn't confuse the > > user and will not leave the impression, that there exists a :setloclist > > ex command. But note, that I don't have a strong feeling about it > > anyhow. > > > I have updated the patch to use the old default titles, as mentioned earlier: > > diff --git a/src/eval.c b/src/eval.c > index 2f7da3d..b366223 100644 > --- a/src/eval.c > +++ b/src/eval.c > @@ -16733,7 +16733,7 @@ set_qf_ll_list(wp, list_arg, action_arg, title_arg, > rettv) > return; /* type error; errmsg already given */ > } > if (title == NULL) > - title = (char_u*)(wp == NULL ? "setqflist()" : "setloclist()"); > + title = (char_u*)(wp == NULL ? ":setqflist()" : ":setloclist()"); > > if (l != NULL && set_errorlist(wp, l, action, title) == OK) > rettv->vval.v_number = 0; > > > FWIW, I have created a branch (based on a Git mirror) to track this patch: > https://github.com/blueyed/vim/compare/setqflist_title > > The patch can be seen also by adding ".patch" to the URL: > https://github.com/blueyed/vim/compare/setqflist_title.patch > > It would be nice to get it applied/included finally. > > > Regards, > Daniel. -- -- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
>From 50e65127477321669e62ed55d5c60edff3d5e92e Mon Sep 17 00:00:00 2001 From: Daniel Hahler <[email protected]> Date: Mon, 11 Aug 2014 14:41:32 +0200 Subject: [PATCH] Apply setqflist_title.diff (originally from Christian Brabandt) Change the patch to work with current master/tip (test10 failed). Source/discussion: https://groups.google.com/d/msg/vim_dev/X7VVPd4Do5s/7j0TX6KJOp0J --- runtime/doc/eval.txt | 15 +++++++++------ src/eval.c | 34 ++++++++++++++++++++++++++-------- src/proto/quickfix.pro | 1 + src/quickfix.c | 21 +++++++++++++++++++++ 4 files changed, 57 insertions(+), 14 deletions(-) diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 62aa167..eaa9ab0 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1954,11 +1954,12 @@ serverlist() String get a list of available servers setbufvar( {expr}, {varname}, {val}) set {varname} in buffer {expr} to {val} setcmdpos( {pos}) Number set cursor position in command-line setline( {lnum}, {line}) Number set line {lnum} to {line} -setloclist( {nr}, {list}[, {action}]) +setloclist( {nr}, {list}[, {action}[, {title}]]) Number modify location list using {list} setmatches( {list}) Number restore a list of matches setpos( {expr}, {list}) Number set the {expr} position to {list} -setqflist( {list}[, {action}]) Number modify quickfix list using {list} +setqflist( {list}[, {action}[, {title}]]) + Number modify quickfix list using {list} setreg( {n}, {v}[, {opt}]) Number set register to value and type settabvar( {nr}, {varname}, {val}) set {varname} in tab page {nr} to {val} settabwinvar( {tabnr}, {winnr}, {varname}, {val}) set {varname} in window @@ -5354,11 +5355,12 @@ setline({lnum}, {text}) *setline()* :endfor < Note: The '[ and '] marks are not set. -setloclist({nr}, {list} [, {action}]) *setloclist()* +setloclist({nr}, {list} [, {action}[, {title}]]) *setloclist()* Create or replace or add to the location list for window {nr}. When {nr} is zero the current window is used. For a location list window, the displayed location list is modified. For an - invalid window number {nr}, -1 is returned. + invalid window number {nr}, -1 is returned. If {title} is + given, it will be stored in the variable |w:quickfix_title|. Otherwise, same as |setqflist()|. Also see |location-list|. @@ -5415,7 +5417,7 @@ setpos({expr}, {list}) |winrestview()|. -setqflist({list} [, {action}]) *setqflist()* +setqflist({list} [, {action}[, {title}]]) *setqflist()* Create or replace or add to the quickfix list using the items in {list}. Each item in {list} is a dictionary. Non-dictionary items in {list} are ignored. Each dictionary @@ -5452,7 +5454,8 @@ setqflist({list} [, {action}]) *setqflist()* list, then a new list is created. If {action} is set to 'r', then the items from the current quickfix list are replaced with the items from {list}. If {action} is not present or is - set to ' ', then a new list is created. + set to ' ', then a new list is created. If {title} is + given, it will be stored in the variable |w:quickfix_title|. Returns zero for success, -1 for failure. diff --git a/src/eval.c b/src/eval.c index ae8331d..36439be 100644 --- a/src/eval.c +++ b/src/eval.c @@ -8119,10 +8119,10 @@ static struct fst {"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}, @@ -16812,21 +16812,23 @@ f_setline(argvars, rettv) 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; @@ -16846,9 +16848,16 @@ set_qf_ll_list(wp, list_arg, action_arg, rettv) if (*act == 'a' || *act == 'r') action = *act; } + 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, - (char_u *)(wp == NULL ? "setqflist()" : "setloclist()")) == OK) + if (l != NULL && set_errorlist(wp, l, action, title) == OK) rettv->vval.v_number = 0; } #endif @@ -16868,7 +16877,7 @@ f_setloclist(argvars, rettv) 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); } /* @@ -16986,7 +16995,7 @@ f_setqflist(argvars, rettv) 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); } /* @@ -17239,6 +17248,15 @@ setwinvar(argvars, rettv, off) STRCPY(winvarname, "w:"); STRCPY(winvarname + 2, varname); set_var(winvarname, varp, TRUE); + if (STRCMP(varname, "quickfix_title") == 0) + { + dictitem_T *v; + + v = find_var_in_ht(&win->w_vars->dv_hashtab, 'w', varname, FALSE); + if (v != NULL) + win_set_qf_title(curwin, (&v->di_tv)->vval.v_string); + } + vim_free(winvarname); } } diff --git a/src/proto/quickfix.pro b/src/proto/quickfix.pro index a5c690f..86dd4c0 100644 --- a/src/proto/quickfix.pro +++ b/src/proto/quickfix.pro @@ -5,6 +5,7 @@ void copy_loclist __ARGS((win_T *from, win_T *to)); void qf_jump __ARGS((qf_info_T *qi, int dir, int errornr, int forceit)); void qf_list __ARGS((exarg_T *eap)); void qf_age __ARGS((exarg_T *eap)); +void win_set_qf_title __ARGS((win_T *wp, char_u *title)); void qf_mark_adjust __ARGS((win_T *wp, linenr_T line1, linenr_T line2, long amount, long amount_after)); void ex_cwindow __ARGS((exarg_T *eap)); void ex_cclose __ARGS((exarg_T *eap)); diff --git a/src/quickfix.c b/src/quickfix.c index c8954cc..bc380e1 100644 --- a/src/quickfix.c +++ b/src/quickfix.c @@ -2629,6 +2629,27 @@ qf_set_title_var(qi) qi->qf_lists[qi->qf_curlist].qf_title); } + void +win_set_qf_title(wp, title) + win_T *wp; + char_u *title; +{ + qf_info_T *qi; + + if (IS_LL_WINDOW(wp)) + qi = wp->w_llist_ref; + else if (IS_QF_WINDOW(wp)) + qi = &ql_info; + else + return; + + if (title != NULL) + { + qf_free(qi, qi->qf_curlist); + qf_store_title(qi, title); + } +} + /* * Fill current buffer with quickfix errors, replacing any previous contents. * curbuf must be the quickfix buffer! -- 2.0.3
