Karsten Hopp a600a3
To: vim_dev@googlegroups.com
Karsten Hopp a600a3
Subject: Patch 7.4.689
Karsten Hopp a600a3
Fcc: outbox
Karsten Hopp a600a3
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp a600a3
Mime-Version: 1.0
Karsten Hopp a600a3
Content-Type: text/plain; charset=UTF-8
Karsten Hopp a600a3
Content-Transfer-Encoding: 8bit
Karsten Hopp a600a3
------------
Karsten Hopp a600a3
Karsten Hopp a600a3
Patch 7.4.689
Karsten Hopp a600a3
Problem:    On MS-Windows, when 'autochdir' is set, diff mode with files in
Karsten Hopp a600a3
	    different directories does not work. (Axel Bender)
Karsten Hopp a600a3
Solution:   Remember the current directory and use it where needed. (Christian
Karsten Hopp a600a3
	    Brabandt)
Karsten Hopp a600a3
Files:	    src/main.c
Karsten Hopp a600a3
Karsten Hopp a600a3
Karsten Hopp a600a3
*** ../vim-7.4.688/src/main.c	2015-03-24 16:48:16.969934944 +0100
Karsten Hopp a600a3
--- src/main.c	2015-04-03 14:52:48.011422200 +0200
Karsten Hopp a600a3
***************
Karsten Hopp a600a3
*** 110,116 ****
Karsten Hopp a600a3
  static void read_stdin __ARGS((void));
Karsten Hopp a600a3
  static void create_windows __ARGS((mparm_T *parmp));
Karsten Hopp a600a3
  # ifdef FEAT_WINDOWS
Karsten Hopp a600a3
! static void edit_buffers __ARGS((mparm_T *parmp));
Karsten Hopp a600a3
  # endif
Karsten Hopp a600a3
  static void exe_pre_commands __ARGS((mparm_T *parmp));
Karsten Hopp a600a3
  static void exe_commands __ARGS((mparm_T *parmp));
Karsten Hopp a600a3
--- 110,116 ----
Karsten Hopp a600a3
  static void read_stdin __ARGS((void));
Karsten Hopp a600a3
  static void create_windows __ARGS((mparm_T *parmp));
Karsten Hopp a600a3
  # ifdef FEAT_WINDOWS
Karsten Hopp a600a3
! static void edit_buffers __ARGS((mparm_T *parmp, char_u *cwd));
Karsten Hopp a600a3
  # endif
Karsten Hopp a600a3
  static void exe_pre_commands __ARGS((mparm_T *parmp));
Karsten Hopp a600a3
  static void exe_commands __ARGS((mparm_T *parmp));
Karsten Hopp a600a3
***************
Karsten Hopp a600a3
*** 168,173 ****
Karsten Hopp a600a3
--- 168,174 ----
Karsten Hopp a600a3
      char_u	*fname = NULL;		/* file name from command line */
Karsten Hopp a600a3
      mparm_T	params;			/* various parameters passed between
Karsten Hopp a600a3
  					 * main() and other functions. */
Karsten Hopp a600a3
+     char_u	*cwd = NULL;		/* current workding dir on startup */
Karsten Hopp a600a3
  #ifdef STARTUPTIME
Karsten Hopp a600a3
      int		i;
Karsten Hopp a600a3
  #endif
Karsten Hopp a600a3
***************
Karsten Hopp a600a3
*** 404,415 ****
Karsten Hopp a600a3
--- 405,421 ----
Karsten Hopp a600a3
  	 */
Karsten Hopp a600a3
  	if (!params.literal)
Karsten Hopp a600a3
  	{
Karsten Hopp a600a3
+ 	    cwd = alloc(MAXPATHL);
Karsten Hopp a600a3
+ 	    if (cwd != NULL)
Karsten Hopp a600a3
+ 		mch_dirname(cwd, MAXPATHL);
Karsten Hopp a600a3
  	    /* Temporarily add '(' and ')' to 'isfname'.  These are valid
Karsten Hopp a600a3
  	     * filename characters but are excluded from 'isfname' to make
Karsten Hopp a600a3
  	     * "gf" work on a file name in parenthesis (e.g.: see vim.h). */
Karsten Hopp a600a3
  	    do_cmdline_cmd((char_u *)":set isf+=(,)");
Karsten Hopp a600a3
  	    alist_expand(NULL, 0);
Karsten Hopp a600a3
  	    do_cmdline_cmd((char_u *)":set isf&";;
Karsten Hopp a600a3
+ 	    if (cwd != NULL)
Karsten Hopp a600a3
+ 		mch_chdir((char *)cwd);
Karsten Hopp a600a3
  	}
Karsten Hopp a600a3
  #endif
Karsten Hopp a600a3
  	fname = alist_name(&GARGLIST[0]);
Karsten Hopp a600a3
***************
Karsten Hopp a600a3
*** 435,440 ****
Karsten Hopp a600a3
--- 441,448 ----
Karsten Hopp a600a3
  	 * If the cd fails, it doesn't matter.
Karsten Hopp a600a3
  	 */
Karsten Hopp a600a3
  	(void)vim_chdirfile(fname);
Karsten Hopp a600a3
+ 	if (cwd != NULL)
Karsten Hopp a600a3
+ 	    mch_dirnamem(cwd, MAXPATHL);
Karsten Hopp a600a3
      }
Karsten Hopp a600a3
  #endif
Karsten Hopp a600a3
      TIME_MSG("expanding arguments");
Karsten Hopp a600a3
***************
Karsten Hopp a600a3
*** 488,493 ****
Karsten Hopp a600a3
--- 496,503 ----
Karsten Hopp a600a3
  		expand_env((char_u *)"$HOME", NameBuff, MAXPATHL);
Karsten Hopp a600a3
  		vim_chdir(NameBuff);
Karsten Hopp a600a3
  	    }
Karsten Hopp a600a3
+ 	    if (cwd != NULL)
Karsten Hopp a600a3
+ 		mch_dirname(cwd, MAXPATHL);
Karsten Hopp a600a3
  	}
Karsten Hopp a600a3
      }
Karsten Hopp a600a3
  #endif
Karsten Hopp a600a3
***************
Karsten Hopp a600a3
*** 900,907 ****
Karsten Hopp a600a3
       * If opened more than one window, start editing files in the other
Karsten Hopp a600a3
       * windows.
Karsten Hopp a600a3
       */
Karsten Hopp a600a3
!     edit_buffers(&params);
Karsten Hopp a600a3
  #endif
Karsten Hopp a600a3
  
Karsten Hopp a600a3
  #ifdef FEAT_DIFF
Karsten Hopp a600a3
      if (params.diff_mode)
Karsten Hopp a600a3
--- 910,918 ----
Karsten Hopp a600a3
       * If opened more than one window, start editing files in the other
Karsten Hopp a600a3
       * windows.
Karsten Hopp a600a3
       */
Karsten Hopp a600a3
!     edit_buffers(&params, cwd);
Karsten Hopp a600a3
  #endif
Karsten Hopp a600a3
+     vim_free(cwd);
Karsten Hopp a600a3
  
Karsten Hopp a600a3
  #ifdef FEAT_DIFF
Karsten Hopp a600a3
      if (params.diff_mode)
Karsten Hopp a600a3
***************
Karsten Hopp a600a3
*** 2730,2737 ****
Karsten Hopp a600a3
       * windows.  make_windows() has already opened the windows.
Karsten Hopp a600a3
       */
Karsten Hopp a600a3
      static void
Karsten Hopp a600a3
! edit_buffers(parmp)
Karsten Hopp a600a3
      mparm_T	*parmp;
Karsten Hopp a600a3
  {
Karsten Hopp a600a3
      int		arg_idx;		/* index in argument list */
Karsten Hopp a600a3
      int		i;
Karsten Hopp a600a3
--- 2741,2749 ----
Karsten Hopp a600a3
       * windows.  make_windows() has already opened the windows.
Karsten Hopp a600a3
       */
Karsten Hopp a600a3
      static void
Karsten Hopp a600a3
! edit_buffers(parmp, cwd)
Karsten Hopp a600a3
      mparm_T	*parmp;
Karsten Hopp a600a3
+     char_u	*cwd;			/* current working dir */
Karsten Hopp a600a3
  {
Karsten Hopp a600a3
      int		arg_idx;		/* index in argument list */
Karsten Hopp a600a3
      int		i;
Karsten Hopp a600a3
***************
Karsten Hopp a600a3
*** 2756,2761 ****
Karsten Hopp a600a3
--- 2768,2775 ----
Karsten Hopp a600a3
      arg_idx = 1;
Karsten Hopp a600a3
      for (i = 1; i < parmp->window_count; ++i)
Karsten Hopp a600a3
      {
Karsten Hopp a600a3
+ 	if (cwd != NULL)
Karsten Hopp a600a3
+ 	    mch_chdir((char *)cwd);
Karsten Hopp a600a3
  	/* When w_arg_idx is -1 remove the window (see create_windows()). */
Karsten Hopp a600a3
  	if (curwin->w_arg_idx == -1)
Karsten Hopp a600a3
  	{
Karsten Hopp a600a3
*** ../vim-7.4.688/src/version.c	2015-03-31 19:17:55.620054448 +0200
Karsten Hopp a600a3
--- src/version.c	2015-04-03 14:51:43.680122220 +0200
Karsten Hopp a600a3
***************
Karsten Hopp a600a3
*** 743,744 ****
Karsten Hopp a600a3
--- 743,746 ----
Karsten Hopp a600a3
  {   /* Add new patch number below this line */
Karsten Hopp a600a3
+ /**/
Karsten Hopp a600a3
+     689,
Karsten Hopp a600a3
  /**/
Karsten Hopp a600a3
Karsten Hopp a600a3
-- 
Karsten Hopp a600a3
Violators can be fined, arrested or jailed for making ugly faces at a dog.
Karsten Hopp a600a3
		[real standing law in Oklahoma, United States of America]
Karsten Hopp a600a3
Karsten Hopp a600a3
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp a600a3
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp a600a3
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp a600a3
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///