Anton Lindqvist wrote:

> This is a result of a previous discussion[1] which concluded that a
> more general Error autocmd event would be a better addition than the
> proposed TagNotFound event.
> 
> Questions and comments regarding the patch in no particular order:
> 
> - Is the addition to the main_loop function at a suitable location?
> 
> - The error code (emsg_code) is the actual code including the 'E' prefix.
>   Another solution is to use the numerical representation of the error code.
> 
> - The get_error_pat function is used to translate error codes into something
>   more descriptive. As of writing this only one such mapping is
>   present. We could either ensure that all possible error codes has a
>   mapping or add them on demand. The function is doing a linear search
>   of error_pats. If the error code is represented as an int this could
>   be replaced with a constant lookup if the array index is equal to
>   the error code:
> 
>     static const char *error_pat[] = {
>       [426] = "tagnotfound",
>     }
> 
>   If mappings of all possible error codes is present the array won't end up
>   being that sparse.
> 
>   The existing solution (representing error codes as string) could also be
>   improved by replacing the linear search with a binary search.
> 
> - If no mapping of the error code to pattern is found the actual error
>   code is used as the amatch argument when triggering the Error event.
> 
> [1] https://groups.google.com/d/msg/vim_dev/XzhNNjbtfow/u6BWsne4CwAJ

I am wondering if this is really a useful solution.

At least in scripts one can already use try/catch to deal with errors.
Thus this patch is mainly for when typing commands.

The original reason was to handle an error for a tag lookup.  With the
solution the tag lookup will still fail.  It can trigger rebuilding the
tags file, but for most users it will be quite unexpected that trying to
jump to the same tag suddenly works a bit later.

Can you think of a command or situation where this patch provides a
nice, useful solution?


-- 
I'm in shape.  Round IS a shape.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" 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

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui