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