On Tue, Jan 14, 2014 at 11:24 PM, Bram Moolenaar <b...@moolenaar.net> wrote:

>
> Patch 7.4.149
> Problem:    Get E685 error when assigning a function to an autoload
> variable.
>             (Yukihiro Nakadaira)
> Solution:   Instead of having a global no_autoload variable, pass an
> autoload
>             flag down to where it is used. (ZyX)
> Files:      src/eval.c, src/testdir/test55.in, src/testdir/test55.ok,
>             src/testdir/test60.in, src/testdir/test60.ok,
>             src/testdir/sautest/autoload/footest.vim
>

Sorry for my late reply.  It need additional no_autoload to fix the problem.

diff -r 98a642716acc src/eval.c
--- a/src/eval.c    Tue Jan 14 15:53:52 2014 +0100
+++ b/src/eval.c    Wed Jan 15 00:58:24 2014 +0900
@@ -447,7 +447,7 @@
 #endif
 static int get_env_tv __ARGS((char_u **arg, typval_T *rettv, int
evaluate));
 static int find_internal_func __ARGS((char_u *name));
-static char_u *deref_func_name __ARGS((char_u *name, int *lenp));
+static char_u *deref_func_name __ARGS((char_u *name, int *lenp, int
no_autoload));
 static int get_func_tv __ARGS((char_u *name, int len, typval_T *rettv,
char_u **arg, linenr_T firstline, linenr_T lastline, int *doesrange, int
evaluate, dict_T *selfdict));
 static int call_func __ARGS((char_u *funcname, int len, typval_T *rettv,
int argcount, typval_T *argvars, linenr_T firstline, linenr_T lastline, int
*doesrange, int evaluate, dict_T *selfdict));
 static void emsg_funcname __ARGS((char *ermsg, char_u *name));
@@ -3432,7 +3432,7 @@

     /* If it is the name of a variable of type VAR_FUNC use its contents.
*/
     len = (int)STRLEN(tofree);
-    name = deref_func_name(tofree, &len);
+    name = deref_func_name(tofree, &len, FALSE);

     /* Skip white space to allow ":call func ()".  Not good, but required
for
      * backward compatibility. */
@@ -5159,7 +5159,7 @@
         {
         /* If "s" is the name of a variable of type VAR_FUNC
          * use its contents. */
-        s = deref_func_name(s, &len);
+        s = deref_func_name(s, &len, FALSE);

         /* Invoke the function. */
         ret = get_func_tv(s, len, rettv, arg,
@@ -8282,16 +8282,17 @@
  * name it contains, otherwise return "name".
  */
     static char_u *
-deref_func_name(name, lenp)
+deref_func_name(name, lenp, no_autoload)
     char_u    *name;
     int        *lenp;
+    int        no_autoload;
 {
     dictitem_T    *v;
     int        cc;

     cc = name[*lenp];
     name[*lenp] = NUL;
-    v = find_var(name, NULL, FALSE);
+    v = find_var(name, NULL, no_autoload);
     name[*lenp] = cc;
     if (v != NULL && v->di_tv.v_type == VAR_FUNC)
     {
@@ -21938,14 +21939,14 @@
     if (lv.ll_exp_name != NULL)
     {
     len = (int)STRLEN(lv.ll_exp_name);
-    name = deref_func_name(lv.ll_exp_name, &len);
+    name = deref_func_name(lv.ll_exp_name, &len, flags & TFN_NO_AUTOLOAD);
     if (name == lv.ll_exp_name)
         name = NULL;
     }
     else
     {
     len = (int)(end - *pp);
-    name = deref_func_name(*pp, &len);
+    name = deref_func_name(*pp, &len, flags & TFN_NO_AUTOLOAD);
     if (name == *pp)
         name = NULL;
     }


-- 
Yukihiro Nakadaira - yukihiro.nakada...@gmail.com

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

Raspunde prin e-mail lui