Bram,
I use an uppercase mark to access a blowfish encrypted file. I therefore 
:bwipe that buffer when I'm done with this file. Unfortunately, I can't 
use the uppercase mark again, to reload that file, Vim throws E92 error.

Attached patch fixes it and includes a test.

Best,
Christian

-- 
-- 
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/groups/opt_out.
diff --git a/src/buffer.c b/src/buffer.c
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -631,6 +631,8 @@
 #ifdef FEAT_TCL
     tcl_buffer_free(buf);
 #endif
+    if (flags & BFA_WIPE)
+	save_mark_filename_for_bufnr(buf);
     ml_close(buf, TRUE);	    /* close and delete the memline/memfile */
     buf->b_ml.ml_line_count = 0;    /* no lines in buffer */
     if ((flags & BFA_KEEP_UNDO) == 0)
diff --git a/src/mark.c b/src/mark.c
--- a/src/mark.c
+++ b/src/mark.c
@@ -520,6 +520,24 @@
     return result;
 }
 
+/* when wiping, store the buffer name back in the marks,
+ * so that those can be obtained again */
+    void
+save_mark_filename_for_bufnr(buf)
+    buf_T	*buf;
+{
+    int i;
+
+    for (i = 0; i < NMARKS + EXTRA_MARKS; ++i)
+    {
+	if (namedfm[i].fmark.fnum == buf->b_fnum)
+	{
+	    namedfm[i].fname = home_replace_save(NULL, buf->b_ffname);
+	    namedfm[i].fmark.fnum = 0;
+	}
+    }
+}
+
 /*
  * For an xtended filemark: set the fnum from the fname.
  * This is used for marks obtained from the .viminfo file.  It's postponed
diff --git a/src/proto/mark.pro b/src/proto/mark.pro
--- a/src/proto/mark.pro
+++ b/src/proto/mark.pro
@@ -9,6 +9,7 @@
 pos_T *getmark __ARGS((int c, int changefile));
 pos_T *getmark_buf_fnum __ARGS((buf_T *buf, int c, int changefile, int *fnum));
 pos_T *getnextmark __ARGS((pos_T *startpos, int dir, int begin_line));
+void save_mark_filename_for_bufnr __ARGS((buf_T *buf));
 void fmarks_check_names __ARGS((buf_T *buf));
 int check_mark __ARGS((pos_T *pos));
 void clrallmarks __ARGS((buf_T *buf));
diff --git a/src/testdir/test5.in b/src/testdir/test5.in
--- a/src/testdir/test5.in
+++ b/src/testdir/test5.in
@@ -1,5 +1,6 @@
 Test for autocommand that deletes the current buffer on BufLeave event.
 Also test deleting the last buffer, should give a new, empty buffer.
+Also test, that accessing marks after :bw still works
 
 STARTTEST
 :so small.vim
@@ -17,6 +18,14 @@
 :bwipe!                         " delete current buffer, get an empty one
 ithis is another test line:w >>test.out
 :                               " append an extra line to the output file
+:sp test17a.in
+:kA
+:bw
+:try
+norm! 'A
+:catch /^Vim\%((\a\+)\)\=:E92/
+:!echo "Caught E92 when trying to access mark A" >> test.out
+endtry
 :qa!
 ENDTEST
 

Raspunde prin e-mail lui