To: vim_dev@googlegroups.com Subject: Patch 8.2.3975 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.3975 Problem: Error messages are spread out. Solution: Move more error messages to errors.h. Files: src/errors.h, src/clientserver.c, src/fileio.c, src/gui.c, src/gui_beval.c, src/gui_w32.c, src/gui_x11.c, src/if_cscope.c, src/if_xcmdsrv.c, src/os_mswin.c, src/sign.c, src/viminfo.c, src/window.c *** ../vim-8.2.3974/src/errors.h 2022-01-01 16:31:44.015615365 +0000 --- src/errors.h 2022-01-01 19:30:02.701286529 +0000 *************** *** 494,525 **** INIT(= N_("E227: mapping already exists for %s")); EXTERN char e_makemap_illegal_mode[] INIT(= N_("E228: makemap: Illegal mode")); EXTERN char e_cannot_start_the_GUI[] INIT(= N_("E229: Cannot start the GUI")); ! ! #if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_X11) EXTERN char e_cannot_open_display[] INIT(= N_("E233: cannot open display")); ! #endif ! #if defined(FEAT_GUI) && defined(FEAT_XFONTSET) EXTERN char e_unknown_fontset_str[] INIT(= N_("E234: Unknown fontset: %s")); ! #endif ! #if defined(FEAT_GUI_X11) || defined(FEAT_GUI_GTK) \ || defined(FEAT_GUI_PHOTON) || defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_HAIKU) EXTERN char e_unknown_font_str[] INIT(= N_("E235: Unknown font: %s")); ! #endif ! #if defined(FEAT_GUI_X11) && !defined(FEAT_GUI_GTK) EXTERN char e_font_str_is_not_fixed_width[] INIT(= N_("E236: Font \"%s\" is not fixed-width")); #endif #ifdef FEAT_CLIENTSERVER EXTERN char e_no_registered_server_named_str[] INIT(= N_("E247: no registered server named \"%s\"")); #endif EXTERN char e_window_layout_changed_unexpectedly[] INIT(= N_("E249: window layout changed unexpectedly")); #if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) EXTERN char e_cannot_allocate_color_str[] INIT(= N_("E254: Cannot allocate color %s")); --- 494,578 ---- INIT(= N_("E227: mapping already exists for %s")); EXTERN char e_makemap_illegal_mode[] INIT(= N_("E228: makemap: Illegal mode")); + #ifdef FEAT_GUI EXTERN char e_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) EXTERN char e_cannot_open_display[] INIT(= N_("E233: cannot open display")); ! # endif ! # if defined(FEAT_XFONTSET) EXTERN char e_unknown_fontset_str[] INIT(= N_("E234: Unknown fontset: %s")); ! # endif ! # if defined(FEAT_GUI_X11) || defined(FEAT_GUI_GTK) \ || defined(FEAT_GUI_PHOTON) || defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_HAIKU) EXTERN char e_unknown_font_str[] INIT(= N_("E235: Unknown font: %s")); ! # endif ! # if defined(FEAT_GUI_X11) && !defined(FEAT_GUI_GTK) EXTERN char e_font_str_is_not_fixed_width[] INIT(= N_("E236: Font \"%s\" is not fixed-width")); + # 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 EXTERN char e_no_registered_server_named_str[] 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 EXTERN char e_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) EXTERN char e_cannot_allocate_color_str[] INIT(= N_("E254: Cannot allocate color %s")); *************** *** 528,533 **** --- 581,598 ---- EXTERN char e_couldnt_read_in_sign_data[] INIT(= N_("E255: Couldn't read in sign data")); #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 EXTERN char e_no_white_space_allowed_before_parenthesis[] INIT(= N_("E274: No white space allowed before parenthesis")); *** ../vim-8.2.3974/src/clientserver.c 2022-01-01 15:58:19.106486379 +0000 --- src/clientserver.c 2022-01-01 19:16:40.006015056 +0000 *************** *** 709,715 **** make_connection(); if (X_DISPLAY == NULL) { ! emsg(_("E240: No connection to the X server")); return FAIL; } return OK; --- 709,715 ---- make_connection(); if (X_DISPLAY == NULL) { ! emsg(_(e_no_connection_to_x_server)); return FAIL; } return OK; *************** *** 759,765 **** vim_free(r); } else ! semsg(_("E241: Unable to send to %s"), server_name); return; } --- 759,765 ---- vim_free(r); } else ! semsg(_(e_unable_to_send_to_str), server_name); return; } *************** *** 1016,1022 **** if (serverSendReply(server, reply) < 0) { ! emsg(_("E258: Unable to send to client")); return; } rettv->vval.v_number = 0; --- 1016,1022 ---- if (serverSendReply(server, reply) < 0) { ! emsg(_(e_unable_to_send_to_client)); return; } rettv->vval.v_number = 0; *** ../vim-8.2.3974/src/fileio.c 2022-01-01 14:19:44.040353857 +0000 --- src/fileio.c 2022-01-01 19:03:22.274610868 +0000 *************** *** 4155,4161 **** if (n) { if (!bufref_valid(&bufref)) ! emsg(_("E246: FileChangedShell autocommand deleted buffer")); #ifdef FEAT_EVAL s = get_vim_var_str(VV_FCS_CHOICE); if (STRCMP(s, "reload") == 0 && *reason != 'd') --- 4155,4161 ---- if (n) { if (!bufref_valid(&bufref)) ! emsg(_(e_filechangedshell_autocommand_deleted_buffer)); #ifdef FEAT_EVAL s = get_vim_var_str(VV_FCS_CHOICE); if (STRCMP(s, "reload") == 0 && *reason != 'd') *** ../vim-8.2.3974/src/gui.c 2021-12-31 18:49:39.149303426 +0000 --- src/gui.c 2022-01-01 18:39:39.984854318 +0000 *************** *** 547,553 **** if (STRCMP(use_gvimrc, "NONE") != 0 && STRCMP(use_gvimrc, "NORC") != 0 && do_source(use_gvimrc, FALSE, DOSO_NONE, NULL) != OK) ! semsg(_("E230: Cannot read from \"%s\""), use_gvimrc); } else { --- 547,553 ---- if (STRCMP(use_gvimrc, "NONE") != 0 && STRCMP(use_gvimrc, "NORC") != 0 && do_source(use_gvimrc, FALSE, DOSO_NONE, NULL) != OK) ! semsg(_(e_cannot_read_from_str), use_gvimrc); } else { *************** *** 686,692 **** goto error2; } if (gui_get_wide_font() == FAIL) ! emsg(_("E231: 'guifontwide' invalid")); gui.num_cols = Columns; gui.num_rows = Rows; --- 686,692 ---- goto error2; } if (gui_get_wide_font() == FAIL) ! emsg(_(e_guifontwide_invalid)); gui.num_cols = Columns; gui.num_rows = Rows; *** ../vim-8.2.3974/src/gui_beval.c 2021-06-14 21:08:42.609468956 +0100 --- src/gui_beval.c 2022-01-01 18:40:52.261222296 +0000 *************** *** 103,109 **** if (mesg != NULL && mesgCB != NULL) { ! iemsg(_("E232: Cannot create BalloonEval with both message and callback")); return NULL; } --- 103,109 ---- if (mesg != NULL && mesgCB != NULL) { ! iemsg(_(e_cannot_create_ballooneval_with_both_message_and_callback)); return NULL; } *** ../vim-8.2.3974/src/gui_w32.c 2022-01-01 15:58:19.114486366 +0000 --- src/gui_w32.c 2022-01-01 18:58:28.106730686 +0000 *************** *** 4982,4989 **** // Can't use emsg() here, we have not finished initialisation yet. vim_snprintf(buf, IOSIZE, ! _("E243: Argument not supported: \"-%s\"; Use the OLE version."), ! arg); mch_errmsg(buf); } #endif --- 4982,4988 ---- // Can't use emsg() here, we have not finished initialisation yet. vim_snprintf(buf, IOSIZE, ! _(e_argument_not_supported_str_use_ole_version), arg); mch_errmsg(buf); } #endif *************** *** 8682,8688 **** if (mesg != NULL && mesgCB != NULL) { ! iemsg(_("E232: Cannot create BalloonEval with both message and callback")); return NULL; } --- 8681,8687 ---- if (mesg != NULL && mesgCB != NULL) { ! iemsg(_(e_cannot_create_ballooneval_with_both_message_and_callback)); return NULL; } *** ../vim-8.2.3974/src/gui_x11.c 2022-01-01 15:58:19.114486366 +0000 --- src/gui_x11.c 2022-01-01 19:25:31.469537963 +0000 *************** *** 2062,2068 **** if (giveErrorIfMissing) { ! semsg(_("E250: Fonts for the following charsets are missing in fontset %s:"), name); for (i = 0; i < num_missing; i++) semsg("%s", missing[i]); } --- 2062,2068 ---- if (giveErrorIfMissing) { ! semsg(_(e_fonts_for_the_following_charsets_are_missing_in_fontset), name); for (i = 0; i < num_missing; i++) semsg("%s", missing[i]); } *************** *** 2104,2111 **** { if (xfs[i]->max_bounds.width != xfs[i]->min_bounds.width) { ! semsg(_("E252: Fontset name: %s"), base_name); ! semsg(_("Font '%s' is not fixed-width"), font_name[i]); return FAIL; } } --- 2104,2111 ---- { if (xfs[i]->max_bounds.width != xfs[i]->min_bounds.width) { ! semsg(_(e_fontsent_name_str_font_str_is_not_fixed_width), ! base_name, font_name[i]); return FAIL; } } *************** *** 2124,2130 **** if ( xfs[i]->max_bounds.width != 2 * min_width && xfs[i]->max_bounds.width != min_width) { ! semsg(_("E253: Fontset name: %s"), base_name); semsg(_("Font0: %s"), font_name[min_font_idx]); semsg(_("Font%d: %s"), i, font_name[i]); semsg(_("Font%d width is not twice that of font0"), i); --- 2124,2130 ---- if ( xfs[i]->max_bounds.width != 2 * min_width && xfs[i]->max_bounds.width != min_width) { ! semsg(_(e_fontset_name_str), base_name); semsg(_("Font0: %s"), font_name[min_font_idx]); semsg(_("Font%d: %s"), i, font_name[i]); semsg(_("Font%d width is not twice that of font0"), i); *** ../vim-8.2.3974/src/if_cscope.c 2022-01-01 14:19:44.044353848 +0000 --- src/if_cscope.c 2022-01-01 19:29:41.073306693 +0000 *************** *** 308,314 **** if (!ret) { ! (void)emsg(_("E257: cstag: tag not found")); #if defined(FEAT_QUICKFIX) g_do_tagpreview = 0; #endif --- 308,314 ---- if (!ret) { ! (void)emsg(_(e_cstag_tag_not_founc)); #if defined(FEAT_QUICKFIX) g_do_tagpreview = 0; #endif *************** *** 1160,1166 **** if (totmatches == 0) { if (verbose) ! (void)semsg(_("E259: no matches found for cscope query %s of %s"), opt, pat); vim_free(nummatches); return FALSE; } --- 1160,1167 ---- if (totmatches == 0) { if (verbose) ! (void)semsg(_(e_no_matches_found_for_cscope_query_str_of_str), ! opt, pat); vim_free(nummatches); return FALSE; } *** ../vim-8.2.3974/src/if_xcmdsrv.c 2022-01-01 15:58:19.114486366 +0000 --- src/if_xcmdsrv.c 2022-01-01 19:19:14.933879138 +0000 *************** *** 456,462 **** vim_free(property); if (res < 0) { ! emsg(_("E248: Failed to send command to the destination program")); return -1; } --- 456,462 ---- vim_free(property); if (res < 0) { ! emsg(_(e_failed_to_send_command_to_destination_program)); return -1; } *************** *** 1089,1095 **** XFree(*regPropp); XDeleteProperty(dpy, RootWindow(dpy, 0), registryProperty); if (domsg) ! emsg(_("E251: VIM instance registry property is badly formed. Deleted!")); return FAIL; } return OK; --- 1089,1095 ---- XFree(*regPropp); XDeleteProperty(dpy, RootWindow(dpy, 0), registryProperty); if (domsg) ! emsg(_(e_vim_instance_registry_property_is_badly_formed_deleted)); return FAIL; } return OK; *** ../vim-8.2.3974/src/os_mswin.c 2022-01-01 15:58:19.118486361 +0000 --- src/os_mswin.c 2022-01-01 19:02:35.282635750 +0000 *************** *** 1399,1405 **** if (prt_dlg.hDC == NULL) { ! emsg(_("E237: Printer selection failed")); mch_print_cleanup(); return FALSE; } --- 1399,1405 ---- if (prt_dlg.hDC == NULL) { ! emsg(_(e_printer_selection_failed)); mch_print_cleanup(); return FALSE; } *************** *** 1519,1525 **** FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, err, 0, (LPTSTR)(&buf), 0, NULL); ! semsg(_("E238: Print error: %s"), buf == NULL ? (char_u *)_("Unknown") : buf); LocalFree((LPVOID)(buf)); } --- 1519,1525 ---- FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, err, 0, (LPTSTR)(&buf), 0, NULL); ! semsg(_(e_print_error_str), buf == NULL ? (char_u *)_("Unknown") : buf); LocalFree((LPVOID)(buf)); } *************** *** 2961,2967 **** if (cp->name == NULL && verbose) { char_u *s = utf16_to_enc(p, NULL); ! semsg(_("E244: Illegal charset name \"%s\" in font name \"%s\""), s, name); vim_free(s); break; } --- 2961,2969 ---- if (cp->name == NULL && verbose) { char_u *s = utf16_to_enc(p, NULL); ! ! semsg(_(e_illegal_str_name_str_in_font_name_str), ! "charset", s, name); vim_free(s); break; } *************** *** 2981,2987 **** if (qp->name == NULL && verbose) { char_u *s = utf16_to_enc(p, NULL); ! semsg(_("E244: Illegal quality name \"%s\" in font name \"%s\""), s, name); vim_free(s); break; } --- 2983,2990 ---- if (qp->name == NULL && verbose) { char_u *s = utf16_to_enc(p, NULL); ! semsg(_(e_illegal_str_name_str_in_font_name_str), ! "quality", s, name); vim_free(s); break; } *************** *** 2989,2995 **** } default: if (verbose) ! semsg(_("E245: Illegal char '%c' in font name \"%s\""), p[-1], name); goto theend; } while (*p == L':') --- 2992,2998 ---- } default: if (verbose) ! semsg(_(e_illegal_char_nr_in_font_name_str), p[-1], name); goto theend; } while (*p == L':') *** ../vim-8.2.3974/src/sign.c 2022-01-01 15:58:19.118486361 +0000 --- src/sign.c 2022-01-01 18:54:30.430740603 +0000 *************** *** 1019,1025 **** // Currently sign text must be one or two display cells if (s != endp || cells < 1 || cells > 2) { ! semsg(_("E239: Invalid sign text: %s"), text); return FAIL; } --- 1019,1025 ---- // Currently sign text must be one or two display cells if (s != endp || cells < 1 || cells > 2) { ! semsg(_(e_invalid_sign_text_str), text); return FAIL; } *** ../vim-8.2.3974/src/viminfo.c 2021-12-26 20:20:29.093631230 +0000 --- src/viminfo.c 2021-12-31 17:56:57.294126838 +0000 *************** *** 3326,3332 **** { if (read_viminfo(eap->arg, VIF_WANT_INFO | VIF_WANT_MARKS | (eap->forceit ? VIF_FORCEIT : 0)) == FAIL) ! emsg(_("E195: Cannot open viminfo file for reading")); } else write_viminfo(eap->arg, eap->forceit); --- 3326,3332 ---- { if (read_viminfo(eap->arg, VIF_WANT_INFO | VIF_WANT_MARKS | (eap->forceit ? VIF_FORCEIT : 0)) == FAIL) ! emsg(_(e_cannot_open_viminfo_file_for_reading)); } else write_viminfo(eap->arg, eap->forceit); *** ../vim-8.2.3974/src/window.c 2022-01-01 15:58:19.122486356 +0000 --- src/window.c 2022-01-01 18:57:32.030741683 +0000 *************** *** 774,780 **** { if (split_disallowed > 0) { ! emsg(_("E242: Can't split a window while closing another")); return FAIL; } if (curwin->w_buffer->b_locked_split) --- 774,780 ---- { if (split_disallowed > 0) { ! emsg(_(e_cant_split_window_while_closing_another)); return FAIL; } if (curwin->w_buffer->b_locked_split) *** ../vim-8.2.3974/src/version.c 2022-01-01 18:29:17.265807214 +0000 --- src/version.c 2022-01-01 19:33:05.313115706 +0000 *************** *** 751,752 **** --- 751,754 ---- { /* Add new patch number below this line */ + /**/ + 3975, /**/ -- hundred-and-one symptoms of being an internet addict: 179. You wonder why your household garbage can doesn't have an "empty recycle bin" button. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///