Skip to content

Commit 5c80908

Browse files
committed
patch 7.4.2300
Problem: Get warning for deleting autocommand group when the autocommand using the group is scheduled for deletion. (Pavol Juhas) Solution: Check for deleted autocommand.
1 parent 04c4ce6 commit 5c80908

3 files changed

Lines changed: 18 additions & 1 deletion

File tree

src/fileio.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8018,7 +8018,7 @@ au_del_group(char_u *name)
80188018
event = (event_T)((int)event + 1))
80198019
{
80208020
for (ap = first_autopat[(int)event]; ap != NULL; ap = ap->next)
8021-
if (ap->group == i)
8021+
if (ap->group == i && ap->pat != NULL)
80228022
{
80238023
give_warning((char_u *)_("W19: Deleting augroup that is still in use"), TRUE);
80248024
in_use = TRUE;

src/testdir/test_autocmd.vim

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,11 @@ func Test_early_bar()
152152
call assert_equal(1, len(split(execute('au vimBarTest'), "\n")))
153153
endfunc
154154

155+
func RemoveGroup()
156+
autocmd! StartOK
157+
augroup! StartOK
158+
endfunc
159+
155160
func Test_augroup_warning()
156161
augroup TheWarning
157162
au VimEnter * echo 'entering'
@@ -167,4 +172,14 @@ func Test_augroup_warning()
167172
augroup Another
168173
augroup END
169174
call assert_true(match(execute('au VimEnter'), "-Deleted-.*VimEnter") >= 0)
175+
176+
" no warning for postpone aucmd delete
177+
augroup StartOK
178+
au VimEnter * call RemoveGroup()
179+
augroup END
180+
call assert_true(match(execute('au VimEnter'), "StartOK.*VimEnter") >= 0)
181+
redir => res
182+
doautocmd VimEnter
183+
redir END
184+
call assert_true(match(res, "W19:") < 0)
170185
endfunc

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -763,6 +763,8 @@ static char *(features[]) =
763763

764764
static int included_patches[] =
765765
{ /* Add new patch number below this line */
766+
/**/
767+
2300,
766768
/**/
767769
2299,
768770
/**/

0 commit comments

Comments
 (0)