To: vim_dev@googlegroups.com
Subject: Patch 7.4.327
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 7.4.327
Problem:    When 'verbose' is set to display the return value of a function,
	    may get E724 repeatedly.
Solution:   Do not give an error for verbose messages. Abort conversion to
	    string after an error.
Files:	    src/eval.c


*** ../vim-7.4.326/src/eval.c	2014-06-12 18:39:16.828400409 +0200
--- src/eval.c	2014-06-17 12:48:12.083946675 +0200
***************
*** 134,139 ****
--- 134,142 ----
  #define COPYID_INC 2
  #define COPYID_MASK (~0x1)
  
+ /* Abort conversion to string after a recursion error. */
+ static int  did_echo_string_emsg = FALSE;
+ 
  /*
   * Array to hold the hashtab with variables local to each sourced script.
   * Each item holds a variable (nameless) that points to the dict_T.
***************
*** 6686,6691 ****
--- 6689,6696 ----
  	}
  
  	line_breakcheck();
+ 	if (did_echo_string_emsg)  /* recursion error, bail out */
+ 	    break;
      }
  
      /* Allocate result buffer with its total size, avoid re-allocation and
***************
*** 7460,7467 ****
  	    if (s != NULL)
  		ga_concat(&ga, s);
  	    vim_free(tofree);
! 	    if (s == NULL)
  		break;
  	}
      }
      if (todo > 0)
--- 7465,7474 ----
  	    if (s != NULL)
  		ga_concat(&ga, s);
  	    vim_free(tofree);
! 	    if (s == NULL || did_echo_string_emsg)
  		break;
+ 	    line_breakcheck();
+ 
  	}
      }
      if (todo > 0)
***************
*** 7619,7627 ****
  
      if (recurse >= DICT_MAXNEST)
      {
! 	EMSG(_("E724: variable nested too deep for displaying"));
  	*tofree = NULL;
! 	return NULL;
      }
      ++recurse;
  
--- 7626,7641 ----
  
      if (recurse >= DICT_MAXNEST)
      {
! 	if (!did_echo_string_emsg)
! 	{
! 	    /* Only give this message once for a recursive call to avoid
! 	     * flooding the user with errors.  And stop iterating over lists
! 	     * and dicts. */
! 	    did_echo_string_emsg = TRUE;
! 	    EMSG(_("E724: variable nested too deep for displaying"));
! 	}
  	*tofree = NULL;
! 	return (char_u *)"{E724}";
      }
      ++recurse;
  
***************
*** 7689,7695 ****
  	    *tofree = NULL;
      }
  
!     --recurse;
      return r;
  }
  
--- 7703,7710 ----
  	    *tofree = NULL;
      }
  
!     if (--recurse == 0)
! 	did_echo_string_emsg = FALSE;
      return r;
  }
  
***************
*** 23303,23309 ****
--- 23318,23327 ----
  			msg_outnum((long)argvars[i].vval.v_number);
  		    else
  		    {
+ 			/* Do not want errors such as E724 here. */
+ 			++emsg_off;
  			s = tv2string(&argvars[i], &tofree, numbuf2, 0);
+ 			--emsg_off;
  			if (s != NULL)
  			{
  			    if (vim_strsize(s) > MSG_BUF_CLEN)
***************
*** 23395,23402 ****
  
  	    /* The value may be very long.  Skip the middle part, so that we
  	     * have some idea how it starts and ends. smsg() would always
! 	     * truncate it at the end. */
  	    s = tv2string(fc->rettv, &tofree, numbuf2, 0);
  	    if (s != NULL)
  	    {
  		if (vim_strsize(s) > MSG_BUF_CLEN)
--- 23413,23422 ----
  
  	    /* The value may be very long.  Skip the middle part, so that we
  	     * have some idea how it starts and ends. smsg() would always
! 	     * truncate it at the end. Don't want errors such as E724 here. */
! 	    ++emsg_off;
  	    s = tv2string(fc->rettv, &tofree, numbuf2, 0);
+ 	    --emsg_off;
  	    if (s != NULL)
  	    {
  		if (vim_strsize(s) > MSG_BUF_CLEN)
*** ../vim-7.4.326/src/version.c	2014-06-14 12:53:27.394152699 +0200
--- src/version.c	2014-06-17 12:41:45.019932032 +0200
***************
*** 736,737 ****
--- 736,739 ----
  {   /* Add new patch number below this line */
+ /**/
+     327,
  /**/

-- 
TALL KNIGHT: We shall say Ni! again to you if you do not appease us.
ARTHUR:      All right!  What do you want?
TALL KNIGHT: We want ... a shrubbery!
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
