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