Mercurial > vim
comparison src/fileio.c @ 5263:3059c799fcd9 v7.4b.008
updated for version 7.4b.008
Problem: 'autochdir' causes setbufvar() to change the current directory.
(Ben Fritz)
Solution: When disabling autocommands also reset 'acd' temporarily.
(Christian Brabandt)
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Fri, 02 Aug 2013 17:08:13 +0200 |
parents | 6b7ab6a4f31a |
children | d96f16667cc4 |
comparison
equal
deleted
inserted
replaced
5262:cd7e3cdc310f | 5263:3059c799fcd9 |
---|---|
8859 { | 8859 { |
8860 win_T *win; | 8860 win_T *win; |
8861 #ifdef FEAT_WINDOWS | 8861 #ifdef FEAT_WINDOWS |
8862 int save_ea; | 8862 int save_ea; |
8863 #endif | 8863 #endif |
8864 int save_acd; | |
8864 | 8865 |
8865 /* Find a window that is for the new buffer */ | 8866 /* Find a window that is for the new buffer */ |
8866 if (buf == curbuf) /* be quick when buf is curbuf */ | 8867 if (buf == curbuf) /* be quick when buf is curbuf */ |
8867 win = curwin; | 8868 win = curwin; |
8868 else | 8869 else |
8907 aucmd_win_used = TRUE; | 8908 aucmd_win_used = TRUE; |
8908 aucmd_win->w_buffer = buf; | 8909 aucmd_win->w_buffer = buf; |
8909 aucmd_win->w_s = &buf->b_s; | 8910 aucmd_win->w_s = &buf->b_s; |
8910 ++buf->b_nwindows; | 8911 ++buf->b_nwindows; |
8911 win_init_empty(aucmd_win); /* set cursor and topline to safe values */ | 8912 win_init_empty(aucmd_win); /* set cursor and topline to safe values */ |
8912 vim_free(aucmd_win->w_localdir); | |
8913 aucmd_win->w_localdir = NULL; | |
8914 | 8913 |
8915 /* Make sure w_localdir and globaldir are NULL to avoid a chdir() in | 8914 /* Make sure w_localdir and globaldir are NULL to avoid a chdir() in |
8916 * win_enter_ext(). */ | 8915 * win_enter_ext(). */ |
8916 vim_free(aucmd_win->w_localdir); | |
8917 aucmd_win->w_localdir = NULL; | 8917 aucmd_win->w_localdir = NULL; |
8918 aco->globaldir = globaldir; | 8918 aco->globaldir = globaldir; |
8919 globaldir = NULL; | 8919 globaldir = NULL; |
8920 | 8920 |
8921 | 8921 |
8924 * We don't want the BufEnter or WinEnter autocommands. */ | 8924 * We don't want the BufEnter or WinEnter autocommands. */ |
8925 block_autocmds(); | 8925 block_autocmds(); |
8926 make_snapshot(SNAP_AUCMD_IDX); | 8926 make_snapshot(SNAP_AUCMD_IDX); |
8927 save_ea = p_ea; | 8927 save_ea = p_ea; |
8928 p_ea = FALSE; | 8928 p_ea = FALSE; |
8929 | |
8930 /* Prevent chdir() call in win_enter_ext(), through do_autochdir(). */ | |
8931 save_acd = p_acd; | |
8932 p_acd = FALSE; | |
8933 | |
8929 (void)win_split_ins(0, WSP_TOP, aucmd_win, 0); | 8934 (void)win_split_ins(0, WSP_TOP, aucmd_win, 0); |
8930 (void)win_comp_pos(); /* recompute window positions */ | 8935 (void)win_comp_pos(); /* recompute window positions */ |
8931 p_ea = save_ea; | 8936 p_ea = save_ea; |
8937 p_acd = save_acd; | |
8932 unblock_autocmds(); | 8938 unblock_autocmds(); |
8933 #endif | 8939 #endif |
8934 curwin = aucmd_win; | 8940 curwin = aucmd_win; |
8935 } | 8941 } |
8936 curbuf = buf; | 8942 curbuf = buf; |