diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-01-28 13:47:59 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-01-28 13:47:59 +0100 |
commit | 9a046fd08bcae319d39a4dbde2be81decee19013 (patch) | |
tree | d4f2eb3f05595e0b38ca7704011e16d428d14e6e /src/autocmd.c | |
parent | d697ddea1466d877a79f8c56d46361dc54e9baef (diff) |
patch 8.2.2420: too many problems with using all autocommand eventsv8.2.2420
Problem: Too many problems with using all autocommand events.
Solution: Disallow defining an autocommand for all events.
Diffstat (limited to 'src/autocmd.c')
-rw-r--r-- | src/autocmd.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/autocmd.c b/src/autocmd.c index f7ca41de44..2f6001c267 100644 --- a/src/autocmd.c +++ b/src/autocmd.c @@ -956,11 +956,14 @@ do_autocmd(char_u *arg_in, int forceit) last_group = AUGROUP_ERROR; // for listing the group name if (*arg == '*' || *arg == NUL || *arg == '|') { - for (event = (event_T)0; (int)event < (int)NUM_EVENTS; - event = (event_T)((int)event + 1)) - if (do_autocmd_event(event, pat, - once, nested, cmd, forceit, group) == FAIL) - break; + if (!forceit && *cmd != NUL) + emsg(_(e_cannot_define_autocommands_for_all_events)); + else + for (event = (event_T)0; (int)event < (int)NUM_EVENTS; + event = (event_T)((int)event + 1)) + if (do_autocmd_event(event, pat, + once, nested, cmd, forceit, group) == FAIL) + break; } else { |