> Am 31.03.2011 08:38, schrieb Rostyslaw Lewyckyj:
>> IF vim recognizes an error in a script, what does it do?
>> Where are the rules for this detailed?
>>
>> Suppose that while editing file.foo, I initiate a script
>> e.g. :so myscript.vim
>> and there is an error
>> e.g. the script looks for a non existing pattern in file.foo
>> After issuing its error message what is the expected action
>> for the general case:
>> 1. The script is immediately terminated, returning to the
>> invocation point?
>> 2. After possibly issuing an error message,
>> the script continues trying to execute with its next command.
>> In this case as if the search for the pattern had not failed?
>>
>> Are these kinds of exception rules spelled out explicitly
>> anywhere in the available documentation?
>> Not just mentioned in passing by an example!
>>
>> In my simple test case, it appears that 2. is the rule.
>> But of course I'm just seemingly poking a black box.
>
> :h except-compat
>
> Normally, a script is sourced to the end, even if errors occur. This is
> the same in all (also older) Vim versions.
>
> But if :source is executed within a :try-block, sourcing will stop on
> the first error.
> try
> so script.vim
> endtry
>
> If you want to still source to the end, you have to use :sil! to
> surpress errors:
> try
> :sil! so script.vim
> endtry
>
> What you can't have is: execute :so within a :try-block and still see
> all error messages (not only the first).
>
All very good hints and commets, thank you messieurs: Brabant, Schmidt,
and Wokula.
However none of you answered,
>> Are these kinds of exception rules spelled out explicitly
>> anywhere in the available documentation?
>> Not just mentioned in passing by an example!
>> Where are the rules for this detailed?
Or is this an impossible task, since the rules of vim
are not regular, but an ad hoc collection?
(like French grammar. :-) )
--
Rostyk
--
You received this message from the "vim_use" 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
No comments:
Post a Comment