diff --git a/src/eval.c b/src/eval.c index d0b58ea635..f915789283 100644 --- a/src/eval.c +++ b/src/eval.c @@ -8485,33 +8485,39 @@ call_func(funcname, len, rettv, argcount, argvars, firstline, lastline, /* execute the function if no errors detected and executing */ if (evaluate && error == ERROR_NONE) { + char_u *rfname = fname; + + /* Ignore "g:" before a function name. */ + if (fname[0] == 'g' && fname[1] == ':') + rfname = fname + 2; + rettv->v_type = VAR_NUMBER; /* default rettv is number zero */ rettv->vval.v_number = 0; error = ERROR_UNKNOWN; - if (!builtin_function(fname, -1)) + if (!builtin_function(rfname, -1)) { /* * User defined function. */ - fp = find_func(fname); + fp = find_func(rfname); #ifdef FEAT_AUTOCMD /* Trigger FuncUndefined event, may load the function. */ if (fp == NULL && apply_autocmds(EVENT_FUNCUNDEFINED, - fname, fname, TRUE, NULL) + rfname, rfname, TRUE, NULL) && !aborting()) { /* executed an autocommand, search for the function again */ - fp = find_func(fname); + fp = find_func(rfname); } #endif /* Try loading a package. */ - if (fp == NULL && script_autoload(fname, TRUE) && !aborting()) + if (fp == NULL && script_autoload(rfname, TRUE) && !aborting()) { /* loaded a package, search for the function again */ - fp = find_func(fname); + fp = find_func(rfname); } if (fp != NULL) diff --git a/src/testdir/test_eval.in b/src/testdir/test_eval.in index 4919694bea..214a99edb9 100644 --- a/src/testdir/test_eval.in +++ b/src/testdir/test_eval.in @@ -172,11 +172,13 @@ endfun :endtry :" :" function name starting with/without "g:", buffer-local funcref. -:function! g:Foo() -: $put ='called Foo()' +:function! g:Foo(n) +: $put ='called Foo(' . a:n . ')' :endfunction :let b:my_func = function('Foo') -:call b:my_func() +:call b:my_func(1) +:echo g:Foo(2) +:echo Foo(3) :" :/^start:/+1,$wq! test.out :" vim: et ts=4 isk-=\: fmr=???,??? diff --git a/src/testdir/test_eval.ok b/src/testdir/test_eval.ok index 57383be748..cfe045b53e 100644 Binary files a/src/testdir/test_eval.ok and b/src/testdir/test_eval.ok differ diff --git a/src/version.c b/src/version.c index fc95a5ad02..94d985705b 100644 --- a/src/version.c +++ b/src/version.c @@ -734,6 +734,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 265, /**/ 264, /**/