Reply to message «Re: [BUG] Trying to override redirection to a script variable 
from another script results in error», 
sent 19:55:08 27 March 2011, Sunday
by Bram Moolenaar:

> Well, the error message is a bit strange, but what you are doing is
> wrong: you don't end the redirection in the script.  When you add "redir
> END" in the sourced script everything is OK.
> 
> I suppose Vim could give a better error.  Or stop redirecting at the end
> of the sourced script.
It can appear if a script or a function that does such redirection 
sources/calls 
another function that tries to use redirection on its own. It will also appear 
if uncaught exception is thrown before Vim reaches `redir END' command. Or if 
`redir END' command is called outside of a script (it is actually how I got it: 
I tried to add a hack that will prevent my test suite from catching `New File' 
messages by stopping a redirection in a test that emits this message).

Original message:
> ZyX wrote:
> > > I don't get an error when using an actual file.  My shell doesn't
> > > accept this syntax.
> > > 
> >     echo "redir => s:foo" > /tmp/redir
> >     vim -u NONE -S /tmp/redir -c 'redir => g:bar'
> > 
> > works for me as well. Vim-7.3.145.
> 
> Well, the error message is a bit strange, but what you are doing is
> wrong: you don't end the redirection in the script.  When you add "redir
> END" in the sourced script everything is OK.
> 
> I suppose Vim could give a better error.  Or stop redirecting at the end
> of the sourced script.

Attachment: signature.asc
Description: This is a digitally signed message part.

Raspunde prin e-mail lui