To: vim_dev@googlegroups.com Subject: Patch 7.4.2110 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.4.2110 Problem: When there is an CmdUndefined autocmd then the error for a missing command is E464 instead of E492. (Manuel Ortega) Solution: Don't let the pointer be NULL. Files: src/ex_docmd.c, src/testdir/test_usercommands.vim *** ../vim-7.4.2109/src/ex_docmd.c 2016-07-24 21:58:39.700057671 +0200 --- src/ex_docmd.c 2016-07-28 20:29:58.821512097 +0200 *************** *** 2343,2349 **** vim_free(p); /* If the autocommands did something and didn't cause an error, try * finding the command again. */ ! p = (ret && !aborting()) ? find_command(&ea, NULL) : NULL; } #endif --- 2343,2349 ---- vim_free(p); /* If the autocommands did something and didn't cause an error, try * finding the command again. */ ! p = (ret && !aborting()) ? find_command(&ea, NULL) : ea.cmd; } #endif *** ../vim-7.4.2109/src/testdir/test_usercommands.vim 2016-06-04 22:08:38.881905472 +0200 --- src/testdir/test_usercommands.vim 2016-07-28 22:06:38.231231588 +0200 *************** *** 46,48 **** --- 46,78 ---- delcommand MyQCmd unlet g:mods endfunction + + func Test_Ambiguous() + command Doit let g:didit = 'yes' + command Dothat let g:didthat = 'also' + call assert_fails('Do', 'E464:') + Doit + call assert_equal('yes', g:didit) + Dothat + call assert_equal('also', g:didthat) + unlet g:didit + unlet g:didthat + + delcommand Doit + Do + call assert_equal('also', g:didthat) + delcommand Dothat + endfunc + + func Test_CmdUndefined() + call assert_fails('Doit', 'E492:') + au CmdUndefined Doit :command Doit let g:didit = 'yes' + Doit + call assert_equal('yes', g:didit) + delcommand Doit + + call assert_fails('Dothat', 'E492:') + au CmdUndefined * let g:didnot = 'yes' + call assert_fails('Dothat', 'E492:') + call assert_equal('yes', g:didnot) + endfunc *** ../vim-7.4.2109/src/version.c 2016-07-27 23:26:00.782222261 +0200 --- src/version.c 2016-07-28 22:07:35.786690465 +0200 *************** *** 760,761 **** --- 760,763 ---- { /* Add new patch number below this line */ + /**/ + 2110, /**/ -- A special law prohibits unmarried women from parachuting on Sunday or she shall risk arrest, fine, and/or jailing. [real standing law in Florida, United States of America] /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///