|
Karsten Hopp |
d985c7 |
To: vim-dev@vim.org
|
|
Karsten Hopp |
d985c7 |
Subject: Patch 7.0.087
|
|
Karsten Hopp |
d985c7 |
Fcc: outbox
|
|
Karsten Hopp |
d985c7 |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
Karsten Hopp |
d985c7 |
Mime-Version: 1.0
|
|
Karsten Hopp |
d985c7 |
Content-Type: text/plain; charset=ISO-8859-1
|
|
Karsten Hopp |
d985c7 |
Content-Transfer-Encoding: 8bit
|
|
Karsten Hopp |
d985c7 |
------------
|
|
Karsten Hopp |
d985c7 |
|
|
Karsten Hopp |
d985c7 |
Patch 7.0.087
|
|
Karsten Hopp |
d985c7 |
Problem: After ":file fname" and ":saveas fname" the 'autochdir' option
|
|
Karsten Hopp |
d985c7 |
does not take effect. (Yakov Lerner)
|
|
Karsten Hopp |
d985c7 |
Commands for handling 'autochdir' are repeated many times.
|
|
Karsten Hopp |
d985c7 |
Solution: Add the DO_AUTOCHDIR macro and do_autochdir(). Use it for
|
|
Karsten Hopp |
d985c7 |
":file fname" and ":saveas fname".
|
|
Karsten Hopp |
d985c7 |
Files: src/proto/buffer.pro, src/buffer.c, src/ex_cmds.c, src/macros.h,
|
|
Karsten Hopp |
d985c7 |
src/option.c, src/window.c
|
|
Karsten Hopp |
d985c7 |
|
|
Karsten Hopp |
d985c7 |
|
|
Karsten Hopp |
d985c7 |
*** ../vim-7.0.086/src/proto/buffer.pro Sun Apr 30 20:25:32 2006
|
|
Karsten Hopp |
d985c7 |
--- src/proto/buffer.pro Tue Sep 5 16:25:40 2006
|
|
Karsten Hopp |
d985c7 |
***************
|
|
Karsten Hopp |
d985c7 |
*** 10,15 ****
|
|
Karsten Hopp |
d985c7 |
--- 10,16 ----
|
|
Karsten Hopp |
d985c7 |
extern int do_buffer __ARGS((int action, int start, int dir, int count, int forceit));
|
|
Karsten Hopp |
d985c7 |
extern void set_curbuf __ARGS((buf_T *buf, int action));
|
|
Karsten Hopp |
d985c7 |
extern void enter_buffer __ARGS((buf_T *buf));
|
|
Karsten Hopp |
d985c7 |
+ extern void do_autochdir __ARGS((void));
|
|
Karsten Hopp |
d985c7 |
extern buf_T *buflist_new __ARGS((char_u *ffname, char_u *sfname, linenr_T lnum, int flags));
|
|
Karsten Hopp |
d985c7 |
extern void free_buf_options __ARGS((buf_T *buf, int free_p_ff));
|
|
Karsten Hopp |
d985c7 |
extern int buflist_getfile __ARGS((int n, linenr_T lnum, int options, int forceit));
|
|
Karsten Hopp |
d985c7 |
*** ../vim-7.0.086/src/buffer.c Tue Aug 29 16:52:01 2006
|
|
Karsten Hopp |
d985c7 |
--- src/buffer.c Tue Sep 5 15:18:19 2006
|
|
Karsten Hopp |
d985c7 |
***************
|
|
Karsten Hopp |
d985c7 |
*** 434,445 ****
|
|
Karsten Hopp |
d985c7 |
if (usingNetbeans)
|
|
Karsten Hopp |
d985c7 |
netbeans_file_closed(buf);
|
|
Karsten Hopp |
d985c7 |
#endif
|
|
Karsten Hopp |
d985c7 |
! #ifdef FEAT_AUTOCHDIR
|
|
Karsten Hopp |
d985c7 |
! /* Change directories when the acd option is set on. */
|
|
Karsten Hopp |
d985c7 |
! if (p_acd && curbuf->b_ffname != NULL
|
|
Karsten Hopp |
d985c7 |
! && vim_chdirfile(curbuf->b_ffname) == OK)
|
|
Karsten Hopp |
d985c7 |
! shorten_fnames(TRUE);
|
|
Karsten Hopp |
d985c7 |
! #endif
|
|
Karsten Hopp |
d985c7 |
|
|
Karsten Hopp |
d985c7 |
/*
|
|
Karsten Hopp |
d985c7 |
* Remove the buffer from the list.
|
|
Karsten Hopp |
d985c7 |
--- 434,441 ----
|
|
Karsten Hopp |
d985c7 |
if (usingNetbeans)
|
|
Karsten Hopp |
d985c7 |
netbeans_file_closed(buf);
|
|
Karsten Hopp |
d985c7 |
#endif
|
|
Karsten Hopp |
d985c7 |
! /* Change directories when the 'acd' option is set. */
|
|
Karsten Hopp |
d985c7 |
! DO_AUTOCHDIR
|
|
Karsten Hopp |
d985c7 |
|
|
Karsten Hopp |
d985c7 |
/*
|
|
Karsten Hopp |
d985c7 |
* Remove the buffer from the list.
|
|
Karsten Hopp |
d985c7 |
***************
|
|
Karsten Hopp |
d985c7 |
*** 1422,1433 ****
|
|
Karsten Hopp |
d985c7 |
netbeans_file_activated(curbuf);
|
|
Karsten Hopp |
d985c7 |
#endif
|
|
Karsten Hopp |
d985c7 |
|
|
Karsten Hopp |
d985c7 |
! #ifdef FEAT_AUTOCHDIR
|
|
Karsten Hopp |
d985c7 |
! /* Change directories when the acd option is set on. */
|
|
Karsten Hopp |
d985c7 |
! if (p_acd && curbuf->b_ffname != NULL
|
|
Karsten Hopp |
d985c7 |
! && vim_chdirfile(curbuf->b_ffname) == OK)
|
|
Karsten Hopp |
d985c7 |
! shorten_fnames(TRUE);
|
|
Karsten Hopp |
d985c7 |
! #endif
|
|
Karsten Hopp |
d985c7 |
|
|
Karsten Hopp |
d985c7 |
#ifdef FEAT_KEYMAP
|
|
Karsten Hopp |
d985c7 |
if (curbuf->b_kmap_state & KEYMAP_INIT)
|
|
Karsten Hopp |
d985c7 |
--- 1418,1425 ----
|
|
Karsten Hopp |
d985c7 |
netbeans_file_activated(curbuf);
|
|
Karsten Hopp |
d985c7 |
#endif
|
|
Karsten Hopp |
d985c7 |
|
|
Karsten Hopp |
d985c7 |
! /* Change directories when the 'acd' option is set. */
|
|
Karsten Hopp |
d985c7 |
! DO_AUTOCHDIR
|
|
Karsten Hopp |
d985c7 |
|
|
Karsten Hopp |
d985c7 |
#ifdef FEAT_KEYMAP
|
|
Karsten Hopp |
d985c7 |
if (curbuf->b_kmap_state & KEYMAP_INIT)
|
|
Karsten Hopp |
d985c7 |
***************
|
|
Karsten Hopp |
d985c7 |
*** 1435,1440 ****
|
|
Karsten Hopp |
d985c7 |
--- 1427,1444 ----
|
|
Karsten Hopp |
d985c7 |
#endif
|
|
Karsten Hopp |
d985c7 |
redraw_later(NOT_VALID);
|
|
Karsten Hopp |
d985c7 |
}
|
|
Karsten Hopp |
d985c7 |
+
|
|
Karsten Hopp |
d985c7 |
+ #if defined(FEAT_AUTOCHDIR) || defined(PROTO)
|
|
Karsten Hopp |
d985c7 |
+ /*
|
|
Karsten Hopp |
d985c7 |
+ * Change to the directory of the current buffer.
|
|
Karsten Hopp |
d985c7 |
+ */
|
|
Karsten Hopp |
d985c7 |
+ void
|
|
Karsten Hopp |
d985c7 |
+ do_autochdir()
|
|
Karsten Hopp |
d985c7 |
+ {
|
|
Karsten Hopp |
d985c7 |
+ if (curbuf->b_ffname != NULL && vim_chdirfile(curbuf->b_ffname) == OK)
|
|
Karsten Hopp |
d985c7 |
+ shorten_fnames(TRUE);
|
|
Karsten Hopp |
d985c7 |
+ }
|
|
Karsten Hopp |
d985c7 |
+ #endif
|
|
Karsten Hopp |
d985c7 |
|
|
Karsten Hopp |
d985c7 |
/*
|
|
Karsten Hopp |
d985c7 |
* functions for dealing with the buffer list
|
|
Karsten Hopp |
d985c7 |
*** ../vim-7.0.086/src/ex_cmds.c Tue Aug 29 17:28:56 2006
|
|
Karsten Hopp |
d985c7 |
--- src/ex_cmds.c Tue Sep 5 15:24:58 2006
|
|
Karsten Hopp |
d985c7 |
***************
|
|
Karsten Hopp |
d985c7 |
*** 2458,2463 ****
|
|
Karsten Hopp |
d985c7 |
--- 2458,2465 ----
|
|
Karsten Hopp |
d985c7 |
#ifdef FEAT_AUTOCMD
|
|
Karsten Hopp |
d985c7 |
apply_autocmds(EVENT_BUFFILEPOST, NULL, NULL, FALSE, curbuf);
|
|
Karsten Hopp |
d985c7 |
#endif
|
|
Karsten Hopp |
d985c7 |
+ /* Change directories when the 'acd' option is set. */
|
|
Karsten Hopp |
d985c7 |
+ DO_AUTOCHDIR
|
|
Karsten Hopp |
d985c7 |
}
|
|
Karsten Hopp |
d985c7 |
/* print full file name if :cd used */
|
|
Karsten Hopp |
d985c7 |
fileinfo(FALSE, FALSE, eap->forceit);
|
|
Karsten Hopp |
d985c7 |
***************
|
|
Karsten Hopp |
d985c7 |
*** 2675,2682 ****
|
|
Karsten Hopp |
d985c7 |
eap, eap->append, eap->forceit, TRUE, FALSE);
|
|
Karsten Hopp |
d985c7 |
|
|
Karsten Hopp |
d985c7 |
/* After ":saveas fname" reset 'readonly'. */
|
|
Karsten Hopp |
d985c7 |
! if (eap->cmdidx == CMD_saveas && retval == OK)
|
|
Karsten Hopp |
d985c7 |
! curbuf->b_p_ro = FALSE;
|
|
Karsten Hopp |
d985c7 |
}
|
|
Karsten Hopp |
d985c7 |
|
|
Karsten Hopp |
d985c7 |
theend:
|
|
Karsten Hopp |
d985c7 |
--- 2677,2689 ----
|
|
Karsten Hopp |
d985c7 |
eap, eap->append, eap->forceit, TRUE, FALSE);
|
|
Karsten Hopp |
d985c7 |
|
|
Karsten Hopp |
d985c7 |
/* After ":saveas fname" reset 'readonly'. */
|
|
Karsten Hopp |
d985c7 |
! if (eap->cmdidx == CMD_saveas)
|
|
Karsten Hopp |
d985c7 |
! {
|
|
Karsten Hopp |
d985c7 |
! if (retval == OK)
|
|
Karsten Hopp |
d985c7 |
! curbuf->b_p_ro = FALSE;
|
|
Karsten Hopp |
d985c7 |
! /* Change directories when the 'acd' option is set. */
|
|
Karsten Hopp |
d985c7 |
! DO_AUTOCHDIR
|
|
Karsten Hopp |
d985c7 |
! }
|
|
Karsten Hopp |
d985c7 |
}
|
|
Karsten Hopp |
d985c7 |
|
|
Karsten Hopp |
d985c7 |
theend:
|
|
Karsten Hopp |
d985c7 |
***************
|
|
Karsten Hopp |
d985c7 |
*** 3547,3557 ****
|
|
Karsten Hopp |
d985c7 |
foldUpdateAll(curwin);
|
|
Karsten Hopp |
d985c7 |
#endif
|
|
Karsten Hopp |
d985c7 |
|
|
Karsten Hopp |
d985c7 |
! #ifdef FEAT_AUTOCHDIR
|
|
Karsten Hopp |
d985c7 |
! if (p_acd && curbuf->b_ffname != NULL
|
|
Karsten Hopp |
d985c7 |
! && vim_chdirfile(curbuf->b_ffname) == OK)
|
|
Karsten Hopp |
d985c7 |
! shorten_fnames(TRUE);
|
|
Karsten Hopp |
d985c7 |
! #endif
|
|
Karsten Hopp |
d985c7 |
/*
|
|
Karsten Hopp |
d985c7 |
* Careful: open_buffer() and apply_autocmds() may change the current
|
|
Karsten Hopp |
d985c7 |
* buffer and window.
|
|
Karsten Hopp |
d985c7 |
--- 3554,3562 ----
|
|
Karsten Hopp |
d985c7 |
foldUpdateAll(curwin);
|
|
Karsten Hopp |
d985c7 |
#endif
|
|
Karsten Hopp |
d985c7 |
|
|
Karsten Hopp |
d985c7 |
! /* Change directories when the 'acd' option is set. */
|
|
Karsten Hopp |
d985c7 |
! DO_AUTOCHDIR
|
|
Karsten Hopp |
d985c7 |
!
|
|
Karsten Hopp |
d985c7 |
/*
|
|
Karsten Hopp |
d985c7 |
* Careful: open_buffer() and apply_autocmds() may change the current
|
|
Karsten Hopp |
d985c7 |
* buffer and window.
|
|
Karsten Hopp |
d985c7 |
***************
|
|
Karsten Hopp |
d985c7 |
*** 3718,3729 ****
|
|
Karsten Hopp |
d985c7 |
if (p_im)
|
|
Karsten Hopp |
d985c7 |
need_start_insertmode = TRUE;
|
|
Karsten Hopp |
d985c7 |
|
|
Karsten Hopp |
d985c7 |
! #ifdef FEAT_AUTOCHDIR
|
|
Karsten Hopp |
d985c7 |
! /* Change directories when the acd option is set on. */
|
|
Karsten Hopp |
d985c7 |
! if (p_acd && curbuf->b_ffname != NULL
|
|
Karsten Hopp |
d985c7 |
! && vim_chdirfile(curbuf->b_ffname) == OK)
|
|
Karsten Hopp |
d985c7 |
! shorten_fnames(TRUE);
|
|
Karsten Hopp |
d985c7 |
! #endif
|
|
Karsten Hopp |
d985c7 |
|
|
Karsten Hopp |
d985c7 |
#if defined(FEAT_SUN_WORKSHOP) || defined(FEAT_NETBEANS_INTG)
|
|
Karsten Hopp |
d985c7 |
if (gui.in_use && curbuf->b_ffname != NULL)
|
|
Karsten Hopp |
d985c7 |
--- 3723,3730 ----
|
|
Karsten Hopp |
d985c7 |
if (p_im)
|
|
Karsten Hopp |
d985c7 |
need_start_insertmode = TRUE;
|
|
Karsten Hopp |
d985c7 |
|
|
Karsten Hopp |
d985c7 |
! /* Change directories when the 'acd' option is set. */
|
|
Karsten Hopp |
d985c7 |
! DO_AUTOCHDIR
|
|
Karsten Hopp |
d985c7 |
|
|
Karsten Hopp |
d985c7 |
#if defined(FEAT_SUN_WORKSHOP) || defined(FEAT_NETBEANS_INTG)
|
|
Karsten Hopp |
d985c7 |
if (gui.in_use && curbuf->b_ffname != NULL)
|
|
Karsten Hopp |
d985c7 |
*** ../vim-7.0.086/src/macros.h Wed Mar 1 23:00:25 2006
|
|
Karsten Hopp |
d985c7 |
--- src/macros.h Tue Sep 5 15:15:30 2006
|
|
Karsten Hopp |
d985c7 |
***************
|
|
Karsten Hopp |
d985c7 |
*** 276,278 ****
|
|
Karsten Hopp |
d985c7 |
--- 276,284 ----
|
|
Karsten Hopp |
d985c7 |
# define MB_CHARLEN(p) STRLEN(p)
|
|
Karsten Hopp |
d985c7 |
# define PTR2CHAR(p) ((int)*(p))
|
|
Karsten Hopp |
d985c7 |
#endif
|
|
Karsten Hopp |
d985c7 |
+
|
|
Karsten Hopp |
d985c7 |
+ #ifdef FEAT_AUTOCHDIR
|
|
Karsten Hopp |
d985c7 |
+ # define DO_AUTOCHDIR if (p_acd) do_autochdir();
|
|
Karsten Hopp |
d985c7 |
+ #else
|
|
Karsten Hopp |
d985c7 |
+ # define DO_AUTOCHDIR
|
|
Karsten Hopp |
d985c7 |
+ #endif
|
|
Karsten Hopp |
d985c7 |
*** ../vim-7.0.086/src/option.c Tue Aug 29 17:28:56 2006
|
|
Karsten Hopp |
d985c7 |
--- src/option.c Tue Sep 5 15:20:04 2006
|
|
Karsten Hopp |
d985c7 |
***************
|
|
Karsten Hopp |
d985c7 |
*** 7326,7334 ****
|
|
Karsten Hopp |
d985c7 |
#ifdef FEAT_AUTOCHDIR
|
|
Karsten Hopp |
d985c7 |
else if ((int *)varp == &p_acd)
|
|
Karsten Hopp |
d985c7 |
{
|
|
Karsten Hopp |
d985c7 |
! if (p_acd && curbuf->b_ffname != NULL
|
|
Karsten Hopp |
d985c7 |
! && vim_chdirfile(curbuf->b_ffname) == OK)
|
|
Karsten Hopp |
d985c7 |
! shorten_fnames(TRUE);
|
|
Karsten Hopp |
d985c7 |
}
|
|
Karsten Hopp |
d985c7 |
#endif
|
|
Karsten Hopp |
d985c7 |
|
|
Karsten Hopp |
d985c7 |
--- 7326,7333 ----
|
|
Karsten Hopp |
d985c7 |
#ifdef FEAT_AUTOCHDIR
|
|
Karsten Hopp |
d985c7 |
else if ((int *)varp == &p_acd)
|
|
Karsten Hopp |
d985c7 |
{
|
|
Karsten Hopp |
d985c7 |
! /* Change directories when the 'acd' option is set now. */
|
|
Karsten Hopp |
d985c7 |
! DO_AUTOCHDIR
|
|
Karsten Hopp |
d985c7 |
}
|
|
Karsten Hopp |
d985c7 |
#endif
|
|
Karsten Hopp |
d985c7 |
|
|
Karsten Hopp |
d985c7 |
*** ../vim-7.0.086/src/window.c Tue Aug 29 17:28:56 2006
|
|
Karsten Hopp |
d985c7 |
--- src/window.c Tue Sep 5 15:20:35 2006
|
|
Karsten Hopp |
d985c7 |
***************
|
|
Karsten Hopp |
d985c7 |
*** 3954,3966 ****
|
|
Karsten Hopp |
d985c7 |
setmouse(); /* in case jumped to/from help buffer */
|
|
Karsten Hopp |
d985c7 |
#endif
|
|
Karsten Hopp |
d985c7 |
|
|
Karsten Hopp |
d985c7 |
! #ifdef FEAT_AUTOCHDIR
|
|
Karsten Hopp |
d985c7 |
! /* Change directories when the 'acd' option is set on and after
|
|
Karsten Hopp |
d985c7 |
! * switching windows. */
|
|
Karsten Hopp |
d985c7 |
! if (p_acd && curbuf->b_ffname != NULL
|
|
Karsten Hopp |
d985c7 |
! && vim_chdirfile(curbuf->b_ffname) == OK)
|
|
Karsten Hopp |
d985c7 |
! shorten_fnames(TRUE);
|
|
Karsten Hopp |
d985c7 |
! #endif
|
|
Karsten Hopp |
d985c7 |
}
|
|
Karsten Hopp |
d985c7 |
|
|
Karsten Hopp |
d985c7 |
#endif /* FEAT_WINDOWS */
|
|
Karsten Hopp |
d985c7 |
--- 3954,3961 ----
|
|
Karsten Hopp |
d985c7 |
setmouse(); /* in case jumped to/from help buffer */
|
|
Karsten Hopp |
d985c7 |
#endif
|
|
Karsten Hopp |
d985c7 |
|
|
Karsten Hopp |
d985c7 |
! /* Change directories when the 'acd' option is set. */
|
|
Karsten Hopp |
d985c7 |
! DO_AUTOCHDIR
|
|
Karsten Hopp |
d985c7 |
}
|
|
Karsten Hopp |
d985c7 |
|
|
Karsten Hopp |
d985c7 |
#endif /* FEAT_WINDOWS */
|
|
Karsten Hopp |
d985c7 |
*** ../vim-7.0.086/src/version.c Tue Sep 5 15:36:30 2006
|
|
Karsten Hopp |
d985c7 |
--- src/version.c Tue Sep 5 15:52:45 2006
|
|
Karsten Hopp |
d985c7 |
***************
|
|
Karsten Hopp |
d985c7 |
*** 668,669 ****
|
|
Karsten Hopp |
d985c7 |
--- 668,671 ----
|
|
Karsten Hopp |
d985c7 |
{ /* Add new patch number below this line */
|
|
Karsten Hopp |
d985c7 |
+ /**/
|
|
Karsten Hopp |
d985c7 |
+ 87,
|
|
Karsten Hopp |
d985c7 |
/**/
|
|
Karsten Hopp |
d985c7 |
|
|
Karsten Hopp |
d985c7 |
--
|
|
Karsten Hopp |
d985c7 |
Overflow on /dev/null, please empty the bit bucket.
|
|
Karsten Hopp |
d985c7 |
|
|
Karsten Hopp |
d985c7 |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
Karsten Hopp |
d985c7 |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
Karsten Hopp |
d985c7 |
\\\ download, build and distribute -- http://www.A-A-P.org ///
|
|
Karsten Hopp |
d985c7 |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|