Skip to content

Commit

Permalink
patch 7.4.2300
Browse files Browse the repository at this point in the history
Problem:    Get warning for deleting autocommand group when the autocommand
            using the group is scheduled for deletion. (Pavol Juhas)
Solution:   Check for deleted autocommand.
  • Loading branch information
brammool committed Sep 1, 2016
1 parent 04c4ce6 commit 5c80908
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/fileio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
15 changes: 15 additions & 0 deletions src/testdir/test_autocmd.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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
2 changes: 2 additions & 0 deletions src/version.c
Original file line number Diff line number Diff line change
Expand Up @@ -763,6 +763,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
2300,
/**/
2299,
/**/
Expand Down

0 comments on commit 5c80908

Please sign in to comment.