073263
To: vim_dev@googlegroups.com
073263
Subject: Patch 7.4.605
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.605
073263
Problem:    The # register is not writable, it cannot be restored after
073263
	    jumping around.
073263
Solution:   Make the # register writable. (Marcin Szamotulski)
073263
Files:	    runtime/doc/change.txt, src/ops.c, src/buffer.c, src/globals.h
073263
073263
073263
*** ../vim-7.4.604/runtime/doc/change.txt	2014-03-25 18:23:27.046087691 +0100
073263
--- runtime/doc/change.txt	2015-01-27 18:41:27.840005417 +0100
073263
***************
073263
*** 1100,1110 ****
073263
  2. 10 numbered registers "0 to "9
073263
  3. The small delete register "-
073263
  4. 26 named registers "a to "z or "A to "Z
073263
! 5. four read-only registers ":, "., "% and "#
073263
! 6. the expression register "=
073263
! 7. The selection and drop registers "*, "+ and "~ 
073263
! 8. The black hole register "_
073263
! 9. Last search pattern register "/
073263
  
073263
  1. Unnamed register ""				*quote_quote* *quotequote*
073263
  Vim fills this register with text deleted with the "d", "c", "s", "x" commands
073263
--- 1103,1114 ----
073263
  2. 10 numbered registers "0 to "9
073263
  3. The small delete register "-
073263
  4. 26 named registers "a to "z or "A to "Z
073263
! 5. three read-only registers ":, "., "%
073263
! 7. alternate buffer register "#
073263
! 7. the expression register "=
073263
! 8. The selection and drop registers "*, "+ and "~ 
073263
! 9. The black hole register "_
073263
! 10. Last search pattern register "/
073263
  
073263
  1. Unnamed register ""				*quote_quote* *quotequote*
073263
  Vim fills this register with text deleted with the "d", "c", "s", "x" commands
073263
***************
073263
*** 1131,1136 ****
073263
--- 1135,1142 ----
073263
  made for the delete operator with these movement commands: |%|, |(|, |)|, |`|,
073263
  |/|, |?|, |n|, |N|, |{| and |}|.  Register "1 is always used then (this is Vi
073263
  compatible).  The "- register is used as well if the delete is within a line.
073263
+ Note that these characters may be mapped.  E.g. |%| is mapped by the matchit
073263
+ plugin.
073263
     With each successive deletion or change, Vim shifts the previous contents
073263
  of register 1 into register 2, 2 into 3, and so forth, losing the previous
073263
  contents of register 9.
073263
***************
073263
*** 1148,1154 ****
073263
  to their previous contents.  When the '>' flag is present in 'cpoptions' then
073263
  a line break is inserted before the appended text.
073263
  
073263
! 5. Read-only registers ":, "., "% and "#
073263
  These are '%', '#', ':' and '.'.  You can use them only with the "p", "P",
073263
  and ":put" commands and with CTRL-R.  {not in Vi}
073263
  						*quote_.* *quote.* *E29*
073263
--- 1154,1160 ----
073263
  to their previous contents.  When the '>' flag is present in 'cpoptions' then
073263
  a line break is inserted before the appended text.
073263
  
073263
! 5. Read-only registers ":, ". and "%
073263
  These are '%', '#', ':' and '.'.  You can use them only with the "p", "P",
073263
  and ":put" commands and with CTRL-R.  {not in Vi}
073263
  						*quote_.* *quote.* *E29*
073263
***************
073263
*** 1159,1166 ****
073263
  		('textwidth' and other options affect what is inserted).
073263
  							*quote_%* *quote%*
073263
  	"%	Contains the name of the current file.
073263
- 							*quote_#* *quote#*
073263
- 	"#	Contains the name of the alternate file.
073263
  						*quote_:* *quote:* *E30*
073263
  	":	Contains the most recent executed command-line.  Example: Use
073263
  		"@:" to repeat the previous command-line command.
073263
--- 1165,1170 ----
073263
***************
073263
*** 1169,1176 ****
073263
  		the command was completely from a mapping.
073263
  		{not available when compiled without the |+cmdline_hist|
073263
  		feature}
073263
  
073263
! 6. Expression register "=			*quote_=* *quote=* *@=*
073263
  This is not really a register that stores text, but is a way to use an
073263
  expression in commands which use a register.  The expression register is
073263
  read-only; you cannot put text into it.  After the '=', the cursor moves to
073263
--- 1173,1195 ----
073263
  		the command was completely from a mapping.
073263
  		{not available when compiled without the |+cmdline_hist|
073263
  		feature}
073263
+ 							*quote_#* *quote#*
073263
+ 6. Alternate file register "#
073263
+ Contains the name of the alternate file for the current window.  It will
073263
+ change how the |CTRL-^| command works.
073263
+ This register is writable, mainly to allow for restoring it after a plugin has
073263
+ changed it.  It accepts buffer number: >
073263
+     let altbuf = bufnr(@#)
073263
+     ...
073263
+     let @# = altbuf
073263
+ It will give error |E86| if you pass buffer number and this buffer does not
073263
+ exist.
073263
+ It can also accept a match with an existing buffer name: >
073263
+     let @# = 'buffer_name'
073263
+ Error |E93| if there is more than one buffer matching the given name or |E94|
073263
+ if none of buffers matches the given name.
073263
  
073263
! 7. Expression register "=			*quote_=* *quote=* *@=*
073263
  This is not really a register that stores text, but is a way to use an
073263
  expression in commands which use a register.  The expression register is
073263
  read-only; you cannot put text into it.  After the '=', the cursor moves to
073263
***************
073263
*** 1191,1197 ****
073263
  characters.  If the String ends in a <NL>, it is regarded as a linewise
073263
  register.  {not in Vi}
073263
  
073263
! 7. Selection and drop registers "*, "+ and "~ 
073263
  Use these registers for storing and retrieving the selected text for the GUI.
073263
  See |quotestar| and |quoteplus|.  When the clipboard is not available or not
073263
  working, the unnamed register is used instead.  For Unix systems the clipboard
073263
--- 1210,1216 ----
073263
  characters.  If the String ends in a <NL>, it is regarded as a linewise
073263
  register.  {not in Vi}
073263
  
073263
! 8. Selection and drop registers "*, "+ and "~ 
073263
  Use these registers for storing and retrieving the selected text for the GUI.
073263
  See |quotestar| and |quoteplus|.  When the clipboard is not available or not
073263
  working, the unnamed register is used instead.  For Unix systems the clipboard
073263
***************
073263
*** 1213,1224 ****
073263
  Note: The "~ register is only used when dropping plain text onto Vim.
073263
  Drag'n'drop of URI lists is handled internally.
073263
  
073263
! 8. Black hole register "_				*quote_*
073263
  When writing to this register, nothing happens.  This can be used to delete
073263
  text without affecting the normal registers.  When reading from this register,
073263
  nothing is returned.  {not in Vi}
073263
  
073263
! 9. Last search pattern register	"/			*quote_/* *quote/*
073263
  Contains the most recent search-pattern.  This is used for "n" and 'hlsearch'.
073263
  It is writable with `:let`, you can change it to have 'hlsearch' highlight
073263
  other matches without actually searching.  You can't yank or delete into this
073263
--- 1232,1243 ----
073263
  Note: The "~ register is only used when dropping plain text onto Vim.
073263
  Drag'n'drop of URI lists is handled internally.
073263
  
073263
! 9. Black hole register "_				*quote_*
073263
  When writing to this register, nothing happens.  This can be used to delete
073263
  text without affecting the normal registers.  When reading from this register,
073263
  nothing is returned.  {not in Vi}
073263
  
073263
! 10. Last search pattern register	"/			*quote_/* *quote/*
073263
  Contains the most recent search-pattern.  This is used for "n" and 'hlsearch'.
073263
  It is writable with `:let`, you can change it to have 'hlsearch' highlight
073263
  other matches without actually searching.  You can't yank or delete into this
073263
*** ../vim-7.4.604/src/ops.c	2015-01-27 13:22:17.176885347 +0100
073263
--- src/ops.c	2015-01-27 18:33:06.813476985 +0100
073263
***************
073263
*** 856,866 ****
073263
      if (       (regname > 0 && ASCII_ISALNUM(regname))
073263
  	    || (!writing && vim_strchr((char_u *)
073263
  #ifdef FEAT_EVAL
073263
! 				    "/.%#:="
073263
  #else
073263
! 				    "/.%#:"
073263
  #endif
073263
  					, regname) != NULL)
073263
  	    || regname == '"'
073263
  	    || regname == '-'
073263
  	    || regname == '_'
073263
--- 856,867 ----
073263
      if (       (regname > 0 && ASCII_ISALNUM(regname))
073263
  	    || (!writing && vim_strchr((char_u *)
073263
  #ifdef FEAT_EVAL
073263
! 				    "/.%:="
073263
  #else
073263
! 				    "/.%:"
073263
  #endif
073263
  					, regname) != NULL)
073263
+ 	    || regname == '#'
073263
  	    || regname == '"'
073263
  	    || regname == '-'
073263
  	    || regname == '_'
073263
***************
073263
*** 6514,6519 ****
073263
--- 6515,6541 ----
073263
  	return;
073263
      }
073263
  
073263
+     if (name == '#')
073263
+     {
073263
+ 	buf_T	*buf;
073263
+ 
073263
+ 	if (VIM_ISDIGIT(*str))
073263
+ 	{
073263
+ 	    int	num = atoi((char *)str);
073263
+ 
073263
+ 	    buf = buflist_findnr(num);
073263
+ 	    if (buf == NULL)
073263
+ 		EMSGN(_(e_nobufnr), (long)num);
073263
+ 	}
073263
+ 	else
073263
+ 	    buf = buflist_findnr(buflist_findpat(str, str + STRLEN(str),
073263
+ 							 TRUE, FALSE, FALSE));
073263
+ 	if (buf == NULL)
073263
+ 	    return;
073263
+ 	curwin->w_alt_fnum = buf->b_fnum;
073263
+ 	return;
073263
+     }
073263
+ 
073263
  #ifdef FEAT_EVAL
073263
      if (name == '=')
073263
      {
073263
*** ../vim-7.4.604/src/buffer.c	2015-01-07 13:31:48.886661739 +0100
073263
--- src/buffer.c	2015-01-27 18:19:29.334392632 +0100
073263
***************
073263
*** 1150,1156 ****
073263
  	{
073263
  	    /* don't warn when deleting */
073263
  	    if (!unload)
073263
! 		EMSGN(_("E86: Buffer %ld does not exist"), count);
073263
  	}
073263
  	else if (dir == FORWARD)
073263
  	    EMSG(_("E87: Cannot go beyond last buffer"));
073263
--- 1150,1156 ----
073263
  	{
073263
  	    /* don't warn when deleting */
073263
  	    if (!unload)
073263
! 		EMSGN(_(e_nobufnr), count);
073263
  	}
073263
  	else if (dir == FORWARD)
073263
  	    EMSG(_("E87: Cannot go beyond last buffer"));
073263
*** ../vim-7.4.604/src/globals.h	2015-01-14 12:44:38.407422077 +0100
073263
--- src/globals.h	2015-01-27 18:19:24.294447531 +0100
073263
***************
073263
*** 1571,1576 ****
073263
--- 1571,1577 ----
073263
  EXTERN char_u e_intern2[]	INIT(= N_("E685: Internal error: %s"));
073263
  EXTERN char_u e_maxmempat[]	INIT(= N_("E363: pattern uses more memory than 'maxmempattern'"));
073263
  EXTERN char_u e_emptybuf[]	INIT(= N_("E749: empty buffer"));
073263
+ EXTERN char_u e_nobufnr[]	INIT(= N_("E86: Buffer %ld does not exist"));
073263
  
073263
  #ifdef FEAT_EX_EXTRA
073263
  EXTERN char_u e_invalpat[]	INIT(= N_("E682: Invalid search pattern or delimiter"));
073263
*** ../vim-7.4.604/src/version.c	2015-01-27 17:11:55.690558815 +0100
073263
--- src/version.c	2015-01-27 17:15:24.132287083 +0100
073263
***************
073263
*** 743,744 ****
073263
--- 743,746 ----
073263
  {   /* Add new patch number below this line */
073263
+ /**/
073263
+     605,
073263
  /**/
073263
073263
-- 
073263
All true wisdom is found on T-shirts.
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    ///