From a0c982671ee2f4c4e87a6480d2ea4d23ba807273 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 19 Apr 2023 07:59:35 +0800 Subject: vim-patch:9.0.1469: deferred functions not called from autocommands Problem: Deferred functions not called from autocommands. Solution: Also go through the funccal_stack. (closes vim/vim#12267) https://github.com/vim/vim/commit/960cf9119e3f4922ca9719feb5e0c0bc5e3b9840 --- test/old/testdir/test_user_func.vim | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'test') diff --git a/test/old/testdir/test_user_func.vim b/test/old/testdir/test_user_func.vim index d8e36cefe4..5f6229258d 100644 --- a/test/old/testdir/test_user_func.vim +++ b/test/old/testdir/test_user_func.vim @@ -661,6 +661,35 @@ func Test_defer_quitall_def() call delete('XQuitallDefThree') endfunc +func Test_defer_quitall_autocmd() + let lines =<< trim END + autocmd User DeferAutocmdThree qa! + + func DeferLevelTwo() + call writefile(['text'], 'XQuitallAutocmdTwo', 'D') + doautocmd User DeferAutocmdThree + endfunc + + autocmd User DeferAutocmdTwo ++nested call DeferLevelTwo() + + " def DeferLevelOne() + func DeferLevelOne() + call writefile(['text'], 'XQuitallAutocmdOne', 'D') + doautocmd User DeferAutocmdTwo + " enddef + endfunc + + autocmd User DeferAutocmdOne ++nested call DeferLevelOne() + + doautocmd User DeferAutocmdOne + END + call writefile(lines, 'XdeferQuitallAutocmd', 'D') + let res = system(GetVimCommand() .. ' -X -S XdeferQuitallAutocmd') + call assert_equal(0, v:shell_error) + call assert_false(filereadable('XQuitallAutocmdOne')) + call assert_false(filereadable('XQuitallAutocmdTwo')) +endfunc + func Test_defer_quitall_in_expr_func() throw 'Skipped: Vim9 script is N/A' let lines =<< trim END -- cgit