]> granicus.if.org Git - vim/commitdiff
patch 8.2.3972: error messages are spread out v8.2.3972
authorBram Moolenaar <Bram@vim.org>
Sat, 1 Jan 2022 16:21:00 +0000 (16:21 +0000)
committerBram Moolenaar <Bram@vim.org>
Sat, 1 Jan 2022 16:21:00 +0000 (16:21 +0000)
Problem:    Error messages are spread out.
Solution:   Move the last errors from globals.h to errors.h.

15 files changed:
src/errors.h
src/eval.c
src/evalfunc.c
src/evalvars.c
src/evalwindow.c
src/ex_eval.c
src/globals.h
src/list.c
src/match.c
src/menu.c
src/popupmenu.c
src/search.c
src/version.c
src/vim9cmds.c
src/vim9expr.c

index a333385f55bab878090b944f866e6f27b5c468d4..27dde8ff158fad67974ea92ea6eca4f55f744298 100644 (file)
@@ -528,7 +528,15 @@ EXTERN char e_cannot_allocate_color_str[]
 EXTERN char e_couldnt_read_in_sign_data[]
        INIT(= N_("E255: Couldn't read in sign data"));
 #endif
+#ifdef FEAT_EVAL
+EXTERN char e_no_white_space_allowed_before_parenthesis[]
+       INIT(= N_("E274: No white space allowed before parenthesis"));
+#endif
 
+#ifdef FEAT_MENU
+EXTERN char e_menu_only_exists_in_another_mode[]
+       INIT(= N_("E328: Menu only exists in another mode"));
+#endif
 EXTERN char e_internal_error_lalloc_zero[]
        INIT(= N_("E341: Internal error: lalloc(0, )"));
 EXTERN char e_out_of_memory_allocating_nr_bytes[]
@@ -668,6 +676,16 @@ EXTERN char e_not_allowed_to_change_text_or_change_window[]
 EXTERN char e_not_allowed_to_change_text_here[]
        INIT(= N_("E578: Not allowed to change text here"));
 #ifdef FEAT_EVAL
+EXTERN char e_endif_without_if[]
+       INIT(= N_("E580: :endif without :if"));
+EXTERN char e_else_without_if[]
+       INIT(= N_("E581: :else without :if"));
+EXTERN char e_elseif_without_if[]
+       INIT(= N_("E582: :elseif without :if"));
+EXTERN char e_continue_without_while_or_for[]
+       INIT(= N_("E586: :continue without :while or :for"));
+EXTERN char e_break_without_while_or_for[]
+       INIT(= N_("E587: :break without :while or :for"));
 EXTERN char e_endwhile_without_while[]
        INIT(= N_("E588: :endwhile without :while"));
 EXTERN char e_endfor_without_for[]
@@ -716,11 +734,17 @@ EXTERN char e_list_index_out_of_range_nr[]
 EXTERN char e_internal_error_str[]
        INIT(= N_("E685: Internal error: %s"));
 #ifdef FEAT_EVAL
+EXTERN char e_argument_of_str_must_be_list[]
+       INIT(= N_("E686: Argument of %s must be a List"));
+EXTERN char e_missing_in_after_for[]
+       INIT(= N_("E690: Missing \"in\" after :for"));
+// E693 unused
 EXTERN char e_cannot_index_a_funcref[]
        INIT(= N_("E695: Cannot index a Funcref"));
 EXTERN char e_missing_end_of_list_rsb_str[]
        INIT(= N_("E697: Missing end of List ']': %s"));
 
+// E706 unused
 EXTERN char e_list_value_has_more_items_than_targets[]
        INIT(= N_("E710: List value has more items than targets"));
 EXTERN char e_list_value_does_not_have_enough_items[]
@@ -864,6 +888,10 @@ EXTERN char e_attempt_to_delete_buffer_that_is_in_use_str[]
        INIT(= N_("E937: Attempt to delete a buffer that is in use: %s"));
 EXTERN char e_positive_count_required[]
        INIT(= N_("E939: Positive count required"));
+#ifdef FEAT_EVAL
+EXTERN char e_cannot_lock_or_unlock_variable_str[]
+       INIT(= N_("E940: Cannot lock or unlock variable %s"));
+#endif
 #ifdef FEAT_TERMINAL
 EXTERN char e_job_still_running[]
        INIT(= N_("E948: Job still running"));
@@ -874,6 +902,8 @@ EXTERN char e_file_changed_while_writing[]
        INIT(= N_("E949: File changed while writing"));
 EXTERN char e_autocommand_caused_recursive_behavior[]
        INIT(= N_("E952: Autocommand caused recursive behavior"));
+EXTERN char e_invalid_window_number[]
+       INIT(= N_("E957: Invalid window number"));
 EXTERN char_u e_invalid_column_number_nr[]
        INIT(= N_("E964: Invalid column number: %ld"));
 EXTERN char_u e_invalid_line_number_nr[]
index fa3941c94d77c3ae46eae0c86aafbc96c929ff0e..f22806776aabdca18346d0be80395c077e2ebbfa 100644 (file)
@@ -1632,7 +1632,7 @@ eval_for_line(
        if (in_vim9script() && *expr == ':' && expr != var_list_end)
            semsg(_(e_no_white_space_allowed_before_colon_str), expr);
        else
-           emsg(_(e_missing_in));
+           emsg(_(e_missing_in_after_for));
        return fi;
     }
 
@@ -3888,7 +3888,7 @@ eval_lambda(
        if (verbose)
        {
            if (*skipwhite(*arg) == '(')
-               emsg(_(e_nowhitespace));
+               emsg(_(e_no_white_space_allowed_before_parenthesis));
            else
                semsg(_(e_missing_parenthesis_str), "lambda");
        }
@@ -3951,7 +3951,7 @@ eval_method(
        else if (VIM_ISWHITE((*arg)[-1]))
        {
            if (verbose)
-               emsg(_(e_nowhitespace));
+               emsg(_(e_no_white_space_allowed_before_parenthesis));
            ret = FAIL;
        }
        else
@@ -5948,7 +5948,7 @@ handle_subscript(
            {
                if (VIM_ISWHITE(**arg))
                {
-                   emsg(_(e_nowhitespace));
+                   emsg(_(e_no_white_space_allowed_before_parenthesis));
                    ret = FAIL;
                }
                else if ((**arg == '{' && !in_vim9script()) || **arg == '(')
index 92764c65b5b208431ba8ef4b18a4a19b25a4f53d..f491a7c980082334107adf652d585421f07e42f5 100644 (file)
@@ -3071,7 +3071,7 @@ get_optional_window(typval_T *argvars, int idx)
        win = find_win_by_nr_or_id(&argvars[idx]);
        if (win == NULL)
        {
-           emsg(_(e_invalwindow));
+           emsg(_(e_invalid_window_number));
            return NULL;
        }
     }
@@ -6570,7 +6570,7 @@ f_inputlist(typval_T *argvars, typval_T *rettv)
 
     if (argvars[0].v_type != VAR_LIST || argvars[0].vval.v_list == NULL)
     {
-       semsg(_(e_listarg), "inputlist()");
+       semsg(_(e_argument_of_str_must_be_list), "inputlist()");
        return;
     }
 
index a54158f340888b959bab9b10982e64cafde550ed..fba668dd8c33ff69e96a612f2f834c4dc9fe89d4 100644 (file)
@@ -1889,7 +1889,7 @@ do_lock_var(
        *name_end = NUL;
        if (*lp->ll_name == '$')
        {
-           semsg(_(e_lock_unlock), lp->ll_name);
+           semsg(_(e_cannot_lock_or_unlock_variable_str), lp->ll_name);
            ret = FAIL;
        }
        else
@@ -1909,7 +1909,7 @@ do_lock_var(
            {
                // For historic reasons this error is not given for a list or
                // dict.  E.g., the b: dict could be locked/unlocked.
-               semsg(_(e_lock_unlock), lp->ll_name);
+               semsg(_(e_cannot_lock_or_unlock_variable_str), lp->ll_name);
                ret = FAIL;
            }
            else
index f86302684b905caad1bafbee20499617c210e135..0fc62d1cc270b3aed28108d07f84e258f4789a6a 100644 (file)
@@ -916,7 +916,7 @@ f_win_splitmove(typval_T *argvars, typval_T *rettv)
            || !win_valid(wp) || !win_valid(targetwin)
            || win_valid_popup(wp) || win_valid_popup(targetwin))
     {
-        emsg(_(e_invalwindow));
+        emsg(_(e_invalid_window_number));
        rettv->vval.v_number = -1;
        return;
     }
index 4f4a0a6f8a1857a09e8a507df3e70c784b4d754a..9a4780232c187a5c79d5fad510ad1cf6eddc2ead 100644 (file)
@@ -1316,7 +1316,7 @@ ex_continue(exarg_T *eap)
     cstack_T   *cstack = eap->cstack;
 
     if (cstack->cs_looplevel <= 0 || cstack->cs_idx < 0)
-       eap->errmsg = _(e_continue);
+       eap->errmsg = _(e_continue_without_while_or_for);
     else
     {
        // Try to find the matching ":while".  This might stop at a try
@@ -1354,7 +1354,7 @@ ex_break(exarg_T *eap)
     cstack_T   *cstack = eap->cstack;
 
     if (cstack->cs_looplevel <= 0 || cstack->cs_idx < 0)
-       eap->errmsg = _(e_break);
+       eap->errmsg = _(e_break_without_while_or_for);
     else
     {
        // Inactivate conditionals until the matching ":while" or a try
index 1e8fd25f6b97d61e3627412eaec2dbbe72af3d67..cdad353606cc09f7e89e0eedd778f0ae54e9cc86 100644 (file)
@@ -1600,36 +1600,15 @@ EXTERN int netbeansSuppressNoLines INIT(= 0); // skip "No lines in buffer"
 #endif
 
 /*
- * Some error messages that can be shared are included here.
- * They should be moved to errors.h.
+ * Some messages that can be shared are included here.
  */
-#ifdef FEAT_MENU
-EXTERN char e_menuothermode[]  INIT(= N_("E328: Menu only exists in another mode"));
-#endif
-EXTERN char e_invalwindow[]    INIT(= N_("E957: Invalid window number"));
-EXTERN char e_listarg[]                INIT(= N_("E686: Argument of %s must be a List"));
-#ifdef FEAT_EVAL
-EXTERN char e_missing_in[]     INIT(= N_("E690: Missing \"in\" after :for"));
-EXTERN char e_else_without_if[] INIT(= N_("E581: :else without :if"));
-EXTERN char e_elseif_without_if[] INIT(= N_("E582: :elseif without :if"));
-EXTERN char e_endif_without_if[] INIT(= N_("E580: :endif without :if"));
-EXTERN char e_continue[]       INIT(= N_("E586: :continue without :while or :for"));
-EXTERN char e_break[]          INIT(= N_("E587: :break without :while or :for"));
-EXTERN char e_nowhitespace[]   INIT(= N_("E274: No white space allowed before parenthesis"));
-
-EXTERN char e_lock_unlock[]    INIT(= N_("E940: Cannot lock or unlock variable %s"));
-#endif
-
-EXTERN char e_chan_or_job_req[]        INIT(= N_("E706: Channel or Job required"));
-EXTERN char e_jobreq[]         INIT(= N_("E693: Job required"));
-
-EXTERN char top_bot_msg[] INIT(= N_("search hit TOP, continuing at BOTTOM"));
-EXTERN char bot_top_msg[] INIT(= N_("search hit BOTTOM, continuing at TOP"));
+EXTERN char top_bot_msg[]   INIT(= N_("search hit TOP, continuing at BOTTOM"));
+EXTERN char bot_top_msg[]   INIT(= N_("search hit BOTTOM, continuing at TOP"));
 
-EXTERN char line_msg[]         INIT(= N_(" line "));
+EXTERN char line_msg[]     INIT(= N_(" line "));
 
 #ifdef FEAT_CRYPT
-EXTERN char need_key_msg[] INIT(= N_("Need encryption key for \"%s\""));
+EXTERN char need_key_msg[]  INIT(= N_("Need encryption key for \"%s\""));
 #endif
 
 /*
index fe8c082fe465209ab54330fea96664bfbb79aeb8..743ccf5193c298151e0249812a84562561577b16 100644 (file)
@@ -992,7 +992,7 @@ flatten_common(typval_T *argvars, typval_T *rettv, int make_copy)
 
     if (argvars[0].v_type != VAR_LIST)
     {
-       semsg(_(e_listarg), "flatten()");
+       semsg(_(e_argument_of_str_must_be_list), "flatten()");
        return;
     }
 
@@ -2202,7 +2202,7 @@ do_sort_uniq(typval_T *argvars, typval_T *rettv, int sort)
 
     if (argvars[0].v_type != VAR_LIST)
     {
-       semsg(_(e_listarg), sort ? "sort()" : "uniq()");
+       semsg(_(e_argument_of_str_must_be_list), sort ? "sort()" : "uniq()");
        return;
     }
 
index 9589d55abcd8a8016c8e5d22b72c51b2035faba1..082c0793eee3242d00db7d6264a1fbdf3cd7df94 100644 (file)
@@ -949,7 +949,7 @@ matchadd_dict_arg(typval_T *tv, char_u **conceal_char, win_T **win)
        *win = find_win_by_nr_or_id(&di->di_tv);
        if (*win == NULL)
        {
-           emsg(_(e_invalwindow));
+           emsg(_(e_invalid_window_number));
            return FAIL;
        }
     }
@@ -1259,7 +1259,7 @@ f_matchaddpos(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
 
     if (argvars[1].v_type != VAR_LIST)
     {
-       semsg(_(e_listarg), "matchaddpos()");
+       semsg(_(e_argument_of_str_must_be_list), "matchaddpos()");
        return;
     }
     l = argvars[1].vval.v_list;
index 9ecba448e41a5eaedf9b4cfb9afc68b57e36b8c1..0583c10fae9d12bfae83045666ac95d5dc95be2b 100644 (file)
@@ -959,7 +959,7 @@ remove_menu(
            else if (*name != NUL)
            {
                if (!silent)
-                   emsg(_(e_menuothermode));
+                   emsg(_(e_menu_only_exists_in_another_mode));
                return FAIL;
            }
 
@@ -1133,7 +1133,7 @@ show_menus(char_u *path_name, int modes)
                }
                else if ((menu->modes & modes) == 0x0)
                {
-                   emsg(_(e_menuothermode));
+                   emsg(_(e_menu_only_exists_in_another_mode));
                    vim_free(path_name);
                    return FAIL;
                }
index 86a9cbb0704a6b9d034b4d5aa71588136e6d5e6e..cf5558b0743ce3b0b46337266f277829c44e52c0 100644 (file)
@@ -1476,7 +1476,7 @@ pum_show_popupmenu(vimmenu_T *menu)
     // pum_size being zero.
     if (pum_size <= 0)
     {
-       emsg(e_menuothermode);
+       emsg(e_menu_only_exists_in_another_mode);
        return;
     }
 
index 35a4a3a1e71f3d8a0b2f69b89cced7ee09e2d05f..c3597e65794a84b096cf12cd859cd7e03be2bbb4 100644 (file)
@@ -4807,7 +4807,8 @@ do_fuzzymatch(typval_T *argvars, typval_T *rettv, int retmatchpos)
     // validate and get the arguments
     if (argvars[0].v_type != VAR_LIST || argvars[0].vval.v_list == NULL)
     {
-       semsg(_(e_listarg), retmatchpos ? "matchfuzzypos()" : "matchfuzzy()");
+       semsg(_(e_argument_of_str_must_be_list),
+                            retmatchpos ? "matchfuzzypos()" : "matchfuzzy()");
        return;
     }
     if (argvars[1].v_type != VAR_STRING
index 86c7a472ab189aa1fb4fa99f7db1ff10510576ce..f98cf4352ece9067b30fe2bbaaf4292d7b3b56aa 100644 (file)
@@ -749,6 +749,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    3972,
 /**/
     3971,
 /**/
index 250c265ff2cfcebebfd04d5da2ef649ee645f622..5a86a940ccfd04e3c90f67ac525c953ae177a292 100644 (file)
@@ -796,7 +796,7 @@ compile_for(char_u *arg_start, cctx_T *cctx)
        if (*p == ':' && wp != p)
            semsg(_(e_no_white_space_allowed_before_colon_str), p);
        else
-           emsg(_(e_missing_in));
+           emsg(_(e_missing_in_after_for));
        return NULL;
     }
     wp = p + 2;
@@ -1150,7 +1150,7 @@ compile_continue(char_u *arg, cctx_T *cctx)
     {
        if (scope == NULL)
        {
-           emsg(_(e_continue));
+           emsg(_(e_continue_without_while_or_for));
            return NULL;
        }
        if (scope->se_type == FOR_SCOPE)
@@ -1192,7 +1192,7 @@ compile_break(char_u *arg, cctx_T *cctx)
     {
        if (scope == NULL)
        {
-           emsg(_(e_break));
+           emsg(_(e_break_without_while_or_for));
            return NULL;
        }
        if (scope->se_type == FOR_SCOPE || scope->se_type == WHILE_SCOPE)
index ff106d1896aa6099e613ffdd2160489d4363794e..0c3f3e503090da7c6f3484003e6ed96a7f87b861 100644 (file)
@@ -1659,7 +1659,7 @@ compile_subscript(
                if (**arg != '(')
                {
                    if (*skipwhite(*arg) == '(')
-                       emsg(_(e_nowhitespace));
+                       emsg(_(e_no_white_space_allowed_before_parenthesis));
                    else
                        semsg(_(e_missing_parenthesis_str), *arg);
                    return FAIL;