]> granicus.if.org Git - vim/commitdiff
patch 8.2.3749: error messages are everywhere v8.2.3749
authorBram Moolenaar <Bram@vim.org>
Sun, 5 Dec 2021 21:46:34 +0000 (21:46 +0000)
committerBram Moolenaar <Bram@vim.org>
Sun, 5 Dec 2021 21:46:34 +0000 (21:46 +0000)
Problem:    Error messages are everywhere.
Solution:   Move more error messages to errors.h and adjust the names.

src/bufwrite.c
src/cmdexpand.c
src/errors.h
src/getchar.c
src/globals.h
src/memfile.c
src/regexp.c
src/regexp_bt.c
src/regexp_nfa.c
src/tag.c
src/version.c

index 76c36e18e99915b343effc4e73760756bf9efaeb..035c859e22568646e0345d183450a543878d617f 100644 (file)
@@ -713,7 +713,7 @@ buf_write(
     // Avoid a crash for a long name.
     if (STRLEN(fname) >= MAXPATHL)
     {
-       emsg(_(e_longname));
+       emsg(_(e_name_too_long));
        return FAIL;
     }
 
index 9e88d99b7abe849034105f29f2d86e76329fa9c9..73c5a916646cf50a66ab1df0ac106f04e211dba0 100644 (file)
@@ -406,7 +406,7 @@ ExpandOne(
                    // together. Don't really want to wait for this message
                    // (and possibly have to hit return to continue!).
                    if (!(options & WILD_SILENT))
-                       emsg(_(e_toomany));
+                       emsg(_(e_too_many_file_names));
                    else if (!(options & WILD_NO_BEEP))
                        beep_flush();
                }
index 96aef67fcb9ef579b7d935cd513ea42277570ae3..49df3572def65d677b55366f1b0d5565f64ca4da 100644 (file)
@@ -134,6 +134,40 @@ EXTERN char e_invalid_character_after_str_at[]
        INIT(= N_("E59: invalid character after %s@"));
 EXTERN char e_too_many_complex_str_curly[]
        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
 EXTERN char e_undefined_variable_str[]
index bdf0272ef0e12b38a15f717cfa445292225d6fd5..8c6b48d0cffd80f9357a7742fd79a73b36d93cf0 100644 (file)
@@ -1010,7 +1010,7 @@ ins_typebuf(
        if (typebuf.tb_len > 2147483647 - extra)
        {
            // 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();
            return FAIL;
        }
index f90dea20b85fab9c2e4c9944b8fae374618d58bc..143aaa0bdccd8d66ee82426237985bd8a78678e5 100644 (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)
 EXTERN char e_signdata[]       INIT(= N_("E255: Couldn't read in sign data!"));
 #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_arg[]   INIT(= N_("E488: Trailing characters: %s"));
 EXTERN char e_umark[]          INIT(= N_("E78: Unknown mark"));
index a414d9e5d63b0fe12f3a14f8f76742d6cd258559..fbffdbe95dd57db46ec19dc7fc7a8e7d09be66fc 100644 (file)
@@ -242,7 +242,7 @@ mf_close(memfile_T *mfp, int del_file)
     if (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)
        mch_remove(mfp->mf_fname);
@@ -288,7 +288,7 @@ mf_close_file(
     }
 
     if (close(mfp->mf_fd) < 0)                 // close the file
-       emsg(_(e_swapclose));
+       emsg(_(e_close_error_on_swap_file));
     mfp->mf_fd = -1;
 
     if (mfp->mf_fname != NULL)
index 45485f4018fbbd5980e93cc11252e14e166b6382..72255c44a3ba9e18d4c93b8b41433bd7920f04c8 100644 (file)
@@ -74,12 +74,6 @@ toggle_Magic(int x)
 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");
-#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");
 
 #define NOT_MULTI      0
index 313451ccbca4f496d0c9989d3e9549af1bff527e..f631741618d23e9551e16b92c9802db65613c161 100644 (file)
@@ -1242,7 +1242,7 @@ seen_endbrace(int refnum)
                break;
        if (*p == NUL)
        {
-           emsg(_("E65: Illegal back reference"));
+           emsg(_(e_illegal_back_reference));
            rc_did_emsg = TRUE;
            return FALSE;
        }
@@ -1347,7 +1347,7 @@ regatom(int *flagp)
       case Magic('U'):
        p = vim_strchr(classchars, no_Magic(c));
        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
        // the composing char is matched here.
@@ -1402,7 +1402,7 @@ regatom(int *flagp)
       case Magic('{'):
       case Magic('*'):
        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);
        // NOTREACHED
 
@@ -1453,7 +1453,7 @@ regatom(int *flagp)
            {
 #ifdef FEAT_SYN_HL
                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)
                              EMSG_ONE_RET_NULL;
                          ret = reg(REG_ZPAREN, &flags);
@@ -1472,7 +1472,7 @@ regatom(int *flagp)
                case '7':
                case '8':
                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');
                          re_has_z = REX_USE;
                          break;
@@ -1544,7 +1544,7 @@ regatom(int *flagp)
                              while ((c = getchr()) != ']')
                              {
                                  if (c == NUL)
-                                     EMSG2_RET_NULL(_(e_missing_sb),
+                                     EMSG2_RET_NULL(_(e_missing_sb_after_str),
                                                      reg_magic == MAGIC_ALL);
                                  br = regnode(BRANCH);
                                  if (ret == NULL)
@@ -1564,7 +1564,7 @@ regatom(int *flagp)
                                      return NULL;
                              }
                              if (ret == NULL)
-                                 EMSG2_RET_NULL(_(e_empty_sb),
+                                 EMSG2_RET_NULL(_(e_empty_str_brackets),
                                                      reg_magic == MAGIC_ALL);
                              lastbranch = regnode(BRANCH);
                              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);
            }
        }
@@ -2001,7 +2001,7 @@ collection:
                regc(NUL);
                prevchr_len = 1;        // last char was the ']'
                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
                *flagp |= HASWIDTH | SIMPLE;
                break;
@@ -2215,8 +2215,8 @@ regpiece(int *flagp)
     {
        // Can't have a multi follow a multi.
        if (peekchr() == Magic('*'))
-           EMSG2_RET_NULL(_("E61: Nested %s*"), reg_magic >= MAGIC_ON);
-       EMSG3_RET_NULL(_("E62: Nested %s%c"), reg_magic == MAGIC_ALL,
+           EMSG2_RET_NULL(_(e_nested_str), reg_magic >= MAGIC_ON);
+       EMSG3_RET_NULL(_(e_nested_str_chr), reg_magic == MAGIC_ALL,
                                                          no_Magic(peekchr()));
     }
 
index a0f1a960b30aa579c1dbcdc2d71ef77eb07ad468..ffe894d4a497e0337d5bcfaa2e783ff699beacd2 100644 (file)
@@ -1586,7 +1586,7 @@ nfa_regatom(void)
                case '9':
                    // \z1...\z9
                    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'));
                    // No need to set rex.nfa_has_backref, the sub-matches don't
                    // change when \z1 .. \z9 matches or not.
@@ -1595,7 +1595,7 @@ nfa_regatom(void)
                case '(':
                    // \z(
                    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)
                        return FAIL;        // cascaded error
                    re_has_z = REX_SET;
@@ -1677,7 +1677,7 @@ nfa_regatom(void)
                        for (n = 0; (c = peekchr()) != ']'; ++n)
                        {
                            if (c == NUL)
-                               EMSG2_RET_FAIL(_(e_missing_sb),
+                               EMSG2_RET_FAIL(_(e_missing_sb_after_str),
                                                      reg_magic == MAGIC_ALL);
                            // recursive call!
                            if (nfa_regatom() == FAIL)
@@ -1685,7 +1685,7 @@ nfa_regatom(void)
                        }
                        getchr();  // get the ]
                        if (n == 0)
-                           EMSG2_RET_FAIL(_(e_empty_sb),
+                           EMSG2_RET_FAIL(_(e_empty_str_brackets),
                                                      reg_magic == MAGIC_ALL);
                        EMIT(NFA_OPT_CHARS);
                        EMIT(n);
index a4acbacd86d04aba86ed650b723c418a3d935db0..f932934769357b6dbb750496cdf4520e6c909a3e 100644 (file)
--- a/src/tag.c
+++ b/src/tag.c
@@ -350,7 +350,7 @@ do_tag(
                    tagstacklen == 0)
            {
                // empty stack
-               emsg(_(e_tagstack));
+               emsg(_(e_tag_stack_empty));
                goto end_do_tag;
            }
 
index 17dfe9891aac90782ad99f62c201669fcf675b65..69a230d0a8d4259ec340564be9fdbad2ae6180eb 100644 (file)
@@ -753,6 +753,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    3749,
 /**/
     3748,
 /**/