]> granicus.if.org Git - vim/commitdiff
patch 8.2.3957: error messages are spread out v8.2.3957
authorBram Moolenaar <Bram@vim.org>
Fri, 31 Dec 2021 17:25:48 +0000 (17:25 +0000)
committerBram Moolenaar <Bram@vim.org>
Fri, 31 Dec 2021 17:25:48 +0000 (17:25 +0000)
Problem:    Error messages are spread out.
Solution:   Move more errors to errors.h.

15 files changed:
src/arglist.c
src/bufwrite.c
src/errors.h
src/evalvars.c
src/ex_cmds2.c
src/ex_docmd.c
src/ex_eval.c
src/globals.h
src/help.c
src/scriptfile.c
src/usercmd.c
src/userfunc.c
src/version.c
src/vim9cmds.c
src/vim9compile.c

index 90ee4796b812900113d19c3a37d282c82d0333f4..2db9b9e5331c371cd497f2da18b6eb6c917cac0e 100644 (file)
@@ -673,11 +673,11 @@ do_argfile(exarg_T *eap, int argn)
     if (argn < 0 || argn >= ARGCOUNT)
     {
        if (ARGCOUNT <= 1)
-           emsg(_("E163: There is only one file to edit"));
+           emsg(_(e_there_is_only_one_file_to_edit));
        else if (argn < 0)
-           emsg(_("E164: Cannot go before first file"));
+           emsg(_(e_cannot_go_before_first_file));
        else
-           emsg(_("E165: Cannot go beyond last file"));
+           emsg(_(e_cannot_go_beyond_last_file));
     }
     else
     {
index 035c859e22568646e0345d183450a543878d617f..8ffc7e0868cf38103bdd29048ee25d6dd1fdd07d 100644 (file)
@@ -1821,7 +1821,8 @@ buf_write(
                            || (mch_lstat((char *)fname, &st) == 0
                                && (st.st_dev != st_old.st_dev
                                    || st.st_ino != st_old.st_ino)))
-                       errmsg = (char_u *)_("E166: Can't open linked file for writing");
+                       errmsg =
+                             (char_u *)_(e_cant_open_linked_file_for_writing);
                    else
 #endif
                    {
index 592de4598c98049900ebefbff5275ca2c5c37966..23b858355f03656b6b4c329a18dcc25f0258d8f3 100644 (file)
@@ -266,7 +266,7 @@ EXTERN char e_undefined_variable_str[]
        INIT(= N_("E121: Undefined variable: %s"));
 EXTERN char e_undefined_variable_char_str[]
        INIT(= N_("E121: Undefined variable: %c:%s"));
-EXTERN char e_function_str_already_exists_add_excl_to_replace[]
+EXTERN char e_function_str_already_exists_add_bang_to_replace[]
        INIT(= N_("E122: Function %s already exists, add ! to replace it"));
 EXTERN char e_undefined_function_str[]
        INIT(= N_("E123: Undefined function: %s"));
@@ -328,7 +328,7 @@ EXTERN char e_not_a_directory_str[]
        INIT(= N_("E150: Not a directory: %s"));
 EXTERN char e_no_match_str[]
        INIT(= N_("E151: No match: %s"));
-EXTERN char e_cannot_open_str_for_writing[]
+EXTERN char e_cannot_open_str_for_writing_1[]
        INIT(= N_("E152: Cannot open %s for writing"));
 EXTERN char e_unable_to_open_str_for_reading[]
        INIT(= N_("E153: Unable to open %s for reading"));
@@ -350,9 +350,70 @@ EXTERN char e_unknown_sign_command_str[]
 EXTERN char e_breakpoint_not_found_str[]
        INIT(= N_("E161: Breakpoint not found: %s"));
 #endif
-
+EXTERN char e_no_write_since_last_change_for_buffer_str[]
+       INIT(= N_("E162: No write since last change for buffer \"%s\""));
+EXTERN char e_there_is_only_one_file_to_edit[]
+       INIT(= N_("E163: There is only one file to edit"));
+EXTERN char e_cannot_go_before_first_file[]
+       INIT(= N_("E164: Cannot go before first file"));
+EXTERN char e_cannot_go_beyond_last_file[]
+       INIT(= N_("E165: Cannot go beyond last file"));
+EXTERN char e_cant_open_linked_file_for_writing[]
+       INIT(= N_("E166: Can't open linked file for writing"));
+EXTERN char e_scriptencoding_used_outside_of_sourced_file[]
+       INIT(= N_("E167: :scriptencoding used outside of a sourced file"));
+EXTERN char e_finish_used_outside_of_sourced_file[]
+       INIT(= N_("E168: :finish used outside of a sourced file"));
+EXTERN char e_command_too_recursive[]
+       INIT(= N_("E169: Command too recursive"));
+EXTERN char e_missing_endwhile[]
+       INIT(= N_("E170: Missing :endwhile"));
+EXTERN char e_missing_endfor[]
+       INIT(= N_("E170: Missing :endfor"));
+EXTERN char e_missing_endif[]
+       INIT(= N_("E171: Missing :endif"));
+EXTERN char e_missing_marker[]
+       INIT(= N_("E172: Missing marker"));
+EXTERN char e_nr_more_file_to_edit[]
+       INIT(= N_("E173: %d more file to edit"));
+EXTERN char e_nr_more_files_to_edit[]
+       INIT(= N_("E173: %d more files to edit"));
+EXTERN char e_command_already_exists_add_bang_to_replace_it_str[]
+       INIT(= N_("E174: Command already exists: add ! to replace it: %s"));
+EXTERN char e_no_attribute_specified[]
+       INIT(= N_("E175: No attribute specified"));
+EXTERN char e_invalid_number_of_arguments[]
+       INIT(= N_("E176: Invalid number of arguments"));
+EXTERN char e_count_cannot_be_specified_twice[]
+       INIT(= N_("E177: Count cannot be specified twice"));
+EXTERN char e_invalid_default_value_for_count[]
+       INIT(= N_("E178: Invalid default value for count"));
+EXTERN char e_argument_required_for_str[]
+       INIT(= N_("E179: argument required for %s"));
+EXTERN char e_invalid_complete_value_str[]
+       INIT(= N_("E180: Invalid complete value: %s"));
+EXTERN char e_invalid_attribute_str[]
+       INIT(= N_("E181: Invalid attribute: %s"));
+EXTERN char e_invalid_command_name[]
+       INIT(= N_("E182: Invalid command name"));
+EXTERN char e_user_defined_commands_must_start_with_an_uppercase_letter[]
+       INIT(= N_("E183: User defined commands must start with an uppercase letter"));
 EXTERN char e_no_such_user_defined_command_str[]
        INIT(= N_("E184: No such user-defined command: %s"));
+EXTERN char e_cannot_find_color_scheme_str[]
+       INIT(= N_("E185: Cannot find color scheme '%s'"));
+EXTERN char e_no_previous_directory[]
+       INIT(= N_("E186: No previous directory"));
+EXTERN char e_directory_unknown[]
+       INIT(= N_("E187: Directory unknown"));
+EXTERN char e_obtaining_window_position_not_implemented_for_this_platform[]
+       INIT(= N_("E188: Obtaining window position not implemented for this platform"));
+EXTERN char e_str_exists_add_bang_to_override[]
+       INIT(= N_("E189: \"%s\" exists (add ! to override)"));
+EXTERN char e_cannot_open_str_for_writing_2[]
+       INIT(= N_("E190: Cannot open \"%s\" for writing"));
+
+
 #ifndef FEAT_DIGRAPHS
 EXTERN char e_no_digraphs_version[]
        INIT(= N_("E196: No digraphs in this version"));
index adc9c204c05ff1466b76fafedfc8cff97bbd2abe..4ddd215b0818a0a619684dda895aa15d0da1f11a 100644 (file)
@@ -638,7 +638,7 @@ heredoc_get(exarg_T *eap, char_u *cmd, int script_get)
            marker = dot;
        else
        {
-           emsg(_("E172: Missing marker"));
+           emsg(_(e_missing_marker));
            return NULL;
        }
     }
index 8e7da18aafba5521bb84ddcb8c1f8f1a390064ce..b118c2d74bc07baceed646ffad4e62819a3e93d6 100644 (file)
@@ -367,7 +367,7 @@ check_changed_any(
                                                                  buf->b_fname)
                    :
 #endif
-               semsg(_("E162: No write since last change for buffer \"%s\""),
+               semsg(_(e_no_write_since_last_change_for_buffer_str),
                    buf_spname(buf) != NULL ? buf_spname(buf) : buf->b_fname))
        {
            save = no_wait_return;
index a9adea3b66e5bd274b440df7f6390740b0e0ac71..40955ad466a15dea340542aaf22a37c75d77a718 100644 (file)
@@ -677,7 +677,7 @@ do_cmdline(
 #endif
            )
     {
-       emsg(_("E169: Command too recursive"));
+       emsg(_(e_command_too_recursive));
 #ifdef FEAT_EVAL
        // When converting to an exception, we do not include the command name
        // since this is not an error of the specific command.
@@ -1214,11 +1214,11 @@ do_cmdline(
            if (cstack.cs_flags[cstack.cs_idx] & CSF_TRY)
                emsg(_(e_endtry));
            else if (cstack.cs_flags[cstack.cs_idx] & CSF_WHILE)
-               emsg(_(e_endwhile));
+               emsg(_(e_missing_endwhile));
            else if (cstack.cs_flags[cstack.cs_idx] & CSF_FOR)
-               emsg(_(e_endfor));
+               emsg(_(e_missing_endfor));
            else
-               emsg(_(e_endif));
+               emsg(_(e_missing_endif));
        }
 
        /*
@@ -5561,8 +5561,8 @@ check_more(
                return FAIL;
            }
 #endif
-           semsg(NGETTEXT("E173: %d more file to edit",
-                       "E173: %d more files to edit", n), n);
+           semsg(NGETTEXT(e_nr_more_file_to_edit,
+                          e_nr_more_files_to_edit , n), n);
            quitmore = 2;           // next try to quit is allowed
        }
        return FAIL;
@@ -5609,7 +5609,7 @@ ex_colorscheme(exarg_T *eap)
 #endif
     }
     else if (load_colors(eap->arg) == FAIL)
-       semsg(_("E185: Cannot find color scheme '%s'"), eap->arg);
+       semsg(_(e_cannot_find_color_scheme_str), eap->arg);
 
 #ifdef FEAT_VTP
     else if (has_vtp_working())
@@ -7377,7 +7377,7 @@ changedir_func(
        pdir = get_prevdir(scope);
        if (pdir == NULL)
        {
-           emsg(_("E186: No previous directory"));
+           emsg(_(e_no_previous_directory));
            return FALSE;
        }
        new_dir = pdir;
@@ -7510,7 +7510,7 @@ ex_pwd(exarg_T *eap UNUSED)
            msg((char *)NameBuff);
     }
     else
-       emsg(_("E187: Unknown"));
+       emsg(_(e_directory_unknown));
 }
 
 /*
@@ -7716,7 +7716,7 @@ ex_winpos(exarg_T *eap)
        }
        else
 # endif
-           emsg(_("E188: Obtaining window position not implemented for this platform"));
+           emsg(_(e_obtaining_window_position_not_implemented_for_this_platform));
     }
     else
     {
@@ -8303,12 +8303,12 @@ open_exfile(
 #endif
     if (!forceit && *mode != 'a' && vim_fexists(fname))
     {
-       semsg(_("E189: \"%s\" exists (add ! to override)"), fname);
+       semsg(_(e_str_exists_add_bang_to_override), fname);
        return NULL;
     }
 
     if ((fd = mch_fopen((char *)fname, mode)) == NULL)
-       semsg(_("E190: Cannot open \"%s\" for writing"), fname);
+       semsg(_(e_cannot_open_str_for_writing_2), fname);
 
     return fd;
 }
index b3c38a1ea57dca587b262f669c370ef50eb4d0f5..337f1ed147dabda89e943b473463bc96541285ae 100644 (file)
@@ -1413,7 +1413,7 @@ ex_endwhile(exarg_T *eap)
        if (!(fl & (CSF_WHILE | CSF_FOR)))
        {
            if (!(fl & CSF_TRY))
-               eap->errmsg = _(e_endif);
+               eap->errmsg = _(e_missing_endif);
            else if (fl & CSF_FINALLY)
                eap->errmsg = _(e_endtry);
            // Try to find the matching ":while" and report what's missing.
@@ -2484,10 +2484,10 @@ cleanup_conditionals(
 get_end_emsg(cstack_T *cstack)
 {
     if (cstack->cs_flags[cstack->cs_idx] & CSF_WHILE)
-       return _(e_endwhile);
+       return _(e_missing_endwhile);
     if (cstack->cs_flags[cstack->cs_idx] & CSF_FOR)
-       return _(e_endfor);
-    return _(e_endif);
+       return _(e_missing_endfor);
+    return _(e_missing_endif);
 }
 
 
index a7e98450ce275244579957e287a2e7bd515b1525..2341f2d232db3d013e7814e8be1d22f5f87a320d 100644 (file)
@@ -1606,14 +1606,11 @@ EXTERN int netbeansSuppressNoLines INIT(= 0); // skip "No lines in buffer"
 EXTERN char e_abort[]          INIT(= N_("E470: Command aborted"));
 EXTERN char e_argreq[]         INIT(= N_("E471: Argument required"));
 #ifdef FEAT_EVAL
-EXTERN char e_endif[]          INIT(= N_("E171: Missing :endif"));
 EXTERN char e_catch[]          INIT(= N_("E603: :catch without :try"));
 EXTERN char e_finally[]                INIT(= N_("E606: :finally without :try"));
 EXTERN char e_finally_dup[]    INIT(= N_("E607: multiple :finally"));
 EXTERN char e_endtry[]         INIT(= N_("E600: Missing :endtry"));
 EXTERN char e_no_endtry[]      INIT(= N_("E602: :endtry without :try"));
-EXTERN char e_endwhile[]       INIT(= N_("E170: Missing :endwhile"));
-EXTERN char e_endfor[]         INIT(= N_("E170: Missing :endfor"));
 EXTERN char e_while[]          INIT(= N_("E588: :endwhile without :while"));
 EXTERN char e_for[]            INIT(= N_("E588: :endfor without :for"));
 #endif
index bb9fc8eecd78eab6cf41a6948e700d7798e76d57..22a86ed64136ad656227ed91244c87855fcd3513 100644 (file)
@@ -995,7 +995,7 @@ helptags_one(
     if (fd_tags == NULL)
     {
        if (!ignore_writeerr)
-           semsg(_(e_cannot_open_str_for_writing), NameBuff);
+           semsg(_(e_cannot_open_str_for_writing_1), NameBuff);
        FreeWild(filecount, files);
        return;
     }
index 9c8f1ef8495e624c413290dc04856d745295cf4a..7d0c2724875ebc56dfa15d754df7aab4122055a9 100644 (file)
@@ -1919,7 +1919,7 @@ ex_scriptencoding(exarg_T *eap)
 
     if (!getline_equal(eap->getline, eap->cookie, getsourceline))
     {
-       emsg(_("E167: :scriptencoding used outside of a sourced file"));
+       emsg(_(e_scriptencoding_used_outside_of_sourced_file));
        return;
     }
 
@@ -1983,7 +1983,7 @@ ex_finish(exarg_T *eap)
     if (getline_equal(eap->getline, eap->cookie, getsourceline))
        do_finish(eap, FALSE);
     else
-       emsg(_("E168: :finish used outside of a sourced file"));
+       emsg(_(e_finish_used_outside_of_sourced_file));
 }
 
 /*
index 0cc0034f31d92cd1d4fd209f7a2ecdb3cb418866..2c41f6fd655f2508de987c7f55e03367ad2a3bb7 100644 (file)
@@ -678,7 +678,7 @@ parse_compl_arg(
 
     if (command_complete[i].expand == 0)
     {
-       semsg(_("E180: Invalid complete value: %s"), value);
+       semsg(_(e_invalid_complete_value_str), value);
        return FAIL;
     }
 
@@ -726,7 +726,7 @@ uc_scan_attr(
 
     if (len == 0)
     {
-       emsg(_("E175: No attribute specified"));
+       emsg(_(e_no_attribute_specified));
        return FAIL;
     }
 
@@ -781,7 +781,7 @@ uc_scan_attr(
            else
            {
 wrong_nargs:
-               emsg(_("E176: Invalid number of arguments"));
+               emsg(_(e_invalid_number_of_arguments));
                return FAIL;
            }
        }
@@ -796,7 +796,7 @@ wrong_nargs:
                if (*def >= 0)
                {
 two_count:
-                   emsg(_("E177: Count cannot be specified twice"));
+                   emsg(_(e_count_cannot_be_specified_twice));
                    return FAIL;
                }
 
@@ -806,7 +806,7 @@ two_count:
                if (p != val + vallen || vallen == 0)
                {
 invalid_count:
-                   emsg(_("E178: Invalid default value for count"));
+                   emsg(_(e_invalid_default_value_for_count));
                    return FAIL;
                }
            }
@@ -840,7 +840,7 @@ invalid_count:
        {
            if (val == NULL)
            {
-               emsg(_("E179: argument required for -complete"));
+               semsg(_(e_argument_required_for_str), "-complete");
                return FAIL;
            }
 
@@ -853,7 +853,7 @@ invalid_count:
            *argt |= EX_RANGE;
            if (val == NULL)
            {
-               emsg(_("E179: argument required for -addr"));
+               semsg(_(e_argument_required_for_str), "-addr");
                return FAIL;
            }
            if (parse_addr_type_arg(val, (int)vallen, addr_type_arg) == FAIL)
@@ -865,7 +865,7 @@ invalid_count:
        {
            char_u ch = attr[len];
            attr[len] = '\0';
-           semsg(_("E181: Invalid attribute: %s"), attr);
+           semsg(_(e_invalid_attribute_str), attr);
            attr[len] = ch;
            return FAIL;
        }
@@ -945,7 +945,7 @@ uc_add_command(
 #endif
                    )
            {
-               semsg(_("E174: Command already exists: add ! to replace it: %s"),
+               semsg(_(e_command_already_exists_add_bang_to_replace_it_str),
                                                                         name);
                goto fail;
            }
@@ -1085,7 +1085,7 @@ ex_command(exarg_T *eap)
            ++p;
     if (!ends_excmd2(eap->arg, p) && !VIM_ISWHITE(*p))
     {
-       emsg(_("E182: Invalid command name"));
+       emsg(_(e_invalid_command_name));
        return;
     }
     end = p;
@@ -1097,7 +1097,7 @@ ex_command(exarg_T *eap)
     if (!has_attr && ends_excmd2(eap->arg, p))
        uc_list(name, end - name);
     else if (!ASCII_ISUPPER(*name))
-       emsg(_("E183: User defined commands must start with an uppercase letter"));
+       emsg(_(e_user_defined_commands_must_start_with_an_uppercase_letter));
     else if ((name_len == 1 && *name == 'X')
          || (name_len <= 4
                  && STRNCMP(name, "Next", name_len > 4 ? 4 : name_len) == 0))
index 85a1cd315c045d7b37ac89a297a4d154865b2bf5..c3b000eab9df4cec44b4b404f93a292e16cfa760 100644 (file)
@@ -2360,7 +2360,7 @@ copy_func(char_u *lambda, char_u *global, ectx_T *ectx)
     if (fp != NULL)
     {
        // TODO: handle ! to overwrite
-       semsg(_(e_function_str_already_exists_add_excl_to_replace), global);
+       semsg(_(e_function_str_already_exists_add_bang_to_replace), global);
        return FAIL;
     }
 
@@ -4380,7 +4380,7 @@ define_function(exarg_T *eap, char_u *name_arg, char_u **line_to_free)
            if (fudi.fd_dict != NULL && fudi.fd_newkey == NULL)
                emsg(_(e_funcdict));
            else if (name != NULL && find_func(name, is_global, NULL) != NULL)
-               emsg_funcname(e_function_str_already_exists_add_excl_to_replace, name);
+               emsg_funcname(e_function_str_already_exists_add_bang_to_replace, name);
        }
 
        if (!eap->skip && did_emsg)
@@ -4438,7 +4438,7 @@ define_function(exarg_T *eap, char_u *name_arg, char_u **line_to_free)
                if (vim9script)
                    emsg_funcname(e_name_already_defined_str, name);
                else
-                   emsg_funcname(e_function_str_already_exists_add_excl_to_replace, name);
+                   emsg_funcname(e_function_str_already_exists_add_bang_to_replace, name);
                goto erret;
            }
            if (fp->uf_calls > 0)
index d623c586ae9df1d0ac71a4280a20e6d7a5cc3df9..0431474000135a69574a5f1a94af7fb85af15409 100644 (file)
@@ -749,6 +749,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    3957,
 /**/
     3956,
 /**/
index d3411540fc23f362d597678a1b01ba7db3bab334..eb28a7922fe128135f5cb9b8e24697f8511f2b83 100644 (file)
@@ -1520,11 +1520,11 @@ compile_endtry(char_u *arg, cctx_T *cctx)
        if (scope == NULL)
            emsg(_(e_no_endtry));
        else if (scope->se_type == WHILE_SCOPE)
-           emsg(_(e_endwhile));
+           emsg(_(e_missing_endwhile));
        else if (scope->se_type == FOR_SCOPE)
-           emsg(_(e_endfor));
+           emsg(_(e_missing_endfor));
        else
-           emsg(_(e_endif));
+           emsg(_(e_missing_endif));
        return NULL;
     }
 
index 041837830550846865aa228e07e92acf72efc58c..2b14089321e9abb01bc0baeb86283472d1afc010 100644 (file)
@@ -3109,11 +3109,11 @@ nextline:
     if (cctx.ctx_scope != NULL)
     {
        if (cctx.ctx_scope->se_type == IF_SCOPE)
-           emsg(_(e_endif));
+           emsg(_(e_missing_endif));
        else if (cctx.ctx_scope->se_type == WHILE_SCOPE)
-           emsg(_(e_endwhile));
+           emsg(_(e_missing_endwhile));
        else if (cctx.ctx_scope->se_type == FOR_SCOPE)
-           emsg(_(e_endfor));
+           emsg(_(e_missing_endfor));
        else
            emsg(_(e_missing_rcurly));
        goto erret;