home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / patches / 6.2.408 < prev    next >
Encoding:
Internet Message Format  |  2004-03-26  |  8.1 KB

  1. To: vim-dev@vim.org
  2. Subject: Patch 6.2.408
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. Mime-Version: 1.0
  6. Content-Type: text/plain; charset=ISO-8859-1
  7. Content-Transfer-Encoding: 8bit
  8. ------------
  9.  
  10. Patch 6.2.408
  11. Problem:    ":compiler" is not consistent: Sets local options and a global
  12.         variable. (Douglas Potts)  There is no error message when a
  13.         compiler is not supported.
  14. Solution:   Use ":compiler!" to set a compiler globally, otherwise it's local
  15.         to the buffer and "b:current_compiler" is used.  Give an error
  16.         when no compiler script could be found.
  17.         Note: updated compiler plugins can be found at
  18.         ftp://ftp.vim.org/pub/vim/runtime/compiler/
  19. Files:        runtime/compiler/msvc.vim, runtime/doc/quickfix.txt, src/eval.c,
  20.         src/ex_cmds2.c
  21.  
  22.  
  23. *** ../vim-6.2.407/runtime/compiler/msvc.vim    Mon Sep 24 19:58:35 2001
  24. --- runtime/compiler/msvc.vim    Fri Mar 19 20:48:09 2004
  25. ***************
  26. *** 1,13 ****
  27.   " Vim compiler file
  28.   " Compiler:    Miscrosoft Visual C
  29.   " Maintainer:    Bram Moolenaar <Bram@vim.org>
  30. ! " Last Change:    2001 Sep 24
  31.   
  32.   if exists("current_compiler")
  33.     finish
  34.   endif
  35.   let current_compiler = "msvc"
  36.   
  37.   " The errorformat for MSVC is the default.
  38. ! setlocal errorformat&
  39. ! setlocal makeprg=nmake
  40. --- 1,17 ----
  41.   " Vim compiler file
  42.   " Compiler:    Miscrosoft Visual C
  43.   " Maintainer:    Bram Moolenaar <Bram@vim.org>
  44. ! " Last Change:    2004 Mar 19
  45.   
  46.   if exists("current_compiler")
  47.     finish
  48.   endif
  49.   let current_compiler = "msvc"
  50.   
  51. + if exists(":CompilerSet") != 2        " older Vim always used :setlocal
  52. +   command -nargs=* CompilerSet setlocal <args>
  53. + endif
  54.   " The errorformat for MSVC is the default.
  55. ! CompilerSet errorformat&
  56. ! CompilerSet makeprg=nmake
  57. *** ../vim-6.2.407/runtime/doc/quickfix.txt    Tue Feb 10 19:35:15 2004
  58. --- runtime/doc/quickfix.txt    Sat Mar 27 12:57:25 2004
  59. ***************
  60. *** 1,4 ****
  61. ! *quickfix.txt*  For Vim version 6.2.  Last change: 2004 Feb 10
  62.   
  63.   
  64.             VIM REFERENCE MANUAL    by Bram Moolenaar
  65. --- 1,4 ----
  66. ! *quickfix.txt*  For Vim version 6.2.  Last change: 2004 Mar 27
  67.   
  68.   
  69.             VIM REFERENCE MANUAL    by Bram Moolenaar
  70. ***************
  71. *** 365,379 ****
  72.   =============================================================================
  73.   6. Selecting a compiler                    *compiler-select*
  74.   
  75. !                             *:comp* *:compiler*
  76. ! :comp[iler] {name}        Set options to work with compiler {name}.
  77.                   {not available when compiled without the
  78.                   |+eval| feature}
  79.   
  80.   
  81. ! What this command actually does is:
  82. ! - delete the "current_compiler" variable        *current_compiler*
  83. ! - execute ":runtime! compiler/{name}.vim"
  84.   
  85.   For writing a compiler plugin, see |write-compiler-plugin|.
  86.   
  87. --- 365,399 ----
  88.   =============================================================================
  89.   6. Selecting a compiler                    *compiler-select*
  90.   
  91. !                         *:comp* *:compiler* *E666*
  92. ! :comp[iler][!] {name}        Set options to work with compiler {name}.
  93. !                 Without the "!" options are set for the
  94. !                 current buffer.  With "!" global options are
  95. !                 set.
  96. !                 If you use ":compiler foo" in "file.foo" and
  97. !                 then ":compiler! bar" in another buffer, Vim
  98. !                 will keep on using "foo" in "file.foo".
  99.                   {not available when compiled without the
  100.                   |+eval| feature}
  101.   
  102.   
  103. ! The Vim plugins in the "compiler" directory will set options to use the
  104. ! selected compiler.  For ":compiler" local options are set, for ":compiler!"
  105. ! global options.
  106. !                             *current_compiler*
  107. ! To support older Vim versions, the plugins always use "current_compiler" and
  108. ! not "b:current_compiler".  What the command actually does is the following:
  109. ! - Delete the "current_compiler" and "b:current_compiler" variables.
  110. ! - Define the "CompilerSet" user command.  With "!" it does ":set", without "!"
  111. !   it does ":setlocal".
  112. ! - Execute ":runtime! compiler/{name}.vim".  The plugins are expected to set
  113. !   options with "CompilerSet" and set the "current_compiler" variable to the
  114. !   name of the compiler.
  115. ! - Delete the "CompilerSet user command.
  116. ! - Set "b:current_compiler" to the value of "current_compiler".
  117. ! - Without "!" the old value of "current_compiler" is restored.
  118.   
  119.   For writing a compiler plugin, see |write-compiler-plugin|.
  120.   
  121. *** ../vim-6.2.407/src/eval.c    Wed Mar 17 14:08:56 2004
  122. --- src/eval.c    Fri Mar 26 12:05:28 2004
  123. ***************
  124. *** 418,424 ****
  125.   static char_u * make_expanded_name __ARGS((char_u *in_start,  char_u *expr_start,  char_u *expr_end,  char_u *in_end));
  126.   #endif
  127.   
  128. - #if defined(FEAT_STL_OPT) || defined(PROTO)
  129.   /*
  130.    * Set an internal variable to a string value. Creates the variable if it does
  131.    * not already exist.
  132. --- 418,423 ----
  133. ***************
  134. *** 442,448 ****
  135.       }
  136.       }
  137.   }
  138. - #endif
  139.   
  140.   # if defined(FEAT_MBYTE) || defined(PROTO)
  141.       int
  142. --- 441,446 ----
  143. *** ../vim-6.2.407/src/ex_cmds2.c    Sun Mar  7 19:33:55 2004
  144. --- src/ex_cmds2.c    Sat Mar 27 13:02:59 2004
  145. ***************
  146. *** 1756,1783 ****
  147.   
  148.   #ifdef FEAT_EVAL
  149.   /*
  150. !  * ":compiler {name}"
  151.    */
  152.       void
  153.   ex_compiler(eap)
  154.       exarg_T    *eap;
  155.   {
  156.       char_u    *buf;
  157.   
  158.       if (*eap->arg == NUL)
  159.       {
  160.       /* List all compiler scripts. */
  161.       do_cmdline_cmd((char_u *)"echo globpath(&rtp, 'compiler/*.vim')");
  162.       }
  163.       else
  164.       {
  165.       buf = alloc((unsigned)(STRLEN(eap->arg) + 14));
  166.       if (buf != NULL)
  167.       {
  168.           do_unlet((char_u *)"current_compiler");
  169.           sprintf((char *)buf, "compiler/%s.vim", eap->arg);
  170. !         (void)cmd_runtime(buf, TRUE);
  171.           vim_free(buf);
  172.       }
  173.       }
  174.   }
  175. --- 1756,1828 ----
  176.   
  177.   #ifdef FEAT_EVAL
  178.   /*
  179. !  * ":compiler[!] {name}"
  180.    */
  181.       void
  182.   ex_compiler(eap)
  183.       exarg_T    *eap;
  184.   {
  185.       char_u    *buf;
  186. +     char_u    *old_cur_comp = NULL;
  187. +     char_u    *p;
  188.   
  189.       if (*eap->arg == NUL)
  190.       {
  191.       /* List all compiler scripts. */
  192.       do_cmdline_cmd((char_u *)"echo globpath(&rtp, 'compiler/*.vim')");
  193. +                     /* ) keep the indenter happy... */
  194.       }
  195.       else
  196.       {
  197.       buf = alloc((unsigned)(STRLEN(eap->arg) + 14));
  198.       if (buf != NULL)
  199.       {
  200. +         if (eap->forceit)
  201. +         {
  202. +         /* ":compiler! {name}" sets global options */
  203. +         do_cmdline_cmd((char_u *)
  204. +                    "command -nargs=* CompilerSet set <args>");
  205. +         }
  206. +         else
  207. +         {
  208. +         /* ":compiler! {name}" sets local options.
  209. +          * To remain backwards compatible "current_compiler" is always
  210. +          * used.  A user's compiler plugin may set it, the distributed
  211. +          * plugin will then skip the settings.  Afterwards set
  212. +          * "b:current_compiler" and restore "current_compiler". */
  213. +         old_cur_comp = get_var_value((char_u *)"current_compiler");
  214. +         if (old_cur_comp != NULL)
  215. +             old_cur_comp = vim_strsave(old_cur_comp);
  216. +         do_cmdline_cmd((char_u *)
  217. +                   "command -nargs=* CompilerSet setlocal <args>");
  218. +         }
  219.           do_unlet((char_u *)"current_compiler");
  220. +         do_unlet((char_u *)"b:current_compiler");
  221.           sprintf((char *)buf, "compiler/%s.vim", eap->arg);
  222. !         if (cmd_runtime(buf, TRUE) == FAIL)
  223. !         EMSG2(_("E666: compiler not supported: %s"), eap->arg);
  224.           vim_free(buf);
  225. +         do_cmdline_cmd((char_u *)":delcommand CompilerSet");
  226. +         /* Set "b:current_compiler" from "current_compiler". */
  227. +         p = get_var_value((char_u *)"current_compiler");
  228. +         if (p != NULL)
  229. +         set_internal_string_var((char_u *)"b:current_compiler", p);
  230. +         /* Restore "current_compiler" for ":compiler {name}". */
  231. +         if (!eap->forceit)
  232. +         {
  233. +         if (old_cur_comp != NULL)
  234. +         {
  235. +             set_internal_string_var((char_u *)"current_compiler",
  236. +                                 old_cur_comp);
  237. +             vim_free(old_cur_comp);
  238. +         }
  239. +         else
  240. +             do_unlet((char_u *)"current_compiler");
  241. +         }
  242.       }
  243.       }
  244.   }
  245. *** ../vim-6.2.407/src/version.c    Fri Mar 26 22:33:25 2004
  246. --- src/version.c    Sat Mar 27 13:20:14 2004
  247. ***************
  248. *** 639,640 ****
  249. --- 639,642 ----
  250.   {   /* Add new patch number below this line */
  251. + /**/
  252. +     408,
  253.   /**/
  254.  
  255. -- 
  256. hundred-and-one symptoms of being an internet addict:
  257. 163. You go outside for the fresh air (at -30 degrees) but open the
  258.      window first to hear new mail arrive.
  259.  
  260.  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
  261. ///        Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
  262. \\\              Project leader for A-A-P -- http://www.A-A-P.org        ///
  263.  \\\  Buy at Amazon and help AIDS victims -- http://ICCF.nl/click1.html ///
  264.