diff options
-rw-r--r-- | src/nvim/if_cscope.c | 11 | ||||
-rw-r--r-- | src/nvim/quickfix.c | 38 | ||||
-rw-r--r-- | src/nvim/testdir/test_quickfix.vim | 17 |
3 files changed, 41 insertions, 25 deletions
diff --git a/src/nvim/if_cscope.c b/src/nvim/if_cscope.c index a05ac5f877..550d256de5 100644 --- a/src/nvim/if_cscope.c +++ b/src/nvim/if_cscope.c @@ -994,11 +994,12 @@ static int cs_find_common(char *opt, char *pat, int forceit, int verbose, return FALSE; } - if (*qfpos != '0') { - apply_autocmds(EVENT_QUICKFIXCMDPRE, (char_u *)"cscope", - curbuf->b_fname, TRUE, curbuf); - if (did_throw || force_abort) - return FALSE; + if (*qfpos != '0' + && apply_autocmds(EVENT_QUICKFIXCMDPRE, (char_u *)"cscope", + curbuf->b_fname, true, curbuf)) { + if (aborting()) { + return false; + } } } diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c index c4b8d266cf..40a8066f75 100644 --- a/src/nvim/quickfix.c +++ b/src/nvim/quickfix.c @@ -3023,11 +3023,11 @@ void ex_make(exarg_T *eap) case CMD_lgrepadd: au_name = (char_u *)"lgrepadd"; break; default: break; } - if (au_name != NULL) { - apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name, - curbuf->b_fname, TRUE, curbuf); - if (did_throw || force_abort) + if (au_name != NULL && apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name, + curbuf->b_fname, true, curbuf)) { + if (aborting()) { return; + } } if (eap->cmdidx == CMD_lmake || eap->cmdidx == CMD_lgrep @@ -3487,11 +3487,11 @@ void ex_vimgrep(exarg_T *eap) case CMD_lgrepadd: au_name = (char_u *)"lgrepadd"; break; default: break; } - if (au_name != NULL) { - apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name, - curbuf->b_fname, TRUE, curbuf); - if (did_throw || force_abort) + if (au_name != NULL && apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name, + curbuf->b_fname, true, curbuf)) { + if (aborting()) { return; + } } if (eap->cmdidx == CMD_lgrep @@ -4310,10 +4310,9 @@ void ex_cbuffer(exarg_T *eap) break; } - if (au_name != NULL) { - apply_autocmds(EVENT_QUICKFIXCMDPRE, (char_u *)au_name, - curbuf->b_fname, true, curbuf); - if (did_throw || force_abort) { + if (au_name != NULL && apply_autocmds(EVENT_QUICKFIXCMDPRE, (char_u *)au_name, + curbuf->b_fname, true, curbuf)) { + if (aborting()) { return; } } @@ -4396,10 +4395,9 @@ void ex_cexpr(exarg_T *eap) default: break; } - if (au_name != NULL) { - apply_autocmds(EVENT_QUICKFIXCMDPRE, (char_u *)au_name, - curbuf->b_fname, true, curbuf); - if (did_throw || force_abort) { + if (au_name != NULL && apply_autocmds(EVENT_QUICKFIXCMDPRE, (char_u *)au_name, + curbuf->b_fname, true, curbuf)) { + if (aborting()) { return; } } @@ -4455,11 +4453,11 @@ void ex_helpgrep(exarg_T *eap) case CMD_lhelpgrep: au_name = (char_u *)"lhelpgrep"; break; default: break; } - if (au_name != NULL) { - apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name, - curbuf->b_fname, TRUE, curbuf); - if (did_throw || force_abort) + if (au_name != NULL && apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name, + curbuf->b_fname, true, curbuf)) { + if (aborting()) { return; + } } /* Make 'cpoptions' empty, the 'l' flag should not be used here. */ diff --git a/src/nvim/testdir/test_quickfix.vim b/src/nvim/testdir/test_quickfix.vim index 50fe6ce977..044c288ce0 100644 --- a/src/nvim/testdir/test_quickfix.vim +++ b/src/nvim/testdir/test_quickfix.vim @@ -1560,3 +1560,20 @@ function Test_Autocmd() \ 'postcaddbuffer'] call assert_equal(l, g:acmds) endfunction + +function! Test_Autocmd_Exception() + set efm=%m + lgetexpr '?' + + try + call DoesNotExit() + catch + lgetexpr '1' + finally + lgetexpr '1' + endtry + + call assert_equal('1', getloclist(0)[0].text) + + set efm&vim +endfunction |