3ef2ca
To: vim_dev@googlegroups.com
3ef2ca
Subject: Patch 7.4.213
3ef2ca
Fcc: outbox
3ef2ca
From: Bram Moolenaar <Bram@moolenaar.net>
3ef2ca
Mime-Version: 1.0
3ef2ca
Content-Type: text/plain; charset=UTF-8
3ef2ca
Content-Transfer-Encoding: 8bit
3ef2ca
------------
3ef2ca
3ef2ca
Patch 7.4.213
3ef2ca
Problem:    It's not possible to open a new buffer without creating a swap
3ef2ca
	    file.
3ef2ca
Solution:   Add the ":noswapfile" modifier. (Christian Brabandt)
3ef2ca
Files:	    runtime/doc/recover.txt, src/ex_cmds.h, src/ex_docmd.c,
3ef2ca
	    src/memline.c, src/structs.h
3ef2ca
3ef2ca
3ef2ca
*** ../vim-7.4.212/runtime/doc/recover.txt	2013-08-10 13:25:00.000000000 +0200
3ef2ca
--- runtime/doc/recover.txt	2014-03-23 16:01:59.655309841 +0100
3ef2ca
***************
3ef2ca
*** 81,87 ****
3ef2ca
  'maxmemtot'.  And when making a change to a read-only file, the swap file is
3ef2ca
  created anyway.
3ef2ca
  
3ef2ca
! The 'swapfile' option can be reset to avoid creating a swapfile.
3ef2ca
  
3ef2ca
  
3ef2ca
  Detecting an existing swap file ~
3ef2ca
--- 81,94 ----
3ef2ca
  'maxmemtot'.  And when making a change to a read-only file, the swap file is
3ef2ca
  created anyway.
3ef2ca
  
3ef2ca
! The 'swapfile' option can be reset to avoid creating a swapfile.  And the
3ef2ca
! |:noswapfile| modifier can be used to not create a swapfile for a new buffer.
3ef2ca
! 
3ef2ca
! :noswap[file]   {command}			*:noswap* *:noswapfile*
3ef2ca
! 		Execute {command}. If it contains a command that loads a new
3ef2ca
! 		buffer, it will be loaded without creating a swapfile and the
3ef2ca
! 		'swapfile' option will be reset.  If a buffer already had a
3ef2ca
! 		swapfile it is not removed and 'swapfile' is not reset.
3ef2ca
  
3ef2ca
  
3ef2ca
  Detecting an existing swap file ~
3ef2ca
*** ../vim-7.4.212/src/ex_cmds.h	2014-03-22 13:29:57.693846167 +0100
3ef2ca
--- src/ex_cmds.h	2014-03-23 15:36:42.399286592 +0100
3ef2ca
***************
3ef2ca
*** 655,660 ****
3ef2ca
--- 655,662 ----
3ef2ca
  			EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
3ef2ca
  EX(CMD_noremenu,	"noremenu",	ex_menu,
3ef2ca
  			RANGE|NOTADR|ZEROR|BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
3ef2ca
+ EX(CMD_noswapfile,	"noswapfile",	ex_wrongmodifier,
3ef2ca
+ 			NEEDARG|EXTRA|NOTRLCOM),
3ef2ca
  EX(CMD_normal,		"normal",	ex_normal,
3ef2ca
  			RANGE|BANG|EXTRA|NEEDARG|NOTRLCOM|USECTRLV|SBOXOK|CMDWIN),
3ef2ca
  EX(CMD_number,		"number",	ex_print,
3ef2ca
*** ../vim-7.4.212/src/ex_docmd.c	2014-03-23 15:12:29.919264336 +0100
3ef2ca
--- src/ex_docmd.c	2014-03-23 15:44:42.335293946 +0100
3ef2ca
***************
3ef2ca
*** 1874,1891 ****
3ef2ca
  #endif
3ef2ca
  			continue;
3ef2ca
  
3ef2ca
! 	    case 'n':	if (!checkforcmd(&ea.cmd, "noautocmd", 3))
3ef2ca
! 			    break;
3ef2ca
! #ifdef FEAT_AUTOCMD
3ef2ca
! 			if (cmdmod.save_ei == NULL)
3ef2ca
  			{
3ef2ca
! 			    /* Set 'eventignore' to "all". Restore the
3ef2ca
! 			     * existing option value later. */
3ef2ca
! 			    cmdmod.save_ei = vim_strsave(p_ei);
3ef2ca
! 			    set_string_option_direct((char_u *)"ei", -1,
3ef2ca
  					 (char_u *)"all", OPT_FREE, SID_NONE);
3ef2ca
! 			}
3ef2ca
  #endif
3ef2ca
  			continue;
3ef2ca
  
3ef2ca
  	    case 'r':	if (!checkforcmd(&ea.cmd, "rightbelow", 6))
3ef2ca
--- 1874,1896 ----
3ef2ca
  #endif
3ef2ca
  			continue;
3ef2ca
  
3ef2ca
! 	    case 'n':	if (checkforcmd(&ea.cmd, "noautocmd", 3))
3ef2ca
  			{
3ef2ca
! #ifdef FEAT_AUTOCMD
3ef2ca
! 			    if (cmdmod.save_ei == NULL)
3ef2ca
! 			    {
3ef2ca
! 				/* Set 'eventignore' to "all". Restore the
3ef2ca
! 				 * existing option value later. */
3ef2ca
! 				cmdmod.save_ei = vim_strsave(p_ei);
3ef2ca
! 				set_string_option_direct((char_u *)"ei", -1,
3ef2ca
  					 (char_u *)"all", OPT_FREE, SID_NONE);
3ef2ca
! 			    }
3ef2ca
  #endif
3ef2ca
+ 			    continue;
3ef2ca
+ 			}
3ef2ca
+ 			if (!checkforcmd(&ea.cmd, "noswapfile", 6))
3ef2ca
+ 			    break;
3ef2ca
+ 			cmdmod.noswapfile = TRUE;
3ef2ca
  			continue;
3ef2ca
  
3ef2ca
  	    case 'r':	if (!checkforcmd(&ea.cmd, "rightbelow", 6))
3ef2ca
***************
3ef2ca
*** 2596,2601 ****
3ef2ca
--- 2601,2608 ----
3ef2ca
  	    case CMD_lua:
3ef2ca
  	    case CMD_match:
3ef2ca
  	    case CMD_mzscheme:
3ef2ca
+ 	    case CMD_noautocmd:
3ef2ca
+ 	    case CMD_noswapfile:
3ef2ca
  	    case CMD_perl:
3ef2ca
  	    case CMD_psearch:
3ef2ca
  	    case CMD_python:
3ef2ca
***************
3ef2ca
*** 3099,3104 ****
3ef2ca
--- 3106,3112 ----
3ef2ca
      {"leftabove", 5, FALSE},
3ef2ca
      {"lockmarks", 3, FALSE},
3ef2ca
      {"noautocmd", 3, FALSE},
3ef2ca
+     {"noswapfile", 3, FALSE},
3ef2ca
      {"rightbelow", 6, FALSE},
3ef2ca
      {"sandbox", 3, FALSE},
3ef2ca
      {"silent", 3, FALSE},
3ef2ca
***************
3ef2ca
*** 3611,3616 ****
3ef2ca
--- 3619,3626 ----
3ef2ca
  	case CMD_keeppatterns:
3ef2ca
  	case CMD_leftabove:
3ef2ca
  	case CMD_lockmarks:
3ef2ca
+ 	case CMD_noautocmd:
3ef2ca
+ 	case CMD_noswapfile:
3ef2ca
  	case CMD_rightbelow:
3ef2ca
  	case CMD_sandbox:
3ef2ca
  	case CMD_silent:
3ef2ca
*** ../vim-7.4.212/src/memline.c	2014-02-11 15:23:27.942123631 +0100
3ef2ca
--- src/memline.c	2014-03-23 15:48:05.679297062 +0100
3ef2ca
***************
3ef2ca
*** 289,294 ****
3ef2ca
--- 289,297 ----
3ef2ca
      buf->b_ml.ml_chunksize = NULL;
3ef2ca
  #endif
3ef2ca
  
3ef2ca
+     if (cmdmod.noswapfile)
3ef2ca
+ 	buf->b_p_swf = FALSE;
3ef2ca
+ 
3ef2ca
      /*
3ef2ca
       * When 'updatecount' is non-zero swap file may be opened later.
3ef2ca
       */
3ef2ca
***************
3ef2ca
*** 606,612 ****
3ef2ca
  	 * When 'updatecount' is 0 and 'noswapfile' there is no swap file.
3ef2ca
  	 * For help files we will make a swap file now.
3ef2ca
  	 */
3ef2ca
! 	if (p_uc != 0)
3ef2ca
  	    ml_open_file(buf);	    /* create a swap file */
3ef2ca
  	return;
3ef2ca
      }
3ef2ca
--- 609,615 ----
3ef2ca
  	 * When 'updatecount' is 0 and 'noswapfile' there is no swap file.
3ef2ca
  	 * For help files we will make a swap file now.
3ef2ca
  	 */
3ef2ca
! 	if (p_uc != 0 && !cmdmod.noswapfile)
3ef2ca
  	    ml_open_file(buf);	    /* create a swap file */
3ef2ca
  	return;
3ef2ca
      }
3ef2ca
***************
3ef2ca
*** 719,725 ****
3ef2ca
      char_u	*dirp;
3ef2ca
  
3ef2ca
      mfp = buf->b_ml.ml_mfp;
3ef2ca
!     if (mfp == NULL || mfp->mf_fd >= 0 || !buf->b_p_swf)
3ef2ca
  	return;		/* nothing to do */
3ef2ca
  
3ef2ca
  #ifdef FEAT_SPELL
3ef2ca
--- 722,728 ----
3ef2ca
      char_u	*dirp;
3ef2ca
  
3ef2ca
      mfp = buf->b_ml.ml_mfp;
3ef2ca
!     if (mfp == NULL || mfp->mf_fd >= 0 || !buf->b_p_swf || cmdmod.noswapfile)
3ef2ca
  	return;		/* nothing to do */
3ef2ca
  
3ef2ca
  #ifdef FEAT_SPELL
3ef2ca
*** ../vim-7.4.212/src/structs.h	2014-03-23 15:12:29.943264337 +0100
3ef2ca
--- src/structs.h	2014-03-23 15:36:42.407286592 +0100
3ef2ca
***************
3ef2ca
*** 545,550 ****
3ef2ca
--- 545,551 ----
3ef2ca
      int		keepjumps;		/* TRUE when ":keepjumps" was used */
3ef2ca
      int		lockmarks;		/* TRUE when ":lockmarks" was used */
3ef2ca
      int		keeppatterns;		/* TRUE when ":keeppatterns" was used */
3ef2ca
+     int		noswapfile;		/* TRUE when ":noswapfile" was used */
3ef2ca
  # ifdef FEAT_AUTOCMD
3ef2ca
      char_u	*save_ei;		/* saved value of 'eventignore' */
3ef2ca
  # endif
3ef2ca
*** ../vim-7.4.212/src/version.c	2014-03-23 15:12:29.943264337 +0100
3ef2ca
--- src/version.c	2014-03-23 16:02:16.519310100 +0100
3ef2ca
***************
3ef2ca
*** 736,737 ****
3ef2ca
--- 736,739 ----
3ef2ca
  {   /* Add new patch number below this line */
3ef2ca
+ /**/
3ef2ca
+     213,
3ef2ca
  /**/
3ef2ca
3ef2ca
-- 
3ef2ca
Looking at Perl through Lisp glasses, Perl looks atrocious.
3ef2ca
3ef2ca
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
3ef2ca
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
3ef2ca
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
3ef2ca
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///