]> granicus.if.org Git - vim/commitdiff
patch 8.2.3886: can define autocmd for every event by using "au!" v8.2.3886
authorBram Moolenaar <Bram@vim.org>
Fri, 24 Dec 2021 19:24:47 +0000 (19:24 +0000)
committerBram Moolenaar <Bram@vim.org>
Fri, 24 Dec 2021 19:24:47 +0000 (19:24 +0000)
Problem:    Can define autocmd for every event by using "au!".
Solution:   Check if a command is present also for "au!".

src/autocmd.c
src/testdir/test_arglist.vim
src/testdir/test_autocmd.vim
src/version.c

index 789dde1a207b932ac42e6701398d7c12a90c4c25..9b6a5d074b532093ab2c4c3f8f2652b2c8e2bdb6 100644 (file)
@@ -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;
index ca7e2f8e217658b87534dd5b98d4dc4ff6d854b8..9f9957ae1b076548c10c4c994a856a64fcdf5434 100644 (file)
@@ -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
index 4bdb8dc22e146829587a38ef082abdbb8b2c9602..b6f621dbff12ba215658cb75edf06031e7877e7b 100644 (file)
@@ -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()
index b7b5441e7c786ce13b8077d5c65780994719ce08..14e65f1459ffdd9002dbb530ed152f39e5eb7ae3 100644 (file)
@@ -749,6 +749,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    3886,
 /**/
     3885,
 /**/