lkundrak / rpms / vim

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