Steps to reproduce:

  function F()
    compiler ant
    compiler bcc
    " Now, 'makeprg' is "ant"
    echo &makeprg
  endfunction


":help current_compiler" says:

  To support older Vim versions, the plugins always use "current_compiler" and
  not "b:current_compiler".  What the command actually does is the following:

  - Delete the "current_compiler" and "b:current_compiler" variables.
  ...

But "current_compiler" variable is not deleted and compiler plugin do
nothing by the following check:

  if exists("current_compiler")
    finish
  endif
  let current_compiler = "foo"


The following patch fixes this problem.

Index: ex_cmds2.c
===================================================================
--- ex_cmds2.c  (revision 1711)
+++ ex_cmds2.c  (working copy)
@@ -2497,13 +2497,13 @@
                 * 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");
+               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 <args>");
            }
-           do_unlet((char_u *)"current_compiler", TRUE);
+           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,7 +2514,7 @@
            do_cmdline_cmd((char_u *)":delcommand CompilerSet");

            /* Set "b:current_compiler" from "current_compiler". */
-           p = get_var_value((char_u *)"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,12 +2523,12 @@
            {
                if (old_cur_comp != NULL)
                {
-                   set_internal_string_var((char_u *)"current_compiler",
+                   set_internal_string_var((char_u *)"g:current_compiler",
                                                                old_cur_comp);
                    vim_free(old_cur_comp);
                }
                else
-                   do_unlet((char_u *)"current_compiler", TRUE);
+                   do_unlet((char_u *)"g:current_compiler", TRUE);
            }
        }
     }


-- 
Yukihiro Nakadaira - yukihiro.nakada...@gmail.com

-- 
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php

Raspunde prin e-mail lui