To: vim_dev@googlegroups.com Subject: Patch 8.2.4345 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.4345 Problem: is expanded like a file name for DirChangedPre. Solution: Do not expand . (closes #9742) Also for the User event. Files: src/autocmd.c, src/testdir/test_autocmd.vim *** ../vim-8.2.4344/src/autocmd.c 2022-02-09 12:58:16.502258779 +0000 --- src/autocmd.c 2022-02-11 16:24:41.081238953 +0000 *************** *** 2043,2049 **** { sfname = vim_strsave(fname); // Don't try expanding FileType, Syntax, FuncUndefined, WindowID, ! // ColorScheme, QuickFixCmd* or DirChanged if (event == EVENT_FILETYPE || event == EVENT_SYNTAX || event == EVENT_CMDLINECHANGED --- 2043,2049 ---- { sfname = vim_strsave(fname); // Don't try expanding FileType, Syntax, FuncUndefined, WindowID, ! // ColorScheme, QuickFixCmd*, DirChanged and similar. if (event == EVENT_FILETYPE || event == EVENT_SYNTAX || event == EVENT_CMDLINECHANGED *************** *** 2061,2067 **** --- 2061,2069 ---- || event == EVENT_OPTIONSET || event == EVENT_QUICKFIXCMDPOST || event == EVENT_DIRCHANGED + || event == EVENT_DIRCHANGEDPRE || event == EVENT_MODECHANGED + || event == EVENT_USER || event == EVENT_WINCLOSED) { fname = vim_strsave(fname); *** ../vim-8.2.4344/src/testdir/test_autocmd.vim 2022-02-09 12:58:16.502258779 +0000 --- src/testdir/test_autocmd.vim 2022-02-11 16:29:24.936951295 +0000 *************** *** 1899,1904 **** --- 1899,1912 ---- call assert_fails('au! * x bwipe', 'E1155:') endfunc + func Test_autocmd_user() + au User MyEvent let s:res = [expand(""), expand("")] + doautocmd User MyEvent + call assert_equal(['MyEvent', 'MyEvent'], s:res) + au! User + unlet s:res + endfunc + function s:Before_test_dirchanged() augroup test_dirchanged autocmd! *************** *** 1922,1932 **** function Test_dirchanged_global() call s:Before_test_dirchanged() ! autocmd test_dirchanged DirChangedPre global call add(s:li, "pre cd " .. v:event.directory) autocmd test_dirchanged DirChanged global call add(s:li, "cd:") autocmd test_dirchanged DirChanged global call add(s:li, expand("")) call chdir(s:dir_foo) ! let expected = ["pre cd " .. s:dir_foo, "cd:", s:dir_foo] call assert_equal(expected, s:li) call chdir(s:dir_foo) call assert_equal(expected, s:li) --- 1930,1940 ---- function Test_dirchanged_global() call s:Before_test_dirchanged() ! autocmd test_dirchanged DirChangedPre global call add(s:li, expand("") .. " pre cd " .. v:event.directory) autocmd test_dirchanged DirChanged global call add(s:li, "cd:") autocmd test_dirchanged DirChanged global call add(s:li, expand("")) call chdir(s:dir_foo) ! let expected = ["global pre cd " .. s:dir_foo, "cd:", s:dir_foo] call assert_equal(expected, s:li) call chdir(s:dir_foo) call assert_equal(expected, s:li) *** ../vim-8.2.4344/src/version.c 2022-02-11 16:11:11.593975996 +0000 --- src/version.c 2022-02-11 16:29:50.820925173 +0000 *************** *** 748,749 **** --- 748,751 ---- { /* Add new patch number below this line */ + /**/ + 4345, /**/ -- I'm not familiar with this proof, but I'm aware of a significant following of toddlers who believe that peanut butter is the solution to all of life's problems... -- Tim Hammerquist /// 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 ///