|
Karsten Hopp |
c4173e |
To: vim_dev@googlegroups.com
|
|
Karsten Hopp |
c4173e |
Subject: Patch 7.4.265
|
|
Karsten Hopp |
c4173e |
Fcc: outbox
|
|
Karsten Hopp |
c4173e |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
Karsten Hopp |
c4173e |
Mime-Version: 1.0
|
|
Karsten Hopp |
c4173e |
Content-Type: text/plain; charset=UTF-8
|
|
Karsten Hopp |
c4173e |
Content-Transfer-Encoding: 8bit
|
|
Karsten Hopp |
c4173e |
------------
|
|
Karsten Hopp |
c4173e |
|
|
Karsten Hopp |
c4173e |
Patch 7.4.265 (after 7.4.260)
|
|
Karsten Hopp |
c4173e |
Problem: Can't call a global function with "g:" in an expression.
|
|
Karsten Hopp |
c4173e |
Solution: Skip the "g:" when looking up the function.
|
|
Karsten Hopp |
c4173e |
Files: src/eval.c, src/testdir/test_eval.in, src/testdir/test_eval.ok
|
|
Karsten Hopp |
c4173e |
|
|
Karsten Hopp |
c4173e |
|
|
Karsten Hopp |
c4173e |
*** ../vim-7.4.264/src/eval.c 2014-04-23 20:43:07.290689167 +0200
|
|
Karsten Hopp |
c4173e |
--- src/eval.c 2014-04-24 17:06:38.884920215 +0200
|
|
Karsten Hopp |
c4173e |
***************
|
|
Karsten Hopp |
c4173e |
*** 8485,8517 ****
|
|
Karsten Hopp |
c4173e |
/* execute the function if no errors detected and executing */
|
|
Karsten Hopp |
c4173e |
if (evaluate && error == ERROR_NONE)
|
|
Karsten Hopp |
c4173e |
{
|
|
Karsten Hopp |
c4173e |
rettv->v_type = VAR_NUMBER; /* default rettv is number zero */
|
|
Karsten Hopp |
c4173e |
rettv->vval.v_number = 0;
|
|
Karsten Hopp |
c4173e |
error = ERROR_UNKNOWN;
|
|
Karsten Hopp |
c4173e |
|
|
Karsten Hopp |
c4173e |
! if (!builtin_function(fname, -1))
|
|
Karsten Hopp |
c4173e |
{
|
|
Karsten Hopp |
c4173e |
/*
|
|
Karsten Hopp |
c4173e |
* User defined function.
|
|
Karsten Hopp |
c4173e |
*/
|
|
Karsten Hopp |
c4173e |
! fp = find_func(fname);
|
|
Karsten Hopp |
c4173e |
|
|
Karsten Hopp |
c4173e |
#ifdef FEAT_AUTOCMD
|
|
Karsten Hopp |
c4173e |
/* Trigger FuncUndefined event, may load the function. */
|
|
Karsten Hopp |
c4173e |
if (fp == NULL
|
|
Karsten Hopp |
c4173e |
&& apply_autocmds(EVENT_FUNCUNDEFINED,
|
|
Karsten Hopp |
c4173e |
! fname, fname, TRUE, NULL)
|
|
Karsten Hopp |
c4173e |
&& !aborting())
|
|
Karsten Hopp |
c4173e |
{
|
|
Karsten Hopp |
c4173e |
/* executed an autocommand, search for the function again */
|
|
Karsten Hopp |
c4173e |
! fp = find_func(fname);
|
|
Karsten Hopp |
c4173e |
}
|
|
Karsten Hopp |
c4173e |
#endif
|
|
Karsten Hopp |
c4173e |
/* Try loading a package. */
|
|
Karsten Hopp |
c4173e |
! if (fp == NULL && script_autoload(fname, TRUE) && !aborting())
|
|
Karsten Hopp |
c4173e |
{
|
|
Karsten Hopp |
c4173e |
/* loaded a package, search for the function again */
|
|
Karsten Hopp |
c4173e |
! fp = find_func(fname);
|
|
Karsten Hopp |
c4173e |
}
|
|
Karsten Hopp |
c4173e |
|
|
Karsten Hopp |
c4173e |
if (fp != NULL)
|
|
Karsten Hopp |
c4173e |
--- 8485,8523 ----
|
|
Karsten Hopp |
c4173e |
/* execute the function if no errors detected and executing */
|
|
Karsten Hopp |
c4173e |
if (evaluate && error == ERROR_NONE)
|
|
Karsten Hopp |
c4173e |
{
|
|
Karsten Hopp |
c4173e |
+ char_u *rfname = fname;
|
|
Karsten Hopp |
c4173e |
+
|
|
Karsten Hopp |
c4173e |
+ /* Ignore "g:" before a function name. */
|
|
Karsten Hopp |
c4173e |
+ if (fname[0] == 'g' && fname[1] == ':')
|
|
Karsten Hopp |
c4173e |
+ rfname = fname + 2;
|
|
Karsten Hopp |
c4173e |
+
|
|
Karsten Hopp |
c4173e |
rettv->v_type = VAR_NUMBER; /* default rettv is number zero */
|
|
Karsten Hopp |
c4173e |
rettv->vval.v_number = 0;
|
|
Karsten Hopp |
c4173e |
error = ERROR_UNKNOWN;
|
|
Karsten Hopp |
c4173e |
|
|
Karsten Hopp |
c4173e |
! if (!builtin_function(rfname, -1))
|
|
Karsten Hopp |
c4173e |
{
|
|
Karsten Hopp |
c4173e |
/*
|
|
Karsten Hopp |
c4173e |
* User defined function.
|
|
Karsten Hopp |
c4173e |
*/
|
|
Karsten Hopp |
c4173e |
! fp = find_func(rfname);
|
|
Karsten Hopp |
c4173e |
|
|
Karsten Hopp |
c4173e |
#ifdef FEAT_AUTOCMD
|
|
Karsten Hopp |
c4173e |
/* Trigger FuncUndefined event, may load the function. */
|
|
Karsten Hopp |
c4173e |
if (fp == NULL
|
|
Karsten Hopp |
c4173e |
&& apply_autocmds(EVENT_FUNCUNDEFINED,
|
|
Karsten Hopp |
c4173e |
! rfname, rfname, TRUE, NULL)
|
|
Karsten Hopp |
c4173e |
&& !aborting())
|
|
Karsten Hopp |
c4173e |
{
|
|
Karsten Hopp |
c4173e |
/* executed an autocommand, search for the function again */
|
|
Karsten Hopp |
c4173e |
! fp = find_func(rfname);
|
|
Karsten Hopp |
c4173e |
}
|
|
Karsten Hopp |
c4173e |
#endif
|
|
Karsten Hopp |
c4173e |
/* Try loading a package. */
|
|
Karsten Hopp |
c4173e |
! if (fp == NULL && script_autoload(rfname, TRUE) && !aborting())
|
|
Karsten Hopp |
c4173e |
{
|
|
Karsten Hopp |
c4173e |
/* loaded a package, search for the function again */
|
|
Karsten Hopp |
c4173e |
! fp = find_func(rfname);
|
|
Karsten Hopp |
c4173e |
}
|
|
Karsten Hopp |
c4173e |
|
|
Karsten Hopp |
c4173e |
if (fp != NULL)
|
|
Karsten Hopp |
c4173e |
*** ../vim-7.4.264/src/testdir/test_eval.in 2014-04-23 20:43:07.290689167 +0200
|
|
Karsten Hopp |
c4173e |
--- src/testdir/test_eval.in 2014-04-24 17:07:57.108918330 +0200
|
|
Karsten Hopp |
c4173e |
***************
|
|
Karsten Hopp |
c4173e |
*** 172,182 ****
|
|
Karsten Hopp |
c4173e |
:endtry
|
|
Karsten Hopp |
c4173e |
:"
|
|
Karsten Hopp |
c4173e |
:" function name starting with/without "g:", buffer-local funcref.
|
|
Karsten Hopp |
c4173e |
! :function! g:Foo()
|
|
Karsten Hopp |
c4173e |
! : $put ='called Foo()'
|
|
Karsten Hopp |
c4173e |
:endfunction
|
|
Karsten Hopp |
c4173e |
:let b:my_func = function('Foo')
|
|
Karsten Hopp |
c4173e |
! :call b:my_func()
|
|
Karsten Hopp |
c4173e |
:"
|
|
Karsten Hopp |
c4173e |
:/^start:/+1,$wq! test.out
|
|
Karsten Hopp |
c4173e |
:" vim: et ts=4 isk-=\: fmr=???,???
|
|
Karsten Hopp |
c4173e |
--- 172,184 ----
|
|
Karsten Hopp |
c4173e |
:endtry
|
|
Karsten Hopp |
c4173e |
:"
|
|
Karsten Hopp |
c4173e |
:" function name starting with/without "g:", buffer-local funcref.
|
|
Karsten Hopp |
c4173e |
! :function! g:Foo(n)
|
|
Karsten Hopp |
c4173e |
! : $put ='called Foo(' . a:n . ')'
|
|
Karsten Hopp |
c4173e |
:endfunction
|
|
Karsten Hopp |
c4173e |
:let b:my_func = function('Foo')
|
|
Karsten Hopp |
c4173e |
! :call b:my_func(1)
|
|
Karsten Hopp |
c4173e |
! :echo g:Foo(2)
|
|
Karsten Hopp |
c4173e |
! :echo Foo(3)
|
|
Karsten Hopp |
c4173e |
:"
|
|
Karsten Hopp |
c4173e |
:/^start:/+1,$wq! test.out
|
|
Karsten Hopp |
c4173e |
:" vim: et ts=4 isk-=\: fmr=???,???
|
|
Karsten Hopp |
c4173e |
*** ../vim-7.4.264/src/testdir/test_eval.ok 2014-04-23 20:43:07.290689167 +0200
|
|
Karsten Hopp |
c4173e |
--- src/testdir/test_eval.ok 2014-04-24 16:54:36.856937613 +0200
|
|
Karsten Hopp |
c4173e |
***************
|
|
Karsten Hopp |
c4173e |
*** 338,341 ****
|
|
Karsten Hopp |
c4173e |
Vim(function):E128: Function name must start with a capital or "s:": g:test()
|
|
Karsten Hopp |
c4173e |
Vim(function):E128: Function name must start with a capital or "s:": b:test()
|
|
Karsten Hopp |
c4173e |
Vim(function):E128: Function name must start with a capital or "s:": test2() "#
|
|
Karsten Hopp |
c4173e |
! called Foo()
|
|
Karsten Hopp |
c4173e |
--- 338,343 ----
|
|
Karsten Hopp |
c4173e |
Vim(function):E128: Function name must start with a capital or "s:": g:test()
|
|
Karsten Hopp |
c4173e |
Vim(function):E128: Function name must start with a capital or "s:": b:test()
|
|
Karsten Hopp |
c4173e |
Vim(function):E128: Function name must start with a capital or "s:": test2() "#
|
|
Karsten Hopp |
c4173e |
! called Foo(1)
|
|
Karsten Hopp |
c4173e |
! called Foo(2)
|
|
Karsten Hopp |
c4173e |
! called Foo(3)
|
|
Karsten Hopp |
c4173e |
*** ../vim-7.4.264/src/version.c 2014-04-23 20:43:07.290689167 +0200
|
|
Karsten Hopp |
c4173e |
--- src/version.c 2014-04-24 16:56:24.520935019 +0200
|
|
Karsten Hopp |
c4173e |
***************
|
|
Karsten Hopp |
c4173e |
*** 736,737 ****
|
|
Karsten Hopp |
c4173e |
--- 736,739 ----
|
|
Karsten Hopp |
c4173e |
{ /* Add new patch number below this line */
|
|
Karsten Hopp |
c4173e |
+ /**/
|
|
Karsten Hopp |
c4173e |
+ 265,
|
|
Karsten Hopp |
c4173e |
/**/
|
|
Karsten Hopp |
c4173e |
|
|
Karsten Hopp |
c4173e |
--
|
|
Karsten Hopp |
c4173e |
The sooner you fall behind, the more time you'll have to catch up.
|
|
Karsten Hopp |
c4173e |
|
|
Karsten Hopp |
c4173e |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
Karsten Hopp |
c4173e |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
Karsten Hopp |
c4173e |
\\\ an exciting new programming language -- http://www.Zimbu.org ///
|
|
Karsten Hopp |
c4173e |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|