0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 8.2.3749: error messages are everywhere

Problem:    Error messages are everywhere.
Solution:   Move more error messages to errors.h and adjust the names.
This commit is contained in:
Bram Moolenaar
2021-12-05 21:46:34 +00:00
parent e5710a02cb
commit 12f3c1b77f
11 changed files with 57 additions and 33 deletions

View File

@@ -713,7 +713,7 @@ buf_write(
// Avoid a crash for a long name. // Avoid a crash for a long name.
if (STRLEN(fname) >= MAXPATHL) if (STRLEN(fname) >= MAXPATHL)
{ {
emsg(_(e_longname)); emsg(_(e_name_too_long));
return FAIL; return FAIL;
} }

View File

@@ -406,7 +406,7 @@ ExpandOne(
// together. Don't really want to wait for this message // together. Don't really want to wait for this message
// (and possibly have to hit return to continue!). // (and possibly have to hit return to continue!).
if (!(options & WILD_SILENT)) if (!(options & WILD_SILENT))
emsg(_(e_toomany)); emsg(_(e_too_many_file_names));
else if (!(options & WILD_NO_BEEP)) else if (!(options & WILD_NO_BEEP))
beep_flush(); beep_flush();
} }

View File

@@ -134,6 +134,40 @@ EXTERN char e_invalid_character_after_str_at[]
INIT(= N_("E59: invalid character after %s@")); INIT(= N_("E59: invalid character after %s@"));
EXTERN char e_too_many_complex_str_curly[] EXTERN char e_too_many_complex_str_curly[]
INIT(= N_("E60: Too many complex %s{...}s")); INIT(= N_("E60: Too many complex %s{...}s"));
EXTERN char e_nested_str[]
INIT(= N_("E61: Nested %s*"));
EXTERN char e_nested_str_chr[]
INIT(= N_("E62: Nested %s%c"));
EXTERN char e_invalid_use_of_underscore[]
INIT(= N_("E63: invalid use of \\_"));
EXTERN char e_str_chr_follows_nothing[]
INIT(= N_("E64: %s%c follows nothing"));
EXTERN char e_illegal_back_reference[]
INIT(= N_("E65: Illegal back reference"));
#ifdef FEAT_SYN_HL
EXTERN char e_z_not_allowed_here[]
INIT(= N_("E66: \\z( not allowed here"));
EXTERN char e_z1_z9_not_allowed_here[]
INIT(= N_("E67: \\z1 - \\z9 not allowed here"));
#endif
EXTERN char e_missing_sb_after_str[]
INIT(= N_("E69: Missing ] after %s%%["));
EXTERN char e_empty_str_brackets[]
INIT(= N_("E70: Empty %s%%[]"));
EXTERN char e_invalid_character_after_str[]
INIT(= N_("E71: Invalid character after %s%%"));
EXTERN char e_close_error_on_swap_file[]
INIT(= N_("E72: Close error on swap file"));
EXTERN char e_tag_stack_empty[]
INIT(= N_("E73: tag stack empty"));
EXTERN char e_command_too_complex[]
INIT(= N_("E74: Command too complex"));
EXTERN char e_name_too_long[]
INIT(= N_("E75: Name too long"));
EXTERN char e_too_many_brackets[]
INIT(= N_("E76: Too many ["));
EXTERN char e_too_many_file_names[]
INIT(= N_("E77: Too many file names"));
#ifdef FEAT_EVAL #ifdef FEAT_EVAL
EXTERN char e_undefined_variable_str[] EXTERN char e_undefined_variable_str[]

View File

@@ -1010,7 +1010,7 @@ ins_typebuf(
if (typebuf.tb_len > 2147483647 - extra) if (typebuf.tb_len > 2147483647 - extra)
{ {
// string is getting too long for a 32 bit int // string is getting too long for a 32 bit int
emsg(_(e_toocompl)); // also calls flush_buffers emsg(_(e_command_too_complex)); // also calls flush_buffers
setcursor(); setcursor();
return FAIL; return FAIL;
} }

View File

@@ -1715,12 +1715,6 @@ EXTERN char e_shellempty[] INIT(= N_("E91: 'shell' option is empty"));
#if defined(FEAT_SIGN_ICONS) && !defined(FEAT_GUI_GTK) #if defined(FEAT_SIGN_ICONS) && !defined(FEAT_GUI_GTK)
EXTERN char e_signdata[] INIT(= N_("E255: Couldn't read in sign data!")); EXTERN char e_signdata[] INIT(= N_("E255: Couldn't read in sign data!"));
#endif #endif
EXTERN char e_swapclose[] INIT(= N_("E72: Close error on swap file"));
EXTERN char e_tagstack[] INIT(= N_("E73: tag stack empty"));
EXTERN char e_toocompl[] INIT(= N_("E74: Command too complex"));
EXTERN char e_longname[] INIT(= N_("E75: Name too long"));
EXTERN char e_toomsbra[] INIT(= N_("E76: Too many ["));
EXTERN char e_toomany[] INIT(= N_("E77: Too many file names"));
EXTERN char e_trailing[] INIT(= N_("E488: Trailing characters")); EXTERN char e_trailing[] INIT(= N_("E488: Trailing characters"));
EXTERN char e_trailing_arg[] INIT(= N_("E488: Trailing characters: %s")); EXTERN char e_trailing_arg[] INIT(= N_("E488: Trailing characters: %s"));
EXTERN char e_umark[] INIT(= N_("E78: Unknown mark")); EXTERN char e_umark[] INIT(= N_("E78: Unknown mark"));

View File

@@ -242,7 +242,7 @@ mf_close(memfile_T *mfp, int del_file)
if (mfp->mf_fd >= 0) if (mfp->mf_fd >= 0)
{ {
if (close(mfp->mf_fd) < 0) if (close(mfp->mf_fd) < 0)
emsg(_(e_swapclose)); emsg(_(e_close_error_on_swap_file));
} }
if (del_file && mfp->mf_fname != NULL) if (del_file && mfp->mf_fname != NULL)
mch_remove(mfp->mf_fname); mch_remove(mfp->mf_fname);
@@ -288,7 +288,7 @@ mf_close_file(
} }
if (close(mfp->mf_fd) < 0) // close the file if (close(mfp->mf_fd) < 0) // close the file
emsg(_(e_swapclose)); emsg(_(e_close_error_on_swap_file));
mfp->mf_fd = -1; mfp->mf_fd = -1;
if (mfp->mf_fname != NULL) if (mfp->mf_fname != NULL)

View File

@@ -74,12 +74,6 @@ toggle_Magic(int x)
static char_u e_missingbracket[] = N_("E769: Missing ] after %s["); 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_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_large_class[] = N_("E945: Range too large in character class");
#ifdef FEAT_SYN_HL
static char_u e_z_not_allowed[] = N_("E66: \\z( not allowed here");
static char_u e_z1_not_allowed[] = N_("E67: \\z1 - \\z9 not allowed here");
#endif
static char_u e_missing_sb[] = N_("E69: Missing ] after %s%%[");
static char_u e_empty_sb[] = N_("E70: Empty %s%%[]");
static char_u e_recursive[] = N_("E956: Cannot use pattern recursively"); static char_u e_recursive[] = N_("E956: Cannot use pattern recursively");
#define NOT_MULTI 0 #define NOT_MULTI 0

View File

@@ -1242,7 +1242,7 @@ seen_endbrace(int refnum)
break; break;
if (*p == NUL) if (*p == NUL)
{ {
emsg(_("E65: Illegal back reference")); emsg(_(e_illegal_back_reference));
rc_did_emsg = TRUE; rc_did_emsg = TRUE;
return FALSE; return FALSE;
} }
@@ -1347,7 +1347,7 @@ regatom(int *flagp)
case Magic('U'): case Magic('U'):
p = vim_strchr(classchars, no_Magic(c)); p = vim_strchr(classchars, no_Magic(c));
if (p == NULL) if (p == NULL)
EMSG_RET_NULL(_("E63: invalid use of \\_")); EMSG_RET_NULL(_(e_invalid_use_of_underscore));
// When '.' is followed by a composing char ignore the dot, so that // When '.' is followed by a composing char ignore the dot, so that
// the composing char is matched here. // the composing char is matched here.
@@ -1402,7 +1402,7 @@ regatom(int *flagp)
case Magic('{'): case Magic('{'):
case Magic('*'): case Magic('*'):
c = no_Magic(c); c = no_Magic(c);
EMSG3_RET_NULL(_("E64: %s%c follows nothing"), EMSG3_RET_NULL(_(e_str_chr_follows_nothing),
(c == '*' ? reg_magic >= MAGIC_ON : reg_magic == MAGIC_ALL), c); (c == '*' ? reg_magic >= MAGIC_ON : reg_magic == MAGIC_ALL), c);
// NOTREACHED // NOTREACHED
@@ -1453,7 +1453,7 @@ regatom(int *flagp)
{ {
#ifdef FEAT_SYN_HL #ifdef FEAT_SYN_HL
case '(': if ((reg_do_extmatch & REX_SET) == 0) case '(': if ((reg_do_extmatch & REX_SET) == 0)
EMSG_RET_NULL(_(e_z_not_allowed)); EMSG_RET_NULL(_(e_z_not_allowed_here));
if (one_exactly) if (one_exactly)
EMSG_ONE_RET_NULL; EMSG_ONE_RET_NULL;
ret = reg(REG_ZPAREN, &flags); ret = reg(REG_ZPAREN, &flags);
@@ -1472,7 +1472,7 @@ regatom(int *flagp)
case '7': case '7':
case '8': case '8':
case '9': if ((reg_do_extmatch & REX_USE) == 0) case '9': if ((reg_do_extmatch & REX_USE) == 0)
EMSG_RET_NULL(_(e_z1_not_allowed)); EMSG_RET_NULL(_(e_z1_z9_not_allowed_here));
ret = regnode(ZREF + c - '0'); ret = regnode(ZREF + c - '0');
re_has_z = REX_USE; re_has_z = REX_USE;
break; break;
@@ -1544,7 +1544,7 @@ regatom(int *flagp)
while ((c = getchr()) != ']') while ((c = getchr()) != ']')
{ {
if (c == NUL) if (c == NUL)
EMSG2_RET_NULL(_(e_missing_sb), EMSG2_RET_NULL(_(e_missing_sb_after_str),
reg_magic == MAGIC_ALL); reg_magic == MAGIC_ALL);
br = regnode(BRANCH); br = regnode(BRANCH);
if (ret == NULL) if (ret == NULL)
@@ -1564,7 +1564,7 @@ regatom(int *flagp)
return NULL; return NULL;
} }
if (ret == NULL) if (ret == NULL)
EMSG2_RET_NULL(_(e_empty_sb), EMSG2_RET_NULL(_(e_empty_str_brackets),
reg_magic == MAGIC_ALL); reg_magic == MAGIC_ALL);
lastbranch = regnode(BRANCH); lastbranch = regnode(BRANCH);
br = regnode(NOTHING); br = regnode(NOTHING);
@@ -1712,7 +1712,7 @@ regatom(int *flagp)
} }
} }
EMSG2_RET_NULL(_("E71: Invalid character after %s%%"), EMSG2_RET_NULL(_(e_invalid_character_after_str),
reg_magic == MAGIC_ALL); reg_magic == MAGIC_ALL);
} }
} }
@@ -2001,7 +2001,7 @@ collection:
regc(NUL); regc(NUL);
prevchr_len = 1; // last char was the ']' prevchr_len = 1; // last char was the ']'
if (*regparse != ']') if (*regparse != ']')
EMSG_RET_NULL(_(e_toomsbra)); // Cannot happen? EMSG_RET_NULL(_(e_too_many_brackets)); // Cannot happen?
skipchr(); // let's be friends with the lexer again skipchr(); // let's be friends with the lexer again
*flagp |= HASWIDTH | SIMPLE; *flagp |= HASWIDTH | SIMPLE;
break; break;
@@ -2215,8 +2215,8 @@ regpiece(int *flagp)
{ {
// Can't have a multi follow a multi. // Can't have a multi follow a multi.
if (peekchr() == Magic('*')) if (peekchr() == Magic('*'))
EMSG2_RET_NULL(_("E61: Nested %s*"), reg_magic >= MAGIC_ON); EMSG2_RET_NULL(_(e_nested_str), reg_magic >= MAGIC_ON);
EMSG3_RET_NULL(_("E62: Nested %s%c"), reg_magic == MAGIC_ALL, EMSG3_RET_NULL(_(e_nested_str_chr), reg_magic == MAGIC_ALL,
no_Magic(peekchr())); no_Magic(peekchr()));
} }

View File

@@ -1586,7 +1586,7 @@ nfa_regatom(void)
case '9': case '9':
// \z1...\z9 // \z1...\z9
if ((reg_do_extmatch & REX_USE) == 0) if ((reg_do_extmatch & REX_USE) == 0)
EMSG_RET_FAIL(_(e_z1_not_allowed)); EMSG_RET_FAIL(_(e_z1_z9_not_allowed_here));
EMIT(NFA_ZREF1 + (no_Magic(c) - '1')); EMIT(NFA_ZREF1 + (no_Magic(c) - '1'));
// No need to set rex.nfa_has_backref, the sub-matches don't // No need to set rex.nfa_has_backref, the sub-matches don't
// change when \z1 .. \z9 matches or not. // change when \z1 .. \z9 matches or not.
@@ -1595,7 +1595,7 @@ nfa_regatom(void)
case '(': case '(':
// \z( // \z(
if ((reg_do_extmatch & REX_SET) == 0) if ((reg_do_extmatch & REX_SET) == 0)
EMSG_RET_FAIL(_(e_z_not_allowed)); EMSG_RET_FAIL(_(e_z_not_allowed_here));
if (nfa_reg(REG_ZPAREN) == FAIL) if (nfa_reg(REG_ZPAREN) == FAIL)
return FAIL; // cascaded error return FAIL; // cascaded error
re_has_z = REX_SET; re_has_z = REX_SET;
@@ -1677,7 +1677,7 @@ nfa_regatom(void)
for (n = 0; (c = peekchr()) != ']'; ++n) for (n = 0; (c = peekchr()) != ']'; ++n)
{ {
if (c == NUL) if (c == NUL)
EMSG2_RET_FAIL(_(e_missing_sb), EMSG2_RET_FAIL(_(e_missing_sb_after_str),
reg_magic == MAGIC_ALL); reg_magic == MAGIC_ALL);
// recursive call! // recursive call!
if (nfa_regatom() == FAIL) if (nfa_regatom() == FAIL)
@@ -1685,7 +1685,7 @@ nfa_regatom(void)
} }
getchr(); // get the ] getchr(); // get the ]
if (n == 0) if (n == 0)
EMSG2_RET_FAIL(_(e_empty_sb), EMSG2_RET_FAIL(_(e_empty_str_brackets),
reg_magic == MAGIC_ALL); reg_magic == MAGIC_ALL);
EMIT(NFA_OPT_CHARS); EMIT(NFA_OPT_CHARS);
EMIT(n); EMIT(n);

View File

@@ -350,7 +350,7 @@ do_tag(
tagstacklen == 0) tagstacklen == 0)
{ {
// empty stack // empty stack
emsg(_(e_tagstack)); emsg(_(e_tag_stack_empty));
goto end_do_tag; goto end_do_tag;
} }

View File

@@ -753,6 +753,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
3749,
/**/ /**/
3748, 3748,
/**/ /**/