diff --git a/runtime/doc/index.txt b/runtime/doc/index.txt
index a973c598e99cc8001d554535b5cdb9787b00de77..5484ebc2ab8dbb50b133c6ef36af0186b14c68ba 100644
--- a/runtime/doc/index.txt
+++ b/runtime/doc/index.txt
@@ -1,4 +1,4 @@
-*index.txt*     For Vim version 7.0aa.  Last change: 2004 Dec 29
+*index.txt*     For Vim version 7.0aa.  Last change: 2005 Jan 31
 
 
 		  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -1211,6 +1211,7 @@ The commands are sorted on the non-optional part of their name.
 |:loadkeymap|	:loadk[eymap]	load the following keymaps until EOF
 |:loadview|	:lo[adview]	load view for current window from a file
 |:lockmarks|	:loc[kmarks]	following command keeps marks where they are
+|:lockvar|	:lockv[ar]	lock variables
 |:ls|		:ls		list all buffers
 |:lunmap|	:lu[nmap]	like ":unmap!" but includes Lang-Arg mode
 |:move|		:m[ove]		move lines
@@ -1395,6 +1396,7 @@ The commands are sorted on the non-optional part of their name.
 |:unhide|	:unh[ide]	open a window for each loaded file in the
 				buffer list
 |:unlet|	:unl[et]	delete variable
+|:unlockvar|	:unlo[ckvar]	unlock variables
 |:unmap|	:unm[ap]	remove mapping
 |:unmenu|	:unme[nu]	remove menu
 |:update|	:up[date]	write buffer if modified
diff --git a/src/netbeans.c b/src/netbeans.c
index 1611a8fa0ce17b02bbff96748a2a17afcdd085d0..ed75470c575e4e6d560ab4f5196f67c8cbea8c30 100644
--- a/src/netbeans.c
+++ b/src/netbeans.c
@@ -1676,20 +1676,20 @@ nb_do_cmd(
 		return FAIL;
 	    }
 	    buf->fireChanges = 0;
-	    if (buf->bufp != NULL)
+	    if (buf->bufp != NULL && buf->bufp->b_was_netbeans_file)
 	    {
-		if (buf->bufp->b_was_netbeans_file
-				&& !buf->bufp->b_netbeans_file)
+		if (!buf->bufp->b_netbeans_file)
 		    EMSGN(_("E658: NetBeans connection lost for buffer %ld"),
 							   buf->bufp->b_fnum);
-#if 0		/* This breaks Agide. */
 		else
 		{
-		    do_bufdel(DOBUF_DEL, (char_u *)"", 1, buf->bufp->b_fnum,
-				buf->bufp->b_fnum, TRUE);
+		    /* NetBeans uses stopDocumentListen when it stops editing
+		     * a file.  It then expects the buffer in Vim to
+		     * disappear. */
+		    do_bufdel(DOBUF_DEL, (char_u *)"", 1,
+				  buf->bufp->b_fnum, buf->bufp->b_fnum, TRUE);
 		    vim_memset(buf, 0, sizeof(nbbuf_T));
 		}
-#endif
 	    }
 /* =====================================================================*/
 	}