summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-12-31 17:25:48 +0000
committerBram Moolenaar <Bram@vim.org>2021-12-31 17:25:48 +0000
commit1a9922243a90f213894d5c58cd063465eea3350f (patch)
treeb9fb1efe82d000b215d8b99750372e4f2ec7ba92
parent4b1478093eb8b8bebc94b1f596e0afc25db4d189 (diff)
downloadvim-git-8.2.3957.tar.gz
patch 8.2.3957: error messages are spread outv8.2.3957
Problem: Error messages are spread out. Solution: Move more errors to errors.h.
-rw-r--r--src/arglist.c6
-rw-r--r--src/bufwrite.c3
-rw-r--r--src/errors.h67
-rw-r--r--src/evalvars.c2
-rw-r--r--src/ex_cmds2.c2
-rw-r--r--src/ex_docmd.c24
-rw-r--r--src/ex_eval.c8
-rw-r--r--src/globals.h3
-rw-r--r--src/help.c2
-rw-r--r--src/scriptfile.c4
-rw-r--r--src/usercmd.c22
-rw-r--r--src/userfunc.c6
-rw-r--r--src/version.c2
-rw-r--r--src/vim9cmds.c6
-rw-r--r--src/vim9compile.c6
15 files changed, 112 insertions, 51 deletions
diff --git a/src/arglist.c b/src/arglist.c
index 90ee4796b..2db9b9e53 100644
--- a/src/arglist.c
+++ b/src/arglist.c
@@ -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
{
diff --git a/src/bufwrite.c b/src/bufwrite.c
index 035c859e2..8ffc7e086 100644
--- a/src/bufwrite.c
+++ b/src/bufwrite.c
@@ -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
{
diff --git a/src/errors.h b/src/errors.h
index 592de4598..23b858355 100644
--- a/src/errors.h
+++ b/src/errors.h
@@ -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"));
diff --git a/src/evalvars.c b/src/evalvars.c
index adc9c204c..4ddd215b0 100644
--- a/src/evalvars.c
+++ b/src/evalvars.c
@@ -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;
}
}
diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c
index 8e7da18aa..b118c2d74 100644
--- a/src/ex_cmds2.c
+++ b/src/ex_cmds2.c
@@ -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;
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index a9adea3b6..40955ad46 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -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;
}
diff --git a/src/ex_eval.c b/src/ex_eval.c
index b3c38a1ea..337f1ed14 100644
--- a/src/ex_eval.c
+++ b/src/ex_eval.c
@@ -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);
}
diff --git a/src/globals.h b/src/globals.h
index a7e98450c..2341f2d23 100644
--- a/src/globals.h
+++ b/src/globals.h
@@ -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
diff --git a/src/help.c b/src/help.c
index bb9fc8eec..22a86ed64 100644
--- a/src/help.c
+++ b/src/help.c
@@ -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;
}
diff --git a/src/scriptfile.c b/src/scriptfile.c
index 9c8f1ef84..7d0c27248 100644
--- a/src/scriptfile.c
+++ b/src/scriptfile.c
@@ -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));
}
/*
diff --git a/src/usercmd.c b/src/usercmd.c
index 0cc0034f3..2c41f6fd6 100644
--- a/src/usercmd.c
+++ b/src/usercmd.c
@@ -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))
diff --git a/src/userfunc.c b/src/userfunc.c
index 85a1cd315..c3b000eab 100644
--- a/src/userfunc.c
+++ b/src/userfunc.c
@@ -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)
diff --git a/src/version.c b/src/version.c
index d623c586a..043147400 100644
--- a/src/version.c
+++ b/src/version.c
@@ -750,6 +750,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 3957,
+/**/
3956,
/**/
3955,
diff --git a/src/vim9cmds.c b/src/vim9cmds.c
index d3411540f..eb28a7922 100644
--- a/src/vim9cmds.c
+++ b/src/vim9cmds.c
@@ -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;
}
diff --git a/src/vim9compile.c b/src/vim9compile.c
index 041837830..2b1408932 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -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;