diff options
author | Bram Moolenaar <Bram@vim.org> | 2016-09-01 16:21:48 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2016-09-01 16:21:48 +0200 |
commit | 5c80908ced601be6db7554a147cdb0f98ac8daa1 (patch) | |
tree | 1a569dd71db8795b0fe21f661c9623946b12a8ef | |
parent | 04c4ce650f9e533cd35b2aa6803f4d354d3ec7aa (diff) | |
download | vim-git-5c80908ced601be6db7554a147cdb0f98ac8daa1.tar.gz |
patch 7.4.2300v7.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.
-rw-r--r-- | src/fileio.c | 2 | ||||
-rw-r--r-- | src/testdir/test_autocmd.vim | 15 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 18 insertions, 1 deletions
diff --git a/src/fileio.c b/src/fileio.c index 9ae46fa95..6bf54526a 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -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; diff --git a/src/testdir/test_autocmd.vim b/src/testdir/test_autocmd.vim index d856d3296..6db3bf76d 100644 --- a/src/testdir/test_autocmd.vim +++ b/src/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/version.c b/src/version.c index a3ba5cc54..7bf6d7c8d 100644 --- a/src/version.c +++ b/src/version.c @@ -764,6 +764,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 2300, +/**/ 2299, /**/ 2298, |