On 16/03/09 19:25, StarWing wrote:
>
>
>
> On 3月16日, 下午6时15分, Tony Mechelynck<[email protected]>
> wrote:
>> On 15/03/09 04:18, StarWing wrote:
>>
>>
>>
>>
>>
>>> use redir in functions, e.g.
>>> func! Func1()
>>>       redir =>   funclist
>>>       silent func
>>>       redir END
>>>       " .... other sentence ...
>>
>>> endfunc
>>
>>> funclist maybe a local-variable, but it is globle variable here, must
>>> write
>>> redir =>   l:funclist
>>> to make funclist a local variable.
>>
>>> the doc only said:
>>> :redi[r] =>   {var}      Redirect messages to a variable.  If the variable
>>>                     doesn't exist, then it is created.  If the variable
>>>                     exists, then it is initialized to an empty string.
>>>                     The variable will remain empty until redirection ends.
>>>                     Only string variables can be used.  After the
>>>                     redirection starts, if the variable is removed or
>>>                     locked or the variable type is changed, then further
>>>                     command output messages will cause errors. {not in Vi}
>>
>> Here's the relavant info, from elsewhere in the docs:
>>
>>>                                             *global-variable* *g:var*
>>> Inside functions global variables are accessed with "g:".  Omitting this 
>>> will
>>> access a variable local to a function.  But "g:" can also be used in any 
>>> other
>>> place if you like.
>>
>>>                                             *local-variable* *l:var*
>>> Inside functions local variables are accessed without prepending anything.
>>> But you can also prepend "l:" if you like.  However, without prepending "l:"
>>> you may run into reserved variable names.  For example "count".  By itself 
>>> it
>>> refers to "v:count".  Using "l:count" you can have a local variable with the
>>> same name.
>>
>> So, _inside_ a function, funclist (with no explicit namespace) is
>> equivalent to l:funclist. _Outside_ all functions it is equivalent to
>> g:funclist.
>
> So, is it a bug?

Ah, if the actual behaviour directly contradicts the documentation, then 
either the behaviour is buggy, or the documentation is in error. In this 
case I agree with Bram that, in the light of the "principle of least 
surprise", it's probably better (but maybe not as easy to fix) to regard 
the documentation as right and fix the C code than the opposite.

Best regards,
Tony.
-- 
ARTHUR: The swallow may fly south with the sun, or the house martin or the
         plover seek warmer hot lands in winter, yet these are not 
strangers to
         our land.
SOLDIER: Are you suggesting coconuts migrate?
                  "Monty Python and the Holy Grail" PYTHON (MONTY) 
PICTURES LTD

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui