Karsten Hopp 769626
To: vim_dev@googlegroups.com
Karsten Hopp 769626
Subject: Patch 7.4.691
Karsten Hopp 769626
Fcc: outbox
Karsten Hopp 769626
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 769626
Mime-Version: 1.0
Karsten Hopp 769626
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 769626
Content-Transfer-Encoding: 8bit
Karsten Hopp 769626
------------
Karsten Hopp 769626
Karsten Hopp 769626
Patch 7.4.691 (after 7.4.689)
Karsten Hopp 769626
Problem:    Can't build with MzScheme.
Karsten Hopp 769626
Solution:   Change "cwd" into the global variable "start_dir".
Karsten Hopp 769626
Files:	    src/main.c
Karsten Hopp 769626
Karsten Hopp 769626
Karsten Hopp 769626
*** ../vim-7.4.690/src/main.c	2015-04-03 14:56:43.936840362 +0200
Karsten Hopp 769626
--- src/main.c	2015-04-03 17:58:55.374023988 +0200
Karsten Hopp 769626
***************
Karsten Hopp 769626
*** 147,152 ****
Karsten Hopp 769626
--- 147,154 ----
Karsten Hopp 769626
  #define ME_INVALID_ARG		5
Karsten Hopp 769626
  };
Karsten Hopp 769626
  
Karsten Hopp 769626
+ static char_u *start_dir = NULL;	/* current working dir on startup */
Karsten Hopp 769626
+ 
Karsten Hopp 769626
  #ifndef PROTO		/* don't want a prototype for main() */
Karsten Hopp 769626
  #ifndef NO_VIM_MAIN	/* skip this for unittests */
Karsten Hopp 769626
      int
Karsten Hopp 769626
***************
Karsten Hopp 769626
*** 168,174 ****
Karsten Hopp 769626
      char_u	*fname = NULL;		/* file name from command line */
Karsten Hopp 769626
      mparm_T	params;			/* various parameters passed between
Karsten Hopp 769626
  					 * main() and other functions. */
Karsten Hopp 769626
-     char_u	*cwd = NULL;		/* current workding dir on startup */
Karsten Hopp 769626
  #ifdef STARTUPTIME
Karsten Hopp 769626
      int		i;
Karsten Hopp 769626
  #endif
Karsten Hopp 769626
--- 170,175 ----
Karsten Hopp 769626
***************
Karsten Hopp 769626
*** 405,421 ****
Karsten Hopp 769626
  	 */
Karsten Hopp 769626
  	if (!params.literal)
Karsten Hopp 769626
  	{
Karsten Hopp 769626
! 	    cwd = alloc(MAXPATHL);
Karsten Hopp 769626
! 	    if (cwd != NULL)
Karsten Hopp 769626
! 		mch_dirname(cwd, MAXPATHL);
Karsten Hopp 769626
  	    /* Temporarily add '(' and ')' to 'isfname'.  These are valid
Karsten Hopp 769626
  	     * filename characters but are excluded from 'isfname' to make
Karsten Hopp 769626
  	     * "gf" work on a file name in parenthesis (e.g.: see vim.h). */
Karsten Hopp 769626
  	    do_cmdline_cmd((char_u *)":set isf+=(,)");
Karsten Hopp 769626
  	    alist_expand(NULL, 0);
Karsten Hopp 769626
  	    do_cmdline_cmd((char_u *)":set isf&";;
Karsten Hopp 769626
! 	    if (cwd != NULL)
Karsten Hopp 769626
! 		mch_chdir((char *)cwd);
Karsten Hopp 769626
  	}
Karsten Hopp 769626
  #endif
Karsten Hopp 769626
  	fname = alist_name(&GARGLIST[0]);
Karsten Hopp 769626
--- 406,422 ----
Karsten Hopp 769626
  	 */
Karsten Hopp 769626
  	if (!params.literal)
Karsten Hopp 769626
  	{
Karsten Hopp 769626
! 	    start_dir = alloc(MAXPATHL);
Karsten Hopp 769626
! 	    if (start_dir != NULL)
Karsten Hopp 769626
! 		mch_dirname(start_dir, MAXPATHL);
Karsten Hopp 769626
  	    /* Temporarily add '(' and ')' to 'isfname'.  These are valid
Karsten Hopp 769626
  	     * filename characters but are excluded from 'isfname' to make
Karsten Hopp 769626
  	     * "gf" work on a file name in parenthesis (e.g.: see vim.h). */
Karsten Hopp 769626
  	    do_cmdline_cmd((char_u *)":set isf+=(,)");
Karsten Hopp 769626
  	    alist_expand(NULL, 0);
Karsten Hopp 769626
  	    do_cmdline_cmd((char_u *)":set isf&";;
Karsten Hopp 769626
! 	    if (start_dir != NULL)
Karsten Hopp 769626
! 		mch_chdir((char *)start_dir);
Karsten Hopp 769626
  	}
Karsten Hopp 769626
  #endif
Karsten Hopp 769626
  	fname = alist_name(&GARGLIST[0]);
Karsten Hopp 769626
***************
Karsten Hopp 769626
*** 441,448 ****
Karsten Hopp 769626
  	 * If the cd fails, it doesn't matter.
Karsten Hopp 769626
  	 */
Karsten Hopp 769626
  	(void)vim_chdirfile(fname);
Karsten Hopp 769626
! 	if (cwd != NULL)
Karsten Hopp 769626
! 	    mch_dirnamem(cwd, MAXPATHL);
Karsten Hopp 769626
      }
Karsten Hopp 769626
  #endif
Karsten Hopp 769626
      TIME_MSG("expanding arguments");
Karsten Hopp 769626
--- 442,449 ----
Karsten Hopp 769626
  	 * If the cd fails, it doesn't matter.
Karsten Hopp 769626
  	 */
Karsten Hopp 769626
  	(void)vim_chdirfile(fname);
Karsten Hopp 769626
! 	if (start_dir != NULL)
Karsten Hopp 769626
! 	    mch_dirname(start_dir, MAXPATHL);
Karsten Hopp 769626
      }
Karsten Hopp 769626
  #endif
Karsten Hopp 769626
      TIME_MSG("expanding arguments");
Karsten Hopp 769626
***************
Karsten Hopp 769626
*** 496,503 ****
Karsten Hopp 769626
  		expand_env((char_u *)"$HOME", NameBuff, MAXPATHL);
Karsten Hopp 769626
  		vim_chdir(NameBuff);
Karsten Hopp 769626
  	    }
Karsten Hopp 769626
! 	    if (cwd != NULL)
Karsten Hopp 769626
! 		mch_dirname(cwd, MAXPATHL);
Karsten Hopp 769626
  	}
Karsten Hopp 769626
      }
Karsten Hopp 769626
  #endif
Karsten Hopp 769626
--- 497,504 ----
Karsten Hopp 769626
  		expand_env((char_u *)"$HOME", NameBuff, MAXPATHL);
Karsten Hopp 769626
  		vim_chdir(NameBuff);
Karsten Hopp 769626
  	    }
Karsten Hopp 769626
! 	    if (start_dir != NULL)
Karsten Hopp 769626
! 		mch_dirname(start_dir, MAXPATHL);
Karsten Hopp 769626
  	}
Karsten Hopp 769626
      }
Karsten Hopp 769626
  #endif
Karsten Hopp 769626
***************
Karsten Hopp 769626
*** 910,918 ****
Karsten Hopp 769626
       * If opened more than one window, start editing files in the other
Karsten Hopp 769626
       * windows.
Karsten Hopp 769626
       */
Karsten Hopp 769626
!     edit_buffers(&params, cwd);
Karsten Hopp 769626
  #endif
Karsten Hopp 769626
!     vim_free(cwd);
Karsten Hopp 769626
  
Karsten Hopp 769626
  #ifdef FEAT_DIFF
Karsten Hopp 769626
      if (params.diff_mode)
Karsten Hopp 769626
--- 911,919 ----
Karsten Hopp 769626
       * If opened more than one window, start editing files in the other
Karsten Hopp 769626
       * windows.
Karsten Hopp 769626
       */
Karsten Hopp 769626
!     edit_buffers(&params, start_dir);
Karsten Hopp 769626
  #endif
Karsten Hopp 769626
!     vim_free(start_dir);
Karsten Hopp 769626
  
Karsten Hopp 769626
  #ifdef FEAT_DIFF
Karsten Hopp 769626
      if (params.diff_mode)
Karsten Hopp 769626
*** ../vim-7.4.690/src/version.c	2015-04-03 17:06:21.748398327 +0200
Karsten Hopp 769626
--- src/version.c	2015-04-03 17:35:20.865357402 +0200
Karsten Hopp 769626
***************
Karsten Hopp 769626
*** 743,744 ****
Karsten Hopp 769626
--- 743,746 ----
Karsten Hopp 769626
  {   /* Add new patch number below this line */
Karsten Hopp 769626
+ /**/
Karsten Hopp 769626
+     691,
Karsten Hopp 769626
  /**/
Karsten Hopp 769626
Karsten Hopp 769626
-- 
Karsten Hopp 769626
"Software is like sex... it's better when it's free."
Karsten Hopp 769626
		-- Linus Torvalds, initiator of the free Linux OS
Karsten Hopp 769626
Makes me wonder what FSF stands for...?
Karsten Hopp 769626
Karsten Hopp 769626
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 769626
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 769626
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp 769626
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///