To: vim-dev@vim.org Subject: Patch 6.2.323 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.2.323 Problem: Win32: expanding "~/file" in an autocommand pattern results in backslashes, while this pattern should only have forward slashes. Solution: Make expanding environment variables respect 'shellslash' and set p_ssl when expanding the autocommand pattern. Files: src/fileio.c, src/misc1.c, src/proto/fileio.pro *** ../vim-6.2.322/src/fileio.c Tue Feb 24 15:19:00 2004 --- src/fileio.c Sun Mar 7 14:54:00 2004 *************** *** 6255,6267 **** static EVENT_T last_event; static int last_group; ! #ifdef BACKSLASH_IN_FILENAME ! static void forward_slash __ARGS((char_u *)); ! /* * Convert all backslashes in fname to forward slashes in-place. */ ! static void forward_slash(fname) char_u *fname; { --- 6260,6270 ---- static EVENT_T last_event; static int last_group; ! #if defined(BACKSLASH_IN_FILENAME) || defined(PROTO) /* * Convert all backslashes in fname to forward slashes in-place. */ ! void forward_slash(fname) char_u *fname; { *************** *** 6717,6726 **** if (*cmd) *cmd++ = NUL; ! /* expand environment variables in the pattern */ if (vim_strchr(pat, '$') != NULL || vim_strchr(pat, '~') != NULL) { envpat = expand_env_save(pat); if (envpat != NULL) pat = envpat; } --- 6720,6738 ---- if (*cmd) *cmd++ = NUL; ! /* Expand environment variables in the pattern. Set 'shellslash', we want ! * forward slashes here. */ if (vim_strchr(pat, '$') != NULL || vim_strchr(pat, '~') != NULL) { + #ifdef BACKSLASH_IN_FILENAME + int p_ssl_save = p_ssl; + + p_ssl = TRUE; + #endif envpat = expand_env_save(pat); + #ifdef BACKSLASH_IN_FILENAME + p_ssl = p_ssl_save; + #endif if (envpat != NULL) pat = envpat; } *** ../vim-6.2.322/src/misc1.c Tue Mar 2 16:04:09 2004 --- src/misc1.c Sun Mar 7 14:53:43 2004 *************** *** 3335,3340 **** --- 3358,3381 ---- tail = (char_u *)""; /* for gcc */ #endif /* UNIX || VMS */ } + + #ifdef BACKSLASH_IN_FILENAME + /* If 'shellslash' is set change backslashes to forward slashes. + * Can't use slash_adjust(), p_ssl may be set temporarily. */ + if (p_ssl && var != NULL && vim_strchr(var, '\\') != NULL) + { + char_u *p = vim_strsave(var); + + if (p != NULL) + { + if (mustfree) + vim_free(var); + var = p; + mustfree = TRUE; + forward_slash(var); + } + } + #endif /* If "var" contains white space, escape it with a backslash. * Required for ":e ~/tt" when $HOME includes a space. */ *** ../vim-6.2.322/src/proto/fileio.pro Sun Jan 25 20:45:55 2004 --- src/proto/fileio.pro Sun Mar 7 14:59:51 2004 *************** *** 17,22 **** --- 17,23 ---- void write_lnum_adjust __ARGS((linenr_T offset)); void vim_deltempdir __ARGS((void)); char_u *vim_tempname __ARGS((int extra_char)); + void forward_slash __ARGS((char_u *fname)); void do_augroup __ARGS((char_u *arg, int del_group)); int check_ei __ARGS((void)); void do_autocmd __ARGS((char_u *arg, int forceit)); *** ../vim-6.2.322/src/version.c Sat Mar 6 21:13:14 2004 --- src/version.c Sun Mar 7 15:19:52 2004 *************** *** 639,640 **** --- 639,642 ---- { /* Add new patch number below this line */ + /**/ + 323, /**/ -- Living on Earth includes an annual free trip around the Sun. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ Project leader for A-A-P -- http://www.A-A-P.org /// \\\ Buy at Amazon and help AIDS victims -- http://ICCF.nl/click1.html ///