]> granicus.if.org Git - vim/commitdiff
patch 8.2.1281: the "trailing characters" error can be hard to understand v8.2.1281
authorBram Moolenaar <Bram@vim.org>
Thu, 23 Jul 2020 15:16:18 +0000 (17:16 +0200)
committerBram Moolenaar <Bram@vim.org>
Thu, 23 Jul 2020 15:16:18 +0000 (17:16 +0200)
Problem:    The "trailing characters" error can be hard to understand.
Solution:   Add the trailing characters to the message.

13 files changed:
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
src/version.c

index d708535ff970f03982bbf0d9d3ab6c937064c8bc..69c83c0b5ab48f4a6cebb6428dfb200f5a8b5431 100644 (file)
@@ -705,7 +705,7 @@ ex_history(exarg_T *eap)
            else
            {
                *end = i;
-               emsg(_(e_trailing));
+               semsg(_(e_trailing_arg), arg);
                return;
            }
        }
@@ -717,7 +717,7 @@ ex_history(exarg_T *eap)
        end = arg;
     if (!get_list_range(&end, &hisidx1, &hisidx2) || *end != NUL)
     {
-       emsg(_(e_trailing));
+       semsg(_(e_trailing_arg), end);
        return;
     }
 
index bb75528ca7aaded90b9755d70be5dce8d621faa7..6d3d19ee83192cda9ccff654d5c962879473abef 100644 (file)
@@ -797,7 +797,7 @@ get_lval(
        if (unlet && !VIM_ISWHITE(*p) && !ends_excmd(*p)
                                                    && *p != '[' && *p != '.')
        {
-           emsg(_(e_trailing));
+           semsg(_(e_trailing_arg), p);
            return NULL;
        }
 
index c07b1ab77b3265826fcd6a526b32c059a5750acf..a631fd9c8449edc2949c9b1d23b1fc45e596b371 100644 (file)
@@ -2141,7 +2141,7 @@ f_eval(typval_T *argvars, typval_T *rettv)
        rettv->vval.v_number = 0;
     }
     else if (*s != NUL)
-       emsg(_(e_trailing));
+       semsg(_(e_trailing_arg), s);
 }
 
 /*
@@ -5113,7 +5113,7 @@ f_islocked(typval_T *argvars, typval_T *rettv)
     if (end != NULL && lv.ll_name != NULL)
     {
        if (*end != NUL)
-           emsg(_(e_trailing));
+           semsg(_(e_trailing_arg), end);
        else
        {
            if (lv.ll_tv == NULL)
index 564c65b8aafa34dc06604a917986f28a9213b77c..e11fdac41fb3af1d4926112ca5f764da2f3232df 100644 (file)
@@ -592,7 +592,7 @@ heredoc_get(exarg_T *eap, char_u *cmd, int script_get)
        p = skiptowhite(marker);
        if (*skipwhite(p) != NUL && *skipwhite(p) != '"')
        {
-           emsg(_(e_trailing));
+           semsg(_(e_trailing_arg), p);
            return NULL;
        }
        *p = NUL;
@@ -1113,7 +1113,7 @@ list_arg_vars(exarg_T *eap, char_u *arg, int *first)
            if (!VIM_ISWHITE(*arg) && !ends_excmd(*arg))
            {
                emsg_severe = TRUE;
-               emsg(_(e_trailing));
+               semsg(_(e_trailing_arg), arg);
                break;
            }
        }
@@ -1489,7 +1489,7 @@ ex_unletlock(
                if (name_end != NULL)
                {
                    emsg_severe = TRUE;
-                   emsg(_(e_trailing));
+                   semsg(_(e_trailing_arg), name_end);
                }
                if (!(eap->skip || error))
                    clear_lval(&lv);
@@ -3431,9 +3431,9 @@ var_redir_start(char_u *name, int append)
        clear_lval(redir_lval);
        if (redir_endp != NULL && *redir_endp != NUL)
            // Trailing characters are present after the variable name
-           emsg(_(e_trailing));
+           semsg(_(e_trailing_arg), redir_endp);
        else
-           emsg(_(e_invarg));
+           semsg(_(e_invarg2), name);
        redir_endp = NULL;  // don't store a value, only cleanup
        var_redir_stop();
        return FAIL;
index 59c562b91752dd8e4b897368513442faddf591e6..e8e38aa97a300b6309502be0508e7cdbd22097e1 100644 (file)
@@ -3816,7 +3816,7 @@ do_sub(exarg_T *eap)
        eap->nextcmd = check_nextcmd(cmd);
        if (eap->nextcmd == NULL)
        {
-           emsg(_(e_trailing));
+           semsg(_(e_trailing_arg), cmd);
            return;
        }
     }
index 4f27898a199ec739aaeb927f8c7dda87bddbb8fb..bd3de8ff8f9b5e3299acf00ffa5a13195215ce21 100644 (file)
@@ -2396,7 +2396,7 @@ do_one_cmd(
            && *ea.arg != '"' && (*ea.arg != '|' || (ea.argt & EX_TRLBAR) == 0))
     {
        // no arguments allowed but there is something
-       errormsg = _(e_trailing);
+       errormsg = ex_errmsg(e_trailing_arg, ea.arg);
        goto doend;
     }
 
@@ -7725,7 +7725,7 @@ ex_mark(exarg_T *eap)
     if (*eap->arg == NUL)              // No argument?
        emsg(_(e_argreq));
     else if (eap->arg[1] != NUL)       // more than one character?
-       emsg(_(e_trailing));
+       semsg(_(e_trailing_arg), eap->arg);
     else
     {
        pos = curwin->w_cursor;         // save curwin->w_cursor
index 3fdc208df7c86f11e64d436dce4b7959b797679f..f0ffaffdde8c227eab87b452ab179b688a086766 100644 (file)
@@ -1588,7 +1588,7 @@ ex_catch(exarg_T *eap)
            if (end != NULL && *end != NUL
                                      && !ends_excmd2(end, skipwhite(end + 1)))
            {
-               emsg(_(e_trailing));
+               semsg(_(e_trailing_arg), end);
                return;
            }
 
index c22864df10603ff10eb257b3c2bfbca7fd0539cf..8262640db896d9b4fdc760f4370bbdb61f2b3bbb 100644 (file)
@@ -1086,7 +1086,7 @@ json_decode_all(js_read_T *reader, typval_T *res, int options)
     json_skip_white(reader);
     if (reader->js_buf[reader->js_used] != NUL)
     {
-       emsg(_(e_trailing));
+       semsg(_(e_trailing_arg), reader->js_buf + reader->js_used);
        return FAIL;
     }
     return OK;
index 8a69edd1ab8ad260d73618628bda18a42214f272..fd811de065556bb026e403c39ac1daa52dfba0c2 100644 (file)
@@ -289,7 +289,7 @@ ex_menu(
     }
     else if (*map_to != NUL && (unmenu || enable != MAYBE))
     {
-       emsg(_(e_trailing));
+       semsg(_(e_trailing_arg), map_to);
        goto theend;
     }
 #if defined(FEAT_GUI) && !(defined(FEAT_GUI_GTK) || defined(FEAT_GUI_PHOTON))
index 4957f7d527acca3c468c767faa662c8287b91eab..1901e3806df8f8eb24cd30fc1597ded5eb520836 100644 (file)
@@ -3579,7 +3579,7 @@ qf_list(exarg_T *eap)
     }
     if (!get_list_range(&arg, &idx1, &idx2) || *arg != NUL)
     {
-       emsg(_(e_trailing));
+       semsg(_(e_trailing_arg), arg);
        return;
     }
     qfl = qf_get_curlist(qi);
index a3dfaf034fc667a8d8946fd2ee168acce61dfbf1..fb452b30c5b7e06c5063f5bde7ad9f287bc5ac70 100644 (file)
@@ -1577,7 +1577,7 @@ parse_sign_cmd_args(
            filename = arg;
            *buf = buflist_findnr((int)getdigits(&arg));
            if (*skipwhite(arg) != NUL)
-               emsg(_(e_trailing));
+               semsg(_(e_trailing_arg), arg);
            break;
        }
        else
index 3967d2743dfbb768365bac6a66bc576b482358f3..bf026d85792802d8603fea00f70e264e690a8229 100644 (file)
@@ -2664,7 +2664,7 @@ def_function(exarg_T *eap, char_u *name_arg)
     {
        if (!ends_excmd(*skipwhite(p)))
        {
-           emsg(_(e_trailing));
+           semsg(_(e_trailing_arg), p);
            goto ret_free;
        }
        eap->nextcmd = check_nextcmd(p);
@@ -2833,7 +2833,7 @@ def_function(exarg_T *eap, char_u *name_arg)
            && !(*p == '#' && (vim9script || eap->cmdidx == CMD_def))
            && !eap->skip
            && !did_emsg)
-       emsg(_(e_trailing));
+       semsg(_(e_trailing_arg), p);
 
     /*
      * Read the body of the function, until "}", ":endfunction" or ":enddef" is
@@ -3629,7 +3629,7 @@ ex_delfunction(exarg_T *eap)
     if (!ends_excmd(*skipwhite(p)))
     {
        vim_free(name);
-       emsg(_(e_trailing));
+       semsg(_(e_trailing_arg), p);
        return;
     }
     eap->nextcmd = check_nextcmd(p);
@@ -3977,7 +3977,7 @@ ex_call(exarg_T *eap)
            if (!failed)
            {
                emsg_severe = TRUE;
-               emsg(_(e_trailing));
+               semsg(_(e_trailing_arg), arg);
            }
        }
        else
index 064174659b22b15e42bd3179edd48ede63829f5b..4286eb0b39bb5b9836daed1f6f53ad64de8049d3 100644 (file)
@@ -754,6 +754,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1281,
 /**/
     1280,
 /**/