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