]> granicus.if.org Git - vim/commitdiff
patch 7.4.2314 v7.4.2314
authorBram Moolenaar <Bram@vim.org>
Sat, 3 Sep 2016 14:59:06 +0000 (16:59 +0200)
committerBram Moolenaar <Bram@vim.org>
Sat, 3 Sep 2016 14:59:06 +0000 (16:59 +0200)
Problem:    No error when deleting an augroup while it's the current one.
Solution:   Disallow deleting an augroup when it's the current one.

src/fileio.c
src/testdir/test_autocmd.vim
src/version.c

index 6d5ed19d17babf463cfb03e8e8775d621355e610..ea1f338f587744038f3a74c225951cff43338ebe 100644 (file)
@@ -8017,6 +8017,8 @@ au_del_group(char_u *name)
     i = au_find_group(name);
     if (i == AUGROUP_ERROR)    /* the group doesn't exist */
        EMSG2(_("E367: No such group: \"%s\""), name);
+    else if (i == current_augroup)
+       EMSG(_("E936: Cannot delete the current group"));
     else
     {
        event_T event;
index 7d786c88cf0342e7dcb3f257cd12a7cee52b6768..f05a55f1aaa6e2659275e551335b71a593530abf 100644 (file)
@@ -182,13 +182,17 @@ func Test_augroup_warning()
   doautocmd VimEnter
   redir END
   call assert_true(match(res, "W19:") < 0)
+  au! VimEnter
 endfunc
 
 func Test_augroup_deleted()
-  " This caused a crash
+  " This caused a crash before E936 was introduced
   augroup x
+    call assert_fails('augroup! x', 'E936:')
+    au VimEnter * echo
+  augroup end
   augroup! x
-  au VimEnter * echo
-  au VimEnter
+  call assert_true(match(execute('au VimEnter'), "-Deleted-.*VimEnter") >= 0)
+  au! VimEnter
 endfunc
 
index 8c10a9413e046ce2a8c4c9efbe781794526b5d6c..eb1c30214483abbaffd75c42ca47093bf8542a73 100644 (file)
@@ -763,6 +763,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2314,
 /**/
     2313,
 /**/