Hi Bram,

I rewrote a patch and added a test.
This issue is in the TODO list.
TODO> Patch to have better check for {action} argument of setqflist().
TODO> Nikolai Pavlov, Feb 25, #661.  Can be even more strict.
TODO> Also see patch from Hirohito Higash, Feb 25.

Please include this.
--
Best regards,
Hirohito Higashi (a.k.a. h_east)

-- 
-- 
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.
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index 642f0ad..a0815f8 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -46,6 +46,7 @@ Float		A floating point number. |floating-point-format| *Float*
 		{only when compiled with the |+float| feature}
 		Examples: 123.456  1.15e-6  -1.1e3
 
+							*E928*
 String		A NUL terminated string of 8-bit unsigned characters (bytes).
 		|expr-string| Examples: "ab\txx\"--"  'x-z''a,c'
 
@@ -6245,6 +6246,7 @@ setqflist({list} [, {action}])				*setqflist()*
 		Note that the list is not exactly the same as what
 		|getqflist()| returns.
 
+							*E927*
 		If {action} is set to 'a', then the items from {list} are
 		added to the existing quickfix list. If there is no existing
 		list, then a new list is created. If {action} is set to 'r',
diff --git a/src/eval.c b/src/eval.c
index 2256589..2db67ac 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -98,6 +98,7 @@ static char *e_listarg = N_("E686: Argument of %s must be a List");
 static char *e_listdictarg = N_("E712: Argument of %s must be a List or Dictionary");
 static char *e_listreq = N_("E714: List required");
 static char *e_dictreq = N_("E715: Dictionary required");
+static char *e_stringreq = N_("E928: String required");
 static char *e_toomanyarg = N_("E118: Too many arguments for function: %s");
 static char *e_dictkey = N_("E716: Key not present in Dictionary: %s");
 static char *e_funcexts = N_("E122: Function %s already exists, add ! to replace it");
@@ -17931,8 +17932,9 @@ set_qf_ll_list(
     typval_T	*rettv)
 {
 #ifdef FEAT_QUICKFIX
+    static char *e_invact = N_("E927: Invalid action: '%s'");
     char_u	*act;
-    int		action = ' ';
+    int		action = 0;
 #endif
 
     rettv->vval.v_number = -1;
@@ -17949,11 +17951,17 @@ set_qf_ll_list(
 	    act = get_tv_string_chk(action_arg);
 	    if (act == NULL)
 		return;		/* type error; errmsg already given */
-	    if (*act == 'a' || *act == 'r')
+	    if ((*act == 'a' || *act == 'r' || *act == ' ') && act[1] == NUL)
 		action = *act;
+	    else
+		EMSG2(_(e_invact), act);
 	}
+	else if (action_arg->v_type == VAR_UNKNOWN)
+	    action = ' ';
+	else
+	    EMSG(_(e_stringreq));
 
-	if (l != NULL && set_errorlist(wp, l, action,
+	if (l != NULL && action && set_errorlist(wp, l, action,
 	       (char_u *)(wp == NULL ? "setqflist()" : "setloclist()")) == OK)
 	    rettv->vval.v_number = 0;
     }
diff --git a/src/testdir/test_quickfix.vim b/src/testdir/test_quickfix.vim
index 3908ce0..71a1c14 100644
--- a/src/testdir/test_quickfix.vim
+++ b/src/testdir/test_quickfix.vim
@@ -501,7 +501,7 @@ endfunction
 function Test_locationlist_curwin_was_closed()
     augroup testgroup
       au!
-      autocmd BufReadCmd t call R(expand("<amatch>"))
+      autocmd BufReadCmd test_curwin.txt call R(expand("<amatch>"))
     augroup END
 
     function! R(n)
@@ -510,7 +510,7 @@ function Test_locationlist_curwin_was_closed()
 
     new
     let q = []
-    call add(q, {'filename': 't' })
+    call add(q, {'filename': 'test_curwin.txt' })
     call setloclist(0, q)
     call assert_fails('lrewind', 'E924:')
 
@@ -643,14 +643,14 @@ function XquickfixChangedByAutocmd(cchar)
   let Xgetexpr = a:cchar . 'getexpr'
   let Xrewind = a:cchar . 'rewind'
   if a:cchar == 'c'
-    let Xsetlist = 'setqflist('
+    let Xsetlist = function('setqflist')
     let ErrorNr = 'E925'
     function! ReadFunc()
       colder
       cgetexpr []
     endfunc
   else
-    let Xsetlist = 'setloclist(0,'
+    let Xsetlist = function('setloclist', [0])
     let ErrorNr = 'E926'
     function! ReadFunc()
       lolder
@@ -660,15 +660,15 @@ function XquickfixChangedByAutocmd(cchar)
 
   augroup testgroup
     au!
-    autocmd BufReadCmd t call ReadFunc()
+    autocmd BufReadCmd test_changed.txt call ReadFunc()
   augroup END
 
-  bwipe!
+  new | only
   let words = [ "a", "b" ]
   let qflist = []
   for word in words
-    call add(qflist, {'filename': 't'})
-    exec "call " . Xsetlist . "qflist, '')"
+    call add(qflist, {'filename': 'test_changed.txt'})
+    call Xsetlist(qflist, ' ')
   endfor
   exec "call assert_fails('" . Xrewind . "', '" . ErrorNr . ":')"
 
@@ -692,3 +692,90 @@ func Test_caddbuffer_to_empty()
   endtry
   quit!
 endfunc
+
+function! XquickfixSetListWithAct(cchar)
+  let Xolder = a:cchar . 'older'
+  let Xnewer = a:cchar . 'newer'
+  if a:cchar == 'c'
+    let Xsetlist = function('setqflist')
+    let Xgetlist = function('getqflist')
+  else
+    let Xsetlist = function('setloclist', [0])
+    let Xgetlist = function('getloclist', [0])
+  endif
+  let list1 = [{'filename': 'fnameA', 'text': 'A'},
+          \    {'filename': 'fnameB', 'text': 'B'}]
+  let list2 = [{'filename': 'fnameC', 'text': 'C'},
+          \    {'filename': 'fnameD', 'text': 'D'},
+          \    {'filename': 'fnameE', 'text': 'E'}]
+
+  " {action} is unspecified.  Same as specifing ' '.
+  new | only
+  exec "silent! " . Xnewer . "99"
+  call Xsetlist(list1)
+  call Xsetlist(list2)
+  let li = Xgetlist()
+  call assert_equal(3, len(li))
+  call assert_equal('C', li[0]['text'])
+  call assert_equal('D', li[1]['text'])
+  call assert_equal('E', li[2]['text'])
+  exec "silent! " . Xolder
+  let li = Xgetlist()
+  call assert_equal(2, len(li))
+  call assert_equal('A', li[0]['text'])
+  call assert_equal('B', li[1]['text'])
+
+  " {action} is specified ' '.
+  new | only
+  exec "silent! " . Xnewer . "99"
+  call Xsetlist(list1)
+  call Xsetlist(list2, ' ')
+  let li = Xgetlist()
+  call assert_equal(3, len(li))
+  call assert_equal('C', li[0]['text'])
+  call assert_equal('D', li[1]['text'])
+  call assert_equal('E', li[2]['text'])
+  exec "silent! " . Xolder
+  let li = Xgetlist()
+  call assert_equal(2, len(li))
+  call assert_equal('A', li[0]['text'])
+  call assert_equal('B', li[1]['text'])
+
+  " {action} is specified 'a'.
+  new | only
+  exec "silent! " . Xnewer . "99"
+  call Xsetlist(list1)
+  call Xsetlist(list2, 'a')
+  let li = Xgetlist()
+  call assert_equal(5, len(li))
+  call assert_equal('A', li[0]['text'])
+  call assert_equal('B', li[1]['text'])
+  call assert_equal('C', li[2]['text'])
+  call assert_equal('D', li[3]['text'])
+  call assert_equal('E', li[4]['text'])
+
+  " {action} is specified 'r'.
+  new | only
+  exec "silent! " . Xnewer . "99"
+  call Xsetlist(list1)
+  call Xsetlist(list2, 'r')
+  let li = Xgetlist()
+  call assert_equal(3, len(li))
+  call assert_equal('C', li[0]['text'])
+  call assert_equal('D', li[1]['text'])
+  call assert_equal('E', li[2]['text'])
+
+  " Test for wrong value.
+  new | only
+  call assert_fails("call Xsetlist(0)", 'E714:')
+  call assert_fails("call Xsetlist(list1, '')", 'E927:')
+  call assert_fails("call Xsetlist(list1, 'aa')", 'E927:')
+  call assert_fails("call Xsetlist(list1, ' a')", 'E927:')
+  call assert_fails("call Xsetlist(list1, 0)", 'E928:')
+endfunc
+
+function Test_quickfix_set_list_with_act()
+  call XquickfixSetListWithAct('c')
+  call XquickfixSetListWithAct('l')
+endfunction
+" vim: ts=2 sw=0 et

Raspunde prin e-mail lui