Nikolai Weibull schrieb:
> Could :catch be allowed to take a variable containing a pattern
> instead of only literal patterns? I have the following function
>
> " Turn the error-number NUMBER into a pattern that can be used in a :catch
> " expression to match that error when generated by Vim.
> function now#vim#error(number)
> return '^Vim\%((\a\+)\)\=:E' . a:number
> endfunction
>
> which is meant to be used
>
> let now#vim#undefined_variable_error = now#vim#error(121)
>
> so that one can then later write
>
> try
> ... variable ...
> catch now#vim#undefined_variable_error
> ... other variable instead ...
> endtry
>
> nikolai
I don't see the need to match Vim exceptions against the full pattern.
try
...
catch /:E121:/
...
endtry
This is easy to read and only requires that user exceptions don't use
the ":E<number>:" notation.
--
Andy
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---