diff options
author | Bram Moolenaar <Bram@vim.org> | 2016-11-06 14:46:44 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2016-11-06 14:46:44 +0100 |
commit | 21662be2211675824df1771c7f169948ede40c41 (patch) | |
tree | 581e7302d5aea00e6112561751222bd3b37a2efa | |
parent | 98500fdc6119eb5f02d7a52ab6ffcac3085181be (diff) | |
download | vim-git-21662be2211675824df1771c7f169948ede40c41.tar.gz |
patch 8.0.0068v8.0.0068
Problem: Checking did_throw after executing autocommands is wrong. (Daniel
Hahler)
Solution: Call aborting() instead, and only when autocommands were executed.
-rw-r--r-- | src/if_cscope.c | 8 | ||||
-rw-r--r-- | src/quickfix.c | 39 | ||||
-rw-r--r-- | src/testdir/test_quickfix.vim | 17 | ||||
-rw-r--r-- | src/version.c | 2 |
4 files changed, 42 insertions, 24 deletions
diff --git a/src/if_cscope.c b/src/if_cscope.c index 086c82963..9e7a362b2 100644 --- a/src/if_cscope.c +++ b/src/if_cscope.c @@ -1178,12 +1178,12 @@ cs_find_common( } # ifdef FEAT_AUTOCMD - if (*qfpos != '0') + if (*qfpos != '0' + && apply_autocmds(EVENT_QUICKFIXCMDPRE, (char_u *)"cscope", + curbuf->b_fname, TRUE, curbuf)) { - apply_autocmds(EVENT_QUICKFIXCMDPRE, (char_u *)"cscope", - curbuf->b_fname, TRUE, curbuf); # ifdef FEAT_EVAL - if (did_throw || force_abort) + if (aborting()) return FALSE; # endif } diff --git a/src/quickfix.c b/src/quickfix.c index 5bd125720..c3def1bc0 100644 --- a/src/quickfix.c +++ b/src/quickfix.c @@ -3446,12 +3446,11 @@ ex_make(exarg_T *eap) case CMD_lgrepadd: au_name = (char_u *)"lgrepadd"; break; default: break; } - if (au_name != NULL) + if (au_name != NULL && apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name, + curbuf->b_fname, TRUE, curbuf)) { - apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name, - curbuf->b_fname, TRUE, curbuf); # ifdef FEAT_EVAL - if (did_throw || force_abort) + if (aborting()) return; # endif } @@ -3970,12 +3969,13 @@ ex_vimgrep(exarg_T *eap) case CMD_lgrepadd: au_name = (char_u *)"lgrepadd"; break; default: break; } - if (au_name != NULL) + if (au_name != NULL && apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name, + curbuf->b_fname, TRUE, curbuf)) { - apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name, - curbuf->b_fname, TRUE, curbuf); - if (did_throw || force_abort) +# ifdef FEAT_EVAL + if (aborting()) return; +# endif } #endif @@ -4875,12 +4875,11 @@ ex_cbuffer(exarg_T *eap) case CMD_laddbuffer: au_name = (char_u *)"laddbuffer"; break; default: break; } - if (au_name != NULL) + if (au_name != NULL && apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name, + curbuf->b_fname, TRUE, curbuf)) { - apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name, - curbuf->b_fname, TRUE, curbuf); # ifdef FEAT_EVAL - if (did_throw || force_abort) + if (aborting()) return; # endif } @@ -4966,12 +4965,11 @@ ex_cexpr(exarg_T *eap) case CMD_laddexpr: au_name = (char_u *)"laddexpr"; break; default: break; } - if (au_name != NULL) + if (au_name != NULL && apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name, + curbuf->b_fname, TRUE, curbuf)) { - apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name, - curbuf->b_fname, TRUE, curbuf); # ifdef FEAT_EVAL - if (did_throw || force_abort) + if (aborting()) return; # endif } @@ -5042,12 +5040,13 @@ ex_helpgrep(exarg_T *eap) case CMD_lhelpgrep: au_name = (char_u *)"lhelpgrep"; break; default: break; } - if (au_name != NULL) + if (au_name != NULL && apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name, + curbuf->b_fname, TRUE, curbuf)) { - apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name, - curbuf->b_fname, TRUE, curbuf); - if (did_throw || force_abort) +# ifdef FEAT_EVAL + if (aborting()) return; +# endif } #endif diff --git a/src/testdir/test_quickfix.vim b/src/testdir/test_quickfix.vim index 022c12a29..118a015cb 100644 --- a/src/testdir/test_quickfix.vim +++ b/src/testdir/test_quickfix.vim @@ -1631,3 +1631,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 diff --git a/src/version.c b/src/version.c index 548d578ef..4a0725bb3 100644 --- a/src/version.c +++ b/src/version.c @@ -765,6 +765,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 68, +/**/ 67, /**/ 66, |