]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
updated for version 7.0-087 v7.0.087
authorBram Moolenaar <Bram@vim.org>
Tue, 5 Sep 2006 14:31:54 +0000 (14:31 +0000)
committerBram Moolenaar <Bram@vim.org>
Tue, 5 Sep 2006 14:31:54 +0000 (14:31 +0000)
src/buffer.c
src/ex_cmds.c
src/macros.h
src/option.c
src/proto/buffer.pro
src/version.c
src/window.c

index 3359bc24091016eb0e0f5a0c1c45347507bf86e9..e05bd3935e944caab9f197e2d1e4d52b8ac7d0a4 100644 (file)
@@ -434,12 +434,8 @@ close_buffer(win, buf, action)
     if (usingNetbeans)
        netbeans_file_closed(buf);
 #endif
-#ifdef FEAT_AUTOCHDIR
-    /* Change directories when the acd option is set on. */
-    if (p_acd && curbuf->b_ffname != NULL
-                                    && vim_chdirfile(curbuf->b_ffname) == OK)
-       shorten_fnames(TRUE);
-#endif
+    /* Change directories when the 'acd' option is set. */
+    DO_AUTOCHDIR
 
     /*
      * Remove the buffer from the list.
@@ -1422,12 +1418,8 @@ enter_buffer(buf)
        netbeans_file_activated(curbuf);
 #endif
 
-#ifdef FEAT_AUTOCHDIR
-    /* Change directories when the acd option is set on. */
-    if (p_acd && curbuf->b_ffname != NULL
-                                    && vim_chdirfile(curbuf->b_ffname) == OK)
-       shorten_fnames(TRUE);
-#endif
+    /* Change directories when the 'acd' option is set. */
+    DO_AUTOCHDIR
 
 #ifdef FEAT_KEYMAP
     if (curbuf->b_kmap_state & KEYMAP_INIT)
@@ -1436,6 +1428,18 @@ enter_buffer(buf)
     redraw_later(NOT_VALID);
 }
 
+#if defined(FEAT_AUTOCHDIR) || defined(PROTO)
+/*
+ * Change to the directory of the current buffer.
+ */
+    void
+do_autochdir()
+{
+    if (curbuf->b_ffname != NULL && vim_chdirfile(curbuf->b_ffname) == OK)
+       shorten_fnames(TRUE);
+}
+#endif
+
 /*
  * functions for dealing with the buffer list
  */
index 70440735ccfe2f3a00d4932f69e55a23287998bd..074abfdfb785077d21bc47812a4379a71531ef81 100644 (file)
@@ -2458,6 +2458,8 @@ ex_file(eap)
 #ifdef FEAT_AUTOCMD
        apply_autocmds(EVENT_BUFFILEPOST, NULL, NULL, FALSE, curbuf);
 #endif
+       /* Change directories when the 'acd' option is set. */
+       DO_AUTOCHDIR
     }
     /* print full file name if :cd used */
     fileinfo(FALSE, FALSE, eap->forceit);
@@ -2675,8 +2677,13 @@ do_write(eap)
                                 eap, eap->append, eap->forceit, TRUE, FALSE);
 
        /* After ":saveas fname" reset 'readonly'. */
-       if (eap->cmdidx == CMD_saveas && retval == OK)
-           curbuf->b_p_ro = FALSE;
+       if (eap->cmdidx == CMD_saveas)
+       {
+           if (retval == OK)
+               curbuf->b_p_ro = FALSE;
+           /* Change directories when the 'acd' option is set. */
+           DO_AUTOCHDIR
+       }
     }
 
 theend:
@@ -3547,11 +3554,9 @@ do_ecmd(fnum, ffname, sfname, eap, newlnum, flags)
        foldUpdateAll(curwin);
 #endif
 
-#ifdef FEAT_AUTOCHDIR
-       if (p_acd && curbuf->b_ffname != NULL
-                                    && vim_chdirfile(curbuf->b_ffname) == OK)
-           shorten_fnames(TRUE);
-#endif
+       /* Change directories when the 'acd' option is set. */
+       DO_AUTOCHDIR
+
        /*
         * Careful: open_buffer() and apply_autocmds() may change the current
         * buffer and window.
@@ -3718,12 +3723,8 @@ do_ecmd(fnum, ffname, sfname, eap, newlnum, flags)
     if (p_im)
        need_start_insertmode = TRUE;
 
-#ifdef FEAT_AUTOCHDIR
-    /* Change directories when the acd option is set on. */
-    if (p_acd && curbuf->b_ffname != NULL
-                                    && vim_chdirfile(curbuf->b_ffname) == OK)
-       shorten_fnames(TRUE);
-#endif
+    /* Change directories when the 'acd' option is set. */
+    DO_AUTOCHDIR
 
 #if defined(FEAT_SUN_WORKSHOP) || defined(FEAT_NETBEANS_INTG)
     if (gui.in_use && curbuf->b_ffname != NULL)
index c4c9a14da3eddf459c9583978dc83aa2e76472a0..a8bc2b85236c5a46859ecf01b615715555f1dd7e 100644 (file)
 # define MB_CHARLEN(p)         STRLEN(p)
 # define PTR2CHAR(p)           ((int)*(p))
 #endif
+
+#ifdef FEAT_AUTOCHDIR
+# define DO_AUTOCHDIR if (p_acd) do_autochdir();
+#else
+# define DO_AUTOCHDIR
+#endif
index c599d0245cc7e85f209bd233614a7f842728f3e4..1f47c60b90a069c39be4e9d9bfabbe1d895d90f1 100644 (file)
@@ -7326,9 +7326,8 @@ set_bool_option(opt_idx, varp, value, opt_flags)
 #ifdef FEAT_AUTOCHDIR
     else if ((int *)varp == &p_acd)
     {
-       if (p_acd && curbuf->b_ffname != NULL
-                                    && vim_chdirfile(curbuf->b_ffname) == OK)
-           shorten_fnames(TRUE);
+       /* Change directories when the 'acd' option is set now. */
+       DO_AUTOCHDIR
     }
 #endif
 
index 9da8c3e6e188667c454ce599002597dcaa4eef01..d0556b61e7fd9d9664555ee5840bc75d80fea339 100644 (file)
@@ -10,6 +10,7 @@ extern char_u *do_bufdel __ARGS((int command, char_u *arg, int addr_count, int s
 extern int do_buffer __ARGS((int action, int start, int dir, int count, int forceit));
 extern void set_curbuf __ARGS((buf_T *buf, int action));
 extern void enter_buffer __ARGS((buf_T *buf));
+extern void do_autochdir __ARGS((void));
 extern buf_T *buflist_new __ARGS((char_u *ffname, char_u *sfname, linenr_T lnum, int flags));
 extern void free_buf_options __ARGS((buf_T *buf, int free_p_ff));
 extern int buflist_getfile __ARGS((int n, linenr_T lnum, int options, int forceit));
index 21eb8707cb9acbbddddf1c6536f8dfb5e9d602f9..21a904aaf28486a3711531bdb1dd4918f3530907 100644 (file)
@@ -666,6 +666,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    87,
 /**/
     86,
 /**/
index 4d09ad679c9820e5081f2ed100ec2119ff9883cf..0300b559004d962e2f0cf226f470eadc351fa55e 100644 (file)
@@ -3954,13 +3954,8 @@ win_enter_ext(wp, undo_sync, curwin_invalid)
     setmouse();                        /* in case jumped to/from help buffer */
 #endif
 
-#ifdef FEAT_AUTOCHDIR
-    /* Change directories when the 'acd' option is set on and after
-     * switching windows. */
-    if (p_acd && curbuf->b_ffname != NULL
-                                    && vim_chdirfile(curbuf->b_ffname) == OK)
-       shorten_fnames(TRUE);
-#endif
+    /* Change directories when the 'acd' option is set. */
+    DO_AUTOCHDIR
 }
 
 #endif /* FEAT_WINDOWS */