Patch 7.4.605
Problem:    The # register is not writable, it cannot be restored after
            jumping around.
Solution:   Make the # register writable. (Marcin Szamotulski)
Files:      runtime/doc/change.txt, src/ops.c, src/buffer.c, src/globals.h


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

-- 
All true wisdom is found on T-shirts.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui