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