Karsten Hopp 201dce
To: vim-dev@vim.org
Karsten Hopp 201dce
Subject: Patch 7.2.337
Karsten Hopp 201dce
Fcc: outbox
Karsten Hopp 201dce
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 201dce
Mime-Version: 1.0
Karsten Hopp 201dce
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 201dce
Content-Transfer-Encoding: 8bit
Karsten Hopp 201dce
------------
Karsten Hopp 201dce
Karsten Hopp 201dce
Patch 7.2.337
Karsten Hopp 201dce
Problem:    The :compiler command doesn't function properly when invoked in a
Karsten Hopp 201dce
	    function.
Karsten Hopp 201dce
Solution:   Add "g:" before "current_compiler". (Yukihiro Nakadaira)
Karsten Hopp 201dce
Files:	    src/ex_cmds2.c
Karsten Hopp 201dce
Karsten Hopp 201dce
Karsten Hopp 201dce
*** ../vim-7.2.336/src/ex_cmds2.c	2009-05-16 21:16:12.000000000 +0200
Karsten Hopp 201dce
--- src/ex_cmds2.c	2010-01-19 16:02:53.000000000 +0100
Karsten Hopp 201dce
***************
Karsten Hopp 201dce
*** 2496,2509 ****
Karsten Hopp 201dce
  		 * To remain backwards compatible "current_compiler" is always
Karsten Hopp 201dce
  		 * used.  A user's compiler plugin may set it, the distributed
Karsten Hopp 201dce
  		 * plugin will then skip the settings.  Afterwards set
Karsten Hopp 201dce
! 		 * "b:current_compiler" and restore "current_compiler". */
Karsten Hopp 201dce
! 		old_cur_comp = get_var_value((char_u *)"current_compiler");
Karsten Hopp 201dce
  		if (old_cur_comp != NULL)
Karsten Hopp 201dce
  		    old_cur_comp = vim_strsave(old_cur_comp);
Karsten Hopp 201dce
  		do_cmdline_cmd((char_u *)
Karsten Hopp 201dce
  			      "command -nargs=* CompilerSet setlocal <args>");
Karsten Hopp 201dce
  	    }
Karsten Hopp 201dce
! 	    do_unlet((char_u *)"current_compiler", TRUE);
Karsten Hopp 201dce
  	    do_unlet((char_u *)"b:current_compiler", TRUE);
Karsten Hopp 201dce
  
Karsten Hopp 201dce
  	    sprintf((char *)buf, "compiler/%s.vim", eap->arg);
Karsten Hopp 201dce
--- 2496,2510 ----
Karsten Hopp 201dce
  		 * To remain backwards compatible "current_compiler" is always
Karsten Hopp 201dce
  		 * used.  A user's compiler plugin may set it, the distributed
Karsten Hopp 201dce
  		 * plugin will then skip the settings.  Afterwards set
Karsten Hopp 201dce
! 		 * "b:current_compiler" and restore "current_compiler".
Karsten Hopp 201dce
! 		 * Explicitly prepend "g:" to make it work in a function. */
Karsten Hopp 201dce
! 		old_cur_comp = get_var_value((char_u *)"g:current_compiler");
Karsten Hopp 201dce
  		if (old_cur_comp != NULL)
Karsten Hopp 201dce
  		    old_cur_comp = vim_strsave(old_cur_comp);
Karsten Hopp 201dce
  		do_cmdline_cmd((char_u *)
Karsten Hopp 201dce
  			      "command -nargs=* CompilerSet setlocal <args>");
Karsten Hopp 201dce
  	    }
Karsten Hopp 201dce
! 	    do_unlet((char_u *)"g:current_compiler", TRUE);
Karsten Hopp 201dce
  	    do_unlet((char_u *)"b:current_compiler", TRUE);
Karsten Hopp 201dce
  
Karsten Hopp 201dce
  	    sprintf((char *)buf, "compiler/%s.vim", eap->arg);
Karsten Hopp 201dce
***************
Karsten Hopp 201dce
*** 2514,2520 ****
Karsten Hopp 201dce
  	    do_cmdline_cmd((char_u *)":delcommand CompilerSet");
Karsten Hopp 201dce
  
Karsten Hopp 201dce
  	    /* Set "b:current_compiler" from "current_compiler". */
Karsten Hopp 201dce
! 	    p = get_var_value((char_u *)"current_compiler");
Karsten Hopp 201dce
  	    if (p != NULL)
Karsten Hopp 201dce
  		set_internal_string_var((char_u *)"b:current_compiler", p);
Karsten Hopp 201dce
  
Karsten Hopp 201dce
--- 2515,2521 ----
Karsten Hopp 201dce
  	    do_cmdline_cmd((char_u *)":delcommand CompilerSet");
Karsten Hopp 201dce
  
Karsten Hopp 201dce
  	    /* Set "b:current_compiler" from "current_compiler". */
Karsten Hopp 201dce
! 	    p = get_var_value((char_u *)"g:current_compiler");
Karsten Hopp 201dce
  	    if (p != NULL)
Karsten Hopp 201dce
  		set_internal_string_var((char_u *)"b:current_compiler", p);
Karsten Hopp 201dce
  
Karsten Hopp 201dce
***************
Karsten Hopp 201dce
*** 2523,2534 ****
Karsten Hopp 201dce
  	    {
Karsten Hopp 201dce
  		if (old_cur_comp != NULL)
Karsten Hopp 201dce
  		{
Karsten Hopp 201dce
! 		    set_internal_string_var((char_u *)"current_compiler",
Karsten Hopp 201dce
  								old_cur_comp);
Karsten Hopp 201dce
  		    vim_free(old_cur_comp);
Karsten Hopp 201dce
  		}
Karsten Hopp 201dce
  		else
Karsten Hopp 201dce
! 		    do_unlet((char_u *)"current_compiler", TRUE);
Karsten Hopp 201dce
  	    }
Karsten Hopp 201dce
  	}
Karsten Hopp 201dce
      }
Karsten Hopp 201dce
--- 2524,2535 ----
Karsten Hopp 201dce
  	    {
Karsten Hopp 201dce
  		if (old_cur_comp != NULL)
Karsten Hopp 201dce
  		{
Karsten Hopp 201dce
! 		    set_internal_string_var((char_u *)"g:current_compiler",
Karsten Hopp 201dce
  								old_cur_comp);
Karsten Hopp 201dce
  		    vim_free(old_cur_comp);
Karsten Hopp 201dce
  		}
Karsten Hopp 201dce
  		else
Karsten Hopp 201dce
! 		    do_unlet((char_u *)"g:current_compiler", TRUE);
Karsten Hopp 201dce
  	    }
Karsten Hopp 201dce
  	}
Karsten Hopp 201dce
      }
Karsten Hopp 201dce
*** ../vim-7.2.336/src/version.c	2010-01-19 15:51:29.000000000 +0100
Karsten Hopp 201dce
--- src/version.c	2010-01-19 16:11:20.000000000 +0100
Karsten Hopp 201dce
***************
Karsten Hopp 201dce
*** 683,684 ****
Karsten Hopp 201dce
--- 683,686 ----
Karsten Hopp 201dce
  {   /* Add new patch number below this line */
Karsten Hopp 201dce
+ /**/
Karsten Hopp 201dce
+     337,
Karsten Hopp 201dce
  /**/
Karsten Hopp 201dce
Karsten Hopp 201dce
-- 
Karsten Hopp 201dce
hundred-and-one symptoms of being an internet addict:
Karsten Hopp 201dce
121. You ask for e-mail adresses instead of telephone numbers.
Karsten Hopp 201dce
Karsten Hopp 201dce
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 201dce
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 201dce
\\\        download, build and distribute -- http://www.A-A-P.org        ///
Karsten Hopp 201dce
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///