]> granicus.if.org Git - vim/commitdiff
patch 7.4.2300 v7.4.2300
authorBram Moolenaar <Bram@vim.org>
Thu, 1 Sep 2016 14:21:48 +0000 (16:21 +0200)
committerBram Moolenaar <Bram@vim.org>
Thu, 1 Sep 2016 14:21:48 +0000 (16:21 +0200)
Problem:    Get warning for deleting autocommand group when the autocommand
            using the group is scheduled for deletion. (Pavol Juhas)
Solution:   Check for deleted autocommand.

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

index 9ae46fa95c3d7404a85d4988ddde0238ca8194ef..6bf54526acc122f299beb92df5d43b97c5bcbab3 100644 (file)
@@ -8018,7 +8018,7 @@ au_del_group(char_u *name)
                                            event = (event_T)((int)event + 1))
        {
            for (ap = first_autopat[(int)event]; ap != NULL; ap = ap->next)
-               if (ap->group == i)
+               if (ap->group == i && ap->pat != NULL)
                {
                    give_warning((char_u *)_("W19: Deleting augroup that is still in use"), TRUE);
                    in_use = TRUE;
index d856d3296a32af6ec8f43daf938c4211b652b919..6db3bf76d3e2b1a803193ffbc06b3ca1fc0c48b4 100644 (file)
@@ -152,6 +152,11 @@ func Test_early_bar()
   call assert_equal(1, len(split(execute('au vimBarTest'), "\n")))
 endfunc
 
+func RemoveGroup()
+  autocmd! StartOK
+  augroup! StartOK
+endfunc
+
 func Test_augroup_warning()
   augroup TheWarning
     au VimEnter * echo 'entering'
@@ -167,4 +172,14 @@ func Test_augroup_warning()
   augroup Another
   augroup END
   call assert_true(match(execute('au VimEnter'), "-Deleted-.*VimEnter") >= 0)
+
+  " no warning for postpone aucmd delete
+  augroup StartOK
+    au VimEnter * call RemoveGroup()
+  augroup END
+  call assert_true(match(execute('au VimEnter'), "StartOK.*VimEnter") >= 0)
+  redir => res
+  doautocmd VimEnter
+  redir END
+  call assert_true(match(res, "W19:") < 0)
 endfunc
index a3ba5cc545875862009b725fb36ae3bebb1066c6..7bf6d7c8dce8399bbb44b2bd9a5e7fdd53a1c02f 100644 (file)
@@ -763,6 +763,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2300,
 /**/
     2299,
 /**/