Karsten Hopp ec6f20
To: vim_dev@googlegroups.com
Karsten Hopp ec6f20
Subject: Patch 7.3.1170
Karsten Hopp ec6f20
Fcc: outbox
Karsten Hopp ec6f20
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp ec6f20
Mime-Version: 1.0
Karsten Hopp ec6f20
Content-Type: text/plain; charset=UTF-8
Karsten Hopp ec6f20
Content-Transfer-Encoding: 8bit
Karsten Hopp ec6f20
------------
Karsten Hopp ec6f20
Karsten Hopp ec6f20
Patch 7.3.1170
Karsten Hopp ec6f20
Problem:    Patch 7.3.1058 breaks backwards compatibility, not possible to use
Karsten Hopp ec6f20
	    a function reference as a string. (lilydjwg)
Karsten Hopp ec6f20
Solution:   Instead of translating the function name only translate "s:".
Karsten Hopp ec6f20
Files:	    src/eval.c
Karsten Hopp ec6f20
Karsten Hopp ec6f20
Karsten Hopp ec6f20
*** ../vim-7.3.1169/src/eval.c	2013-06-11 18:40:06.000000000 +0200
Karsten Hopp ec6f20
--- src/eval.c	2013-06-12 13:31:26.000000000 +0200
Karsten Hopp ec6f20
***************
Karsten Hopp ec6f20
*** 10962,10986 ****
Karsten Hopp ec6f20
      typval_T	*rettv;
Karsten Hopp ec6f20
  {
Karsten Hopp ec6f20
      char_u	*s;
Karsten Hopp ec6f20
-     char_u	*name = NULL;
Karsten Hopp ec6f20
  
Karsten Hopp ec6f20
      s = get_tv_string(&argvars[0]);
Karsten Hopp ec6f20
      if (s == NULL || *s == NUL || VIM_ISDIGIT(*s))
Karsten Hopp ec6f20
  	EMSG2(_(e_invarg2), s);
Karsten Hopp ec6f20
!     /* Don't check an autoload name for existence here, but still expand it 
Karsten Hopp ec6f20
!      * checking for validity */
Karsten Hopp ec6f20
!     else if ((name = get_expanded_name(s, vim_strchr(s, AUTOLOAD_CHAR) == NULL))
Karsten Hopp ec6f20
! 									== NULL)
Karsten Hopp ec6f20
  	EMSG2(_("E700: Unknown function: %s"), s);
Karsten Hopp ec6f20
      else
Karsten Hopp ec6f20
      {
Karsten Hopp ec6f20
! 	if (name == NULL)
Karsten Hopp ec6f20
! 	    /* Autoload function, need to copy string */
Karsten Hopp ec6f20
! 	    rettv->vval.v_string = vim_strsave(s);
Karsten Hopp ec6f20
  	else
Karsten Hopp ec6f20
! 	    /* Function found by get_expanded_name, string allocated by 
Karsten Hopp ec6f20
! 	     * trans_function_name: no need to copy */
Karsten Hopp ec6f20
! 	    rettv->vval.v_string = name;
Karsten Hopp ec6f20
  	rettv->v_type = VAR_FUNC;
Karsten Hopp ec6f20
      }
Karsten Hopp ec6f20
  }
Karsten Hopp ec6f20
--- 10962,10994 ----
Karsten Hopp ec6f20
      typval_T	*rettv;
Karsten Hopp ec6f20
  {
Karsten Hopp ec6f20
      char_u	*s;
Karsten Hopp ec6f20
  
Karsten Hopp ec6f20
      s = get_tv_string(&argvars[0]);
Karsten Hopp ec6f20
      if (s == NULL || *s == NUL || VIM_ISDIGIT(*s))
Karsten Hopp ec6f20
  	EMSG2(_(e_invarg2), s);
Karsten Hopp ec6f20
!     /* Don't check an autoload name for existence here. */
Karsten Hopp ec6f20
!     else if (vim_strchr(s, AUTOLOAD_CHAR) == NULL && !function_exists(s))
Karsten Hopp ec6f20
  	EMSG2(_("E700: Unknown function: %s"), s);
Karsten Hopp ec6f20
      else
Karsten Hopp ec6f20
      {
Karsten Hopp ec6f20
! 	if (STRNCMP(s, "s:", 2) == 0)
Karsten Hopp ec6f20
! 	{
Karsten Hopp ec6f20
! 	    char	sid_buf[25];
Karsten Hopp ec6f20
! 
Karsten Hopp ec6f20
! 	    /* Expand s: into <SNR>nr_, so that the function can also be
Karsten Hopp ec6f20
! 	     * called from another script. Using trans_function_name() would
Karsten Hopp ec6f20
! 	     * also work, but some plugins depend on the name being printable
Karsten Hopp ec6f20
! 	     * text. */
Karsten Hopp ec6f20
! 	    sprintf(sid_buf, "<SNR>%ld_", (long)current_SID);
Karsten Hopp ec6f20
! 	    rettv->vval.v_string = alloc(STRLEN(sid_buf) + STRLEN(s + 2) + 1);
Karsten Hopp ec6f20
! 	    if (rettv->vval.v_string != NULL)
Karsten Hopp ec6f20
! 	    {
Karsten Hopp ec6f20
! 		STRCPY(rettv->vval.v_string, sid_buf);
Karsten Hopp ec6f20
! 		STRCAT(rettv->vval.v_string, s + 2);
Karsten Hopp ec6f20
! 	    }
Karsten Hopp ec6f20
! 	}
Karsten Hopp ec6f20
  	else
Karsten Hopp ec6f20
! 	    rettv->vval.v_string = vim_strsave(s);
Karsten Hopp ec6f20
  	rettv->v_type = VAR_FUNC;
Karsten Hopp ec6f20
      }
Karsten Hopp ec6f20
  }
Karsten Hopp ec6f20
*** ../vim-7.3.1169/src/version.c	2013-06-11 22:44:03.000000000 +0200
Karsten Hopp ec6f20
--- src/version.c	2013-06-12 13:36:11.000000000 +0200
Karsten Hopp ec6f20
***************
Karsten Hopp ec6f20
*** 730,731 ****
Karsten Hopp ec6f20
--- 730,733 ----
Karsten Hopp ec6f20
  {   /* Add new patch number below this line */
Karsten Hopp ec6f20
+ /**/
Karsten Hopp ec6f20
+     1170,
Karsten Hopp ec6f20
  /**/
Karsten Hopp ec6f20
Karsten Hopp ec6f20
-- 
Karsten Hopp ec6f20
hundred-and-one symptoms of being an internet addict:
Karsten Hopp ec6f20
165. You have a web page burned into your glasses
Karsten Hopp ec6f20
Karsten Hopp ec6f20
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp ec6f20
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp ec6f20
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp ec6f20
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///