# HG changeset patch # User Bram Moolenaar # Date 1640963703 -3600 # Node ID 806f3157935730f5e8b0e33ea650de097c82d6cb # Parent f75fd683d54b83a7b0a46ce27b80e4884e11d1e4 patch 8.2.3955: error messages are spread out Commit: https://github.com/vim/vim/commit/eb822a280cf4706f7e67319ced1cdf3243b27e20 Author: Bram Moolenaar Date: Fri Dec 31 15:09:27 2021 +0000 patch 8.2.3955: error messages are spread out Problem: Error messages are spread out. Solution: Move more errors to errors.h. diff --git a/src/debugger.c b/src/debugger.c --- a/src/debugger.c +++ b/src/debugger.c @@ -815,7 +815,7 @@ ex_breakdel(exarg_T *eap) } if (todel < 0) - semsg(_("E161: Breakpoint not found: %s"), eap->arg); + semsg(_(e_breakpoint_not_found_str), eap->arg); else { while (gap->ga_len > 0) diff --git a/src/errors.h b/src/errors.h --- a/src/errors.h +++ b/src/errors.h @@ -302,6 +302,54 @@ EXTERN char e_viminfo_file_is_not_writab 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")); diff --git a/src/ex_cmds.c b/src/ex_cmds.c --- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -1941,7 +1941,7 @@ do_write(exarg_T *eap) { // Overwriting a file that is loaded in another buffer is not a // good idea. - emsg(_(e_bufloaded)); + emsg(_(e_file_is_loaded_in_another_buffer)); goto theend; } } @@ -1986,7 +1986,7 @@ do_write(exarg_T *eap) else #endif { - emsg(_("E140: Use ! to write partial buffer")); + emsg(_(e_use_bang_to_write_partial_buffer)); goto theend; } } @@ -2268,8 +2268,7 @@ do_wqall(exarg_T *eap) #endif if (buf->b_ffname == NULL) { - semsg(_("E141: No file name for buffer %ld"), - (long)buf->b_fnum); + semsg(_(e_no_file_name_for_buffer_nr), (long)buf->b_fnum); ++error; } else if (check_readonly(&eap->forceit, buf) @@ -2309,7 +2308,7 @@ not_writing(void) { if (p_write) 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; } @@ -3237,8 +3236,8 @@ theend: static void delbuf_msg(char_u *name) { - semsg(_("E143: Autocommands unexpectedly deleted new buffer %s"), - name == NULL ? (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,7 +3470,7 @@ ex_z(exarg_T *eap) { if (!VIM_ISDIGIT(*x)) { - emsg(_("E144: non-numeric argument to :z")); + emsg(_(e_non_numeric_argument_to_z)); return; } else @@ -3581,7 +3580,7 @@ check_restricted(void) { 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 FALSE; @@ -3660,7 +3659,7 @@ check_regexp_delim(int 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 OK; @@ -4899,7 +4898,7 @@ ex_global(exarg_T *eap) || 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")); + emsg(_(e_cannot_do_global_recursive_with_range)); return; } @@ -4937,7 +4936,7 @@ ex_global(exarg_T *eap) } else if (*cmd == NUL) { - emsg(_("E148: Regular expression missing from global")); + emsg(_(e_regular_expression_missing_from_global)); return; } else if (check_regexp_delim(*cmd) == FAIL) diff --git a/src/globals.h b/src/globals.h --- a/src/globals.h +++ b/src/globals.h @@ -1740,7 +1740,6 @@ EXTERN char e_maxmempat[] INIT(= N_("E36 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 diff --git a/src/help.c b/src/help.c --- a/src/help.c +++ b/src/help.c @@ -107,7 +107,7 @@ ex_help(exarg_T *eap) semsg(_("E661: Sorry, no '%s' help for %s"), lang, arg); else #endif - semsg(_("E149: Sorry, no help for %s"), arg); + semsg(_(e_sorry_no_help_for_str), arg); if (n != FAIL) FreeWild(num_matches, matches); return; @@ -982,7 +982,7 @@ helptags_one( || filecount == 0) { if (!got_int) - semsg(_("E151: No match: %s"), NameBuff); + semsg(_(e_no_match_str), NameBuff); return; } @@ -995,7 +995,7 @@ helptags_one( if (fd_tags == NULL) { if (!ignore_writeerr) - semsg(_("E152: Cannot open %s for writing"), NameBuff); + semsg(_(e_cannot_open_str_for_writing), NameBuff); FreeWild(filecount, files); return; } @@ -1028,7 +1028,7 @@ helptags_one( fd = mch_fopen((char *)files[fi], "r"); if (fd == NULL) { - semsg(_("E153: Unable to open %s for reading"), files[fi]); + semsg(_(e_unable_to_open_str_for_reading), files[fi]); continue; } fname = files[fi] + dirlen + 1; @@ -1136,7 +1136,7 @@ helptags_one( { *p2 = NUL; 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); emsg((char *)NameBuff); *p2 = '\t'; @@ -1316,7 +1316,7 @@ ex_helptags(exarg_T *eap) 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); + semsg(_(e_not_a_directory_str), eap->arg); else do_helptags(dirname, add_help_tags, FALSE); vim_free(dirname); diff --git a/src/sign.c b/src/sign.c --- a/src/sign.c +++ b/src/sign.c @@ -1140,7 +1140,7 @@ sign_undefine_by_name(char_u *name, int if (sp == NULL) { if (give_error) - semsg(_("E155: Unknown sign: %s"), name); + semsg(_(e_unknown_sign_str), name); return FAIL; } sign_undefine(sp, sp_prev); @@ -1160,7 +1160,7 @@ sign_list_by_name(char_u *name) if (sp != NULL) sign_list_defined(sp); else - semsg(_("E155: Unknown sign: %s"), name); + semsg(_(e_unknown_sign_str), name); } static void @@ -1200,7 +1200,7 @@ sign_place( break; if (sp == NULL) { - semsg(_("E155: Unknown sign: %s"), sign_name); + semsg(_(e_unknown_sign_str), sign_name); return FAIL; } if (*sign_id == 0) @@ -1277,7 +1277,7 @@ sign_unplace_at_cursor(char_u *groupname if (id > 0) sign_unplace(id, groupname, curwin->w_buffer, curwin->w_cursor.lnum); else - emsg(_("E159: Missing sign number")); + emsg(_(e_missing_sign_number)); } /* @@ -1290,7 +1290,7 @@ sign_jump(int sign_id, char_u *sign_grou 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; } @@ -1643,7 +1643,7 @@ parse_sign_cmd_args( if (filename != NULL && *buf == NULL) { - semsg(_("E158: Invalid buffer name: %s"), filename); + semsg(_(e_invalid_buffer_name_str), filename); return FAIL; } @@ -1673,7 +1673,7 @@ ex_sign(exarg_T *eap) idx = sign_cmd_idx(arg, p); if (idx == SIGNCMD_LAST) { - semsg(_("E160: Unknown sign command: %s"), arg); + semsg(_(e_unknown_sign_command_str), arg); return; } arg = skipwhite(p); @@ -1688,7 +1688,7 @@ ex_sign(exarg_T *eap) sign_list_defined(sp); } else if (*arg == NUL) - emsg(_("E156: Missing sign name")); + emsg(_(e_missing_sign_name)); else { char_u *name; diff --git a/src/spellfile.c b/src/spellfile.c --- a/src/spellfile.c +++ b/src/spellfile.c @@ -6240,7 +6240,7 @@ spell_add_word( buf = NULL; if (buf != NULL && bufIsChanged(buf)) { - emsg(_(e_bufloaded)); + emsg(_(e_file_is_loaded_in_another_buffer)); vim_free(fnamebuf); return; } diff --git a/src/version.c b/src/version.c --- 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 */ /**/ + 3955, +/**/ 3954, /**/ 3953,