073263
To: vim_dev@googlegroups.com
073263
Subject: Patch 7.4.327
073263
Fcc: outbox
073263
From: Bram Moolenaar <Bram@moolenaar.net>
073263
Mime-Version: 1.0
073263
Content-Type: text/plain; charset=UTF-8
073263
Content-Transfer-Encoding: 8bit
073263
------------
073263
073263
Patch 7.4.327
073263
Problem:    When 'verbose' is set to display the return value of a function,
073263
	    may get E724 repeatedly.
073263
Solution:   Do not give an error for verbose messages. Abort conversion to
073263
	    string after an error.
073263
Files:	    src/eval.c
073263
073263
073263
*** ../vim-7.4.326/src/eval.c	2014-06-12 18:39:16.828400409 +0200
073263
--- src/eval.c	2014-06-17 12:48:12.083946675 +0200
073263
***************
073263
*** 134,139 ****
073263
--- 134,142 ----
073263
  #define COPYID_INC 2
073263
  #define COPYID_MASK (~0x1)
073263
  
073263
+ /* Abort conversion to string after a recursion error. */
073263
+ static int  did_echo_string_emsg = FALSE;
073263
+ 
073263
  /*
073263
   * Array to hold the hashtab with variables local to each sourced script.
073263
   * Each item holds a variable (nameless) that points to the dict_T.
073263
***************
073263
*** 6686,6691 ****
073263
--- 6689,6696 ----
073263
  	}
073263
  
073263
  	line_breakcheck();
073263
+ 	if (did_echo_string_emsg)  /* recursion error, bail out */
073263
+ 	    break;
073263
      }
073263
  
073263
      /* Allocate result buffer with its total size, avoid re-allocation and
073263
***************
073263
*** 7460,7467 ****
073263
  	    if (s != NULL)
073263
  		ga_concat(&ga, s);
073263
  	    vim_free(tofree);
073263
! 	    if (s == NULL)
073263
  		break;
073263
  	}
073263
      }
073263
      if (todo > 0)
073263
--- 7465,7474 ----
073263
  	    if (s != NULL)
073263
  		ga_concat(&ga, s);
073263
  	    vim_free(tofree);
073263
! 	    if (s == NULL || did_echo_string_emsg)
073263
  		break;
073263
+ 	    line_breakcheck();
073263
+ 
073263
  	}
073263
      }
073263
      if (todo > 0)
073263
***************
073263
*** 7619,7627 ****
073263
  
073263
      if (recurse >= DICT_MAXNEST)
073263
      {
073263
! 	EMSG(_("E724: variable nested too deep for displaying"));
073263
  	*tofree = NULL;
073263
! 	return NULL;
073263
      }
073263
      ++recurse;
073263
  
073263
--- 7626,7641 ----
073263
  
073263
      if (recurse >= DICT_MAXNEST)
073263
      {
073263
! 	if (!did_echo_string_emsg)
073263
! 	{
073263
! 	    /* Only give this message once for a recursive call to avoid
073263
! 	     * flooding the user with errors.  And stop iterating over lists
073263
! 	     * and dicts. */
073263
! 	    did_echo_string_emsg = TRUE;
073263
! 	    EMSG(_("E724: variable nested too deep for displaying"));
073263
! 	}
073263
  	*tofree = NULL;
073263
! 	return (char_u *)"{E724}";
073263
      }
073263
      ++recurse;
073263
  
073263
***************
073263
*** 7689,7695 ****
073263
  	    *tofree = NULL;
073263
      }
073263
  
073263
!     --recurse;
073263
      return r;
073263
  }
073263
  
073263
--- 7703,7710 ----
073263
  	    *tofree = NULL;
073263
      }
073263
  
073263
!     if (--recurse == 0)
073263
! 	did_echo_string_emsg = FALSE;
073263
      return r;
073263
  }
073263
  
073263
***************
073263
*** 23303,23309 ****
073263
--- 23318,23327 ----
073263
  			msg_outnum((long)argvars[i].vval.v_number);
073263
  		    else
073263
  		    {
073263
+ 			/* Do not want errors such as E724 here. */
073263
+ 			++emsg_off;
073263
  			s = tv2string(&argvars[i], &tofree, numbuf2, 0);
073263
+ 			--emsg_off;
073263
  			if (s != NULL)
073263
  			{
073263
  			    if (vim_strsize(s) > MSG_BUF_CLEN)
073263
***************
073263
*** 23395,23402 ****
073263
  
073263
  	    /* The value may be very long.  Skip the middle part, so that we
073263
  	     * have some idea how it starts and ends. smsg() would always
073263
! 	     * truncate it at the end. */
073263
  	    s = tv2string(fc->rettv, &tofree, numbuf2, 0);
073263
  	    if (s != NULL)
073263
  	    {
073263
  		if (vim_strsize(s) > MSG_BUF_CLEN)
073263
--- 23413,23422 ----
073263
  
073263
  	    /* The value may be very long.  Skip the middle part, so that we
073263
  	     * have some idea how it starts and ends. smsg() would always
073263
! 	     * truncate it at the end. Don't want errors such as E724 here. */
073263
! 	    ++emsg_off;
073263
  	    s = tv2string(fc->rettv, &tofree, numbuf2, 0);
073263
+ 	    --emsg_off;
073263
  	    if (s != NULL)
073263
  	    {
073263
  		if (vim_strsize(s) > MSG_BUF_CLEN)
073263
*** ../vim-7.4.326/src/version.c	2014-06-14 12:53:27.394152699 +0200
073263
--- src/version.c	2014-06-17 12:41:45.019932032 +0200
073263
***************
073263
*** 736,737 ****
073263
--- 736,739 ----
073263
  {   /* Add new patch number below this line */
073263
+ /**/
073263
+     327,
073263
  /**/
073263
073263
-- 
073263
TALL KNIGHT: We shall say Ni! again to you if you do not appease us.
073263
ARTHUR:      All right!  What do you want?
073263
TALL KNIGHT: We want ... a shrubbery!
073263
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
073263
073263
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
073263
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
073263
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
073263
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///