Bram, On Sat, Feb 06, 2016 at 03:28:37PM +0100, Bram Moolenaar wrote: > > 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.
Thanks for your input. I'm working on a new patch which will extract the logic to the main loop. > Nevertheless, you probably want to do something more clever, since after > rebuilding the tags file you would want to search for a match again. I've been thinking on a way to detect the last tag related normal mode mapping or command without any progress. However being forced to invoke the tag search normal mode mapping or execute the latest command line entry again isn't to frustrating to me. -- :wq -- -- 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.
