updated for version 7.0182
diff --git a/src/edit.c b/src/edit.c
index 298ebc3..ab3558a 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -289,6 +289,13 @@
 	return FALSE;
     }
 #endif
+    /* Don't allow changes in the buffer while editing the cmdline.  The
+     * caller of getcmdline() may get confused. */
+    if (cmdline_busy)
+    {
+	EMSG(_(e_secure));
+	return FALSE;
+    }
 
 #ifdef FEAT_INS_EXPAND
     ins_compl_clear();	    /* clear stuff for CTRL-X mode */
diff --git a/src/ex_cmds.c b/src/ex_cmds.c
index c4fd0c4..e192d10 100644
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -2841,11 +2841,11 @@
 }
 
 /*
- * try to abandon current file and edit a new or existing file
- * 'fnum' is the number of the file, if zero use ffname/sfname
+ * Try to abandon current file and edit a new or existing file.
+ * 'fnum' is the number of the file, if zero use ffname/sfname.
  *
- * return 1 for "normal" error, 2 for "not written" error, 0 for success
- * -1 for succesfully opening another file
+ * Return 1 for "normal" error, 2 for "not written" error, 0 for success
+ * -1 for succesfully opening another file.
  * 'lnum' is the line number for the cursor in the new file (if non-zero).
  */
     int
@@ -2861,10 +2861,8 @@
     int		retval;
     char_u	*free_me = NULL;
 
-#ifdef FEAT_CMDWIN
-    if (cmdwin_type != 0)
+    if (editing_cmdline())
 	return 1;
-#endif
 
     if (fnum == 0)
     {
diff --git a/src/ex_getln.c b/src/ex_getln.c
index 9510953..b1142c4 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -258,6 +258,9 @@
     }
     xpc.xp_context = EXPAND_NOTHING;
     xpc.xp_backslash = XP_BS_NONE;
+#ifndef BACKSLASH_IN_FILENAME
+    xpc.xp_shell = FALSE;
+#endif
 
 #if defined(FEAT_EVAL)
     if (ccline.input_fn)
@@ -658,17 +661,13 @@
 		restore_cmdline(&save_ccline);
 		if (c == '=')
 		{
-		    /* Need to save and restore ccline.  And go into the
-		     * sandbox to avoid nasty things like going to another
-		     * buffer when evaluating an expression. */
+		    /* Need to save and restore ccline.  And set cmdline_busy
+		     * to avoid nasty things like going to another buffer when
+		     * evaluating an expression. */
 		    save_cmdline(&save_ccline);
-#ifdef HAVE_SANDBOX
-		    ++sandbox;
-#endif
+		    ++cmdline_busy;
 		    p = get_expr_line();
-#ifdef HAVE_SANDBOX
-		    --sandbox;
-#endif
+		    --cmdline_busy;
 		    restore_cmdline(&save_ccline);
 
 		    if (p != NULL && realloc_cmdbuff((int)STRLEN(p) + 1) == OK)
@@ -1875,6 +1874,35 @@
 }
 #endif
 
+/*
+ * Return TRUE when the command line is being edited.  That means the current
+ * buffer and window can't be changed.
+ */
+    int
+editing_cmdline()
+{
+#ifdef FEAT_CMDWIN
+    if (cmdwin_type != 0)
+	return TRUE;
+#endif
+    return cmdline_busy;
+}
+
+/*
+ * Give an error message for a command that isn't allowed while the cmdline
+ * window is open or editing the cmdline in another way.
+ */
+    void
+editing_cmdline_msg()
+{
+#ifdef FEAT_CMDWIN
+    if (cmdwin_type != 0)
+	EMSG(_(e_cmdwin));
+    else
+#endif
+	EMSG(_(e_secure));
+}
+
     static int
 cmdline_charsize(idx)
     int		idx;
@@ -2786,17 +2814,12 @@
     regname = may_get_selection(regname);
 #endif
 
-    /* Need to save and restore ccline.  And go into the sandbox to avoid
-     * nasty things like going to another buffer when evaluating an
-     * expression. */
+    /* Need to save and restore ccline.  And set cmdline_busy to avoid nasty
+     * things like going to another buffer when evaluating an expression. */
     save_cmdline(&save_ccline);
-#ifdef HAVE_SANDBOX
-    ++sandbox;
-#endif
+    ++cmdline_busy;
     i = get_spec_reg(regname, &arg, &allocated, TRUE);
-#ifdef HAVE_SANDBOX
-    --sandbox;
-#endif
+    --cmdline_busy;
     restore_cmdline(&save_ccline);
 
     if (i)
@@ -3368,8 +3391,14 @@
     expand_T	*xp;
 {
     xp->xp_backslash = XP_BS_NONE;
+#ifndef BACKSLASH_IN_FILENAME
+    xp->xp_shell = FALSE;
+#endif
     xp->xp_numfiles = -1;
     xp->xp_files = NULL;
+#if defined(FEAT_USR_CMDS) && defined(FEAT_EVAL) && defined(FEAT_CMDL_COMPL)
+    xp->xp_arg = NULL;
+#endif
 }
 
 /*
@@ -3446,7 +3475,8 @@
 		    p = vim_strsave_escaped(files[i], buf);
 		}
 #else
-		p = vim_strsave_escaped(files[i], PATH_ESC_CHARS);
+		p = vim_strsave_escaped(files[i],
+			     xp->xp_shell ? SHELL_ESC_CHARS : PATH_ESC_CHARS);
 #endif
 		if (p != NULL)
 		{
@@ -4527,8 +4557,9 @@
     if (buf == NULL)
 	return NULL;
 
+    ExpandInit(&xpc);
     xpc.xp_context = EXPAND_FILES;
-    xpc.xp_backslash = XP_BS_NONE;
+
     ga_init2(&ga, 1, 100);
 
     /* Loop over all entries in {path}. */
diff --git a/src/globals.h b/src/globals.h
index c22466c..9c81e4e 100644
--- a/src/globals.h
+++ b/src/globals.h
@@ -86,6 +86,8 @@
 #if defined(FEAT_CRYPT) || defined(FEAT_EVAL)
 EXTERN int	cmdline_star INIT(= FALSE);	/* cmdline is crypted */
 #endif
+EXTERN int	cmdline_busy INIT(= FALSE);	/* editing the cmdline */
+
 EXTERN int	exec_from_reg INIT(= FALSE);	/* executing register */
 
 EXTERN int	screen_cleared INIT(= FALSE);	/* screen has been cleared */
diff --git a/src/gui_gtk_x11.c b/src/gui_gtk_x11.c
index 84c5fe4..1502e0c 100644
--- a/src/gui_gtk_x11.c
+++ b/src/gui_gtk_x11.c
@@ -2328,7 +2328,6 @@
     vim_strncpy(IObuff,
 		    _("Vim: Received \"die\" request from session manager\n"),
 	    IOSIZE - 1);
-    deadly_exit = TRUE;
     preserve_exit();
 }
 
diff --git a/src/structs.h b/src/structs.h
index 5420b4e..b71f592 100644
--- a/src/structs.h
+++ b/src/structs.h
@@ -401,6 +401,10 @@
     int		xp_scriptID;		/* SID for completion function */
 #endif
     int		xp_backslash;		/* one of the XP_BS_ values */
+#ifndef BACKSLASH_IN_FILENAME
+    int		xp_shell;		/* for a shell command more characters
+					   need to be escaped */
+#endif
     int		xp_numfiles;		/* number of files found by
 						    file name completion */
     char_u	**xp_files;		/* list of files */
diff --git a/src/undo.c b/src/undo.c
index 34e1f40..1b69cf1 100644
--- a/src/undo.c
+++ b/src/undo.c
@@ -52,6 +52,7 @@
 
 static u_entry_T *u_get_headentry __ARGS((void));
 static void u_getbot __ARGS((void));
+static int undo_allowed __ARGS((void));
 static int u_savecommon __ARGS((linenr_T, linenr_T, linenr_T));
 static void u_doit __ARGS((int count));
 static void u_undoredo __ARGS((void));
@@ -156,6 +157,40 @@
 			nlines == curbuf->b_ml.ml_line_count ? 2 : lnum));
 }
 
+/*
+ * Return TRUE when undo is allowed.  Otherwise give an error message and
+ * return FALSE.
+ */
+    static int
+undo_allowed()
+{
+    /* Don't allow changes when 'modifiable' is off.  */
+    if (!curbuf->b_p_ma)
+    {
+	EMSG(_(e_modifiable));
+	return FALSE;
+    }
+
+#ifdef HAVE_SANDBOX
+    /* In the sandbox it's not allowed to change the text. */
+    if (sandbox != 0)
+    {
+	EMSG(_(e_sandbox));
+	return FALSE;
+    }
+#endif
+
+    /* Don't allow changes in the buffer while editing the cmdline.  The
+     * caller of getcmdline() may get confused. */
+    if (cmdline_busy)
+    {
+	EMSG(_(e_secure));
+	return FALSE;
+    }
+
+    return TRUE;
+}
+
     static int
 u_savecommon(top, bot, newbot)
     linenr_T	top, bot;
@@ -168,27 +203,10 @@
     u_entry_T		*prev_uep;
     long		size;
 
-    /*
-     * Don't allow changes when 'modifiable' is off.  Letting the
-     * undo fail is a crude way to make all change commands fail.
-     */
-    if (!curbuf->b_p_ma)
-    {
-	EMSG(_(e_modifiable));
+    /* When making changes is not allowed return FAIL.  It's a crude way to
+     * make all change commands fail. */
+    if (!undo_allowed())
 	return FAIL;
-    }
-
-#ifdef HAVE_SANDBOX
-    /*
-     * In the sandbox it's not allowed to change the text.  Letting the
-     * undo fail is a crude way to make all change commands fail.
-     */
-    if (sandbox != 0)
-    {
-	EMSG(_(e_sandbox));
-	return FAIL;
-    }
-#endif
 
 #ifdef FEAT_NETBEANS_INTG
     /*
@@ -484,20 +502,8 @@
 u_doit(count)
     int count;
 {
-    /* Don't allow changes when 'modifiable' is off. */
-    if (!curbuf->b_p_ma)
-    {
-	EMSG(_(e_modifiable));
+    if (!undo_allowed())
 	return;
-    }
-#ifdef HAVE_SANDBOX
-    /* In the sandbox it's not allowed to change the text. */
-    if (sandbox != 0)
-    {
-	EMSG(_(e_sandbox));
-	return;
-    }
-#endif
 
     u_newcount = 0;
     u_oldcount = 0;
diff --git a/src/version.h b/src/version.h
index 3cb3dd9..0251f80 100644
--- a/src/version.h
+++ b/src/version.h
@@ -36,5 +36,5 @@
 #define VIM_VERSION_NODOT	"vim70aa"
 #define VIM_VERSION_SHORT	"7.0aa"
 #define VIM_VERSION_MEDIUM	"7.0aa ALPHA"
-#define VIM_VERSION_LONG	"VIM - Vi IMproved 7.0aa ALPHA (2006 Jan 14)"
-#define VIM_VERSION_LONG_DATE	"VIM - Vi IMproved 7.0aa ALPHA (2006 Jan 14, compiled "
+#define VIM_VERSION_LONG	"VIM - Vi IMproved 7.0aa ALPHA (2006 Jan 19)"
+#define VIM_VERSION_LONG_DATE	"VIM - Vi IMproved 7.0aa ALPHA (2006 Jan 19, compiled "