To: vim_dev@googlegroups.com Subject: Patch 8.2.3955 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.3955 Problem: Error messages are spread out. Solution: Move more errors to errors.h. Files: src/errors.h, src/globals.h, src/debugger.c, src/ex_cmds.c, src/help.c, src/sign.c, src/spellfile.c *** ../vim-8.2.3954/src/errors.h 2021-12-28 17:55:22.963786520 +0000 --- src/errors.h 2021-12-31 15:07:27.202273240 +0000 *************** *** 302,307 **** --- 302,355 ---- EXTERN char e_cant_write_viminfo_file_str[] INIT(= N_("E138: Can't write viminfo file %s!")); #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[] INIT(= N_("E184: No such user-defined command: %s")); *** ../vim-8.2.3954/src/globals.h 2021-12-25 21:43:24.296302789 +0000 --- src/globals.h 2021-12-31 14:50:02.183444263 +0000 *************** *** 1740,1746 **** EXTERN char e_emptybuf[] INIT(= N_("E749: empty buffer")); 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) EXTERN char e_notset[] INIT(= N_("E764: Option '%s' is not set")); #endif --- 1740,1745 ---- *** ../vim-8.2.3954/src/debugger.c 2021-10-02 11:23:01.566500862 +0100 --- src/debugger.c 2021-12-31 15:07:37.954260992 +0000 *************** *** 815,821 **** } if (todel < 0) ! semsg(_("E161: Breakpoint not found: %s"), eap->arg); else { while (gap->ga_len > 0) --- 815,821 ---- } if (todel < 0) ! semsg(_(e_breakpoint_not_found_str), eap->arg); else { while (gap->ga_len > 0) *** ../vim-8.2.3954/src/ex_cmds.c 2021-12-31 12:19:18.739789858 +0000 --- src/ex_cmds.c 2021-12-31 14:57:46.746930599 +0000 *************** *** 1941,1947 **** { // Overwriting a file that is loaded in another buffer is not a // good idea. ! emsg(_(e_bufloaded)); goto theend; } } --- 1941,1947 ---- { // Overwriting a file that is loaded in another buffer is not a // good idea. ! emsg(_(e_file_is_loaded_in_another_buffer)); goto theend; } } *************** *** 1986,1992 **** else #endif { ! emsg(_("E140: Use ! to write partial buffer")); goto theend; } } --- 1986,1992 ---- else #endif { ! emsg(_(e_use_bang_to_write_partial_buffer)); goto theend; } } *************** *** 2268,2275 **** #endif if (buf->b_ffname == NULL) { ! semsg(_("E141: No file name for buffer %ld"), ! (long)buf->b_fnum); ++error; } else if (check_readonly(&eap->forceit, buf) --- 2268,2274 ---- #endif if (buf->b_ffname == NULL) { ! semsg(_(e_no_file_name_for_buffer_nr), (long)buf->b_fnum); ++error; } else if (check_readonly(&eap->forceit, buf) *************** *** 2309,2315 **** { if (p_write) return FALSE; ! emsg(_("E142: File not written: Writing is disabled by 'write' option")); return TRUE; } --- 2308,2314 ---- { if (p_write) return FALSE; ! emsg(_(e_file_not_written_writing_is_disabled_by_write_option)); return TRUE; } *************** *** 3237,3244 **** static void delbuf_msg(char_u *name) { ! semsg(_("E143: Autocommands unexpectedly deleted new buffer %s"), ! name == NULL ? (char_u *)"" : name); vim_free(name); au_new_curbuf.br_buf = NULL; au_new_curbuf.br_buf_free_count = 0; --- 3236,3243 ---- static void delbuf_msg(char_u *name) { ! semsg(_(e_autocommands_unexpectedly_deleted_new_buffer_str), ! name == NULL ? (char_u *)"" : name); vim_free(name); au_new_curbuf.br_buf = NULL; au_new_curbuf.br_buf_free_count = 0; *************** *** 3471,3477 **** { if (!VIM_ISDIGIT(*x)) { ! emsg(_("E144: non-numeric argument to :z")); return; } else --- 3470,3476 ---- { if (!VIM_ISDIGIT(*x)) { ! emsg(_(e_non_numeric_argument_to_z)); return; } else *************** *** 3581,3587 **** { if (restricted) { ! emsg(_("E145: Shell commands and some functionality not allowed in rvim")); return TRUE; } return FALSE; --- 3580,3586 ---- { if (restricted) { ! emsg(_(e_shell_commands_and_some_functionality_not_allowed_in_rvim)); return TRUE; } return FALSE; *************** *** 3660,3666 **** { if (isalpha(c)) { ! emsg(_("E146: Regular expressions can't be delimited by letters")); return FAIL; } return OK; --- 3659,3665 ---- { if (isalpha(c)) { ! emsg(_(e_regular_expressions_cant_be_delimited_by_letters)); return FAIL; } return OK; *************** *** 4899,4905 **** || eap->line2 != curbuf->b_ml.ml_line_count)) { // will increment global_busy to break out of the loop ! emsg(_("E147: Cannot do :global recursive with a range")); return; } --- 4898,4904 ---- || eap->line2 != curbuf->b_ml.ml_line_count)) { // will increment global_busy to break out of the loop ! emsg(_(e_cannot_do_global_recursive_with_range)); return; } *************** *** 4937,4943 **** } else if (*cmd == NUL) { ! emsg(_("E148: Regular expression missing from global")); return; } else if (check_regexp_delim(*cmd) == FAIL) --- 4936,4942 ---- } else if (*cmd == NUL) { ! emsg(_(e_regular_expression_missing_from_global)); return; } else if (check_regexp_delim(*cmd) == FAIL) *** ../vim-8.2.3954/src/help.c 2021-11-25 10:50:09.178844306 +0000 --- src/help.c 2021-12-31 15:03:02.394574277 +0000 *************** *** 107,113 **** semsg(_("E661: Sorry, no '%s' help for %s"), lang, arg); else #endif ! semsg(_("E149: Sorry, no help for %s"), arg); if (n != FAIL) FreeWild(num_matches, matches); return; --- 107,113 ---- semsg(_("E661: Sorry, no '%s' help for %s"), lang, arg); else #endif ! semsg(_(e_sorry_no_help_for_str), arg); if (n != FAIL) FreeWild(num_matches, matches); return; *************** *** 982,988 **** || filecount == 0) { if (!got_int) ! semsg(_("E151: No match: %s"), NameBuff); return; } --- 982,988 ---- || filecount == 0) { if (!got_int) ! semsg(_(e_no_match_str), NameBuff); return; } *************** *** 995,1001 **** if (fd_tags == NULL) { if (!ignore_writeerr) ! semsg(_("E152: Cannot open %s for writing"), NameBuff); FreeWild(filecount, files); return; } --- 995,1001 ---- if (fd_tags == NULL) { if (!ignore_writeerr) ! semsg(_(e_cannot_open_str_for_writing), NameBuff); FreeWild(filecount, files); return; } *************** *** 1028,1034 **** fd = mch_fopen((char *)files[fi], "r"); if (fd == NULL) { ! semsg(_("E153: Unable to open %s for reading"), files[fi]); continue; } fname = files[fi] + dirlen + 1; --- 1028,1034 ---- fd = mch_fopen((char *)files[fi], "r"); if (fd == NULL) { ! semsg(_(e_unable_to_open_str_for_reading), files[fi]); continue; } fname = files[fi] + dirlen + 1; *************** *** 1136,1142 **** { *p2 = NUL; vim_snprintf((char *)NameBuff, MAXPATHL, ! _("E154: Duplicate tag \"%s\" in file %s/%s"), ((char_u **)ga.ga_data)[i], dir, p2 + 1); emsg((char *)NameBuff); *p2 = '\t'; --- 1136,1142 ---- { *p2 = NUL; vim_snprintf((char *)NameBuff, MAXPATHL, ! _(e_duplicate_tag_str_in_file_str_str), ((char_u **)ga.ga_data)[i], dir, p2 + 1); emsg((char *)NameBuff); *p2 = '\t'; *************** *** 1316,1322 **** dirname = ExpandOne(&xpc, eap->arg, NULL, WILD_LIST_NOTFOUND|WILD_SILENT, WILD_EXPAND_FREE); if (dirname == NULL || !mch_isdir(dirname)) ! semsg(_("E150: Not a directory: %s"), eap->arg); else do_helptags(dirname, add_help_tags, FALSE); vim_free(dirname); --- 1316,1322 ---- dirname = ExpandOne(&xpc, eap->arg, NULL, WILD_LIST_NOTFOUND|WILD_SILENT, WILD_EXPAND_FREE); if (dirname == NULL || !mch_isdir(dirname)) ! semsg(_(e_not_a_directory_str), eap->arg); else do_helptags(dirname, add_help_tags, FALSE); vim_free(dirname); *** ../vim-8.2.3954/src/sign.c 2021-12-22 19:44:55.474555117 +0000 --- src/sign.c 2021-12-31 15:06:30.242338122 +0000 *************** *** 1140,1146 **** if (sp == NULL) { if (give_error) ! semsg(_("E155: Unknown sign: %s"), name); return FAIL; } sign_undefine(sp, sp_prev); --- 1140,1146 ---- if (sp == NULL) { if (give_error) ! semsg(_(e_unknown_sign_str), name); return FAIL; } sign_undefine(sp, sp_prev); *************** *** 1160,1166 **** if (sp != NULL) sign_list_defined(sp); else ! semsg(_("E155: Unknown sign: %s"), name); } static void --- 1160,1166 ---- if (sp != NULL) sign_list_defined(sp); else ! semsg(_(e_unknown_sign_str), name); } static void *************** *** 1200,1206 **** break; if (sp == NULL) { ! semsg(_("E155: Unknown sign: %s"), sign_name); return FAIL; } if (*sign_id == 0) --- 1200,1206 ---- break; if (sp == NULL) { ! semsg(_(e_unknown_sign_str), sign_name); return FAIL; } if (*sign_id == 0) *************** *** 1277,1283 **** if (id > 0) sign_unplace(id, groupname, curwin->w_buffer, curwin->w_cursor.lnum); else ! emsg(_("E159: Missing sign number")); } /* --- 1277,1283 ---- if (id > 0) sign_unplace(id, groupname, curwin->w_buffer, curwin->w_cursor.lnum); else ! emsg(_(e_missing_sign_number)); } /* *************** *** 1290,1296 **** if ((lnum = buf_findsign(buf, sign_id, sign_group)) <= 0) { ! semsg(_("E157: Invalid sign ID: %d"), sign_id); return -1; } --- 1290,1296 ---- if ((lnum = buf_findsign(buf, sign_id, sign_group)) <= 0) { ! semsg(_(e_invalid_sign_id_nr), sign_id); return -1; } *************** *** 1643,1649 **** if (filename != NULL && *buf == NULL) { ! semsg(_("E158: Invalid buffer name: %s"), filename); return FAIL; } --- 1643,1649 ---- if (filename != NULL && *buf == NULL) { ! semsg(_(e_invalid_buffer_name_str), filename); return FAIL; } *************** *** 1673,1679 **** idx = sign_cmd_idx(arg, p); if (idx == SIGNCMD_LAST) { ! semsg(_("E160: Unknown sign command: %s"), arg); return; } arg = skipwhite(p); --- 1673,1679 ---- idx = sign_cmd_idx(arg, p); if (idx == SIGNCMD_LAST) { ! semsg(_(e_unknown_sign_command_str), arg); return; } arg = skipwhite(p); *************** *** 1688,1694 **** sign_list_defined(sp); } else if (*arg == NUL) ! emsg(_("E156: Missing sign name")); else { char_u *name; --- 1688,1694 ---- sign_list_defined(sp); } else if (*arg == NUL) ! emsg(_(e_missing_sign_name)); else { char_u *name; *** ../vim-8.2.3954/src/spellfile.c 2021-12-27 17:21:38.020449109 +0000 --- src/spellfile.c 2021-12-31 14:49:36.191472354 +0000 *************** *** 6240,6246 **** buf = NULL; if (buf != NULL && bufIsChanged(buf)) { ! emsg(_(e_bufloaded)); vim_free(fnamebuf); return; } --- 6240,6246 ---- buf = NULL; if (buf != NULL && bufIsChanged(buf)) { ! emsg(_(e_file_is_loaded_in_another_buffer)); vim_free(fnamebuf); return; } *** ../vim-8.2.3954/src/version.c 2021-12-31 14:06:41.413853990 +0000 --- src/version.c 2021-12-31 15:08:57.434170413 +0000 *************** *** 751,752 **** --- 751,754 ---- { /* Add new patch number below this line */ + /**/ + 3955, /**/ -- "Hit any key to continue" is very confusing when you have two keyboards. /// 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 ///