Karsten Hopp f5f9f9
To: vim_dev@googlegroups.com
Karsten Hopp f5f9f9
Subject: Patch 7.4.276
Karsten Hopp f5f9f9
Fcc: outbox
Karsten Hopp f5f9f9
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp f5f9f9
Mime-Version: 1.0
Karsten Hopp f5f9f9
Content-Type: text/plain; charset=UTF-8
Karsten Hopp f5f9f9
Content-Transfer-Encoding: 8bit
Karsten Hopp f5f9f9
------------
Karsten Hopp f5f9f9
Karsten Hopp f5f9f9
Patch 7.4.276
Karsten Hopp f5f9f9
Problem:    The fish shell is not supported.
Karsten Hopp f5f9f9
Solution:   Use begin/end instead of () for fish. (Andy Russell)
Karsten Hopp f5f9f9
Files:	    src/ex_cmds.c, src/misc1.c, src/option.c, src/proto/misc1.pro
Karsten Hopp f5f9f9
Karsten Hopp f5f9f9
Karsten Hopp f5f9f9
*** ../vim-7.4.275/src/ex_cmds.c	2014-05-07 14:38:41.129091709 +0200
Karsten Hopp f5f9f9
--- src/ex_cmds.c	2014-05-07 15:09:57.797108136 +0200
Karsten Hopp f5f9f9
***************
Karsten Hopp f5f9f9
*** 1551,1558 ****
Karsten Hopp f5f9f9
  {
Karsten Hopp f5f9f9
      char_u	*buf;
Karsten Hopp f5f9f9
      long_u	len;
Karsten Hopp f5f9f9
  
Karsten Hopp f5f9f9
!     len = (long_u)STRLEN(cmd) + 3;			/* "()" + NUL */
Karsten Hopp f5f9f9
      if (itmp != NULL)
Karsten Hopp f5f9f9
  	len += (long_u)STRLEN(itmp) + 9;		/* " { < " + " } " */
Karsten Hopp f5f9f9
      if (otmp != NULL)
Karsten Hopp f5f9f9
--- 1551,1566 ----
Karsten Hopp f5f9f9
  {
Karsten Hopp f5f9f9
      char_u	*buf;
Karsten Hopp f5f9f9
      long_u	len;
Karsten Hopp f5f9f9
+     int		is_fish_shell;
Karsten Hopp f5f9f9
  
Karsten Hopp f5f9f9
! #if (defined(UNIX) && !defined(ARCHIE)) || defined(OS2)
Karsten Hopp f5f9f9
!     /* Account for fish's different syntax for subshells */
Karsten Hopp f5f9f9
!     is_fish_shell = (fnamecmp(get_isolated_shell_name(), "fish") == 0);
Karsten Hopp f5f9f9
!     if (is_fish_shell)
Karsten Hopp f5f9f9
! 	len = (long_u)STRLEN(cmd) + 13;		/* "begin; " + "; end" + NUL */
Karsten Hopp f5f9f9
!     else
Karsten Hopp f5f9f9
! #endif
Karsten Hopp f5f9f9
! 	len = (long_u)STRLEN(cmd) + 3;			/* "()" + NUL */
Karsten Hopp f5f9f9
      if (itmp != NULL)
Karsten Hopp f5f9f9
  	len += (long_u)STRLEN(itmp) + 9;		/* " { < " + " } " */
Karsten Hopp f5f9f9
      if (otmp != NULL)
Karsten Hopp f5f9f9
***************
Karsten Hopp f5f9f9
*** 1567,1573 ****
Karsten Hopp f5f9f9
       * redirecting input and/or output.
Karsten Hopp f5f9f9
       */
Karsten Hopp f5f9f9
      if (itmp != NULL || otmp != NULL)
Karsten Hopp f5f9f9
! 	vim_snprintf((char *)buf, len, "(%s)", (char *)cmd);
Karsten Hopp f5f9f9
      else
Karsten Hopp f5f9f9
  	STRCPY(buf, cmd);
Karsten Hopp f5f9f9
      if (itmp != NULL)
Karsten Hopp f5f9f9
--- 1575,1586 ----
Karsten Hopp f5f9f9
       * redirecting input and/or output.
Karsten Hopp f5f9f9
       */
Karsten Hopp f5f9f9
      if (itmp != NULL || otmp != NULL)
Karsten Hopp f5f9f9
!     {
Karsten Hopp f5f9f9
! 	if (is_fish_shell)
Karsten Hopp f5f9f9
! 	    vim_snprintf((char *)buf, len, "begin; %s; end", (char *)cmd);
Karsten Hopp f5f9f9
! 	else
Karsten Hopp f5f9f9
! 	    vim_snprintf((char *)buf, len, "(%s)", (char *)cmd);
Karsten Hopp f5f9f9
!     }
Karsten Hopp f5f9f9
      else
Karsten Hopp f5f9f9
  	STRCPY(buf, cmd);
Karsten Hopp f5f9f9
      if (itmp != NULL)
Karsten Hopp f5f9f9
***************
Karsten Hopp f5f9f9
*** 1577,1583 ****
Karsten Hopp f5f9f9
      }
Karsten Hopp f5f9f9
  #else
Karsten Hopp f5f9f9
      /*
Karsten Hopp f5f9f9
!      * for shells that don't understand braces around commands, at least allow
Karsten Hopp f5f9f9
       * the use of commands in a pipe.
Karsten Hopp f5f9f9
       */
Karsten Hopp f5f9f9
      STRCPY(buf, cmd);
Karsten Hopp f5f9f9
--- 1590,1596 ----
Karsten Hopp f5f9f9
      }
Karsten Hopp f5f9f9
  #else
Karsten Hopp f5f9f9
      /*
Karsten Hopp f5f9f9
!      * For shells that don't understand braces around commands, at least allow
Karsten Hopp f5f9f9
       * the use of commands in a pipe.
Karsten Hopp f5f9f9
       */
Karsten Hopp f5f9f9
      STRCPY(buf, cmd);
Karsten Hopp f5f9f9
***************
Karsten Hopp f5f9f9
*** 4315,4321 ****
Karsten Hopp f5f9f9
      pos_T	old_cursor = curwin->w_cursor;
Karsten Hopp f5f9f9
      int		start_nsubs;
Karsten Hopp f5f9f9
  #ifdef FEAT_EVAL
Karsten Hopp f5f9f9
!     int         save_ma = 0;
Karsten Hopp f5f9f9
  #endif
Karsten Hopp f5f9f9
  
Karsten Hopp f5f9f9
      cmd = eap->arg;
Karsten Hopp f5f9f9
--- 4328,4334 ----
Karsten Hopp f5f9f9
      pos_T	old_cursor = curwin->w_cursor;
Karsten Hopp f5f9f9
      int		start_nsubs;
Karsten Hopp f5f9f9
  #ifdef FEAT_EVAL
Karsten Hopp f5f9f9
!     int		save_ma = 0;
Karsten Hopp f5f9f9
  #endif
Karsten Hopp f5f9f9
  
Karsten Hopp f5f9f9
      cmd = eap->arg;
Karsten Hopp f5f9f9
***************
Karsten Hopp f5f9f9
*** 5986,5992 ****
Karsten Hopp f5f9f9
  			       "/\\\\?", "/\\\\z(\\\\)", "\\\\=", ":s\\\\=",
Karsten Hopp f5f9f9
  			       "\\[count]", "\\[quotex]", "\\[range]",
Karsten Hopp f5f9f9
  			       "\\[pattern]", "\\\\bar", "/\\\\%\\$",
Karsten Hopp f5f9f9
!                                "s/\\\\\\~", "s/\\\\U", "s/\\\\L",
Karsten Hopp f5f9f9
  			       "s/\\\\1", "s/\\\\2", "s/\\\\3", "s/\\\\9"};
Karsten Hopp f5f9f9
      int flags;
Karsten Hopp f5f9f9
  
Karsten Hopp f5f9f9
--- 5999,6005 ----
Karsten Hopp f5f9f9
  			       "/\\\\?", "/\\\\z(\\\\)", "\\\\=", ":s\\\\=",
Karsten Hopp f5f9f9
  			       "\\[count]", "\\[quotex]", "\\[range]",
Karsten Hopp f5f9f9
  			       "\\[pattern]", "\\\\bar", "/\\\\%\\$",
Karsten Hopp f5f9f9
! 			       "s/\\\\\\~", "s/\\\\U", "s/\\\\L",
Karsten Hopp f5f9f9
  			       "s/\\\\1", "s/\\\\2", "s/\\\\3", "s/\\\\9"};
Karsten Hopp f5f9f9
      int flags;
Karsten Hopp f5f9f9
  
Karsten Hopp f5f9f9
***************
Karsten Hopp f5f9f9
*** 6026,6032 ****
Karsten Hopp f5f9f9
  	  /* Replace:
Karsten Hopp f5f9f9
  	   * "[:...:]" with "\[:...:]"
Karsten Hopp f5f9f9
  	   * "[++...]" with "\[++...]"
Karsten Hopp f5f9f9
! 	   * "\{" with "\\{"               -- matching "} \}"
Karsten Hopp f5f9f9
  	   */
Karsten Hopp f5f9f9
  	    if ((arg[0] == '[' && (arg[1] == ':'
Karsten Hopp f5f9f9
  			 || (arg[1] == '+' && arg[2] == '+')))
Karsten Hopp f5f9f9
--- 6039,6045 ----
Karsten Hopp f5f9f9
  	  /* Replace:
Karsten Hopp f5f9f9
  	   * "[:...:]" with "\[:...:]"
Karsten Hopp f5f9f9
  	   * "[++...]" with "\[++...]"
Karsten Hopp f5f9f9
! 	   * "\{" with "\\{"		   -- matching "} \}"
Karsten Hopp f5f9f9
  	   */
Karsten Hopp f5f9f9
  	    if ((arg[0] == '[' && (arg[1] == ':'
Karsten Hopp f5f9f9
  			 || (arg[1] == '+' && arg[2] == '+')))
Karsten Hopp f5f9f9
*** ../vim-7.4.275/src/misc1.c	2014-04-05 19:44:36.903160723 +0200
Karsten Hopp f5f9f9
--- src/misc1.c	2014-05-07 15:04:25.921105231 +0200
Karsten Hopp f5f9f9
***************
Karsten Hopp f5f9f9
*** 1405,1411 ****
Karsten Hopp f5f9f9
  #ifdef FEAT_SMARTINDENT
Karsten Hopp f5f9f9
  	if (did_si)
Karsten Hopp f5f9f9
  	{
Karsten Hopp f5f9f9
! 	    int        sw = (int)get_sw_value(curbuf);
Karsten Hopp f5f9f9
  
Karsten Hopp f5f9f9
  	    if (p_sr)
Karsten Hopp f5f9f9
  		newindent -= newindent % sw;
Karsten Hopp f5f9f9
--- 1405,1411 ----
Karsten Hopp f5f9f9
  #ifdef FEAT_SMARTINDENT
Karsten Hopp f5f9f9
  	if (did_si)
Karsten Hopp f5f9f9
  	{
Karsten Hopp f5f9f9
! 	    int sw = (int)get_sw_value(curbuf);
Karsten Hopp f5f9f9
  
Karsten Hopp f5f9f9
  	    if (p_sr)
Karsten Hopp f5f9f9
  		newindent -= newindent % sw;
Karsten Hopp f5f9f9
***************
Karsten Hopp f5f9f9
*** 10896,10898 ****
Karsten Hopp f5f9f9
--- 10896,10936 ----
Karsten Hopp f5f9f9
  {
Karsten Hopp f5f9f9
      return (p_im && stuff_empty() && typebuf_typed());
Karsten Hopp f5f9f9
  }
Karsten Hopp f5f9f9
+ 
Karsten Hopp f5f9f9
+ /*
Karsten Hopp f5f9f9
+  * Returns the isolated name of the shell:
Karsten Hopp f5f9f9
+  * - Skip beyond any path.  E.g., "/usr/bin/csh -f" -> "csh -f".
Karsten Hopp f5f9f9
+  * - Remove any argument.  E.g., "csh -f" -> "csh".
Karsten Hopp f5f9f9
+  * But don't allow a space in the path, so that this works:
Karsten Hopp f5f9f9
+  *   "/usr/bin/csh --rcfile ~/.cshrc"
Karsten Hopp f5f9f9
+  * But don't do that for Windows, it's common to have a space in the path.
Karsten Hopp f5f9f9
+  */
Karsten Hopp f5f9f9
+     char_u *
Karsten Hopp f5f9f9
+ get_isolated_shell_name()
Karsten Hopp f5f9f9
+ {
Karsten Hopp f5f9f9
+     char_u *p;
Karsten Hopp f5f9f9
+ 
Karsten Hopp f5f9f9
+ #ifdef WIN3264
Karsten Hopp f5f9f9
+     p = gettail(p_sh);
Karsten Hopp f5f9f9
+     p = vim_strnsave(p, (int)(skiptowhite(p) - p));
Karsten Hopp f5f9f9
+ #else
Karsten Hopp f5f9f9
+     p = skiptowhite(p_sh);
Karsten Hopp f5f9f9
+     if (*p == NUL)
Karsten Hopp f5f9f9
+     {
Karsten Hopp f5f9f9
+ 	/* No white space, use the tail. */
Karsten Hopp f5f9f9
+ 	p = vim_strsave(gettail(p_sh));
Karsten Hopp f5f9f9
+     }
Karsten Hopp f5f9f9
+     else
Karsten Hopp f5f9f9
+     {
Karsten Hopp f5f9f9
+ 	char_u  *p1, *p2;
Karsten Hopp f5f9f9
+ 
Karsten Hopp f5f9f9
+ 	/* Find the last path separator before the space. */
Karsten Hopp f5f9f9
+ 	p1 = p_sh;
Karsten Hopp f5f9f9
+ 	for (p2 = p_sh; p2 < p; mb_ptr_adv(p2))
Karsten Hopp f5f9f9
+ 	    if (vim_ispathsep(*p2))
Karsten Hopp f5f9f9
+ 		p1 = p2 + 1;
Karsten Hopp f5f9f9
+ 	p = vim_strnsave(p1, (int)(p - p1));
Karsten Hopp f5f9f9
+     }
Karsten Hopp f5f9f9
+ #endif
Karsten Hopp f5f9f9
+     return p;
Karsten Hopp f5f9f9
+ }
Karsten Hopp f5f9f9
*** ../vim-7.4.275/src/option.c	2014-03-23 15:12:29.931264336 +0100
Karsten Hopp f5f9f9
--- src/option.c	2014-05-07 15:05:14.117105653 +0200
Karsten Hopp f5f9f9
***************
Karsten Hopp f5f9f9
*** 3804,3840 ****
Karsten Hopp f5f9f9
      else
Karsten Hopp f5f9f9
  	do_sp = !(options[idx_sp].flags & P_WAS_SET);
Karsten Hopp f5f9f9
  #endif
Karsten Hopp f5f9f9
! 
Karsten Hopp f5f9f9
!     /*
Karsten Hopp f5f9f9
!      * Isolate the name of the shell:
Karsten Hopp f5f9f9
!      * - Skip beyond any path.  E.g., "/usr/bin/csh -f" -> "csh -f".
Karsten Hopp f5f9f9
!      * - Remove any argument.  E.g., "csh -f" -> "csh".
Karsten Hopp f5f9f9
!      * But don't allow a space in the path, so that this works:
Karsten Hopp f5f9f9
!      *   "/usr/bin/csh --rcfile ~/.cshrc"
Karsten Hopp f5f9f9
!      * But don't do that for Windows, it's common to have a space in the path.
Karsten Hopp f5f9f9
!      */
Karsten Hopp f5f9f9
! #ifdef WIN3264
Karsten Hopp f5f9f9
!     p = gettail(p_sh);
Karsten Hopp f5f9f9
!     p = vim_strnsave(p, (int)(skiptowhite(p) - p));
Karsten Hopp f5f9f9
! #else
Karsten Hopp f5f9f9
!     p = skiptowhite(p_sh);
Karsten Hopp f5f9f9
!     if (*p == NUL)
Karsten Hopp f5f9f9
!     {
Karsten Hopp f5f9f9
! 	/* No white space, use the tail. */
Karsten Hopp f5f9f9
! 	p = vim_strsave(gettail(p_sh));
Karsten Hopp f5f9f9
!     }
Karsten Hopp f5f9f9
!     else
Karsten Hopp f5f9f9
!     {
Karsten Hopp f5f9f9
! 	char_u  *p1, *p2;
Karsten Hopp f5f9f9
! 
Karsten Hopp f5f9f9
! 	/* Find the last path separator before the space. */
Karsten Hopp f5f9f9
! 	p1 = p_sh;
Karsten Hopp f5f9f9
! 	for (p2 = p_sh; p2 < p; mb_ptr_adv(p2))
Karsten Hopp f5f9f9
! 	    if (vim_ispathsep(*p2))
Karsten Hopp f5f9f9
! 		p1 = p2 + 1;
Karsten Hopp f5f9f9
! 	p = vim_strnsave(p1, (int)(p - p1));
Karsten Hopp f5f9f9
!     }
Karsten Hopp f5f9f9
! #endif
Karsten Hopp f5f9f9
      if (p != NULL)
Karsten Hopp f5f9f9
      {
Karsten Hopp f5f9f9
  	/*
Karsten Hopp f5f9f9
--- 3804,3810 ----
Karsten Hopp f5f9f9
      else
Karsten Hopp f5f9f9
  	do_sp = !(options[idx_sp].flags & P_WAS_SET);
Karsten Hopp f5f9f9
  #endif
Karsten Hopp f5f9f9
!     p = get_isolated_shell_name();
Karsten Hopp f5f9f9
      if (p != NULL)
Karsten Hopp f5f9f9
      {
Karsten Hopp f5f9f9
  	/*
Karsten Hopp f5f9f9
***************
Karsten Hopp f5f9f9
*** 3875,3880 ****
Karsten Hopp f5f9f9
--- 3845,3851 ----
Karsten Hopp f5f9f9
  		    || fnamecmp(p, "zsh") == 0
Karsten Hopp f5f9f9
  		    || fnamecmp(p, "zsh-beta") == 0
Karsten Hopp f5f9f9
  		    || fnamecmp(p, "bash") == 0
Karsten Hopp f5f9f9
+ 		    || fnamecmp(p, "fish") == 0
Karsten Hopp f5f9f9
  #  ifdef WIN3264
Karsten Hopp f5f9f9
  		    || fnamecmp(p, "cmd") == 0
Karsten Hopp f5f9f9
  		    || fnamecmp(p, "sh.exe") == 0
Karsten Hopp f5f9f9
***************
Karsten Hopp f5f9f9
*** 8858,8865 ****
Karsten Hopp f5f9f9
   * opt_type). Uses
Karsten Hopp f5f9f9
   *
Karsten Hopp f5f9f9
   * Returned flags:
Karsten Hopp f5f9f9
!  *       0 hidden or unknown option, also option that does not have requested 
Karsten Hopp f5f9f9
!  *         type (see SREQ_* in vim.h)
Karsten Hopp f5f9f9
   *  see SOPT_* in vim.h for other flags
Karsten Hopp f5f9f9
   *
Karsten Hopp f5f9f9
   * Possible opt_type values: see SREQ_* in vim.h
Karsten Hopp f5f9f9
--- 8829,8836 ----
Karsten Hopp f5f9f9
   * opt_type). Uses
Karsten Hopp f5f9f9
   *
Karsten Hopp f5f9f9
   * Returned flags:
Karsten Hopp f5f9f9
!  *       0 hidden or unknown option, also option that does not have requested
Karsten Hopp f5f9f9
!  *	   type (see SREQ_* in vim.h)
Karsten Hopp f5f9f9
   *  see SOPT_* in vim.h for other flags
Karsten Hopp f5f9f9
   *
Karsten Hopp f5f9f9
   * Possible opt_type values: see SREQ_* in vim.h
Karsten Hopp f5f9f9
*** ../vim-7.4.275/src/proto/misc1.pro	2014-04-05 19:44:36.903160723 +0200
Karsten Hopp f5f9f9
--- src/proto/misc1.pro	2014-05-07 14:57:04.605101368 +0200
Karsten Hopp f5f9f9
***************
Karsten Hopp f5f9f9
*** 103,106 ****
Karsten Hopp f5f9f9
--- 103,107 ----
Karsten Hopp f5f9f9
  char_u *get_cmd_output __ARGS((char_u *cmd, char_u *infile, int flags, int *ret_len));
Karsten Hopp f5f9f9
  void FreeWild __ARGS((int count, char_u **files));
Karsten Hopp f5f9f9
  int goto_im __ARGS((void));
Karsten Hopp f5f9f9
+ char_u *get_isolated_shell_name __ARGS((void));
Karsten Hopp f5f9f9
  /* vim: set ft=c : */
Karsten Hopp f5f9f9
*** ../vim-7.4.275/src/version.c	2014-05-07 14:38:41.129091709 +0200
Karsten Hopp f5f9f9
--- src/version.c	2014-05-07 14:58:59.769102376 +0200
Karsten Hopp f5f9f9
***************
Karsten Hopp f5f9f9
*** 736,737 ****
Karsten Hopp f5f9f9
--- 736,739 ----
Karsten Hopp f5f9f9
  {   /* Add new patch number below this line */
Karsten Hopp f5f9f9
+ /**/
Karsten Hopp f5f9f9
+     276,
Karsten Hopp f5f9f9
  /**/
Karsten Hopp f5f9f9
Karsten Hopp f5f9f9
-- 
Karsten Hopp f5f9f9
Support your right to bare arms!  Wear short sleeves!
Karsten Hopp f5f9f9
Karsten Hopp f5f9f9
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp f5f9f9
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp f5f9f9
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp f5f9f9
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///