Skip to content

Commit 74409f6

Browse files
committed
patch 8.2.3970: error messages are spread out
Problem: Error messages are spread out. Solution: Move more errors to errors.h.
1 parent 56200ee commit 74409f6

39 files changed

+161
-131
lines changed

src/buffer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1608,7 +1608,7 @@ do_bufdel(
16081608
if (addr_count == 2)
16091609
{
16101610
if (*arg) // both range and argument is not allowed
1611-
return ex_errmsg(e_trailing_arg, arg);
1611+
return ex_errmsg(e_trailing_characters_str, arg);
16121612
bnr = start_bnr;
16131613
}
16141614
else // addr_count == 1

src/bufwrite.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,7 @@ buf_write(
700700
{
701701
// This can happen during startup when there is a stray "w" in the
702702
// vimrc file.
703-
emsg(_(e_emptybuf));
703+
emsg(_(e_empty_buffer));
704704
return FAIL;
705705
}
706706

src/clientserver.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ sendToLocalVim(char_u *cmd, int asExpr, char_u **result)
119119
{
120120
if (ret == NULL)
121121
{
122-
char *err = _(e_invexprmsg);
122+
char *err = _(e_invalid_expression_received);
123123
size_t len = STRLEN(cmd) + STRLEN(err) + 5;
124124
char_u *msg;
125125

src/cmdhist.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -724,7 +724,7 @@ ex_history(exarg_T *eap)
724724
else
725725
{
726726
*end = i;
727-
semsg(_(e_trailing_arg), arg);
727+
semsg(_(e_trailing_characters_str), arg);
728728
return;
729729
}
730730
}
@@ -736,7 +736,7 @@ ex_history(exarg_T *eap)
736736
end = arg;
737737
if (!get_list_range(&end, &hisidx1, &hisidx2) || *end != NUL)
738738
{
739-
semsg(_(e_trailing_arg), end);
739+
semsg(_(e_trailing_characters_str), end);
740740
return;
741741
}
742742

src/dict.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -962,7 +962,7 @@ eval_dict(char_u **arg, typval_T *rettv, evalarg_T *evalarg, int literal)
962962
if (*skipwhite(*arg) == ':')
963963
semsg(_(e_no_white_space_allowed_before_str_str), ":", *arg);
964964
else
965-
semsg(_(e_missing_dict_colon), *arg);
965+
semsg(_(e_missing_colon_in_dictionary), *arg);
966966
clear_tv(&tvkey);
967967
goto failret;
968968
}
@@ -1002,7 +1002,7 @@ eval_dict(char_u **arg, typval_T *rettv, evalarg_T *evalarg, int literal)
10021002
item = dict_find(d, key, -1);
10031003
if (item != NULL)
10041004
{
1005-
semsg(_(e_duplicate_key), key);
1005+
semsg(_(e_duplicate_key_in_dicitonary), key);
10061006
clear_tv(&tvkey);
10071007
clear_tv(&tv);
10081008
goto failret;
@@ -1042,7 +1042,7 @@ eval_dict(char_u **arg, typval_T *rettv, evalarg_T *evalarg, int literal)
10421042
if (**arg == ',')
10431043
semsg(_(e_no_white_space_allowed_before_str_str), ",", *arg);
10441044
else
1045-
semsg(_(e_missing_dict_comma), *arg);
1045+
semsg(_(e_missing_comma_in_dictionary), *arg);
10461046
goto failret;
10471047
}
10481048
}

src/edit.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ edit(
175175
if (textwinlock != 0 || textlock != 0
176176
|| ins_compl_active() || compl_busy || pum_visible())
177177
{
178-
emsg(_(e_textwinlock));
178+
emsg(_(e_not_allowed_to_change_text_or_change_window));
179179
return FALSE;
180180
}
181181
ins_compl_clear(); // clear stuff for CTRL-X mode

src/errors.h

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,11 +524,22 @@ EXTERN char e_window_layout_changed_unexpectedly[]
524524
EXTERN char e_cannot_allocate_color_str[]
525525
INIT(= N_("E254: Cannot allocate color %s"));
526526
#endif
527+
#if defined(FEAT_SIGN_ICONS) && !defined(FEAT_GUI_GTK)
528+
EXTERN char e_couldnt_read_in_sign_data[]
529+
INIT(= N_("E255: Couldn't read in sign data"));
530+
#endif
527531

528532
EXTERN char e_internal_error_lalloc_zero[]
529533
INIT(= N_("E341: Internal error: lalloc(0, )"));
530534
EXTERN char e_out_of_memory_allocating_nr_bytes[]
531535
INIT(= N_("E342: Out of memory! (allocating %lu bytes)"));
536+
#if defined(AMIGA) || defined(MACOS_X) || defined(MSWIN) \
537+
|| defined(UNIX) || defined(VMS)
538+
EXTERN char e_screen_mode_setting_not_supported[]
539+
INIT(= N_("E359: Screen mode setting not supported"));
540+
#endif
541+
EXTERN char e_pattern_uses_more_memory_than_maxmempattern[]
542+
INIT(= N_("E363: pattern uses more memory than 'maxmempattern'"));
532543
#ifdef FEAT_LIBCALL
533544
EXTERN char e_library_call_failed_for_str[]
534545
INIT(= N_("E364: Library call failed for \"%s()\""));
@@ -546,6 +557,10 @@ EXTERN char e_cannot_write_buftype_option_is_set[]
546557
EXTERN char e_could_not_load_library_function_str[]
547558
INIT(= N_("E448: Could not load library function %s"));
548559
#endif
560+
#ifdef FEAT_CLIENTSERVER
561+
EXTERN char e_invalid_expression_received[]
562+
INIT(= N_("E449: Invalid expression received"));
563+
#endif
549564
#if defined(UNIX) || defined(FEAT_SESSION)
550565
EXTERN char e_cannot_go_back_to_previous_directory[]
551566
INIT(= N_("E459: Cannot go back to previous directory"));
@@ -554,6 +569,10 @@ EXTERN char e_cannot_go_back_to_previous_directory[]
554569
EXTERN char e_illegal_variable_name_str[]
555570
INIT(= N_("E461: Illegal variable name: %s"));
556571
#endif
572+
#ifdef FEAT_NETBEANS_INTG
573+
EXTERN char e_region_is_guarded_cannot_modify[]
574+
INIT(= N_("E463: Region is guarded, cannot modify"));
575+
#endif
557576
EXTERN char e_ambiguous_use_of_user_defined_command[]
558577
INIT(= N_("E464: Ambiguous use of user-defined command"));
559578
EXTERN char e_command_aborted[]
@@ -600,6 +619,10 @@ EXTERN char e_no_match_str_2[]
600619
INIT(= N_("E480: No match: %s"));
601620
EXTERN char e_no_range_allowed[]
602621
INIT(= N_("E481: No range allowed"));
622+
EXTERN char e_trailing_characters[]
623+
INIT(= N_("E488: Trailing characters"));
624+
EXTERN char e_trailing_characters_str[]
625+
INIT(= N_("E488: Trailing characters: %s"));
603626

604627
// E502
605628
EXTERN char e_is_a_directory[]
@@ -638,11 +661,22 @@ EXTERN char e_no_buffers_were_deleted[]
638661
INIT(= N_("E516: No buffers were deleted"));
639662
EXTERN char e_no_buffers_were_wiped_out[]
640663
INIT(= N_("E517: No buffers were wiped out"));
664+
EXTERN char e_not_allowed_here[]
665+
INIT(= N_("E523: Not allowed here"));
666+
EXTERN char e_not_allowed_to_change_text_or_change_window[]
667+
INIT(= N_("E565: Not allowed to change text or change window"));
668+
EXTERN char e_not_allowed_to_change_text_here[]
669+
INIT(= N_("E578: Not allowed to change text here"));
641670
#ifdef FEAT_EVAL
642671
EXTERN char e_endwhile_without_while[]
643672
INIT(= N_("E588: :endwhile without :while"));
644673
EXTERN char e_endfor_without_for[]
645674
INIT(= N_("E588: :endfor without :for"));
675+
EXTERN char e_winheight_cannot_be_smaller_than_winminheight[]
676+
INIT(= N_("E591: 'winheight' cannot be smaller than 'winminheight'"));
677+
EXTERN char e_winwidth_cannot_be_smaller_than_winminwidth[]
678+
INIT(= N_("E592: 'winwidth' cannot be smaller than 'winminwidth'"));
679+
646680
EXTERN char e_missing_endtry[]
647681
INIT(= N_("E600: Missing :endtry"));
648682
EXTERN char e_endtry_without_try[]
@@ -673,6 +707,8 @@ EXTERN char e_no_matching_autocommands_for_acwrite_buffer[]
673707
INIT(= N_("E676: No matching autocommands for acwrite buffer"));
674708
EXTERN char e_buffer_nr_invalid_buffer_number[]
675709
INIT(= N_("E680: <buffer=%d>: invalid buffer number"));
710+
EXTERN char e_invalid_search_pattern_or_delimiter[]
711+
INIT(= N_("E682: Invalid search pattern or delimiter"));
676712
#ifdef FEAT_EVAL
677713
EXTERN char e_list_index_out_of_range_nr[]
678714
INIT(= N_("E684: list index out of range: %ld"));
@@ -701,6 +737,14 @@ EXTERN char e_key_not_present_in_dictionary[]
701737
INIT(= N_("E716: Key not present in Dictionary: \"%s\""));
702738
EXTERN char e_cannot_slice_dictionary[]
703739
INIT(= N_("E719: Cannot slice a Dictionary"));
740+
EXTERN char e_missing_colon_in_dictionary[]
741+
INIT(= N_("E720: Missing colon in Dictionary: %s"));
742+
EXTERN char e_duplicate_key_in_dicitonary[]
743+
INIT(= N_("E721: Duplicate key in Dictionary: \"%s\""));
744+
EXTERN char e_missing_comma_in_dictionary[]
745+
INIT(= N_("E722: Missing comma in Dictionary: %s"));
746+
EXTERN char e_missing_dict_end[]
747+
INIT(= N_("E723: Missing end of Dictionary '}': %s"));
704748
EXTERN char e_wrong_variable_type_for_str_equal[]
705749
INIT(= N_("E734: Wrong variable type for %s="));
706750
EXTERN char e_value_is_locked[]
@@ -712,10 +756,20 @@ EXTERN char e_cannot_change_value[]
712756
EXTERN char e_cannot_change_value_of_str[]
713757
INIT(= N_("E742: Cannot change value of %s"));
714758
#endif
759+
#ifdef FEAT_NETBEANS_INTG
760+
EXTERN char e_netbeans_does_not_allow_changes_in_read_only_files[]
761+
INIT(= N_("E744: NetBeans does not allow changes in read-only files"));
762+
#endif
763+
EXTERN char e_empty_buffer[]
764+
INIT(= N_("E749: empty buffer"));
715765
#ifdef FEAT_SPELL
716766
EXTERN char e_spell_checking_is_not_possible[]
717767
INIT(= N_("E756: Spell checking is not possible"));
718768
#endif
769+
#if defined(FEAT_SYN_HL) || defined(FEAT_COMPL_FUNC)
770+
EXTERN char e_option_str_is_not_set[]
771+
INIT(= N_("E764: Option '%s' is not set"));
772+
#endif
719773
#ifdef FEAT_QUICKFIX
720774
EXTERN char e_no_location_list[]
721775
INIT(= N_("E776: No location list"));
@@ -742,6 +796,12 @@ EXTERN char e_arabic_cannot_be_used_not_enabled_at_compile_time[]
742796
EXTERN char e_cannot_use_percent_with_float[]
743797
INIT(= N_("E804: Cannot use '%' with Float"));
744798
#endif
799+
#ifdef FEAT_FLOAT
800+
EXTERN char e_using_float_as_string[]
801+
INIT(= N_("E806: using Float as a String"));
802+
#endif
803+
EXTERN char e_cannot_close_autocmd_or_popup_window[]
804+
INIT(= N_("E813: Cannot close autocmd or popup window"));
745805
EXTERN char e_blowfish_big_little_endian_use_wrong[]
746806
INIT(= N_("E817: Blowfish big/little endian use wrong"));
747807
EXTERN char e_sha256_test_failed[]
@@ -757,6 +817,10 @@ EXTERN char e_conflicts_with_value_of_listchars[]
757817
EXTERN char e_conflicts_with_value_of_fillchars[]
758818
INIT(= N_("E835: Conflicts with value of 'fillchars'"));
759819
// E839 unused
820+
#ifndef FEAT_CLIPBOARD
821+
EXTERN char e_invalid_register_name[]
822+
INIT(= N_("E850: Invalid register name"));
823+
#endif
760824
EXTERN char e_autocommands_caused_command_to_abort[]
761825
INIT(= N_("E855: Autocommands caused command to abort"));
762826
#ifdef FEAT_EVAL
@@ -781,6 +845,10 @@ EXTERN char e_using_invalid_value_as_string_str[]
781845
INIT(= N_("E908: using an invalid value as a String: %s"));
782846
EXTERN char e_cannot_index_special_variable[]
783847
INIT(= N_("E909: Cannot index a special variable"));
848+
#endif
849+
EXTERN char e_directory_not_found_in_str_str[]
850+
INIT(= N_("E919: Directory not found in '%s': \"%s\""));
851+
#ifdef FEAT_EVAL
784852
EXTERN char e_string_required[]
785853
INIT(= N_("E928: String required"));
786854
#endif
@@ -794,6 +862,8 @@ EXTERN char e_cannot_delete_current_group[]
794862
INIT(= N_("E936: Cannot delete the current group"));
795863
EXTERN char e_attempt_to_delete_buffer_that_is_in_use_str[]
796864
INIT(= N_("E937: Attempt to delete a buffer that is in use: %s"));
865+
EXTERN char e_positive_count_required[]
866+
INIT(= N_("E939: Positive count required"));
797867
#ifdef FEAT_TERMINAL
798868
EXTERN char e_job_still_running[]
799869
INIT(= N_("E948: Job still running"));
@@ -802,6 +872,8 @@ EXTERN char e_job_still_running_add_bang_to_end_the_job[]
802872
#endif
803873
EXTERN char e_file_changed_while_writing[]
804874
INIT(= N_("E949: File changed while writing"));
875+
EXTERN char e_autocommand_caused_recursive_behavior[]
876+
INIT(= N_("E952: Autocommand caused recursive behavior"));
805877
EXTERN char_u e_invalid_column_number_nr[]
806878
INIT(= N_("E964: Invalid column number: %ld"));
807879
EXTERN char_u e_invalid_line_number_nr[]

src/eval.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -856,7 +856,7 @@ get_lval(
856856
if (unlet && !VIM_ISWHITE(*p) && !ends_excmd(*p)
857857
&& *p != '[' && *p != '.')
858858
{
859-
semsg(_(e_trailing_arg), p);
859+
semsg(_(e_trailing_characters_str), p);
860860
return NULL;
861861
}
862862

@@ -2269,7 +2269,7 @@ eval0(
22692269
&& (!in_vim9script() || !vim9_bad_comment(p)))
22702270
{
22712271
if (end_error)
2272-
semsg(_(e_trailing_arg), p);
2272+
semsg(_(e_trailing_characters_str), p);
22732273
else
22742274
semsg(_(e_invalid_expression_str), arg);
22752275
}
@@ -4129,7 +4129,7 @@ check_can_index(typval_T *rettv, int evaluate, int verbose)
41294129
case VAR_FLOAT:
41304130
#ifdef FEAT_FLOAT
41314131
if (verbose)
4132-
emsg(_(e_float_as_string));
4132+
emsg(_(e_using_float_as_string));
41334133
return FAIL;
41344134
#endif
41354135
case VAR_BOOL:

src/evalfunc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3496,7 +3496,7 @@ f_eval(typval_T *argvars, typval_T *rettv)
34963496
rettv->vval.v_number = 0;
34973497
}
34983498
else if (*s != NUL)
3499-
semsg(_(e_trailing_arg), s);
3499+
semsg(_(e_trailing_characters_str), s);
35003500
}
35013501

35023502
/*
@@ -6698,7 +6698,7 @@ f_islocked(typval_T *argvars, typval_T *rettv)
66986698
if (*end != NUL)
66996699
{
67006700
semsg(_(lv.ll_name == lv.ll_name_end
6701-
? e_invalid_argument_str : e_trailing_arg), end);
6701+
? e_invalid_argument_str : e_trailing_characters_str), end);
67026702
}
67036703
else
67046704
{

src/evalvars.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,7 @@ heredoc_get(exarg_T *eap, char_u *cmd, int script_get)
622622
p = skiptowhite(marker);
623623
if (*skipwhite(p) != NUL && *skipwhite(p) != comment_char)
624624
{
625-
semsg(_(e_trailing_arg), p);
625+
semsg(_(e_trailing_characters_str), p);
626626
return NULL;
627627
}
628628
*p = NUL;
@@ -802,7 +802,7 @@ ex_let(exarg_T *eap)
802802
if (vim9script)
803803
{
804804
if (!ends_excmd2(eap->cmd, skipwhite(argend)))
805-
semsg(_(e_trailing_arg), argend);
805+
semsg(_(e_trailing_characters_str), argend);
806806
else
807807
// Vim9 declaration ":var name: type"
808808
arg = vim9_declare_scriptvar(eap, arg);
@@ -1206,7 +1206,7 @@ list_arg_vars(exarg_T *eap, char_u *arg, int *first)
12061206
{
12071207
emsg_severe = TRUE;
12081208
if (!did_emsg)
1209-
semsg(_(e_trailing_arg), arg);
1209+
semsg(_(e_trailing_characters_str), arg);
12101210
break;
12111211
}
12121212
}
@@ -1691,7 +1691,7 @@ ex_unletlock(
16911691
if (name_end != NULL)
16921692
{
16931693
emsg_severe = TRUE;
1694-
semsg(_(e_trailing_arg), name_end);
1694+
semsg(_(e_trailing_characters_str), name_end);
16951695
}
16961696
if (!(eap->skip || error))
16971697
clear_lval(&lv);
@@ -4044,7 +4044,7 @@ var_redir_start(char_u *name, int append)
40444044
clear_lval(redir_lval);
40454045
if (redir_endp != NULL && *redir_endp != NUL)
40464046
// Trailing characters are present after the variable name
4047-
semsg(_(e_trailing_arg), redir_endp);
4047+
semsg(_(e_trailing_characters_str), redir_endp);
40484048
else
40494049
semsg(_(e_invalid_argument_str), name);
40504050
redir_endp = NULL; // don't store a value, only cleanup

0 commit comments

Comments
 (0)