From 6f285226a9cc0e24bcb77a3213035cd26170ddb4 Mon Sep 17 00:00:00 2001 From: lonerover Date: Mon, 9 Jan 2017 11:00:56 +0800 Subject: vim-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. https://github.com/vim/vim/commit/5c80908ced601be6db7554a147cdb0f98ac8daa1 --- src/nvim/fileio.c | 2 +- src/nvim/testdir/test_autocmd.vim | 15 +++++++++++++++ src/nvim/version.c | 2 +- 3 files changed, 17 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c index 3f82b4ee97..31db8e2341 100644 --- a/src/nvim/fileio.c +++ b/src/nvim/fileio.c @@ -5580,7 +5580,7 @@ static void au_del_group(char_u *name) for (event = (event_T)0; (int)event < (int)NUM_EVENTS; 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; diff --git a/src/nvim/testdir/test_autocmd.vim b/src/nvim/testdir/test_autocmd.vim index d856d3296a..6db3bf76d3 100644 --- a/src/nvim/testdir/test_autocmd.vim +++ b/src/nvim/testdir/test_autocmd.vim @@ -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 diff --git a/src/nvim/version.c b/src/nvim/version.c index 260e4c743e..93d72a9b0a 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -140,7 +140,7 @@ static int included_patches[] = { // 2303, // 2302 NA // 2301 NA - // 2300, + 2300, // 2299, // 2298 NA // 2297 NA -- cgit