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