From caf2620f18affec2846b56de4f6bf6453296537a Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Tue, 22 Dec 2020 00:15:18 -0500 Subject: vim-patch:8.2.0769: VimLeavePre not triggered when Vim is terminated Problem: VimLeavePre not triggered when Vim is terminated. Solution: Unblock autocommands. https://github.com/vim/vim/commit/129d6bf6b3d120b0a4c69e18b5e8602a84e352bf --- src/nvim/main.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/nvim/main.c') diff --git a/src/nvim/main.c b/src/nvim/main.c index ed055e76ba..41ae78e996 100644 --- a/src/nvim/main.c +++ b/src/nvim/main.c @@ -653,7 +653,18 @@ void getout(int exitval) } } } - apply_autocmds(EVENT_VIMLEAVEPRE, NULL, NULL, FALSE, curbuf); + + int unblock = 0; + // deathtrap() blocks autocommands, but we do want to trigger + // VimLeavePre. + if (is_autocmd_blocked()) { + unblock_autocmds(); + unblock++; + } + apply_autocmds(EVENT_VIMLEAVEPRE, NULL, NULL, false, curbuf); + if (unblock) { + block_autocmds(); + } } if (p_shada && *p_shada != NUL) { -- cgit