diff -r c0801f04a021 runtime/doc/insert.txt
--- a/runtime/doc/insert.txt	Sat Sep 10 22:49:53 2011 +0900
+++ b/runtime/doc/insert.txt	Sun Sep 11 16:41:24 2011 +0900
@@ -1017,9 +1017,18 @@
    a:base	the text with which matches should match; the text that was
 		located in the first call (can be empty)
 
-The function must return a List with the matching words.  These matches
-usually include the "a:base" text.  When there are no matches return an empty
-List.
+The function must return a List (or Dict) with the matching words.  These
+matches usually include the "a:base" text.  When there are no matches return
+an empty List.
+
+To return a Dict, you have to put a List as "words" key.  And you may specify
+some extra parameters with Dict form.  Valid keys are:
+	words		a List of completion words (mandatory).
+	refresh		a string to control re-invocation of the function
+			(option).  To invocate when leading text is changed
+			set "always".  Other value or key is omitted, no
+			invocations were occured.
+
 						*complete-items*
 Each list item can either be a string or a Dictionary.  When it is a string it
 is used as the completion.  When it is a Dictionary it can contain these
diff -r c0801f04a021 src/edit.c
--- a/src/edit.c	Sat Sep 10 22:49:53 2011 +0900
+++ b/src/edit.c	Sun Sep 11 16:41:24 2011 +0900
@@ -135,6 +135,10 @@
 static int	  compl_cont_mode = 0;
 static expand_T	  compl_xp;
 
+#define COMPL_OPT_REFRESH_NEVER		0
+#define COMPL_OPT_REFRESH_ALWAYS	1
+static int	  compl_opt_refresh = COMPL_OPT_REFRESH_NEVER;
+
 static void ins_ctrl_x __ARGS((void));
 static int  has_compl_option __ARGS((int dict_opt));
 static int  ins_compl_accept_char __ARGS((int c));
@@ -163,6 +167,7 @@
 static buf_T *ins_compl_next_buf __ARGS((buf_T *buf, int flag));
 #if defined(FEAT_COMPL_FUNC) || defined(FEAT_EVAL)
 static void ins_compl_add_list __ARGS((list_T *list));
+static void ins_compl_add_dict __ARGS((dict_T *dict));
 #endif
 static int  ins_compl_get_exp __ARGS((pos_T *ini));
 static void ins_compl_delete __ARGS((void));
@@ -3367,6 +3372,15 @@
     ins_bytes(compl_leader + ins_compl_len());
     compl_used_match = FALSE;
 
+    /*
+     * To call eval 'completefunc' when leader is changed and it is requried
+     * by the function (with "refresh" in dict form), restart completion
+     * every time.
+     */
+    if ((ctrl_x_mode == CTRL_X_FUNCTION || ctrl_x_mode == CTRL_X_OMNI)
+	    && compl_opt_refresh == COMPL_OPT_REFRESH_ALWAYS)
+	ins_compl_restart();
+
     if (compl_started)
 	ins_compl_set_original_text(compl_leader);
     else
@@ -3877,6 +3891,8 @@
     pos_T	pos;
     win_T	*curwin_save;
     buf_T	*curbuf_save;
+    dict_T	*matchdict;
+    typval_T	rettv;
 
     funcname = (type == CTRL_X_FUNCTION) ? curbuf->b_p_cfu : curbuf->b_p_ofu;
     if (*funcname == NUL)
@@ -3889,7 +3905,27 @@
     pos = curwin->w_cursor;
     curwin_save = curwin;
     curbuf_save = curbuf;
-    matchlist = call_func_retlist(funcname, 2, args, FALSE);
+
+    /* Call a function, which returns a list or dict. */
+    matchlist = NULL;
+    matchdict = NULL;
+    if (call_vim_function(funcname, 2, args, FALSE, &rettv) == TRUE)
+    {
+	switch (rettv.v_type)
+	{
+	    case VAR_LIST:
+		matchlist = rettv.vval.v_list;
+		break;
+	    case VAR_DICT:
+		matchdict = rettv.vval.v_dict;
+		break;
+	    default:
+		/* FIXME: Show error or warning messages. */
+		clear_tv(&rettv);
+		break;
+	}
+    }
+
     if (curwin_save != curwin || curbuf_save != curbuf)
     {
 	EMSG(_(e_complwin));
@@ -3902,10 +3938,15 @@
 	EMSG(_(e_compldel));
 	goto theend;
     }
+
     if (matchlist != NULL)
 	ins_compl_add_list(matchlist);
+    else if (matchdict != NULL)
+	ins_compl_add_dict(matchdict);
 
 theend:
+    if (matchdict != NULL)
+	dict_unref(matchdict);
     if (matchlist != NULL)
 	list_unref(matchlist);
 }
@@ -3934,6 +3975,38 @@
 }
 
 /*
+ * Add completions from a dict.
+ */
+    static void
+ins_compl_add_dict(dict)
+    dict_T	*dict;
+{
+    dictitem_T	*refresh;
+    dictitem_T	*words;
+
+    /*
+     * Check extended parameters of completions.
+     *   - "refresh" : default is COMPL_OPT_REFRESH_NEVER.
+     */
+    compl_opt_refresh = COMPL_OPT_REFRESH_NEVER;
+    refresh = dict_find(dict, "refresh", 7);
+    if (refresh != NULL && refresh->di_tv.v_type == VAR_STRING)
+    {
+	char_u	*v = refresh->di_tv.vval.v_string;
+
+	if (STRCMP(v, "always") == 0)
+	    compl_opt_refresh = COMPL_OPT_REFRESH_ALWAYS;
+    }
+
+    /* Add completions from a "words" list. */
+    words = dict_find(dict, "words", 5);
+    if (words != NULL && words->di_tv.v_type == VAR_LIST)
+    {
+	ins_compl_add_list(words->di_tv.vval.v_list);
+    }
+}
+
+/*
  * Add a match to the list of matches from a typeval_T.
  * If the given string is already in the list of completions, then return
  * NOTDONE, otherwise add it to the list and return OK.  If there is an error,
@@ -5088,6 +5161,12 @@
 		return FAIL;
 	    }
 
+	    /*
+	     * Reset extended parameters of completion, when start new
+	     * completion.
+	     */
+	    compl_opt_refresh = COMPL_OPT_REFRESH_NEVER;
+
 	    if (col < 0)
 		col = curs_col;
 	    compl_col = col;
diff -r c0801f04a021 src/eval.c
--- a/src/eval.c	Sat Sep 10 22:49:53 2011 +0900
+++ b/src/eval.c	Sun Sep 11 16:41:24 2011 +0900
@@ -380,9 +380,6 @@
 
 static void prepare_vimvar __ARGS((int idx, typval_T *save_tv));
 static void restore_vimvar __ARGS((int idx, typval_T *save_tv));
-#if defined(FEAT_USR_CMDS) && defined(FEAT_CMDL_COMPL)
-static int call_vim_function __ARGS((char_u *func, int argc, char_u **argv, int safe, typval_T *rettv));
-#endif
 static int ex_let_vars __ARGS((char_u *arg, typval_T *tv, int copy, int semicolon, int var_count, char_u *nextchars));
 static char_u *skip_var_list __ARGS((char_u *arg, int *var_count, int *semicolon));
 static char_u *skip_var_one __ARGS((char_u *arg));
@@ -451,7 +448,6 @@
 static void set_ref_in_list __ARGS((list_T *l, int copyID));
 static void set_ref_in_item __ARGS((typval_T *tv, int copyID));
 static int rettv_dict_alloc __ARGS((typval_T *rettv));
-static void dict_unref __ARGS((dict_T *d));
 static void dict_free __ARGS((dict_T *d, int recurse));
 static dictitem_T *dictitem_copy __ARGS((dictitem_T *org));
 static void dictitem_remove __ARGS((dict_T *dict, dictitem_T *item));
@@ -1564,7 +1560,7 @@
  * arguments are currently supported.
  * Returns OK or FAIL.
  */
-    static int
+    int
 call_vim_function(func, argc, argv, safe, rettv)
     char_u      *func;
     int		argc;
@@ -6904,7 +6900,7 @@
  * Unreference a Dictionary: decrement the reference count and free it when it
  * becomes zero.
  */
-    static void
+    void
 dict_unref(d)
     dict_T *d;
 {
diff -r c0801f04a021 src/proto/eval.pro
--- a/src/proto/eval.pro	Sat Sep 10 22:49:53 2011 +0900
+++ b/src/proto/eval.pro	Sun Sep 11 16:41:24 2011 +0900
@@ -23,6 +23,7 @@
 list_T *eval_spell_expr __ARGS((char_u *badword, char_u *expr));
 int get_spellword __ARGS((list_T *list, char_u **pp));
 typval_T *eval_expr __ARGS((char_u *arg, char_u **nextcmd));
+int call_vim_function __ARGS((char_u *func, int argc, char_u **argv, int safe, typval_T *rettv));
 void *call_func_retstr __ARGS((char_u *func, int argc, char_u **argv, int safe));
 long call_func_retnr __ARGS((char_u *func, int argc, char_u **argv, int safe));
 void *call_func_retlist __ARGS((char_u *func, int argc, char_u **argv, int safe));
@@ -52,6 +53,7 @@
 int list_append_string __ARGS((list_T *l, char_u *str, int len));
 int garbage_collect __ARGS((void));
 dict_T *dict_alloc __ARGS((void));
+void dict_unref __ARGS((dict_T *d));
 dictitem_T *dictitem_alloc __ARGS((char_u *key));
 void dictitem_free __ARGS((dictitem_T *item));
 int dict_add __ARGS((dict_T *d, dictitem_T *item));
