Anton Lindqvist wrote:
> On Thu, Feb 04, 2016 at 09:36:21PM +0100, Christian Brabandt wrote:
> > While I agree that this is useful, I have been thinking, if a more
> > general approach would not be more useful. Something like an Error
> > autocommand, that triggers on the EXXX numbers?
>
> I really like this idea, especially if <amatch> would be the actual
> error message since it would allow people to get creative. Having
> limited experience with the Vim codebase: would it be feasible to
> trigger the autocmd event somewhere along the call stack for the emsg
> functions? At first glance it looks like that solution would require
> less changes. Compared to adding a explicit call to apply_autocmds
> prior calling any of the emsg functions.
Although this sounds like a nice general solution, it will require the
code that gives the error message to be prepared for an autocommand
kicking in. Otherwise, whatever the autocommand does may completely
mess up what the code was doing. We have had many autocommands cause
trouble and still fixing more.
So the code would explicitly check for an autocommand that handles the
error. And since we need to do that, we might as well use a nicer name
than the error number. That also helps for when there can be multiple
errors. E.g. "tagnotfound" is much nicer than matching a list of error
codes. And more error codes could be added later.
An alternative would be to match the error code, but not trigger the
autocommand yet. In the main loop we can then check for the matches
and execute the autocommand. That is a lot safer and simpler.
Nevertheless, you probably want to do something more clever, since after
rebuilding the tags file you would want to search for a match again.
--
hundred-and-one symptoms of being an internet addict:
151. You find yourself engaged to someone you've never actually met,
except through e-mail.
/// 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.