0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

patch 8.2.3955: error messages are spread out

Problem:    Error messages are spread out.
Solution:   Move more errors to errors.h.
This commit is contained in:
Bram Moolenaar 2021-12-31 15:09:27 +00:00
parent 9a015111a5
commit eb822a280c
8 changed files with 77 additions and 29 deletions

View File

@ -815,7 +815,7 @@ ex_breakdel(exarg_T *eap)
} }
if (todel < 0) if (todel < 0)
semsg(_("E161: Breakpoint not found: %s"), eap->arg); semsg(_(e_breakpoint_not_found_str), eap->arg);
else else
{ {
while (gap->ga_len > 0) while (gap->ga_len > 0)

View File

@ -302,6 +302,54 @@ EXTERN char e_viminfo_file_is_not_writable_str[]
EXTERN char e_cant_write_viminfo_file_str[] EXTERN char e_cant_write_viminfo_file_str[]
INIT(= N_("E138: Can't write viminfo file %s!")); INIT(= N_("E138: Can't write viminfo file %s!"));
#endif #endif
EXTERN char e_file_is_loaded_in_another_buffer[]
INIT(= N_("E139: File is loaded in another buffer"));
EXTERN char e_use_bang_to_write_partial_buffer[]
INIT(= N_("E140: Use ! to write partial buffer"));
EXTERN char e_no_file_name_for_buffer_nr[]
INIT(= N_("E141: No file name for buffer %ld"));
EXTERN char e_file_not_written_writing_is_disabled_by_write_option[]
INIT(= N_("E142: File not written: Writing is disabled by 'write' option"));
EXTERN char e_autocommands_unexpectedly_deleted_new_buffer_str[]
INIT(= N_("E143: Autocommands unexpectedly deleted new buffer %s"));
EXTERN char e_non_numeric_argument_to_z[]
INIT(= N_("E144: non-numeric argument to :z"));
EXTERN char e_shell_commands_and_some_functionality_not_allowed_in_rvim[]
INIT(= N_("E145: Shell commands and some functionality not allowed in rvim"));
EXTERN char e_regular_expressions_cant_be_delimited_by_letters[]
INIT(= N_("E146: Regular expressions can't be delimited by letters"));
EXTERN char e_cannot_do_global_recursive_with_range[]
INIT(= N_("E147: Cannot do :global recursive with a range"));
EXTERN char e_regular_expression_missing_from_global[]
INIT(= N_("E148: Regular expression missing from :global"));
EXTERN char e_sorry_no_help_for_str[]
INIT(= N_("E149: Sorry, no help for %s"));
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[]
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"));
EXTERN char e_duplicate_tag_str_in_file_str_str[]
INIT(= N_("E154: Duplicate tag \"%s\" in file %s/%s"));
EXTERN char e_unknown_sign_str[]
INIT(= N_("E155: Unknown sign: %s"));
EXTERN char e_missing_sign_name[]
INIT(= N_("E156: Missing sign name"));
EXTERN char e_invalid_sign_id_nr[]
INIT(= N_("E157: Invalid sign ID: %d"));
EXTERN char e_invalid_buffer_name_str[]
INIT(= N_("E158: Invalid buffer name: %s"));
EXTERN char e_missing_sign_number[]
INIT(= N_("E159: Missing sign number"));
EXTERN char e_unknown_sign_command_str[]
INIT(= N_("E160: Unknown sign command: %s"));
#ifdef FEAT_EVAL
EXTERN char e_breakpoint_not_found_str[]
INIT(= N_("E161: Breakpoint not found: %s"));
#endif
EXTERN char e_no_such_user_defined_command_str[] EXTERN char e_no_such_user_defined_command_str[]
INIT(= N_("E184: No such user-defined command: %s")); INIT(= N_("E184: No such user-defined command: %s"));

View File

@ -1941,7 +1941,7 @@ do_write(exarg_T *eap)
{ {
// Overwriting a file that is loaded in another buffer is not a // Overwriting a file that is loaded in another buffer is not a
// good idea. // good idea.
emsg(_(e_bufloaded)); emsg(_(e_file_is_loaded_in_another_buffer));
goto theend; goto theend;
} }
} }
@ -1986,7 +1986,7 @@ do_write(exarg_T *eap)
else else
#endif #endif
{ {
emsg(_("E140: Use ! to write partial buffer")); emsg(_(e_use_bang_to_write_partial_buffer));
goto theend; goto theend;
} }
} }
@ -2268,8 +2268,7 @@ do_wqall(exarg_T *eap)
#endif #endif
if (buf->b_ffname == NULL) if (buf->b_ffname == NULL)
{ {
semsg(_("E141: No file name for buffer %ld"), semsg(_(e_no_file_name_for_buffer_nr), (long)buf->b_fnum);
(long)buf->b_fnum);
++error; ++error;
} }
else if (check_readonly(&eap->forceit, buf) else if (check_readonly(&eap->forceit, buf)
@ -2309,7 +2308,7 @@ not_writing(void)
{ {
if (p_write) if (p_write)
return FALSE; return FALSE;
emsg(_("E142: File not written: Writing is disabled by 'write' option")); emsg(_(e_file_not_written_writing_is_disabled_by_write_option));
return TRUE; return TRUE;
} }
@ -3237,8 +3236,8 @@ theend:
static void static void
delbuf_msg(char_u *name) delbuf_msg(char_u *name)
{ {
semsg(_("E143: Autocommands unexpectedly deleted new buffer %s"), semsg(_(e_autocommands_unexpectedly_deleted_new_buffer_str),
name == NULL ? (char_u *)"" : name); name == NULL ? (char_u *)"" : name);
vim_free(name); vim_free(name);
au_new_curbuf.br_buf = NULL; au_new_curbuf.br_buf = NULL;
au_new_curbuf.br_buf_free_count = 0; au_new_curbuf.br_buf_free_count = 0;
@ -3471,7 +3470,7 @@ ex_z(exarg_T *eap)
{ {
if (!VIM_ISDIGIT(*x)) if (!VIM_ISDIGIT(*x))
{ {
emsg(_("E144: non-numeric argument to :z")); emsg(_(e_non_numeric_argument_to_z));
return; return;
} }
else else
@ -3581,7 +3580,7 @@ check_restricted(void)
{ {
if (restricted) if (restricted)
{ {
emsg(_("E145: Shell commands and some functionality not allowed in rvim")); emsg(_(e_shell_commands_and_some_functionality_not_allowed_in_rvim));
return TRUE; return TRUE;
} }
return FALSE; return FALSE;
@ -3660,7 +3659,7 @@ check_regexp_delim(int c)
{ {
if (isalpha(c)) if (isalpha(c))
{ {
emsg(_("E146: Regular expressions can't be delimited by letters")); emsg(_(e_regular_expressions_cant_be_delimited_by_letters));
return FAIL; return FAIL;
} }
return OK; return OK;
@ -4899,7 +4898,7 @@ ex_global(exarg_T *eap)
|| eap->line2 != curbuf->b_ml.ml_line_count)) || eap->line2 != curbuf->b_ml.ml_line_count))
{ {
// will increment global_busy to break out of the loop // will increment global_busy to break out of the loop
emsg(_("E147: Cannot do :global recursive with a range")); emsg(_(e_cannot_do_global_recursive_with_range));
return; return;
} }
@ -4937,7 +4936,7 @@ ex_global(exarg_T *eap)
} }
else if (*cmd == NUL) else if (*cmd == NUL)
{ {
emsg(_("E148: Regular expression missing from global")); emsg(_(e_regular_expression_missing_from_global));
return; return;
} }
else if (check_regexp_delim(*cmd) == FAIL) else if (check_regexp_delim(*cmd) == FAIL)

View File

@ -1740,7 +1740,6 @@ EXTERN char e_maxmempat[] INIT(= N_("E363: pattern uses more memory than 'maxmem
EXTERN char e_emptybuf[] INIT(= N_("E749: empty buffer")); EXTERN char e_emptybuf[] INIT(= N_("E749: empty buffer"));
EXTERN char e_invalpat[] INIT(= N_("E682: Invalid search pattern or delimiter")); EXTERN char e_invalpat[] INIT(= N_("E682: Invalid search pattern or delimiter"));
EXTERN char e_bufloaded[] INIT(= N_("E139: File is loaded in another buffer"));
#if defined(FEAT_SYN_HL) || defined(FEAT_COMPL_FUNC) #if defined(FEAT_SYN_HL) || defined(FEAT_COMPL_FUNC)
EXTERN char e_notset[] INIT(= N_("E764: Option '%s' is not set")); EXTERN char e_notset[] INIT(= N_("E764: Option '%s' is not set"));
#endif #endif

View File

@ -107,7 +107,7 @@ ex_help(exarg_T *eap)
semsg(_("E661: Sorry, no '%s' help for %s"), lang, arg); semsg(_("E661: Sorry, no '%s' help for %s"), lang, arg);
else else
#endif #endif
semsg(_("E149: Sorry, no help for %s"), arg); semsg(_(e_sorry_no_help_for_str), arg);
if (n != FAIL) if (n != FAIL)
FreeWild(num_matches, matches); FreeWild(num_matches, matches);
return; return;
@ -982,7 +982,7 @@ helptags_one(
|| filecount == 0) || filecount == 0)
{ {
if (!got_int) if (!got_int)
semsg(_("E151: No match: %s"), NameBuff); semsg(_(e_no_match_str), NameBuff);
return; return;
} }
@ -995,7 +995,7 @@ helptags_one(
if (fd_tags == NULL) if (fd_tags == NULL)
{ {
if (!ignore_writeerr) if (!ignore_writeerr)
semsg(_("E152: Cannot open %s for writing"), NameBuff); semsg(_(e_cannot_open_str_for_writing), NameBuff);
FreeWild(filecount, files); FreeWild(filecount, files);
return; return;
} }
@ -1028,7 +1028,7 @@ helptags_one(
fd = mch_fopen((char *)files[fi], "r"); fd = mch_fopen((char *)files[fi], "r");
if (fd == NULL) if (fd == NULL)
{ {
semsg(_("E153: Unable to open %s for reading"), files[fi]); semsg(_(e_unable_to_open_str_for_reading), files[fi]);
continue; continue;
} }
fname = files[fi] + dirlen + 1; fname = files[fi] + dirlen + 1;
@ -1136,7 +1136,7 @@ helptags_one(
{ {
*p2 = NUL; *p2 = NUL;
vim_snprintf((char *)NameBuff, MAXPATHL, vim_snprintf((char *)NameBuff, MAXPATHL,
_("E154: Duplicate tag \"%s\" in file %s/%s"), _(e_duplicate_tag_str_in_file_str_str),
((char_u **)ga.ga_data)[i], dir, p2 + 1); ((char_u **)ga.ga_data)[i], dir, p2 + 1);
emsg((char *)NameBuff); emsg((char *)NameBuff);
*p2 = '\t'; *p2 = '\t';
@ -1316,7 +1316,7 @@ ex_helptags(exarg_T *eap)
dirname = ExpandOne(&xpc, eap->arg, NULL, dirname = ExpandOne(&xpc, eap->arg, NULL,
WILD_LIST_NOTFOUND|WILD_SILENT, WILD_EXPAND_FREE); WILD_LIST_NOTFOUND|WILD_SILENT, WILD_EXPAND_FREE);
if (dirname == NULL || !mch_isdir(dirname)) if (dirname == NULL || !mch_isdir(dirname))
semsg(_("E150: Not a directory: %s"), eap->arg); semsg(_(e_not_a_directory_str), eap->arg);
else else
do_helptags(dirname, add_help_tags, FALSE); do_helptags(dirname, add_help_tags, FALSE);
vim_free(dirname); vim_free(dirname);

View File

@ -1140,7 +1140,7 @@ sign_undefine_by_name(char_u *name, int give_error)
if (sp == NULL) if (sp == NULL)
{ {
if (give_error) if (give_error)
semsg(_("E155: Unknown sign: %s"), name); semsg(_(e_unknown_sign_str), name);
return FAIL; return FAIL;
} }
sign_undefine(sp, sp_prev); sign_undefine(sp, sp_prev);
@ -1160,7 +1160,7 @@ sign_list_by_name(char_u *name)
if (sp != NULL) if (sp != NULL)
sign_list_defined(sp); sign_list_defined(sp);
else else
semsg(_("E155: Unknown sign: %s"), name); semsg(_(e_unknown_sign_str), name);
} }
static void static void
@ -1200,7 +1200,7 @@ sign_place(
break; break;
if (sp == NULL) if (sp == NULL)
{ {
semsg(_("E155: Unknown sign: %s"), sign_name); semsg(_(e_unknown_sign_str), sign_name);
return FAIL; return FAIL;
} }
if (*sign_id == 0) if (*sign_id == 0)
@ -1277,7 +1277,7 @@ sign_unplace_at_cursor(char_u *groupname)
if (id > 0) if (id > 0)
sign_unplace(id, groupname, curwin->w_buffer, curwin->w_cursor.lnum); sign_unplace(id, groupname, curwin->w_buffer, curwin->w_cursor.lnum);
else else
emsg(_("E159: Missing sign number")); emsg(_(e_missing_sign_number));
} }
/* /*
@ -1290,7 +1290,7 @@ sign_jump(int sign_id, char_u *sign_group, buf_T *buf)
if ((lnum = buf_findsign(buf, sign_id, sign_group)) <= 0) if ((lnum = buf_findsign(buf, sign_id, sign_group)) <= 0)
{ {
semsg(_("E157: Invalid sign ID: %d"), sign_id); semsg(_(e_invalid_sign_id_nr), sign_id);
return -1; return -1;
} }
@ -1643,7 +1643,7 @@ parse_sign_cmd_args(
if (filename != NULL && *buf == NULL) if (filename != NULL && *buf == NULL)
{ {
semsg(_("E158: Invalid buffer name: %s"), filename); semsg(_(e_invalid_buffer_name_str), filename);
return FAIL; return FAIL;
} }
@ -1673,7 +1673,7 @@ ex_sign(exarg_T *eap)
idx = sign_cmd_idx(arg, p); idx = sign_cmd_idx(arg, p);
if (idx == SIGNCMD_LAST) if (idx == SIGNCMD_LAST)
{ {
semsg(_("E160: Unknown sign command: %s"), arg); semsg(_(e_unknown_sign_command_str), arg);
return; return;
} }
arg = skipwhite(p); arg = skipwhite(p);
@ -1688,7 +1688,7 @@ ex_sign(exarg_T *eap)
sign_list_defined(sp); sign_list_defined(sp);
} }
else if (*arg == NUL) else if (*arg == NUL)
emsg(_("E156: Missing sign name")); emsg(_(e_missing_sign_name));
else else
{ {
char_u *name; char_u *name;

View File

@ -6240,7 +6240,7 @@ spell_add_word(
buf = NULL; buf = NULL;
if (buf != NULL && bufIsChanged(buf)) if (buf != NULL && bufIsChanged(buf))
{ {
emsg(_(e_bufloaded)); emsg(_(e_file_is_loaded_in_another_buffer));
vim_free(fnamebuf); vim_free(fnamebuf);
return; return;
} }

View File

@ -749,6 +749,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
3955,
/**/ /**/
3954, 3954,
/**/ /**/