To: vim_dev@googlegroups.com Subject: Patch 8.2.1281 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.1281 Problem: The "trailing characters" error can be hard to understand. Solution: Add the trailing characters to the message. Files: src/cmdhist.c, src/eval.c, src/evalfunc.c, src/evalvars.c, src/ex_cmds.c, src/ex_docmd.c, src/ex_eval.c, src/json.c, src/menu.c, src/quickfix.c, src/sign.c, src/userfunc.c, *** ../vim-8.2.1280/src/cmdhist.c 2020-02-25 21:47:42.299474625 +0100 --- src/cmdhist.c 2020-07-23 16:45:02.733939005 +0200 *************** *** 705,711 **** else { *end = i; ! emsg(_(e_trailing)); return; } } --- 705,711 ---- else { *end = i; ! semsg(_(e_trailing_arg), arg); return; } } *************** *** 717,723 **** end = arg; if (!get_list_range(&end, &hisidx1, &hisidx2) || *end != NUL) { ! emsg(_(e_trailing)); return; } --- 717,723 ---- end = arg; if (!get_list_range(&end, &hisidx1, &hisidx2) || *end != NUL) { ! semsg(_(e_trailing_arg), end); return; } *** ../vim-8.2.1280/src/eval.c 2020-07-23 13:11:33.247754399 +0200 --- src/eval.c 2020-07-23 16:45:21.285846427 +0200 *************** *** 797,803 **** if (unlet && !VIM_ISWHITE(*p) && !ends_excmd(*p) && *p != '[' && *p != '.') { ! emsg(_(e_trailing)); return NULL; } --- 797,803 ---- if (unlet && !VIM_ISWHITE(*p) && !ends_excmd(*p) && *p != '[' && *p != '.') { ! semsg(_(e_trailing_arg), p); return NULL; } *** ../vim-8.2.1280/src/evalfunc.c 2020-07-21 22:25:47.187106316 +0200 --- src/evalfunc.c 2020-07-23 16:45:54.985678393 +0200 *************** *** 2141,2147 **** rettv->vval.v_number = 0; } else if (*s != NUL) ! emsg(_(e_trailing)); } /* --- 2141,2147 ---- rettv->vval.v_number = 0; } else if (*s != NUL) ! semsg(_(e_trailing_arg), s); } /* *************** *** 5113,5119 **** if (end != NULL && lv.ll_name != NULL) { if (*end != NUL) ! emsg(_(e_trailing)); else { if (lv.ll_tv == NULL) --- 5113,5119 ---- if (end != NULL && lv.ll_name != NULL) { if (*end != NUL) ! semsg(_(e_trailing_arg), end); else { if (lv.ll_tv == NULL) *** ../vim-8.2.1280/src/evalvars.c 2020-07-23 13:11:33.247754399 +0200 --- src/evalvars.c 2020-07-23 16:48:30.280905929 +0200 *************** *** 592,598 **** p = skiptowhite(marker); if (*skipwhite(p) != NUL && *skipwhite(p) != '"') { ! emsg(_(e_trailing)); return NULL; } *p = NUL; --- 592,598 ---- p = skiptowhite(marker); if (*skipwhite(p) != NUL && *skipwhite(p) != '"') { ! semsg(_(e_trailing_arg), p); return NULL; } *p = NUL; *************** *** 1113,1119 **** if (!VIM_ISWHITE(*arg) && !ends_excmd(*arg)) { emsg_severe = TRUE; ! emsg(_(e_trailing)); break; } } --- 1113,1119 ---- if (!VIM_ISWHITE(*arg) && !ends_excmd(*arg)) { emsg_severe = TRUE; ! semsg(_(e_trailing_arg), arg); break; } } *************** *** 1489,1495 **** if (name_end != NULL) { emsg_severe = TRUE; ! emsg(_(e_trailing)); } if (!(eap->skip || error)) clear_lval(&lv); --- 1489,1495 ---- if (name_end != NULL) { emsg_severe = TRUE; ! semsg(_(e_trailing_arg), name_end); } if (!(eap->skip || error)) clear_lval(&lv); *************** *** 3431,3439 **** clear_lval(redir_lval); if (redir_endp != NULL && *redir_endp != NUL) // Trailing characters are present after the variable name ! emsg(_(e_trailing)); else ! emsg(_(e_invarg)); redir_endp = NULL; // don't store a value, only cleanup var_redir_stop(); return FAIL; --- 3431,3439 ---- clear_lval(redir_lval); if (redir_endp != NULL && *redir_endp != NUL) // Trailing characters are present after the variable name ! semsg(_(e_trailing_arg), redir_endp); else ! semsg(_(e_invarg2), name); redir_endp = NULL; // don't store a value, only cleanup var_redir_stop(); return FAIL; *** ../vim-8.2.1280/src/ex_cmds.c 2020-07-21 21:07:00.720496743 +0200 --- src/ex_cmds.c 2020-07-23 16:48:50.292806599 +0200 *************** *** 3816,3822 **** eap->nextcmd = check_nextcmd(cmd); if (eap->nextcmd == NULL) { ! emsg(_(e_trailing)); return; } } --- 3816,3822 ---- eap->nextcmd = check_nextcmd(cmd); if (eap->nextcmd == NULL) { ! semsg(_(e_trailing_arg), cmd); return; } } *** ../vim-8.2.1280/src/ex_docmd.c 2020-07-23 16:36:59.828375424 +0200 --- src/ex_docmd.c 2020-07-23 17:08:33.728962693 +0200 *************** *** 2396,2402 **** && *ea.arg != '"' && (*ea.arg != '|' || (ea.argt & EX_TRLBAR) == 0)) { // no arguments allowed but there is something ! errormsg = _(e_trailing); goto doend; } --- 2396,2402 ---- && *ea.arg != '"' && (*ea.arg != '|' || (ea.argt & EX_TRLBAR) == 0)) { // no arguments allowed but there is something ! errormsg = ex_errmsg(e_trailing_arg, ea.arg); goto doend; } *************** *** 7725,7731 **** if (*eap->arg == NUL) // No argument? emsg(_(e_argreq)); else if (eap->arg[1] != NUL) // more than one character? ! emsg(_(e_trailing)); else { pos = curwin->w_cursor; // save curwin->w_cursor --- 7725,7731 ---- if (*eap->arg == NUL) // No argument? emsg(_(e_argreq)); else if (eap->arg[1] != NUL) // more than one character? ! semsg(_(e_trailing_arg), eap->arg); else { pos = curwin->w_cursor; // save curwin->w_cursor *** ../vim-8.2.1280/src/ex_eval.c 2020-07-23 16:36:59.828375424 +0200 --- src/ex_eval.c 2020-07-23 16:50:11.412404361 +0200 *************** *** 1588,1594 **** if (end != NULL && *end != NUL && !ends_excmd2(end, skipwhite(end + 1))) { ! emsg(_(e_trailing)); return; } --- 1588,1594 ---- if (end != NULL && *end != NUL && !ends_excmd2(end, skipwhite(end + 1))) { ! semsg(_(e_trailing_arg), end); return; } *** ../vim-8.2.1280/src/json.c 2020-07-12 14:33:56.019239236 +0200 --- src/json.c 2020-07-23 17:11:59.719646138 +0200 *************** *** 1086,1092 **** json_skip_white(reader); if (reader->js_buf[reader->js_used] != NUL) { ! emsg(_(e_trailing)); return FAIL; } return OK; --- 1086,1092 ---- json_skip_white(reader); if (reader->js_buf[reader->js_used] != NUL) { ! semsg(_(e_trailing_arg), reader->js_buf + reader->js_used); return FAIL; } return OK; *** ../vim-8.2.1280/src/menu.c 2020-06-12 22:59:07.266097201 +0200 --- src/menu.c 2020-07-23 16:51:16.348082785 +0200 *************** *** 289,295 **** } else if (*map_to != NUL && (unmenu || enable != MAYBE)) { ! emsg(_(e_trailing)); goto theend; } #if defined(FEAT_GUI) && !(defined(FEAT_GUI_GTK) || defined(FEAT_GUI_PHOTON)) --- 289,295 ---- } else if (*map_to != NUL && (unmenu || enable != MAYBE)) { ! semsg(_(e_trailing_arg), map_to); goto theend; } #if defined(FEAT_GUI) && !(defined(FEAT_GUI_GTK) || defined(FEAT_GUI_PHOTON)) *** ../vim-8.2.1280/src/quickfix.c 2020-07-20 21:31:01.272823437 +0200 --- src/quickfix.c 2020-07-23 16:53:19.531473609 +0200 *************** *** 3579,3585 **** } if (!get_list_range(&arg, &idx1, &idx2) || *arg != NUL) { ! emsg(_(e_trailing)); return; } qfl = qf_get_curlist(qi); --- 3579,3585 ---- } if (!get_list_range(&arg, &idx1, &idx2) || *arg != NUL) { ! semsg(_(e_trailing_arg), arg); return; } qfl = qf_get_curlist(qi); *** ../vim-8.2.1280/src/sign.c 2020-06-12 22:59:07.270097188 +0200 --- src/sign.c 2020-07-23 16:54:09.087228811 +0200 *************** *** 1577,1583 **** filename = arg; *buf = buflist_findnr((int)getdigits(&arg)); if (*skipwhite(arg) != NUL) ! emsg(_(e_trailing)); break; } else --- 1577,1583 ---- filename = arg; *buf = buflist_findnr((int)getdigits(&arg)); if (*skipwhite(arg) != NUL) ! semsg(_(e_trailing_arg), arg); break; } else *** ../vim-8.2.1280/src/userfunc.c 2020-07-22 18:17:04.235863872 +0200 --- src/userfunc.c 2020-07-23 16:55:23.622860863 +0200 *************** *** 2664,2670 **** { if (!ends_excmd(*skipwhite(p))) { ! emsg(_(e_trailing)); goto ret_free; } eap->nextcmd = check_nextcmd(p); --- 2664,2670 ---- { if (!ends_excmd(*skipwhite(p))) { ! semsg(_(e_trailing_arg), p); goto ret_free; } eap->nextcmd = check_nextcmd(p); *************** *** 2833,2839 **** && !(*p == '#' && (vim9script || eap->cmdidx == CMD_def)) && !eap->skip && !did_emsg) ! emsg(_(e_trailing)); /* * Read the body of the function, until "}", ":endfunction" or ":enddef" is --- 2833,2839 ---- && !(*p == '#' && (vim9script || eap->cmdidx == CMD_def)) && !eap->skip && !did_emsg) ! semsg(_(e_trailing_arg), p); /* * Read the body of the function, until "}", ":endfunction" or ":enddef" is *************** *** 3629,3635 **** if (!ends_excmd(*skipwhite(p))) { vim_free(name); ! emsg(_(e_trailing)); return; } eap->nextcmd = check_nextcmd(p); --- 3629,3635 ---- if (!ends_excmd(*skipwhite(p))) { vim_free(name); ! semsg(_(e_trailing_arg), p); return; } eap->nextcmd = check_nextcmd(p); *************** *** 3977,3983 **** if (!failed) { emsg_severe = TRUE; ! emsg(_(e_trailing)); } } else --- 3977,3983 ---- if (!failed) { emsg_severe = TRUE; ! semsg(_(e_trailing_arg), arg); } } else *** ../vim-8.2.1280/src/version.c 2020-07-23 16:36:59.828375424 +0200 --- src/version.c 2020-07-23 17:15:56.014213387 +0200 *************** *** 756,757 **** --- 756,759 ---- { /* Add new patch number below this line */ + /**/ + 1281, /**/ -- hundred-and-one symptoms of being an internet addict: 71. You wonder how people walk /// 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 ///