Patch 8.2.4147

1 view
Skip to first unread message

Bram Moolenaar

unread,
Jan 19, 2022, 3:49:46 PM1/19/22
to vim...@googlegroups.com

Patch 8.2.4147
Problem: E464 does not always include the offending command.
Solution: Add another error message with "%s". (closes #9564)
Files: src/errors.h, src/vim9compile.c, src/ex_docmd.c,
src/testdir/test_vim9_script.vim


*** ../vim-8.2.4146/src/errors.h 2022-01-18 16:25:58.618309943 +0000
--- src/errors.h 2022-01-19 19:35:52.081400677 +0000
***************
*** 1148,1153 ****
--- 1148,1155 ----
#endif
EXTERN char e_ambiguous_use_of_user_defined_command[]
INIT(= N_("E464: Ambiguous use of user-defined command"));
+ EXTERN char e_ambiguous_use_of_user_defined_command_str[]
+ INIT(= N_("E464: Ambiguous use of user-defined command: %s"));
EXTERN char e_winsize_requires_two_number_arguments[]
INIT(= N_("E465: :winsize requires two number arguments"));
EXTERN char e_winpos_requires_two_number_arguments[]
*** ../vim-8.2.4146/src/vim9compile.c 2022-01-15 21:44:39.832970792 +0000
--- src/vim9compile.c 2022-01-19 19:37:23.307555350 +0000
***************
*** 2878,2884 ****
if (p == NULL)
{
if (cctx.ctx_skip != SKIP_YES)
! emsg(_(e_ambiguous_use_of_user_defined_command));
goto erret;
}

--- 2878,2884 ----
if (p == NULL)
{
if (cctx.ctx_skip != SKIP_YES)
! semsg(_(e_ambiguous_use_of_user_defined_command_str), ea.cmd);
goto erret;
}

*** ../vim-8.2.4146/src/ex_docmd.c 2022-01-16 11:25:20.897661683 +0000
--- src/ex_docmd.c 2022-01-19 19:54:08.800262246 +0000
***************
*** 2614,2620 ****

if (errormsg != NULL && *errormsg != NUL && !did_emsg)
{
! if (sourcing)
{
if (errormsg != (char *)IObuff)
{
--- 2614,2620 ----

if (errormsg != NULL && *errormsg != NUL && !did_emsg)
{
! if (sourcing || !KeyTyped)
{
if (errormsg != (char *)IObuff)
{
*** ../vim-8.2.4146/src/testdir/test_vim9_script.vim 2022-01-12 16:18:13.801613093 +0000
--- src/testdir/test_vim9_script.vim 2022-01-19 19:54:55.695402874 +0000
***************
*** 3664,3669 ****
--- 3664,3699 ----
Nested()
enddef

+ def Test_ambigous_command_error()
+ var lines =<< trim END
+ vim9script
+ command CmdA echomsg 'CmdA'
+ command CmdB echomsg 'CmdB'
+ Cmd
+ END
+ CheckScriptFailure(lines, 'E464: Ambiguous use of user-defined command: Cmd', 4)
+
+ lines =<< trim END
+ vim9script
+ def Func()
+ Cmd
+ enddef
+ Func()
+ END
+ CheckScriptFailure(lines, 'E464: Ambiguous use of user-defined command: Cmd', 1)
+
+ lines =<< trim END
+ vim9script
+ nnoremap <F3> <ScriptCmd>Cmd<CR>
+ feedkeys("\<F3>", 'xt')
+ END
+ CheckScriptFailure(lines, 'E464: Ambiguous use of user-defined command: Cmd', 3)
+
+ delcommand CmdA
+ delcommand CmdB
+ nunmap <F3>
+ enddef
+
" Execute this near the end, profiling doesn't stop until Vim exits.
" This only tests that it works, not the profiling output.
def Test_xx_profile_with_lambda()
*** ../vim-8.2.4146/src/version.c 2022-01-19 17:23:00.880902329 +0000
--- src/version.c 2022-01-19 19:36:49.840232637 +0000
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 4147,
/**/

--
MESKIMEN'S LAW
There's never time to do it right, but always time to do it over.

/// Bram Moolenaar -- Br...@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 ///
Reply all
Reply to author
Forward
0 new messages