Patch 8.2.3197
Problem:    Error messages are spread out.
Solution:   Move a few more error messages to errors.h.
Files:      src/globals.h, src/errors.h, src/edit.c, src/ex_cmds.c,
            src/ex_docmd.c, src/evalvars.c, src/option.c, src/quickfix.c,
            src/regexp_bt.c, src/regexp_nfa.c, src/regexp.c, src/undo.c,
            src/vim9compile.c, src/vim9script.c


*** ../vim-8.2.3196/src/globals.h       2021-07-20 21:07:32.960058864 +0200
--- src/globals.h       2021-07-21 21:57:32.585385085 +0200
***************
*** 1666,1672 ****
  EXTERN char e_letwrong[]      INIT(= N_("E734: Wrong variable type for %s="));
  EXTERN char e_illvar[]                INIT(= N_("E461: Illegal variable name: 
%s"));
  EXTERN char e_cannot_mod[]    INIT(= N_("E995: Cannot modify existing 
variable"));
- EXTERN char e_readonlyvar[]   INIT(= N_("E46: Cannot change read-only 
variable \"%s\""));
  EXTERN char e_readonlysbx[]   INIT(= N_("E794: Cannot set variable in the 
sandbox: \"%s\""));
  EXTERN char e_stringreq[]     INIT(= N_("E928: String required"));
  EXTERN char e_numberreq[]     INIT(= N_("E889: Number required"));
--- 1666,1671 ----
***************
*** 1692,1703 ****
  EXTERN char e_reduceempty[]   INIT(= N_("E998: Reduce of an empty %s with no 
initial value"));
  EXTERN char e_no_dict_key[]   INIT(= N_("E857: Dictionary key \"%s\" 
required"));
  #endif
- #ifdef FEAT_QUICKFIX
- EXTERN char e_readerrf[]      INIT(= N_("E47: Error while reading 
errorfile"));
- #endif
- #ifdef HAVE_SANDBOX
- EXTERN char e_sandbox[]               INIT(= N_("E48: Not allowed in 
sandbox"));
- #endif
  EXTERN char e_secure[]                INIT(= N_("E523: Not allowed here"));
  EXTERN char e_textlock[]      INIT(= N_("E578: Not allowed to change text 
here"));
  EXTERN char e_textwinlock[]   INIT(= N_("E565: Not allowed to change text or 
change window"));
--- 1691,1696 ----
***************
*** 1705,1711 ****
        || defined(UNIX) || defined(VMS)
  EXTERN char e_screenmode[]    INIT(= N_("E359: Screen mode setting not 
supported"));
  #endif
- EXTERN char e_scroll[]        INIT(= N_("E49: Invalid scroll size"));
  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!"));
--- 1698,1703 ----
*** ../vim-8.2.3196/src/errors.h        2021-07-20 22:29:15.745365063 +0200
--- src/errors.h        2021-07-21 22:15:29.051048515 +0200
***************
*** 104,113 ****
--- 104,146 ----
        INIT(= N_("E44: Corrupted regexp program"));
  EXTERN char e_readonly_option_is_set_add_bang_to_override[]
        INIT(= N_("E45: 'readonly' option is set (add ! to override)"));
+ #ifdef FEAT_EVAL
+ EXTERN char e_cannot_change_readonly_variable_str[]
+       INIT(= N_("E46: Cannot change read-only variable \"%s\""));
+ #endif
+ #ifdef FEAT_QUICKFIX
+ EXTERN char e_error_while_reading_errorfile[]
+       INIT(= N_("E47: Error while reading errorfile"));
+ #endif
+ #ifdef HAVE_SANDBOX
+ EXTERN char e_not_allowed_in_sandbox[]
+       INIT(= N_("E48: Not allowed in sandbox"));
+ #endif
+ EXTERN char e_invalid_scroll_size[]
+       INIT(= N_("E49: Invalid scroll size"));
+ EXTERN char e_too_many_z[]
+       INIT(= N_("E50: Too many \\z("));
+ EXTERN char e_too_many_str_open[]
+       INIT(= N_("E51: Too many %s("));
+ EXTERN char e_unmatched_z[]
+       INIT(= N_("E52: Unmatched \\z("));
+ EXTERN char e_unmatched_str_percent_open[]
+       INIT(= N_("E53: Unmatched %s%%("));
+ EXTERN char e_unmatched_str_open[]
+       INIT(= N_("E54: Unmatched %s("));
+ EXTERN char e_unmatched_str_close[]
+       INIT(= N_("E55: Unmatched %s)"));
+ 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"));
+ 
+ #ifdef FEAT_EVAL
  EXTERN char e_undefined_variable_str[]
        INIT(= N_("E121: Undefined variable: %s"));
  EXTERN char e_undefined_variable_char_str[]
        INIT(= N_("E121: Undefined variable: %c:%s"));
+ #endif
  #ifndef FEAT_DIGRAPHS
  EXTERN char e_no_digraphs_version[]
        INIT(= N_("E196: No digraphs in this version"));
*** ../vim-8.2.3196/src/edit.c  2021-07-20 21:07:32.960058864 +0200
--- src/edit.c  2021-07-21 21:57:02.457452159 +0200
***************
*** 165,171 ****
      // Don't allow inserting in the sandbox.
      if (sandbox != 0)
      {
!       emsg(_(e_sandbox));
        return FALSE;
      }
  #endif
--- 165,171 ----
      // Don't allow inserting in the sandbox.
      if (sandbox != 0)
      {
!       emsg(_(e_not_allowed_in_sandbox));
        return FALSE;
      }
  #endif
*** ../vim-8.2.3196/src/ex_cmds.c       2021-07-20 21:07:32.964058857 +0200
--- src/ex_cmds.c       2021-07-21 21:57:04.721447111 +0200
***************
*** 3596,3602 ****
       */
      if (sandbox != 0)
      {
!       emsg(_(e_sandbox));
        return TRUE;
      }
  #endif
--- 3596,3602 ----
       */
      if (sandbox != 0)
      {
!       emsg(_(e_not_allowed_in_sandbox));
        return TRUE;
      }
  #endif
*** ../vim-8.2.3196/src/ex_docmd.c      2021-07-20 21:07:32.964058857 +0200
--- src/ex_docmd.c      2021-07-21 21:57:07.097441818 +0200
***************
*** 2112,2118 ****
        if (sandbox != 0 && !(ea.argt & EX_SBOXOK))
        {
            // Command not allowed in sandbox.
!           errormsg = _(e_sandbox);
            goto doend;
        }
  #endif
--- 2112,2118 ----
        if (sandbox != 0 && !(ea.argt & EX_SBOXOK))
        {
            // Command not allowed in sandbox.
!           errormsg = _(e_not_allowed_in_sandbox);
            goto doend;
        }
  #endif
*** ../vim-8.2.3196/src/evalvars.c      2021-07-20 17:51:48.243744105 +0200
--- src/evalvars.c      2021-07-21 21:54:17.941821676 +0200
***************
*** 2232,2238 ****
      // VV_RO is also checked when compiling, but let's check here as well.
      if (vimvars[idx].vv_flags & VV_RO)
      {
!       semsg(_(e_readonlyvar), vimvars[idx].vv_name);
        return FAIL;
      }
      if (sandbox && (vimvars[idx].vv_flags & VV_RO_SBX))
--- 2232,2238 ----
      // VV_RO is also checked when compiling, but let's check here as well.
      if (vimvars[idx].vv_flags & VV_RO)
      {
!       semsg(_(e_cannot_change_readonly_variable_str), vimvars[idx].vv_name);
        return FAIL;
      }
      if (sandbox && (vimvars[idx].vv_flags & VV_RO_SBX))
***************
*** 3499,3505 ****
  {
      if (flags & DI_FLAGS_RO)
      {
!       semsg(_(e_readonlyvar), use_gettext ? (char_u *)_(name) : name);
        return TRUE;
      }
      if ((flags & DI_FLAGS_RO_SBX) && sandbox)
--- 3499,3506 ----
  {
      if (flags & DI_FLAGS_RO)
      {
!       semsg(_(e_cannot_change_readonly_variable_str),
!                                      use_gettext ? (char_u *)_(name) : name);
        return TRUE;
      }
      if ((flags & DI_FLAGS_RO_SBX) && sandbox)
*** ../vim-8.2.3196/src/option.c        2021-07-08 17:35:33.132379930 +0200
--- src/option.c        2021-07-21 21:58:03.413316630 +0200
***************
*** 1485,1491 ****
            // Disallow changing some options in the sandbox
            if (sandbox != 0 && (flags & P_SECURE))
            {
!               errmsg = e_sandbox;
                goto skip;
            }
  #endif
--- 1485,1491 ----
            // Disallow changing some options in the sandbox
            if (sandbox != 0 && (flags & P_SECURE))
            {
!               errmsg = e_not_allowed_in_sandbox;
                goto skip;
            }
  #endif
***************
*** 3757,3763 ****
        if (pp == &(curwin->w_p_scr))
        {
            if (curwin->w_p_scr != 0)
!               errmsg = e_scroll;
            win_comp_scroll(curwin);
        }
        // If 'scroll' became invalid because of a side effect silently adjust
--- 3757,3763 ----
        if (pp == &(curwin->w_p_scr))
        {
            if (curwin->w_p_scr != 0)
!               errmsg = e_invalid_scroll_size;
            win_comp_scroll(curwin);
        }
        // If 'scroll' became invalid because of a side effect silently adjust
***************
*** 3793,3799 ****
            p_sj = Rows / 2;
        else
        {
!           errmsg = e_scroll;
            p_sj = 1;
        }
      }
--- 3793,3799 ----
            p_sj = Rows / 2;
        else
        {
!           errmsg = e_invalid_scroll_size;
            p_sj = 1;
        }
      }
***************
*** 4366,4372 ****
        // Disallow changing some options in the sandbox
        if (sandbox > 0 && (flags & P_SECURE))
        {
!           emsg(_(e_sandbox));
            return NULL;
        }
  #endif
--- 4366,4372 ----
        // Disallow changing some options in the sandbox
        if (sandbox > 0 && (flags & P_SECURE))
        {
!           emsg(_(e_not_allowed_in_sandbox));
            return NULL;
        }
  #endif
*** ../vim-8.2.3196/src/quickfix.c      2021-07-20 21:07:32.968058851 +0200
--- src/quickfix.c      2021-07-21 21:55:15.653691357 +0200
***************
*** 1769,1775 ****
        retval = qfl->qf_count;
        goto qf_init_end;
      }
!     emsg(_(e_readerrf));
  error2:
      if (!adding)
      {
--- 1769,1775 ----
        retval = qfl->qf_count;
        goto qf_init_end;
      }
!     emsg(_(e_error_while_reading_errorfile));
  error2:
      if (!adding)
      {
*** ../vim-8.2.3196/src/regexp_bt.c     2021-07-20 21:07:32.968058851 +0200
--- src/regexp_bt.c     2021-07-21 22:15:06.859096101 +0200
***************
*** 2158,2164 ****
                              }
                }
                if (lop == END)
!                   EMSG2_RET_NULL(_("E59: invalid character after %s@"),
                                                      reg_magic == MAGIC_ALL);
                // Look behind must match with behind_pos.
                if (lop == BEHIND || lop == NOBEHIND)
--- 2158,2164 ----
                              }
                }
                if (lop == END)
!                   EMSG2_RET_NULL(_(e_invalid_character_after_str_at),
                                                      reg_magic == MAGIC_ALL);
                // Look behind must match with behind_pos.
                if (lop == BEHIND || lop == NOBEHIND)
***************
*** 2199,2205 ****
            else
            {
                if (num_complex_braces >= 10)
!                   EMSG2_RET_NULL(_("E60: Too many complex %s{...}s"),
                                                      reg_magic == MAGIC_ALL);
                reginsert(BRACE_COMPLEX + num_complex_braces, ret);
                regoptail(ret, regnode(BACK));
--- 2199,2205 ----
            else
            {
                if (num_complex_braces >= 10)
!                   EMSG2_RET_NULL(_(e_too_many_complex_str_curly),
                                                      reg_magic == MAGIC_ALL);
                reginsert(BRACE_COMPLEX + num_complex_braces, ret);
                regoptail(ret, regnode(BACK));
***************
*** 2369,2375 ****
      {
        // Make a ZOPEN node.
        if (regnzpar >= NSUBEXP)
!           EMSG_RET_NULL(_("E50: Too many \\z("));
        parno = regnzpar;
        regnzpar++;
        ret = regnode(ZOPEN + parno);
--- 2369,2375 ----
      {
        // Make a ZOPEN node.
        if (regnzpar >= NSUBEXP)
!           EMSG_RET_NULL(_(e_too_many_z));
        parno = regnzpar;
        regnzpar++;
        ret = regnode(ZOPEN + parno);
***************
*** 2380,2386 ****
      {
        // Make a MOPEN node.
        if (regnpar >= NSUBEXP)
!           EMSG2_RET_NULL(_("E51: Too many %s("), reg_magic == MAGIC_ALL);
        parno = regnpar;
        ++regnpar;
        ret = regnode(MOPEN + parno);
--- 2380,2386 ----
      {
        // Make a MOPEN node.
        if (regnpar >= NSUBEXP)
!           EMSG2_RET_NULL(_(e_too_many_str_open), reg_magic == MAGIC_ALL);
        parno = regnpar;
        ++regnpar;
        ret = regnode(MOPEN + parno);
***************
*** 2437,2454 ****
      {
  #ifdef FEAT_SYN_HL
        if (paren == REG_ZPAREN)
!           EMSG_RET_NULL(_("E52: Unmatched \\z("));
        else
  #endif
            if (paren == REG_NPAREN)
!           EMSG2_RET_NULL(_(e_unmatchedpp), reg_magic == MAGIC_ALL);
        else
!           EMSG2_RET_NULL(_(e_unmatchedp), reg_magic == MAGIC_ALL);
      }
      else if (paren == REG_NOPAREN && peekchr() != NUL)
      {
        if (curchr == Magic(')'))
!           EMSG2_RET_NULL(_(e_unmatchedpar), reg_magic == MAGIC_ALL);
        else
            EMSG_RET_NULL(_(e_trailing));       // "Can't happen".
        // NOTREACHED
--- 2437,2454 ----
      {
  #ifdef FEAT_SYN_HL
        if (paren == REG_ZPAREN)
!           EMSG_RET_NULL(_(e_unmatched_z));
        else
  #endif
            if (paren == REG_NPAREN)
!           EMSG2_RET_NULL(_(e_unmatched_str_percent_open), reg_magic == 
MAGIC_ALL);
        else
!           EMSG2_RET_NULL(_(e_unmatched_str_open), reg_magic == MAGIC_ALL);
      }
      else if (paren == REG_NOPAREN && peekchr() != NUL)
      {
        if (curchr == Magic(')'))
!           EMSG2_RET_NULL(_(e_unmatched_str_close), reg_magic == MAGIC_ALL);
        else
            EMSG_RET_NULL(_(e_trailing));       // "Can't happen".
        // NOTREACHED
*** ../vim-8.2.3196/src/regexp_nfa.c    2021-07-20 21:07:32.968058851 +0200
--- src/regexp_nfa.c    2021-07-21 22:08:41.111925451 +0200
***************
*** 2561,2574 ****
      if (paren != REG_NOPAREN && getchr() != Magic(')'))
      {
        if (paren == REG_NPAREN)
!           EMSG2_RET_FAIL(_(e_unmatchedpp), reg_magic == MAGIC_ALL);
        else
!           EMSG2_RET_FAIL(_(e_unmatchedp), reg_magic == MAGIC_ALL);
      }
      else if (paren == REG_NOPAREN && peekchr() != NUL)
      {
        if (peekchr() == Magic(')'))
!           EMSG2_RET_FAIL(_(e_unmatchedpar), reg_magic == MAGIC_ALL);
        else
            EMSG_RET_FAIL(_("E873: (NFA regexp) proper termination error"));
      }
--- 2561,2575 ----
      if (paren != REG_NOPAREN && getchr() != Magic(')'))
      {
        if (paren == REG_NPAREN)
!           EMSG2_RET_FAIL(_(e_unmatched_str_percent_open),
!                                                      reg_magic == MAGIC_ALL);
        else
!           EMSG2_RET_FAIL(_(e_unmatched_str_open), reg_magic == MAGIC_ALL);
      }
      else if (paren == REG_NOPAREN && peekchr() != NUL)
      {
        if (peekchr() == Magic(')'))
!           EMSG2_RET_FAIL(_(e_unmatched_str_close), reg_magic == MAGIC_ALL);
        else
            EMSG_RET_FAIL(_("E873: (NFA regexp) proper termination error"));
      }
*** ../vim-8.2.3196/src/regexp.c        2021-07-20 21:07:32.968058851 +0200
--- src/regexp.c        2021-07-21 22:01:52.056813183 +0200
***************
*** 74,82 ****
  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_unmatchedpp[] = N_("E53: Unmatched %s%%(");
- static char_u e_unmatchedp[] = N_("E54: Unmatched %s(");
- static char_u e_unmatchedpar[] = N_("E55: Unmatched %s)");
  #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");
--- 74,79 ----
*** ../vim-8.2.3196/src/undo.c  2021-06-27 22:03:28.649707714 +0200
--- src/undo.c  2021-07-21 21:57:14.661424970 +0200
***************
*** 324,330 ****
      // In the sandbox it's not allowed to change the text.
      if (sandbox != 0)
      {
!       emsg(_(e_sandbox));
        return FALSE;
      }
  #endif
--- 324,330 ----
      // In the sandbox it's not allowed to change the text.
      if (sandbox != 0)
      {
!       emsg(_(e_not_allowed_in_sandbox));
        return FALSE;
      }
  #endif
*** ../vim-8.2.3196/src/vim9compile.c   2021-07-21 21:37:24.628071733 +0200
--- src/vim9compile.c   2021-07-21 21:53:36.697915306 +0200
***************
*** 2477,2483 ****
            || (check_writable == ASSIGN_FINAL
                                              && sv->sv_const == ASSIGN_CONST))
      {
!       semsg(_(e_readonlyvar), name);
        return FAIL;
      }
      return OK;
--- 2477,2483 ----
            || (check_writable == ASSIGN_FINAL
                                              && sv->sv_const == ASSIGN_CONST))
      {
!       semsg(_(e_cannot_change_readonly_variable_str), name);
        return FAIL;
      }
      return OK;
*** ../vim-8.2.3196/src/vim9script.c    2021-07-18 18:21:34.176266950 +0200
--- src/vim9script.c    2021-07-21 21:53:39.569908775 +0200
***************
*** 962,968 ****
      {
        if (sv->sv_const != 0)
        {
!           semsg(_(e_readonlyvar), name);
            return FAIL;
        }
        ret = check_typval_type(sv->sv_type, value, where);
--- 962,968 ----
      {
        if (sv->sv_const != 0)
        {
!           semsg(_(e_cannot_change_readonly_variable_str), name);
            return FAIL;
        }
        ret = check_typval_type(sv->sv_type, value, where);
*** ../vim-8.2.3196/src/version.c       2021-07-21 21:37:24.632071727 +0200
--- src/version.c       2021-07-21 22:17:34.002780735 +0200
***************
*** 757,758 ****
--- 757,760 ----
  {   /* Add new patch number below this line */
+ /**/
+     3197,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
198. You read all the quotes at Netaholics Anonymous and keep thinking
     "What's wrong with that?"

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202107212021.16LKLAvO093040%40masaka.moolenaar.net.

Raspunde prin e-mail lui