Patch 8.2.3972
Problem:    Error messages are spread out.
Solution:   Move the last errors from globals.h to errors.h.
Files:      src/errors.h, src/globals.h, src/eval.c, src/evalfunc.c,
            src/evalvars.c, src/evalwindow.c, src/ex_eval.c, src/list.c,
            src/match.c, src/menu.c, src/popupmenu.c, src/search.c,
            src/vim9cmds.c, src/vim9expr.c


*** ../vim-8.2.3971/src/errors.h        2022-01-01 15:58:19.106486379 +0000
--- src/errors.h        2022-01-01 16:17:14.924751589 +0000
***************
*** 528,534 ****
--- 528,542 ----
  EXTERN char e_couldnt_read_in_sign_data[]
        INIT(= N_("E255: Couldn't read in sign data"));
  #endif
+ #ifdef FEAT_EVAL
+ EXTERN char e_no_white_space_allowed_before_parenthesis[]
+       INIT(= N_("E274: No white space allowed before parenthesis"));
+ #endif
  
+ #ifdef FEAT_MENU
+ EXTERN char e_menu_only_exists_in_another_mode[]
+       INIT(= N_("E328: Menu only exists in another mode"));
+ #endif
  EXTERN char e_internal_error_lalloc_zero[]
        INIT(= N_("E341: Internal error: lalloc(0, )"));
  EXTERN char e_out_of_memory_allocating_nr_bytes[]
***************
*** 668,673 ****
--- 676,691 ----
  EXTERN char e_not_allowed_to_change_text_here[]
        INIT(= N_("E578: Not allowed to change text here"));
  #ifdef FEAT_EVAL
+ EXTERN char e_endif_without_if[]
+       INIT(= N_("E580: :endif without :if"));
+ EXTERN char e_else_without_if[]
+       INIT(= N_("E581: :else without :if"));
+ EXTERN char e_elseif_without_if[]
+       INIT(= N_("E582: :elseif without :if"));
+ EXTERN char e_continue_without_while_or_for[]
+       INIT(= N_("E586: :continue without :while or :for"));
+ EXTERN char e_break_without_while_or_for[]
+       INIT(= N_("E587: :break without :while or :for"));
  EXTERN char e_endwhile_without_while[]
        INIT(= N_("E588: :endwhile without :while"));
  EXTERN char e_endfor_without_for[]
***************
*** 716,726 ****
--- 734,750 ----
  EXTERN char e_internal_error_str[]
        INIT(= N_("E685: Internal error: %s"));
  #ifdef FEAT_EVAL
+ EXTERN char e_argument_of_str_must_be_list[]
+       INIT(= N_("E686: Argument of %s must be a List"));
+ EXTERN char e_missing_in_after_for[]
+       INIT(= N_("E690: Missing \"in\" after :for"));
+ // E693 unused
  EXTERN char e_cannot_index_a_funcref[]
        INIT(= N_("E695: Cannot index a Funcref"));
  EXTERN char e_missing_end_of_list_rsb_str[]
        INIT(= N_("E697: Missing end of List ']': %s"));
  
+ // E706 unused
  EXTERN char e_list_value_has_more_items_than_targets[]
        INIT(= N_("E710: List value has more items than targets"));
  EXTERN char e_list_value_does_not_have_enough_items[]
***************
*** 864,869 ****
--- 888,897 ----
        INIT(= N_("E937: Attempt to delete a buffer that is in use: %s"));
  EXTERN char e_positive_count_required[]
        INIT(= N_("E939: Positive count required"));
+ #ifdef FEAT_EVAL
+ EXTERN char e_cannot_lock_or_unlock_variable_str[]
+       INIT(= N_("E940: Cannot lock or unlock variable %s"));
+ #endif
  #ifdef FEAT_TERMINAL
  EXTERN char e_job_still_running[]
        INIT(= N_("E948: Job still running"));
***************
*** 874,879 ****
--- 902,909 ----
        INIT(= N_("E949: File changed while writing"));
  EXTERN char e_autocommand_caused_recursive_behavior[]
        INIT(= N_("E952: Autocommand caused recursive behavior"));
+ EXTERN char e_invalid_window_number[]
+       INIT(= N_("E957: Invalid window number"));
  EXTERN char_u e_invalid_column_number_nr[]
        INIT(= N_("E964: Invalid column number: %ld"));
  EXTERN char_u e_invalid_line_number_nr[]
*** ../vim-8.2.3971/src/globals.h       2022-01-01 15:58:19.106486379 +0000
--- src/globals.h       2022-01-01 16:19:12.596566189 +0000
***************
*** 1600,1635 ****
  #endif
  
  /*
!  * Some error messages that can be shared are included here.
!  * They should be moved to errors.h.
   */
! #ifdef FEAT_MENU
! EXTERN char e_menuothermode[] INIT(= N_("E328: Menu only exists in another 
mode"));
! #endif
! EXTERN char e_invalwindow[]   INIT(= N_("E957: Invalid window number"));
! EXTERN char e_listarg[]               INIT(= N_("E686: Argument of %s must be 
a List"));
! #ifdef FEAT_EVAL
! EXTERN char e_missing_in[]    INIT(= N_("E690: Missing \"in\" after :for"));
! EXTERN char e_else_without_if[] INIT(= N_("E581: :else without :if"));
! EXTERN char e_elseif_without_if[] INIT(= N_("E582: :elseif without :if"));
! EXTERN char e_endif_without_if[] INIT(= N_("E580: :endif without :if"));
! EXTERN char e_continue[]      INIT(= N_("E586: :continue without :while or 
:for"));
! EXTERN char e_break[]         INIT(= N_("E587: :break without :while or 
:for"));
! EXTERN char e_nowhitespace[]  INIT(= N_("E274: No white space allowed before 
parenthesis"));
! 
! EXTERN char e_lock_unlock[]   INIT(= N_("E940: Cannot lock or unlock variable 
%s"));
! #endif
! 
! EXTERN char e_chan_or_job_req[]       INIT(= N_("E706: Channel or Job 
required"));
! EXTERN char e_jobreq[]                INIT(= N_("E693: Job required"));
! 
! EXTERN char top_bot_msg[] INIT(= N_("search hit TOP, continuing at BOTTOM"));
! EXTERN char bot_top_msg[] INIT(= N_("search hit BOTTOM, continuing at TOP"));
  
! EXTERN char line_msg[]                INIT(= N_(" line "));
  
  #ifdef FEAT_CRYPT
! EXTERN char need_key_msg[] INIT(= N_("Need encryption key for \"%s\""));
  #endif
  
  /*
--- 1600,1614 ----
  #endif
  
  /*
!  * Some messages that can be shared are included here.
   */
! EXTERN char top_bot_msg[]   INIT(= N_("search hit TOP, continuing at 
BOTTOM"));
! EXTERN char bot_top_msg[]   INIT(= N_("search hit BOTTOM, continuing at 
TOP"));
  
! EXTERN char line_msg[]            INIT(= N_(" line "));
  
  #ifdef FEAT_CRYPT
! EXTERN char need_key_msg[]  INIT(= N_("Need encryption key for \"%s\""));
  #endif
  
  /*
*** ../vim-8.2.3971/src/eval.c  2022-01-01 15:58:19.110486371 +0000
--- src/eval.c  2022-01-01 16:14:15.245033817 +0000
***************
*** 1632,1638 ****
        if (in_vim9script() && *expr == ':' && expr != var_list_end)
            semsg(_(e_no_white_space_allowed_before_colon_str), expr);
        else
!           emsg(_(e_missing_in));
        return fi;
      }
  
--- 1632,1638 ----
        if (in_vim9script() && *expr == ':' && expr != var_list_end)
            semsg(_(e_no_white_space_allowed_before_colon_str), expr);
        else
!           emsg(_(e_missing_in_after_for));
        return fi;
      }
  
***************
*** 3888,3894 ****
        if (verbose)
        {
            if (*skipwhite(*arg) == '(')
!               emsg(_(e_nowhitespace));
            else
                semsg(_(e_missing_parenthesis_str), "lambda");
        }
--- 3888,3894 ----
        if (verbose)
        {
            if (*skipwhite(*arg) == '(')
!               emsg(_(e_no_white_space_allowed_before_parenthesis));
            else
                semsg(_(e_missing_parenthesis_str), "lambda");
        }
***************
*** 3951,3957 ****
        else if (VIM_ISWHITE((*arg)[-1]))
        {
            if (verbose)
!               emsg(_(e_nowhitespace));
            ret = FAIL;
        }
        else
--- 3951,3957 ----
        else if (VIM_ISWHITE((*arg)[-1]))
        {
            if (verbose)
!               emsg(_(e_no_white_space_allowed_before_parenthesis));
            ret = FAIL;
        }
        else
***************
*** 5948,5954 ****
            {
                if (VIM_ISWHITE(**arg))
                {
!                   emsg(_(e_nowhitespace));
                    ret = FAIL;
                }
                else if ((**arg == '{' && !in_vim9script()) || **arg == '(')
--- 5948,5954 ----
            {
                if (VIM_ISWHITE(**arg))
                {
!                   emsg(_(e_no_white_space_allowed_before_parenthesis));
                    ret = FAIL;
                }
                else if ((**arg == '{' && !in_vim9script()) || **arg == '(')
*** ../vim-8.2.3971/src/evalfunc.c      2022-01-01 15:58:19.110486371 +0000
--- src/evalfunc.c      2022-01-01 16:09:06.825514229 +0000
***************
*** 3071,3077 ****
        win = find_win_by_nr_or_id(&argvars[idx]);
        if (win == NULL)
        {
!           emsg(_(e_invalwindow));
            return NULL;
        }
      }
--- 3071,3077 ----
        win = find_win_by_nr_or_id(&argvars[idx]);
        if (win == NULL)
        {
!           emsg(_(e_invalid_window_number));
            return NULL;
        }
      }
***************
*** 6570,6576 ****
  
      if (argvars[0].v_type != VAR_LIST || argvars[0].vval.v_list == NULL)
      {
!       semsg(_(e_listarg), "inputlist()");
        return;
      }
  
--- 6570,6576 ----
  
      if (argvars[0].v_type != VAR_LIST || argvars[0].vval.v_list == NULL)
      {
!       semsg(_(e_argument_of_str_must_be_list), "inputlist()");
        return;
      }
  
*** ../vim-8.2.3971/src/evalvars.c      2022-01-01 15:58:19.110486371 +0000
--- src/evalvars.c      2022-01-01 16:15:12.968943340 +0000
***************
*** 1889,1895 ****
        *name_end = NUL;
        if (*lp->ll_name == '$')
        {
!           semsg(_(e_lock_unlock), lp->ll_name);
            ret = FAIL;
        }
        else
--- 1889,1895 ----
        *name_end = NUL;
        if (*lp->ll_name == '$')
        {
!           semsg(_(e_cannot_lock_or_unlock_variable_str), lp->ll_name);
            ret = FAIL;
        }
        else
***************
*** 1909,1915 ****
            {
                // For historic reasons this error is not given for a list or
                // dict.  E.g., the b: dict could be locked/unlocked.
!               semsg(_(e_lock_unlock), lp->ll_name);
                ret = FAIL;
            }
            else
--- 1909,1915 ----
            {
                // For historic reasons this error is not given for a list or
                // dict.  E.g., the b: dict could be locked/unlocked.
!               semsg(_(e_cannot_lock_or_unlock_variable_str), lp->ll_name);
                ret = FAIL;
            }
            else
*** ../vim-8.2.3971/src/evalwindow.c    2021-12-31 22:48:56.575368905 +0000
--- src/evalwindow.c    2022-01-01 16:08:08.081604916 +0000
***************
*** 916,922 ****
            || !win_valid(wp) || !win_valid(targetwin)
            || win_valid_popup(wp) || win_valid_popup(targetwin))
      {
!         emsg(_(e_invalwindow));
        rettv->vval.v_number = -1;
        return;
      }
--- 916,922 ----
            || !win_valid(wp) || !win_valid(targetwin)
            || win_valid_popup(wp) || win_valid_popup(targetwin))
      {
!         emsg(_(e_invalid_window_number));
        rettv->vval.v_number = -1;
        return;
      }
*** ../vim-8.2.3971/src/ex_eval.c       2022-01-01 15:58:19.114486366 +0000
--- src/ex_eval.c       2022-01-01 16:13:28.293107313 +0000
***************
*** 1316,1322 ****
      cstack_T  *cstack = eap->cstack;
  
      if (cstack->cs_looplevel <= 0 || cstack->cs_idx < 0)
!       eap->errmsg = _(e_continue);
      else
      {
        // Try to find the matching ":while".  This might stop at a try
--- 1316,1322 ----
      cstack_T  *cstack = eap->cstack;
  
      if (cstack->cs_looplevel <= 0 || cstack->cs_idx < 0)
!       eap->errmsg = _(e_continue_without_while_or_for);
      else
      {
        // Try to find the matching ":while".  This might stop at a try
***************
*** 1354,1360 ****
      cstack_T  *cstack = eap->cstack;
  
      if (cstack->cs_looplevel <= 0 || cstack->cs_idx < 0)
!       eap->errmsg = _(e_break);
      else
      {
        // Inactivate conditionals until the matching ":while" or a try
--- 1354,1360 ----
      cstack_T  *cstack = eap->cstack;
  
      if (cstack->cs_looplevel <= 0 || cstack->cs_idx < 0)
!       eap->errmsg = _(e_break_without_while_or_for);
      else
      {
        // Inactivate conditionals until the matching ":while" or a try
*** ../vim-8.2.3971/src/list.c  2022-01-01 14:19:44.048353841 +0000
--- src/list.c  2022-01-01 16:09:10.981507806 +0000
***************
*** 992,998 ****
  
      if (argvars[0].v_type != VAR_LIST)
      {
!       semsg(_(e_listarg), "flatten()");
        return;
      }
  
--- 992,998 ----
  
      if (argvars[0].v_type != VAR_LIST)
      {
!       semsg(_(e_argument_of_str_must_be_list), "flatten()");
        return;
      }
  
***************
*** 2202,2208 ****
  
      if (argvars[0].v_type != VAR_LIST)
      {
!       semsg(_(e_listarg), sort ? "sort()" : "uniq()");
        return;
      }
  
--- 2202,2208 ----
  
      if (argvars[0].v_type != VAR_LIST)
      {
!       semsg(_(e_argument_of_str_must_be_list), sort ? "sort()" : "uniq()");
        return;
      }
  
*** ../vim-8.2.3971/src/match.c 2022-01-01 15:58:19.114486366 +0000
--- src/match.c 2022-01-01 16:09:14.137502926 +0000
***************
*** 949,955 ****
        *win = find_win_by_nr_or_id(&di->di_tv);
        if (*win == NULL)
        {
!           emsg(_(e_invalwindow));
            return FAIL;
        }
      }
--- 949,955 ----
        *win = find_win_by_nr_or_id(&di->di_tv);
        if (*win == NULL)
        {
!           emsg(_(e_invalid_window_number));
            return FAIL;
        }
      }
***************
*** 1259,1265 ****
  
      if (argvars[1].v_type != VAR_LIST)
      {
!       semsg(_(e_listarg), "matchaddpos()");
        return;
      }
      l = argvars[1].vval.v_list;
--- 1259,1265 ----
  
      if (argvars[1].v_type != VAR_LIST)
      {
!       semsg(_(e_argument_of_str_must_be_list), "matchaddpos()");
        return;
      }
      l = argvars[1].vval.v_list;
*** ../vim-8.2.3971/src/menu.c  2022-01-01 15:58:19.114486366 +0000
--- src/menu.c  2022-01-01 16:07:16.653684024 +0000
***************
*** 959,965 ****
            else if (*name != NUL)
            {
                if (!silent)
!                   emsg(_(e_menuothermode));
                return FAIL;
            }
  
--- 959,965 ----
            else if (*name != NUL)
            {
                if (!silent)
!                   emsg(_(e_menu_only_exists_in_another_mode));
                return FAIL;
            }
  
***************
*** 1133,1139 ****
                }
                else if ((menu->modes & modes) == 0x0)
                {
!                   emsg(_(e_menuothermode));
                    vim_free(path_name);
                    return FAIL;
                }
--- 1133,1139 ----
                }
                else if ((menu->modes & modes) == 0x0)
                {
!                   emsg(_(e_menu_only_exists_in_another_mode));
                    vim_free(path_name);
                    return FAIL;
                }
*** ../vim-8.2.3971/src/popupmenu.c     2021-11-17 20:39:29.131019723 +0000
--- src/popupmenu.c     2022-01-01 16:07:18.897680580 +0000
***************
*** 1476,1482 ****
      // pum_size being zero.
      if (pum_size <= 0)
      {
!       emsg(e_menuothermode);
        return;
      }
  
--- 1476,1482 ----
      // pum_size being zero.
      if (pum_size <= 0)
      {
!       emsg(e_menu_only_exists_in_another_mode);
        return;
      }
  
*** ../vim-8.2.3971/src/search.c        2022-01-01 14:19:44.052353829 +0000
--- src/search.c        2022-01-01 16:09:49.881447595 +0000
***************
*** 4807,4813 ****
      // validate and get the arguments
      if (argvars[0].v_type != VAR_LIST || argvars[0].vval.v_list == NULL)
      {
!       semsg(_(e_listarg), retmatchpos ? "matchfuzzypos()" : "matchfuzzy()");
        return;
      }
      if (argvars[1].v_type != VAR_STRING
--- 4807,4814 ----
      // validate and get the arguments
      if (argvars[0].v_type != VAR_LIST || argvars[0].vval.v_list == NULL)
      {
!       semsg(_(e_argument_of_str_must_be_list),
!                            retmatchpos ? "matchfuzzypos()" : "matchfuzzy()");
        return;
      }
      if (argvars[1].v_type != VAR_STRING
*** ../vim-8.2.3971/src/vim9cmds.c      2022-01-01 15:58:19.122486356 +0000
--- src/vim9cmds.c      2022-01-01 16:14:17.489030297 +0000
***************
*** 796,802 ****
        if (*p == ':' && wp != p)
            semsg(_(e_no_white_space_allowed_before_colon_str), p);
        else
!           emsg(_(e_missing_in));
        return NULL;
      }
      wp = p + 2;
--- 796,802 ----
        if (*p == ':' && wp != p)
            semsg(_(e_no_white_space_allowed_before_colon_str), p);
        else
!           emsg(_(e_missing_in_after_for));
        return NULL;
      }
      wp = p + 2;
***************
*** 1150,1156 ****
      {
        if (scope == NULL)
        {
!           emsg(_(e_continue));
            return NULL;
        }
        if (scope->se_type == FOR_SCOPE)
--- 1150,1156 ----
      {
        if (scope == NULL)
        {
!           emsg(_(e_continue_without_while_or_for));
            return NULL;
        }
        if (scope->se_type == FOR_SCOPE)
***************
*** 1192,1198 ****
      {
        if (scope == NULL)
        {
!           emsg(_(e_break));
            return NULL;
        }
        if (scope->se_type == FOR_SCOPE || scope->se_type == WHILE_SCOPE)
--- 1192,1198 ----
      {
        if (scope == NULL)
        {
!           emsg(_(e_break_without_while_or_for));
            return NULL;
        }
        if (scope->se_type == FOR_SCOPE || scope->se_type == WHILE_SCOPE)
*** ../vim-8.2.3971/src/vim9expr.c      2022-01-01 15:58:19.122486356 +0000
--- src/vim9expr.c      2022-01-01 16:11:36.845281326 +0000
***************
*** 1659,1665 ****
                if (**arg != '(')
                {
                    if (*skipwhite(*arg) == '(')
!                       emsg(_(e_nowhitespace));
                    else
                        semsg(_(e_missing_parenthesis_str), *arg);
                    return FAIL;
--- 1659,1665 ----
                if (**arg != '(')
                {
                    if (*skipwhite(*arg) == '(')
!                       emsg(_(e_no_white_space_allowed_before_parenthesis));
                    else
                        semsg(_(e_missing_parenthesis_str), *arg);
                    return FAIL;
*** ../vim-8.2.3971/src/version.c       2022-01-01 16:01:17.814226087 +0000
--- src/version.c       2022-01-01 16:20:35.552435219 +0000
***************
*** 751,752 ****
--- 751,754 ----
  {   /* Add new patch number below this line */
+ /**/
+     3972,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
177. You log off of your system because it's time to go to work.

 /// 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/20220101162130.445F71C0A5B%40moolenaar.net.

Raspunde prin e-mail lui