Skip to content

Commit

Permalink
patch 8.2.4008: error messages are spread out
Browse files Browse the repository at this point in the history
Problem:    Error messages are spread out.
Solution:   Move more error messages to errors.h.
  • Loading branch information
brammool committed Jan 5, 2022
1 parent 8e7d9db commit 677658a
Show file tree
Hide file tree
Showing 28 changed files with 187 additions and 76 deletions.
4 changes: 2 additions & 2 deletions src/diff.c
Expand Up @@ -2682,7 +2682,7 @@ ex_diffgetput(exarg_T *eap)
if (idx_other == DB_COUNT)
{
if (found_not_ma)
emsg(_("E793: No other buffer in diff mode is modifiable"));
emsg(_(e_no_other_buffer_in_diff_mode_is_modifiable));
else
emsg(_(e_no_other_buffer_in_diff_mode));
return;
Expand Down Expand Up @@ -2769,7 +2769,7 @@ ex_diffgetput(exarg_T *eap)
change_warning(0);
if (diff_buf_idx(curbuf) != idx_to)
{
emsg(_("E787: Buffer changed unexpectedly"));
emsg(_(e_buffer_changed_unexpectedly));
goto theend;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/digraph.c
Expand Up @@ -2661,7 +2661,7 @@ ex_loadkeymap(exarg_T *eap)
|| *kp->from == NUL || *kp->to == NUL)
{
if (kp->to != NULL && *kp->to == NUL)
emsg(_("E791: Empty keymap entry"));
emsg(_(e_empty_keymap_entry));
vim_free(kp->from);
vim_free(kp->to);
}
Expand Down
128 changes: 124 additions & 4 deletions src/errors.h
Expand Up @@ -1719,47 +1719,160 @@ EXTERN char e_cannot_change_value[]
INIT(= N_("E742: Cannot change value"));
EXTERN char e_cannot_change_value_of_str[]
INIT(= N_("E742: Cannot change value of %s"));
EXTERN char e_variable_nested_too_deep_for_unlock[]
INIT(= N_("E743: variable nested too deep for (un)lock"));
#endif
#ifdef FEAT_NETBEANS_INTG
EXTERN char e_netbeans_does_not_allow_changes_in_read_only_files[]
INIT(= N_("E744: NetBeans does not allow changes in read-only files"));
#endif
#ifdef FEAT_EVAL
EXTERN char e_using_list_as_number[]
INIT(= N_("E745: Using a List as a Number"));
EXTERN char e_function_name_does_not_match_script_file_name_str[]
INIT(= N_("E746: Function name does not match script file name: %s"));
#endif
EXTERN char e_cannot_change_directory_buffer_is_modified_add_bang_to_override[]
INIT(= N_("E747: Cannot change directory, buffer is modified (add ! to override)"));
EXTERN char e_no_previously_used_register[]
INIT(= N_("E748: No previously used register"));
EXTERN char e_empty_buffer[]
INIT(= N_("E749: empty buffer"));
#ifdef FEAT_PROFILE
EXTERN char e_first_use_profile_start_fname[]
INIT(= N_("E750: First use \":profile start {fname}\""));
#endif
#ifdef FEAT_SPELL
EXTERN char e_output_file_name_must_not_have_region_name[]
INIT(= N_("E751: Output file name must not have region name"));
EXTERN char e_no_previous_spell_replacement[]
INIT(= N_("E752: No previous spell replacement"));
EXTERN char e_not_found_str[]
INIT(= N_("E753: Not found: %s"));
EXTERN char e_only_up_to_nr_regions_supported[]
INIT(= N_("E754: Only up to %d regions supported"));
EXTERN char e_invalid_region_in_str[]
INIT(= N_("E755: Invalid region in %s"));
EXTERN char e_spell_checking_is_not_possible[]
INIT(= N_("E756: Spell checking is not possible"));
#endif
EXTERN char e_this_does_not_look_like_spell_file[]
INIT(= N_("E757: This does not look like a spell file"));
EXTERN char e_truncated_spell_file[]
INIT(= N_("E758: Truncated spell file"));
EXTERN char e_format_error_in_spell_file[]
INIT(= N_("E759: Format error in spell file"));
EXTERN char e_no_word_count_in_str[]
INIT(= N_("E760: No word count in %s"));
EXTERN char e_format_error_in_affix_file_fol_low_or_upp[]
INIT(= N_("E761: Format error in affix file FOL, LOW or UPP"));
EXTERN char e_character_in_fol_low_or_upp_is_out_of_range[]
INIT(= N_("E762: Character in FOL, LOW or UPP is out of range"));
EXTERN char e_word_characters_differ_between_spell_files[]
INIT(= N_("E763: Word characters differ between spell files"));
#if defined(FEAT_SYN_HL) || defined(FEAT_COMPL_FUNC)
EXTERN char e_option_str_is_not_set[]
INIT(= N_("E764: Option '%s' is not set"));
#endif
EXTERN char e_spellfile_does_not_have_nr_entries[]
INIT(= N_("E765: 'spellfile' does not have %d entries"));
#endif
EXTERN char e_insufficient_arguments_for_printf[]
INIT(= N_("E766: Insufficient arguments for printf()"));
EXTERN char e_too_many_arguments_to_printf[]
INIT(= N_("E767: Too many arguments for printf()"));
EXTERN char e_swap_file_exists_str_silent_overrides[]
INIT(= N_("E768: Swap file exists: %s (:silent! overrides)"));
EXTERN char e_missing_rsb_after_str_lsb[]
INIT(= N_("E769: Missing ] after %s["));
#ifdef FEAT_SPELL
EXTERN char e_unsupported_section_in_spell_file[]
INIT(= N_("E770: Unsupported section in spell file"));
EXTERN char e_old_spell_file_needs_to_be_updated[]
INIT(= N_("E771: Old spell file, needs to be updated"));
EXTERN char e_spell_file_is_for_newer_version_of_vim[]
INIT(= N_("E772: Spell file is for newer version of Vim"));
#endif
EXTERN char e_symlink_loop_for_str[]
INIT(= N_("E773: Symlink loop for \"%s\""));
EXTERN char e_operatorfunc_is_empty[]
INIT(= N_("E774: 'operatorfunc' is empty"));
#ifndef FEAT_EVAL
EXTERN char e_eval_feature_not_available[]
INIT(= N_("E775: Eval feature not available"));
#endif
#ifdef FEAT_QUICKFIX
EXTERN char e_no_location_list[]
INIT(= N_("E776: No location list"));
#endif
EXTERN char e_string_or_list_expected[]
INIT(= N_("E777: String or List expected"));
#ifdef FEAT_SPELL
EXTERN char e_this_does_not_look_like_sug_file_str[]
INIT(= N_("E778: This does not look like a .sug file: %s"));
EXTERN char e_old_sug_file_needs_to_be_updated_str[]
INIT(= N_("E779: Old .sug file, needs to be updated: %s"));
EXTERN char e_sug_file_is_for_newer_version_of_vim_str[]
INIT(= N_("E780: .sug file is for newer version of Vim: %s"));
EXTERN char e_sug_file_doesnt_match_spl_file_str[]
INIT(= N_("E781: .sug file doesn't match .spl file: %s"));
EXTERN char e_error_while_reading_sug_file_str[]
INIT(= N_("E782: error while reading .sug file: %s"));
EXTERN char e_duplicate_char_in_map_entry[]
INIT(= N_("E783: duplicate char in MAP entry"));
#endif
EXTERN char e_cannot_close_last_tab_page[]
INIT(= N_("E784: Cannot close last tab page"));
EXTERN char e_complete_can_only_be_used_in_insert_mode[]
INIT(= N_("E785: complete() can only be used in Insert mode"));
EXTERN char e_range_not_allowed[]
INIT(= N_("E786: Range not allowed"));
EXTERN char e_buffer_changed_unexpectedly[]
INIT(= N_("E787: Buffer changed unexpectedly"));
EXTERN char e_not_allowed_to_edit_another_buffer_now[]
INIT(= N_("E788: Not allowed to edit another buffer now"));
EXTERN char e_error_missing_rsb_str[]
INIT(= N_("E789: Missing ']': %s"));
EXTERN char e_undojoin_is_not_allowed_after_undo[]
INIT(= N_("E790: undojoin is not allowed after undo"));
EXTERN char e_empty_keymap_entry[]
INIT(= N_("E791: Empty keymap entry"));
EXTERN char e_empty_menu_name[]
INIT(= N_("E792: Empty menu name"));
#ifdef FEAT_DIFF
EXTERN char e_no_other_buffer_in_diff_mode_is_modifiable[]
INIT(= N_("E793: No other buffer in diff mode is modifiable"));
#endif
#ifdef FEAT_EVAL
EXTERN char e_cannot_set_variable_in_sandbox[]
INIT(= N_("E794: Cannot set variable in the sandbox"));
EXTERN char e_cannot_set_variable_in_sandbox_str[]
INIT(= N_("E794: Cannot set variable in the sandbox: \"%s\""));
EXTERN char e_cannot_delete_variable[]
INIT(= N_("E795: Cannot delete variable"));
EXTERN char e_cannot_delete_variable_str[]
INIT(= N_("E795: Cannot delete variable %s"));
// E796
EXTERN char e_writing_to_device_disabled_with_opendevice_option[]
INIT(= N_("writing to device disabled with 'opendevice' option"));
EXTERN char e_cannot_delete_variable_str[]
INIT(= N_("E795: Cannot delete variable %s"));
#endif

#ifdef FEAT_SPELL
EXTERN char e_spellfilemising_autocommand_deleted_buffer[]
INIT(= N_("E797: SpellFileMissing autocommand deleted buffer"));
#endif
EXTERN char e_id_is_reserved_for_match_nr[]
INIT(= N_("E798: ID is reserved for \":match\": %d"));
EXTERN char e_invalid_id_nr_must_be_greater_than_or_equal_to_one[]
INIT(= N_("E799: Invalid ID: %d (must be greater than or equal to 1)"));
#ifndef FEAT_ARABIC
EXTERN char e_arabic_cannot_be_used_not_enabled_at_compile_time[]
INIT(= N_("E800: Arabic cannot be used: Not enabled at compile time\n"));
#endif

#ifdef FEAT_EVAL
EXTERN char e_cannot_use_percent_with_float[]
INIT(= N_("E804: Cannot use '%' with Float"));
#endif

#ifdef FEAT_FLOAT
EXTERN char e_using_float_as_string[]
INIT(= N_("E806: using Float as a String"));
Expand Down Expand Up @@ -1838,6 +1951,11 @@ EXTERN char e_positive_count_required[]
EXTERN char e_cannot_lock_or_unlock_variable_str[]
INIT(= N_("E940: Cannot lock or unlock variable %s"));
#endif
EXTERN char e_reverse_range_in_character_class[]
INIT(= N_("E944: Reverse range in character class"));
EXTERN char e_range_too_large_in_character_class[]
INIT(= N_("E945: Range too large in character class"));

#ifdef FEAT_TERMINAL
EXTERN char e_job_still_running[]
INIT(= N_("E948: Job still running"));
Expand All @@ -1848,6 +1966,8 @@ EXTERN char e_file_changed_while_writing[]
INIT(= N_("E949: File changed while writing"));
EXTERN char e_autocommand_caused_recursive_behavior[]
INIT(= N_("E952: Autocommand caused recursive behavior"));
EXTERN char e_cannot_use_pattern_recursively[]
INIT(= N_("E956: Cannot use pattern recursively"));
EXTERN char e_invalid_window_number[]
INIT(= N_("E957: Invalid window number"));
EXTERN char_u e_invalid_column_number_nr[]
Expand Down
2 changes: 1 addition & 1 deletion src/evalfunc.c
Expand Up @@ -6715,7 +6715,7 @@ f_islocked(typval_T *argvars, typval_T *rettv)
}
}
else if (lv.ll_range)
emsg(_("E786: Range not allowed"));
emsg(_(e_range_not_allowed));
else if (lv.ll_newkey != NULL)
semsg(_(e_key_not_present_in_dictionary), lv.ll_newkey);
else if (lv.ll_list != NULL)
Expand Down
2 changes: 1 addition & 1 deletion src/evalvars.c
Expand Up @@ -1968,7 +1968,7 @@ item_lock(typval_T *tv, int deep, int lock, int check_refcount)

if (recurse >= DICT_MAXNEST)
{
emsg(_("E743: variable nested too deep for (un)lock"));
emsg(_(e_variable_nested_too_deep_for_unlock));
return;
}
if (deep == 0)
Expand Down
3 changes: 1 addition & 2 deletions src/ex_cmds.c
Expand Up @@ -2194,8 +2194,7 @@ check_overwrite(
else
#endif
{
semsg(_("E768: Swap file exists: %s (:silent! overrides)"),
swapname);
semsg(_(e_swap_file_exists_str_silent_overrides), swapname);
vim_free(swapname);
return FAIL;
}
Expand Down
4 changes: 2 additions & 2 deletions src/ex_docmd.c
Expand Up @@ -6023,7 +6023,7 @@ ex_tabclose(exarg_T *eap)
else
# endif
if (first_tabpage->tp_next == NULL)
emsg(_("E784: Cannot close last tab page"));
emsg(_(e_cannot_close_last_tab_page));
else
{
tab_number = get_tabpage_arg(eap);
Expand Down Expand Up @@ -7366,7 +7366,7 @@ changedir_func(

if (vim_strchr(p_cpo, CPO_CHDIR) != NULL && curbufIsChanged() && !forceit)
{
emsg(_("E747: Cannot change directory, buffer is modified (add ! to override)"));
emsg(_(e_cannot_change_directory_buffer_is_modified_add_bang_to_override));
return FALSE;
}

Expand Down
2 changes: 1 addition & 1 deletion src/ex_getln.c
Expand Up @@ -2664,7 +2664,7 @@ curbuf_locked(void)
{
if (curbuf_lock > 0)
{
emsg(_("E788: Not allowed to edit another buffer now"));
emsg(_(e_not_allowed_to_edit_another_buffer_now));
return TRUE;
}
return allbuf_locked();
Expand Down
2 changes: 1 addition & 1 deletion src/insexpand.c
Expand Up @@ -2864,7 +2864,7 @@ f_complete(typval_T *argvars, typval_T *rettv UNUSED)

if ((State & INSERT) == 0)
{
emsg(_("E785: complete() can only be used in Insert mode"));
emsg(_(e_complete_can_only_be_used_in_insert_mode));
return;
}

Expand Down
7 changes: 3 additions & 4 deletions src/match.c
Expand Up @@ -45,8 +45,7 @@ match_add(
return -1;
if (id < -1 || id == 0)
{
semsg(_("E799: Invalid ID: %d (must be greater than or equal to 1)"),
id);
semsg(_(e_invalid_id_nr_must_be_greater_than_or_equal_to_one), id);
return -1;
}
if (id != -1)
Expand Down Expand Up @@ -1216,7 +1215,7 @@ f_matchadd(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
return;
if (id >= 1 && id <= 3)
{
semsg(_("E798: ID is reserved for \":match\": %d"), id);
semsg(_(e_id_is_reserved_for_match_nr), id);
return;
}

Expand Down Expand Up @@ -1284,7 +1283,7 @@ f_matchaddpos(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
// id == 3 is ok because matchaddpos() is supposed to substitute :3match
if (id == 1 || id == 2)
{
semsg(_("E798: ID is reserved for \":match\": %d"), id);
semsg(_(e_id_is_reserved_for_match_nr), id);
return;
}

Expand Down
2 changes: 1 addition & 1 deletion src/memline.c
Expand Up @@ -4415,7 +4415,7 @@ resolve_symlink(char_u *fname, char_u *buf)
// Limit symlink depth to 100, catch recursive loops.
if (++depth == 100)
{
semsg(_("E773: Symlink loop for \"%s\""), fname);
semsg(_(e_symlink_loop_for_str), fname);
return FAIL;
}

Expand Down
2 changes: 1 addition & 1 deletion src/menu.c
Expand Up @@ -512,7 +512,7 @@ add_menu_path(
if (*dname == NUL)
{
// Only a mnemonic or accelerator is not valid.
emsg(_("E792: Empty menu name"));
emsg(_(e_empty_menu_name));
goto erret;
}

Expand Down
4 changes: 2 additions & 2 deletions src/ops.c
Expand Up @@ -3381,7 +3381,7 @@ op_function(oparg_T *oap UNUSED)
typval_T rettv;

if (*p_opfunc == NUL)
emsg(_("E774: 'operatorfunc' is empty"));
emsg(_(e_operatorfunc_is_empty));
else
{
// Set '[ and '] marks to text to be operated on.
Expand Down Expand Up @@ -3419,7 +3419,7 @@ op_function(oparg_T *oap UNUSED)
}
}
#else
emsg(_("E775: Eval feature not available"));
emsg(_(e_eval_feature_not_available));
#endif
}

Expand Down
2 changes: 1 addition & 1 deletion src/profiler.c
Expand Up @@ -320,7 +320,7 @@ ex_profile(exarg_T *eap)
set_vim_var_nr(VV_PROFILING, 1L);
}
else if (do_profiling == PROF_NONE)
emsg(_("E750: First use \":profile start {fname}\""));
emsg(_(e_first_use_profile_start_fname));
else if (STRCMP(eap->arg, "pause") == 0)
{
if (do_profiling == PROF_YES)
Expand Down
2 changes: 1 addition & 1 deletion src/quickfix.c
Expand Up @@ -7978,7 +7978,7 @@ cexpr_core(exarg_T *eap, typval_T *tv)
return OK;
}

emsg(_("E777: String or List expected"));
emsg(_(e_string_or_list_expected));
return FAIL;
}

Expand Down
9 changes: 2 additions & 7 deletions src/regexp.c
Expand Up @@ -71,11 +71,6 @@ toggle_Magic(int x)

#define MAX_LIMIT (32767L << 16L)

static char_u e_missingbracket[] = N_("E769: Missing ] after %s[");
static char_u e_reverse_range[] = N_("E944: Reverse range in character class");
static char_u e_large_class[] = N_("E945: Range too large in character class");
static char_u e_recursive[] = N_("E956: Cannot use pattern recursively");

#define NOT_MULTI 0
#define MULTI_ONE 1
#define MULTI_MULT 2
Expand Down Expand Up @@ -2779,7 +2774,7 @@ vim_regexec_string(
// Cannot use the same prog recursively, it contains state.
if (rmp->regprog->re_in_use)
{
emsg(_(e_recursive));
emsg(_(e_cannot_use_pattern_recursively));
return FALSE;
}
rmp->regprog->re_in_use = TRUE;
Expand Down Expand Up @@ -2900,7 +2895,7 @@ vim_regexec_multi(
// Cannot use the same prog recursively, it contains state.
if (rmp->regprog->re_in_use)
{
emsg(_(e_recursive));
emsg(_(e_cannot_use_pattern_recursively));
return FALSE;
}
rmp->regprog->re_in_use = TRUE;
Expand Down

0 comments on commit 677658a

Please sign in to comment.