1
0
forked from aniani/vim

patch 8.2.3975: error messages are spread out

Problem:    Error messages are spread out.
Solution:   Move more error messages to errors.h.
This commit is contained in:
Bram Moolenaar 2022-01-01 19:33:50 +00:00
parent 1f4a3457a3
commit cbadefe25a
14 changed files with 104 additions and 34 deletions

View File

@ -709,7 +709,7 @@ check_connection(void)
make_connection(); make_connection();
if (X_DISPLAY == NULL) if (X_DISPLAY == NULL)
{ {
emsg(_("E240: No connection to the X server")); emsg(_(e_no_connection_to_x_server));
return FAIL; return FAIL;
} }
return OK; return OK;
@ -759,7 +759,7 @@ remote_common(typval_T *argvars, typval_T *rettv, int expr)
vim_free(r); vim_free(r);
} }
else else
semsg(_("E241: Unable to send to %s"), server_name); semsg(_(e_unable_to_send_to_str), server_name);
return; return;
} }
@ -1016,7 +1016,7 @@ f_server2client(typval_T *argvars UNUSED, typval_T *rettv)
if (serverSendReply(server, reply) < 0) if (serverSendReply(server, reply) < 0)
{ {
emsg(_("E258: Unable to send to client")); emsg(_(e_unable_to_send_to_client));
return; return;
} }
rettv->vval.v_number = 0; rettv->vval.v_number = 0;

View File

@ -494,14 +494,20 @@ EXTERN char e_mapping_already_exists_for_str[]
INIT(= N_("E227: mapping already exists for %s")); INIT(= N_("E227: mapping already exists for %s"));
EXTERN char e_makemap_illegal_mode[] EXTERN char e_makemap_illegal_mode[]
INIT(= N_("E228: makemap: Illegal mode")); INIT(= N_("E228: makemap: Illegal mode"));
#ifdef FEAT_GUI
EXTERN char e_cannot_start_the_GUI[] EXTERN char e_cannot_start_the_GUI[]
INIT(= N_("E229: Cannot start the GUI")); INIT(= N_("E229: Cannot start the GUI"));
EXTERN char e_cannot_read_from_str[]
INIT(= N_("E230: Cannot read from \"%s\""));
EXTERN char e_guifontwide_invalid[]
INIT(= N_("E231: 'guifontwide' invalid"));
EXTERN char e_cannot_create_ballooneval_with_both_message_and_callback[]
INIT(= N_("E232: Cannot create BalloonEval with both message and callback"));
# if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_X11) # if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_X11)
EXTERN char e_cannot_open_display[] EXTERN char e_cannot_open_display[]
INIT(= N_("E233: cannot open display")); INIT(= N_("E233: cannot open display"));
# endif # endif
#if defined(FEAT_GUI) && defined(FEAT_XFONTSET) # if defined(FEAT_XFONTSET)
EXTERN char e_unknown_fontset_str[] EXTERN char e_unknown_fontset_str[]
INIT(= N_("E234: Unknown fontset: %s")); INIT(= N_("E234: Unknown fontset: %s"));
# endif # endif
@ -514,12 +520,59 @@ EXTERN char e_unknown_font_str[]
EXTERN char e_font_str_is_not_fixed_width[] EXTERN char e_font_str_is_not_fixed_width[]
INIT(= N_("E236: Font \"%s\" is not fixed-width")); INIT(= N_("E236: Font \"%s\" is not fixed-width"));
# endif # endif
#endif
#ifdef MSWIN
EXTERN char e_printer_selection_failed[]
INIT(= N_("E237: Printer selection failed"));
EXTERN char e_print_error_str[]
INIT(= N_("E238: Print error: %s"));
#endif
EXTERN char e_invalid_sign_text_str[]
INIT(= N_("E239: Invalid sign text: %s"));
#if defined(FEAT_CLIENTSERVER) && defined(FEAT_X11)
EXTERN char e_no_connection_to_x_server[]
INIT(= N_("E240: No connection to the X server"));
#endif
#ifdef FEAT_CLIENTSERVER
EXTERN char e_unable_to_send_to_str[]
INIT(= N_("E241: Unable to send to %s"));
#endif
EXTERN char e_cant_split_window_while_closing_another[]
INIT(= N_("E242: Can't split a window while closing another"));
#if defined(FEAT_GUI_MSWIN) && !defined(FEAT_OLE)
EXTERN char e_argument_not_supported_str_use_ole_version[]
INIT(= N_("E243: Argument not supported: \"-%s\"; Use the OLE version."));
#endif
#ifdef MSWIN
EXTERN char e_illegal_str_name_str_in_font_name_str[]
INIT(= N_("E244: Illegal %s name \"%s\" in font name \"%s\""));
EXTERN char e_illegal_char_nr_in_font_name_str[]
INIT(= N_("E245: Illegal char '%c' in font name \"%s\""));
#endif
EXTERN char e_filechangedshell_autocommand_deleted_buffer[]
INIT(= N_("E246: FileChangedShell autocommand deleted buffer"));
#ifdef FEAT_CLIENTSERVER #ifdef FEAT_CLIENTSERVER
EXTERN char e_no_registered_server_named_str[] EXTERN char e_no_registered_server_named_str[]
INIT(= N_("E247: no registered server named \"%s\"")); INIT(= N_("E247: no registered server named \"%s\""));
EXTERN char e_failed_to_send_command_to_destination_program[]
INIT(= N_("E248: Failed to send command to the destination program"));
#endif #endif
EXTERN char e_window_layout_changed_unexpectedly[] EXTERN char e_window_layout_changed_unexpectedly[]
INIT(= N_("E249: window layout changed unexpectedly")); INIT(= N_("E249: window layout changed unexpectedly"));
#ifdef FEAT_XFONTSET
EXTERN char e_fonts_for_the_following_charsets_are_missing_in_fontset[]
INIT(= N_("E250: Fonts for the following charsets are missing in fontset %s:"));
#endif
#ifdef FEAT_CLIENTSERVER
EXTERN char e_vim_instance_registry_property_is_badly_formed_deleted[]
INIT(= N_("E251: VIM instance registry property is badly formed. Deleted!"));
#endif
#ifdef FEAT_GUI_X11
EXTERN char e_fontsent_name_str_font_str_is_not_fixed_width[]
INIT(= N_("E252: Fontset name: %s - Font '%s' is not fixed-width"));
EXTERN char e_fontset_name_str[]
INIT(= N_("E253: Fontset name: %s"));
#endif
#if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) #if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS)
EXTERN char e_cannot_allocate_color_str[] EXTERN char e_cannot_allocate_color_str[]
INIT(= N_("E254: Cannot allocate color %s")); INIT(= N_("E254: Cannot allocate color %s"));
@ -528,6 +581,18 @@ EXTERN char e_cannot_allocate_color_str[]
EXTERN char e_couldnt_read_in_sign_data[] EXTERN char e_couldnt_read_in_sign_data[]
INIT(= N_("E255: Couldn't read in sign data")); INIT(= N_("E255: Couldn't read in sign data"));
#endif #endif
// E256 unused
EXTERN char e_cstag_tag_not_founc[]
INIT(= N_("E257: cstag: tag not found"));
#ifdef FEAT_CLIENTSERVER
EXTERN char e_unable_to_send_to_client[]
INIT(= N_("E258: Unable to send to client"));
#endif
#ifdef FEAT_CSCOPE
EXTERN char e_no_matches_found_for_cscope_query_str_of_str[]
INIT(= N_("E259: no matches found for cscope query %s of %s"));
#endif
#ifdef FEAT_EVAL #ifdef FEAT_EVAL
EXTERN char e_no_white_space_allowed_before_parenthesis[] EXTERN char e_no_white_space_allowed_before_parenthesis[]
INIT(= N_("E274: No white space allowed before parenthesis")); INIT(= N_("E274: No white space allowed before parenthesis"));

View File

@ -4155,7 +4155,7 @@ buf_check_timestamp(
if (n) if (n)
{ {
if (!bufref_valid(&bufref)) if (!bufref_valid(&bufref))
emsg(_("E246: FileChangedShell autocommand deleted buffer")); emsg(_(e_filechangedshell_autocommand_deleted_buffer));
#ifdef FEAT_EVAL #ifdef FEAT_EVAL
s = get_vim_var_str(VV_FCS_CHOICE); s = get_vim_var_str(VV_FCS_CHOICE);
if (STRCMP(s, "reload") == 0 && *reason != 'd') if (STRCMP(s, "reload") == 0 && *reason != 'd')

View File

@ -547,7 +547,7 @@ gui_init(void)
if (STRCMP(use_gvimrc, "NONE") != 0 if (STRCMP(use_gvimrc, "NONE") != 0
&& STRCMP(use_gvimrc, "NORC") != 0 && STRCMP(use_gvimrc, "NORC") != 0
&& do_source(use_gvimrc, FALSE, DOSO_NONE, NULL) != OK) && do_source(use_gvimrc, FALSE, DOSO_NONE, NULL) != OK)
semsg(_("E230: Cannot read from \"%s\""), use_gvimrc); semsg(_(e_cannot_read_from_str), use_gvimrc);
} }
else else
{ {
@ -686,7 +686,7 @@ gui_init(void)
goto error2; goto error2;
} }
if (gui_get_wide_font() == FAIL) if (gui_get_wide_font() == FAIL)
emsg(_("E231: 'guifontwide' invalid")); emsg(_(e_guifontwide_invalid));
gui.num_cols = Columns; gui.num_cols = Columns;
gui.num_rows = Rows; gui.num_rows = Rows;

View File

@ -103,7 +103,7 @@ gui_mch_create_beval_area(
if (mesg != NULL && mesgCB != NULL) if (mesg != NULL && mesgCB != NULL)
{ {
iemsg(_("E232: Cannot create BalloonEval with both message and callback")); iemsg(_(e_cannot_create_ballooneval_with_both_message_and_callback));
return NULL; return NULL;
} }

View File

@ -4982,8 +4982,7 @@ ole_error(char *arg)
// Can't use emsg() here, we have not finished initialisation yet. // Can't use emsg() here, we have not finished initialisation yet.
vim_snprintf(buf, IOSIZE, vim_snprintf(buf, IOSIZE,
_("E243: Argument not supported: \"-%s\"; Use the OLE version."), _(e_argument_not_supported_str_use_ole_version), arg);
arg);
mch_errmsg(buf); mch_errmsg(buf);
} }
#endif #endif
@ -8682,7 +8681,7 @@ gui_mch_create_beval_area(
if (mesg != NULL && mesgCB != NULL) if (mesg != NULL && mesgCB != NULL)
{ {
iemsg(_("E232: Cannot create BalloonEval with both message and callback")); iemsg(_(e_cannot_create_ballooneval_with_both_message_and_callback));
return NULL; return NULL;
} }

View File

@ -2062,7 +2062,7 @@ gui_mch_get_fontset(
if (giveErrorIfMissing) if (giveErrorIfMissing)
{ {
semsg(_("E250: Fonts for the following charsets are missing in fontset %s:"), name); semsg(_(e_fonts_for_the_following_charsets_are_missing_in_fontset), name);
for (i = 0; i < num_missing; i++) for (i = 0; i < num_missing; i++)
semsg("%s", missing[i]); semsg("%s", missing[i]);
} }
@ -2104,8 +2104,8 @@ check_fontset_sanity(XFontSet fs)
{ {
if (xfs[i]->max_bounds.width != xfs[i]->min_bounds.width) if (xfs[i]->max_bounds.width != xfs[i]->min_bounds.width)
{ {
semsg(_("E252: Fontset name: %s"), base_name); semsg(_(e_fontsent_name_str_font_str_is_not_fixed_width),
semsg(_("Font '%s' is not fixed-width"), font_name[i]); base_name, font_name[i]);
return FAIL; return FAIL;
} }
} }
@ -2124,7 +2124,7 @@ check_fontset_sanity(XFontSet fs)
if ( xfs[i]->max_bounds.width != 2 * min_width if ( xfs[i]->max_bounds.width != 2 * min_width
&& xfs[i]->max_bounds.width != min_width) && xfs[i]->max_bounds.width != min_width)
{ {
semsg(_("E253: Fontset name: %s"), base_name); semsg(_(e_fontset_name_str), base_name);
semsg(_("Font0: %s"), font_name[min_font_idx]); semsg(_("Font0: %s"), font_name[min_font_idx]);
semsg(_("Font%d: %s"), i, font_name[i]); semsg(_("Font%d: %s"), i, font_name[i]);
semsg(_("Font%d width is not twice that of font0"), i); semsg(_("Font%d width is not twice that of font0"), i);

View File

@ -308,7 +308,7 @@ ex_cstag(exarg_T *eap)
if (!ret) if (!ret)
{ {
(void)emsg(_("E257: cstag: tag not found")); (void)emsg(_(e_cstag_tag_not_founc));
#if defined(FEAT_QUICKFIX) #if defined(FEAT_QUICKFIX)
g_do_tagpreview = 0; g_do_tagpreview = 0;
#endif #endif
@ -1160,7 +1160,8 @@ cs_find_common(
if (totmatches == 0) if (totmatches == 0)
{ {
if (verbose) if (verbose)
(void)semsg(_("E259: no matches found for cscope query %s of %s"), opt, pat); (void)semsg(_(e_no_matches_found_for_cscope_query_str_of_str),
opt, pat);
vim_free(nummatches); vim_free(nummatches);
return FALSE; return FALSE;
} }

View File

@ -456,7 +456,7 @@ serverSendToVim(
vim_free(property); vim_free(property);
if (res < 0) if (res < 0)
{ {
emsg(_("E248: Failed to send command to the destination program")); emsg(_(e_failed_to_send_command_to_destination_program));
return -1; return -1;
} }
@ -1089,7 +1089,7 @@ GetRegProp(
XFree(*regPropp); XFree(*regPropp);
XDeleteProperty(dpy, RootWindow(dpy, 0), registryProperty); XDeleteProperty(dpy, RootWindow(dpy, 0), registryProperty);
if (domsg) if (domsg)
emsg(_("E251: VIM instance registry property is badly formed. Deleted!")); emsg(_(e_vim_instance_registry_property_is_badly_formed_deleted));
return FAIL; return FAIL;
} }
return OK; return OK;

View File

@ -1399,7 +1399,7 @@ mch_print_init(prt_settings_T *psettings, char_u *jobname, int forceit)
if (prt_dlg.hDC == NULL) if (prt_dlg.hDC == NULL)
{ {
emsg(_("E237: Printer selection failed")); emsg(_(e_printer_selection_failed));
mch_print_cleanup(); mch_print_cleanup();
return FALSE; return FALSE;
} }
@ -1519,7 +1519,7 @@ init_fail_dlg:
FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS, FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, err, 0, (LPTSTR)(&buf), 0, NULL); NULL, err, 0, (LPTSTR)(&buf), 0, NULL);
semsg(_("E238: Print error: %s"), semsg(_(e_print_error_str),
buf == NULL ? (char_u *)_("Unknown") : buf); buf == NULL ? (char_u *)_("Unknown") : buf);
LocalFree((LPVOID)(buf)); LocalFree((LPVOID)(buf));
} }
@ -2961,7 +2961,9 @@ get_logfont(
if (cp->name == NULL && verbose) if (cp->name == NULL && verbose)
{ {
char_u *s = utf16_to_enc(p, NULL); char_u *s = utf16_to_enc(p, NULL);
semsg(_("E244: Illegal charset name \"%s\" in font name \"%s\""), s, name);
semsg(_(e_illegal_str_name_str_in_font_name_str),
"charset", s, name);
vim_free(s); vim_free(s);
break; break;
} }
@ -2981,7 +2983,8 @@ get_logfont(
if (qp->name == NULL && verbose) if (qp->name == NULL && verbose)
{ {
char_u *s = utf16_to_enc(p, NULL); char_u *s = utf16_to_enc(p, NULL);
semsg(_("E244: Illegal quality name \"%s\" in font name \"%s\""), s, name); semsg(_(e_illegal_str_name_str_in_font_name_str),
"quality", s, name);
vim_free(s); vim_free(s);
break; break;
} }
@ -2989,7 +2992,7 @@ get_logfont(
} }
default: default:
if (verbose) if (verbose)
semsg(_("E245: Illegal char '%c' in font name \"%s\""), p[-1], name); semsg(_(e_illegal_char_nr_in_font_name_str), p[-1], name);
goto theend; goto theend;
} }
while (*p == L':') while (*p == L':')

View File

@ -1019,7 +1019,7 @@ sign_define_init_text(sign_T *sp, char_u *text)
// Currently sign text must be one or two display cells // Currently sign text must be one or two display cells
if (s != endp || cells < 1 || cells > 2) if (s != endp || cells < 1 || cells > 2)
{ {
semsg(_("E239: Invalid sign text: %s"), text); semsg(_(e_invalid_sign_text_str), text);
return FAIL; return FAIL;
} }

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 */
/**/
3975,
/**/ /**/
3974, 3974,
/**/ /**/

View File

@ -3326,7 +3326,7 @@ ex_viminfo(
{ {
if (read_viminfo(eap->arg, VIF_WANT_INFO | VIF_WANT_MARKS if (read_viminfo(eap->arg, VIF_WANT_INFO | VIF_WANT_MARKS
| (eap->forceit ? VIF_FORCEIT : 0)) == FAIL) | (eap->forceit ? VIF_FORCEIT : 0)) == FAIL)
emsg(_("E195: Cannot open viminfo file for reading")); emsg(_(e_cannot_open_viminfo_file_for_reading));
} }
else else
write_viminfo(eap->arg, eap->forceit); write_viminfo(eap->arg, eap->forceit);

View File

@ -774,7 +774,7 @@ check_split_disallowed()
{ {
if (split_disallowed > 0) if (split_disallowed > 0)
{ {
emsg(_("E242: Can't split a window while closing another")); emsg(_(e_cant_split_window_while_closing_another));
return FAIL; return FAIL;
} }
if (curwin->w_buffer->b_locked_split) if (curwin->w_buffer->b_locked_split)