To: vim_dev@googlegroups.com Subject: Patch 8.2.3886 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.3886 Problem: Can define autocmd for every event by using "au!". Solution: Check if a command is present also for "au!". Files: src/autocmd.c, src/testdir/test_autocmd.vim, src/testdir/test_arglist.vim *** ../vim-8.2.3885/src/autocmd.c 2021-12-17 16:00:00.664431516 +0000 --- src/autocmd.c 2021-12-24 19:07:08.480708521 +0000 *************** *** 967,973 **** last_group = AUGROUP_ERROR; // for listing the group name if (*arg == '*' || *arg == NUL || *arg == '|') { ! if (!forceit && *cmd != NUL) emsg(_(e_cannot_define_autocommands_for_all_events)); else for (event = (event_T)0; (int)event < NUM_EVENTS; --- 967,973 ---- last_group = AUGROUP_ERROR; // for listing the group name if (*arg == '*' || *arg == NUL || *arg == '|') { ! if (*cmd != NUL) emsg(_(e_cannot_define_autocommands_for_all_events)); else for (event = (event_T)0; (int)event < NUM_EVENTS; *** ../vim-8.2.3885/src/testdir/test_autocmd.vim 2021-11-20 10:38:17.705011550 +0000 --- src/testdir/test_autocmd.vim 2021-12-24 18:46:18.062776394 +0000 *************** *** 1896,1901 **** --- 1896,1902 ---- 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() *** ../vim-8.2.3885/src/testdir/test_arglist.vim 2021-12-24 18:58:41.177588306 +0000 --- src/testdir/test_arglist.vim 2021-12-24 19:07:31.376672606 +0000 *************** *** 581,587 **** func Test_clear_arglist_in_all() n 0 00 000 0000 00000 000000 ! au! * 0 n 0 call assert_fails("all", "E1156") au! * endfunc --- 581,587 ---- func Test_clear_arglist_in_all() n 0 00 000 0000 00000 000000 ! au WinNew 0 n 0 call assert_fails("all", "E1156") au! * endfunc *** ../vim-8.2.3885/src/version.c 2021-12-24 18:58:41.177588306 +0000 --- src/version.c 2021-12-24 19:23:20.127299150 +0000 *************** *** 751,752 **** --- 751,754 ---- { /* Add new patch number below this line */ + /**/ + 3886, /**/ -- From "know your smileys": |-( Contact lenses, but has lost them /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///