Patch 7.4b.008
Problem:    'autochdir' causes setbufvar() to change the current directory.
            (Ben Fritz)
Solution:   When disabling autocommands also reset 'acd' temporarily.
            (Christian Brabandt)
Files:      src/fileio.c


*** ../vim-7.4b.007/src/fileio.c        2013-08-02 15:22:33.000000000 +0200
--- src/fileio.c        2013-08-02 16:43:53.000000000 +0200
***************
*** 8861,8866 ****
--- 8861,8867 ----
  #ifdef FEAT_WINDOWS
      int               save_ea;
  #endif
+     int               save_acd;
  
      /* Find a window that is for the new buffer */
      if (buf == curbuf)                /* be quick when buf is curbuf */
***************
*** 8909,8919 ****
        aucmd_win->w_s = &buf->b_s;
        ++buf->b_nwindows;
        win_init_empty(aucmd_win); /* set cursor and topline to safe values */
-       vim_free(aucmd_win->w_localdir);
-       aucmd_win->w_localdir = NULL;
  
        /* Make sure w_localdir and globaldir are NULL to avoid a chdir() in
         * win_enter_ext(). */
        aucmd_win->w_localdir = NULL;
        aco->globaldir = globaldir;
        globaldir = NULL;
--- 8910,8919 ----
        aucmd_win->w_s = &buf->b_s;
        ++buf->b_nwindows;
        win_init_empty(aucmd_win); /* set cursor and topline to safe values */
  
        /* Make sure w_localdir and globaldir are NULL to avoid a chdir() in
         * win_enter_ext(). */
+       vim_free(aucmd_win->w_localdir);
        aucmd_win->w_localdir = NULL;
        aco->globaldir = globaldir;
        globaldir = NULL;
***************
*** 8926,8934 ****
--- 8926,8940 ----
        make_snapshot(SNAP_AUCMD_IDX);
        save_ea = p_ea;
        p_ea = FALSE;
+ 
+       /* Prevent chdir() call in win_enter_ext(), through do_autochdir(). */
+       save_acd = p_acd;
+       p_acd = FALSE;
+ 
        (void)win_split_ins(0, WSP_TOP, aucmd_win, 0);
        (void)win_comp_pos();   /* recompute window positions */
        p_ea = save_ea;
+       p_acd = save_acd;
        unblock_autocmds();
  #endif
        curwin = aucmd_win;
*** ../vim-7.4b.007/src/version.c       2013-08-02 16:10:29.000000000 +0200
--- src/version.c       2013-08-02 16:45:15.000000000 +0200
***************
*** 729,730 ****
--- 729,732 ----
  {   /* Add new patch number below this line */
+ /**/
+     8,
  /**/

-- 
I wonder how much deeper the ocean would be without sponges.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Raspunde prin e-mail lui