From: Bram Moolenaar Date: Fri, 24 Dec 2021 19:24:47 +0000 (+0000) Subject: patch 8.2.3886: can define autocmd for every event by using "au!" X-Git-Tag: v8.2.3886 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b6db1467622be046dbf00b2213fd9f49f4f3cccb;p=vim patch 8.2.3886: can define autocmd for every event by using "au!" Problem: Can define autocmd for every event by using "au!". Solution: Check if a command is present also for "au!". --- diff --git a/src/autocmd.c b/src/autocmd.c index 789dde1a2..9b6a5d074 100644 --- a/src/autocmd.c +++ b/src/autocmd.c @@ -967,7 +967,7 @@ do_autocmd(exarg_T *eap, char_u *arg_in, int forceit) last_group = AUGROUP_ERROR; // for listing the group name if (*arg == '*' || *arg == NUL || *arg == '|') { - if (!forceit && *cmd != NUL) + if (*cmd != NUL) emsg(_(e_cannot_define_autocommands_for_all_events)); else for (event = (event_T)0; (int)event < NUM_EVENTS; diff --git a/src/testdir/test_arglist.vim b/src/testdir/test_arglist.vim index ca7e2f8e2..9f9957ae1 100644 --- a/src/testdir/test_arglist.vim +++ b/src/testdir/test_arglist.vim @@ -581,7 +581,7 @@ endfunc func Test_clear_arglist_in_all() n 0 00 000 0000 00000 000000 - au! * 0 n 0 + au WinNew 0 n 0 call assert_fails("all", "E1156") au! * endfunc diff --git a/src/testdir/test_autocmd.vim b/src/testdir/test_autocmd.vim index 4bdb8dc22..b6f621dbf 100644 --- a/src/testdir/test_autocmd.vim +++ b/src/testdir/test_autocmd.vim @@ -1896,6 +1896,7 @@ endfunc func Test_autocommand_all_events() call assert_fails('au * * bwipe', 'E1155:') call assert_fails('au * x bwipe', 'E1155:') + call assert_fails('au! * x bwipe', 'E1155:') endfunc function s:Before_test_dirchanged() diff --git a/src/version.c b/src/version.c index b7b5441e7..14e65f145 100644 --- a/src/version.c +++ b/src/version.c @@ -749,6 +749,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 3886, /**/ 3885, /**/