]> granicus.if.org Git - vim/commitdiff
patch 8.0.0068 v8.0.0068
authorBram Moolenaar <Bram@vim.org>
Sun, 6 Nov 2016 13:46:44 +0000 (14:46 +0100)
committerBram Moolenaar <Bram@vim.org>
Sun, 6 Nov 2016 13:46:44 +0000 (14:46 +0100)
Problem:    Checking did_throw after executing autocommands is wrong. (Daniel
            Hahler)
Solution:   Call aborting() instead, and only when autocommands were executed.

src/if_cscope.c
src/quickfix.c
src/testdir/test_quickfix.vim
src/version.c

index 086c829631acace7cbe19301be6128f91d73ea84..9e7a362b2b22f632e5bfb7ae1e8ab29027af72dc 100644 (file)
@@ -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
        }
index 5bd1257200d1f6c95f17be5019273812492548cf..c3def1bc01afcee2f00d945ee94e0c1eb5fb26c9 100644 (file)
@@ -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
 
index 022c12a292fa4af22e743379f0638663dc0ac56b..118a015cb0efb3bf7fc10ecad93567dcae8d928f 100644 (file)
@@ -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
index 548d578ef3632ef81776332972daa243420a0aa9..4a0725bb354cd2c50b3033dd57db594a860cc91e 100644 (file)
@@ -764,6 +764,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    68,
 /**/
     67,
 /**/