diff src/evalfunc.c @ 28283:2fd2ce8a556c v8.2.4667

patch 8.2.4667: expandcmd() fails on an error Commit: https://github.com/vim/vim/commit/5018a836c030988944a9bbe2fd2e538bf5261a72 Author: Yegappan Lakshmanan <yegappan@yahoo.com> Date: Sat Apr 2 21:12:21 2022 +0100 patch 8.2.4667: expandcmd() fails on an error Problem: expandcmd() fails on an error. Solution: On failure return the command unmodified. (yegappan Lakshmanan, closes #10063)
author Bram Moolenaar <Bram@vim.org>
date Sat, 02 Apr 2022 22:15:03 +0200
parents c724906134a3
children dc68c111cf7a
line wrap: on
line diff
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -4168,9 +4168,9 @@ f_expandcmd(typval_T *argvars, typval_T 
     eap.nextcmd = NULL;
     eap.cmdidx = CMD_USER;
 
+    ++emsg_off;
     expand_filename(&eap, &cmdstr, &errormsg);
-    if (errormsg != NULL && *errormsg != NUL)
-	emsg(errormsg);
+    --emsg_off;
 
     rettv->vval.v_string = cmdstr;
 }
@@ -4444,8 +4444,7 @@ common_function(typval_T *argvars, typva
 		    arg_idx = 0;
 		else if (list->lv_len > MAX_FUNC_ARGS)
 		{
-		    emsg_funcname((char *)e_too_many_arguments_for_function_str,
-									    s);
+		    emsg_funcname(e_too_many_arguments_for_function_str, s);
 		    vim_free(name);
 		    goto theend;
 		}