diff --git a/7.0.036 b/7.0.036
new file mode 100644
index 0000000..a847110
--- /dev/null
+++ b/7.0.036
@@ -0,0 +1,140 @@
+To: vim-dev@vim.org
+Subject: Patch 7.0.036
+Fcc: outbox
+From: Bram Moolenaar <Bram@moolenaar.net>
+Mime-Version: 1.0
+Content-Type: text/plain; charset=ISO-8859-1
+Content-Transfer-Encoding: 8bit
+------------
+
+Patch 7.0.036
+Problem:    Can't compile with small features and syntax highlighting or the
+	    diff feature.
+Solution:   Define LINE_ATTR whenever syntax highlighting or the diff feature
+	    is enabled.
+Files:	    src/screen.c
+
+
+*** ../vim-7.0.035/src/screen.c	Fri May  5 23:13:04 2006
+--- src/screen.c	Tue Jul 11 21:33:53 2006
+***************
+*** 2612,2618 ****
+  #ifdef FEAT_LINEBREAK
+      int		need_showbreak = FALSE;
+  #endif
+! #if defined(FEAT_SIGNS) || (defined(FEAT_QUICKFIX) && defined(FEAT_WINDOWS))
+  # define LINE_ATTR
+      int		line_attr = 0;		/* atrribute for the whole line */
+  #endif
+--- 2612,2619 ----
+  #ifdef FEAT_LINEBREAK
+      int		need_showbreak = FALSE;
+  #endif
+! #if defined(FEAT_SIGNS) || (defined(FEAT_QUICKFIX) && defined(FEAT_WINDOWS)) \
+! 	|| defined(FEAT_SYN_HL) || defined(FEAT_DIFF)
+  # define LINE_ATTR
+      int		line_attr = 0;		/* atrribute for the whole line */
+  #endif
+***************
+*** 2626,2632 ****
+      int		prev_c = 0;		/* previous Arabic character */
+      int		prev_c1 = 0;		/* first composing char for prev_c */
+  #endif
+! #if defined(FEAT_DIFF) || defined(LINE_ATTR)
+      int		did_line_attr = 0;
+  #endif
+  
+--- 2627,2633 ----
+      int		prev_c = 0;		/* previous Arabic character */
+      int		prev_c1 = 0;		/* first composing char for prev_c */
+  #endif
+! #if defined(LINE_ATTR)
+      int		did_line_attr = 0;
+  #endif
+  
+***************
+*** 4116,4132 ****
+  		    --ptr;	    /* put it back at the NUL */
+  		}
+  #endif
+! #if defined(FEAT_DIFF) || defined(LINE_ATTR)
+  		else if ((
+  # ifdef FEAT_DIFF
+! 			    diff_hlf != (hlf_T)0
+! #  ifdef LINE_ATTR
+! 			    ||
+! #  endif
+  # endif
+- # ifdef LINE_ATTR
+  			    line_attr != 0
+- # endif
+  			) && (
+  # ifdef FEAT_RIGHTLEFT
+  			    wp->w_p_rl ? (col >= 0) :
+--- 4117,4128 ----
+  		    --ptr;	    /* put it back at the NUL */
+  		}
+  #endif
+! #if defined(LINE_ATTR)
+  		else if ((
+  # ifdef FEAT_DIFF
+! 			    diff_hlf != (hlf_T)0 ||
+  # endif
+  			    line_attr != 0
+  			) && (
+  # ifdef FEAT_RIGHTLEFT
+  			    wp->w_p_rl ? (col >= 0) :
+***************
+*** 4237,4243 ****
+  	 * At end of the text line or just after the last character.
+  	 */
+  	if (c == NUL
+! #if defined(FEAT_DIFF) || defined(LINE_ATTR)
+  		|| did_line_attr == 1
+  #endif
+  		)
+--- 4233,4239 ----
+  	 * At end of the text line or just after the last character.
+  	 */
+  	if (c == NUL
+! #if defined(LINE_ATTR)
+  		|| did_line_attr == 1
+  #endif
+  		)
+***************
+*** 4258,4264 ****
+  				|| prevcol == (long)match_hl[0].startcol
+  				|| prevcol == (long)match_hl[1].startcol
+  				|| prevcol == (long)match_hl[2].startcol)
+! # if defined(FEAT_DIFF) || defined(LINE_ATTR)
+  			    && did_line_attr <= 1
+  # endif
+  			   )
+--- 4254,4260 ----
+  				|| prevcol == (long)match_hl[0].startcol
+  				|| prevcol == (long)match_hl[1].startcol
+  				|| prevcol == (long)match_hl[2].startcol)
+! # if defined(LINE_ATTR)
+  			    && did_line_attr <= 1
+  # endif
+  			   )
+*** ../vim-7.0.035/src/version.c	Fri Jun 23 21:36:49 2006
+--- src/version.c	Tue Jul 11 21:36:50 2006
+***************
+*** 668,669 ****
+--- 668,671 ----
+  {   /* Add new patch number below this line */
++ /**/
++     36,
+  /**/
+
+-- 
+Every engineer dreams about saving the universe and having sex with aliens.
+This is much more glamorous than the real life of an engineer, which consists
+of hiding from the universe and having sex without the participation of other
+life forms.                     (Scott Adams - The Dilbert principle)
+
+ /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
+///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
+\\\        download, build and distribute -- http://www.A-A-P.org        ///
+ \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
diff --git a/7.0.037 b/7.0.037
new file mode 100644
index 0000000..6cc301d
--- /dev/null
+++ b/7.0.037
@@ -0,0 +1,63 @@
+To: vim-dev@vim.org
+Subject: Patch 7.0.037
+Fcc: outbox
+From: Bram Moolenaar <Bram@moolenaar.net>
+Mime-Version: 1.0
+Content-Type: text/plain; charset=ISO-8859-1
+Content-Transfer-Encoding: 8bit
+------------
+
+Patch 7.0.037
+Problem:    Crash when resizing the GUI window vertically when there is a line
+	    that doesn't fit.
+Solution:   Don't redraw while the screen data is invalid.
+Files:	    src/screen.c
+
+
+*** ../vim-7.0.036/src/screen.c	Tue Jul 11 22:36:19 2006
+--- src/screen.c	Tue Jul 11 21:33:53 2006
+***************
+*** 7129,7134 ****
+--- 7129,7140 ----
+  	return;
+      entered = TRUE;
+  
++     /*
++      * Note that the window sizes are updated before reallocating the arrays,
++      * thus we must not redraw here!
++      */
++     ++RedrawingDisabled;
++ 
+      win_new_shellsize();    /* fit the windows in the new sized shell */
+  
+      comp_col();		/* recompute columns for shown command and ruler */
+***************
+*** 7363,7368 ****
+--- 7369,7375 ----
+  #endif
+  
+      entered = FALSE;
++     --RedrawingDisabled;
+  
+  #ifdef FEAT_AUTOCMD
+      if (starting == 0)
+*** ../vim-7.0.036/src/version.c	Tue Jul 11 22:36:19 2006
+--- src/version.c	Tue Jul 11 22:38:39 2006
+***************
+*** 668,669 ****
+--- 668,671 ----
+  {   /* Add new patch number below this line */
++ /**/
++     37,
+  /**/
+
+-- 
+For society, it's probably a good thing that engineers value function over
+appearance.  For example, you wouldn't want engineers to build nuclear power
+plants that only _look_ like they would keep all the radiation inside.
+				(Scott Adams - The Dilbert principle)
+
+ /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
+///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
+\\\        download, build and distribute -- http://www.A-A-P.org        ///
+ \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
diff --git a/7.0.038 b/7.0.038
new file mode 100644
index 0000000..58b74fa
--- /dev/null
+++ b/7.0.038
@@ -0,0 +1,95 @@
+To: vim-dev@vim.org
+Subject: Patch 7.0.038
+Fcc: outbox
+From: Bram Moolenaar <Bram@moolenaar.net>
+Mime-Version: 1.0
+Content-Type: text/plain; charset=ISO-8859-1
+Content-Transfer-Encoding: 8bit
+------------
+
+Patch 7.0.038
+Problem:    When calling complete() from an Insert mode expression mapping
+	    text could be inserted in an improper way.
+Solution:   Make undo_allowed() global and use it in complete().
+Files:	    src/undo.c, src/proto/undo.pro, src/eval.c
+
+
+*** ../vim-7.0.037/src/undo.c	Sat Apr 22 00:01:05 2006
+--- src/undo.c	Mon Jul  3 22:23:22 2006
+***************
+*** 84,90 ****
+  static void u_unch_branch __ARGS((u_header_T *uhp));
+  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((int undo));
+--- 84,89 ----
+***************
+*** 196,202 ****
+   * 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.  */
+--- 195,201 ----
+   * Return TRUE when undo is allowed.  Otherwise give an error message and
+   * return FALSE.
+   */
+!     int
+  undo_allowed()
+  {
+      /* Don't allow changes when 'modifiable' is off.  */
+*** ../vim-7.0.037/src/proto/undo.pro	Mon Apr 10 16:38:50 2006
+--- src/proto/undo.pro	Mon Jul  3 22:25:07 2006
+***************
+*** 4,9 ****
+--- 4,10 ----
+  extern int u_savesub __ARGS((linenr_T lnum));
+  extern int u_inssub __ARGS((linenr_T lnum));
+  extern int u_savedel __ARGS((linenr_T lnum, long nlines));
++ extern int undo_allowed __ARGS((void));
+  extern void u_undo __ARGS((int count));
+  extern void u_redo __ARGS((int count));
+  extern void undo_time __ARGS((long step, int sec, int absolute));
+*** ../vim-7.0.037/src/eval.c	Thu Jun 22 21:01:19 2006
+--- src/eval.c	Mon Jul 10 23:03:13 2006
+***************
+*** 8252,8257 ****
+--- 8252,8263 ----
+  	EMSG(_("E785: complete() can only be used in Insert mode"));
+  	return;
+      }
++ 
++     /* Check for undo allowed here, because if something was already inserted
++      * the line was already saved for undo and this check isn't done. */
++     if (!undo_allowed())
++ 	return;
++ 
+      if (argvars[1].v_type != VAR_LIST || argvars[1].vval.v_list == NULL)
+      {
+  	EMSG(_(e_invarg));
+*** ../vim-7.0.037/src/version.c	Tue Jul 11 22:59:04 2006
+--- src/version.c	Wed Jul 12 20:31:49 2006
+***************
+*** 668,669 ****
+--- 668,671 ----
+  {   /* Add new patch number below this line */
++ /**/
++     38,
+  /**/
+
+-- 
+If someone questions your market projections, simply point out that your
+target market is "People who are nuts" and "People who will buy any damn
+thing".  Nobody is going to tell you there aren't enough of those people
+to go around.
+				(Scott Adams - The Dilbert principle)
+
+ /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
+///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
+\\\        download, build and distribute -- http://www.A-A-P.org        ///
+ \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
diff --git a/7.0.039 b/7.0.039
new file mode 100644
index 0000000..57da519
--- /dev/null
+++ b/7.0.039
@@ -0,0 +1,129 @@
+To: vim-dev@vim.org
+Subject: Patch 7.0.039
+Fcc: outbox
+From: Bram Moolenaar <Bram@moolenaar.net>
+Mime-Version: 1.0
+Content-Type: text/plain; charset=ISO-8859-1
+Content-Transfer-Encoding: 8bit
+------------
+
+Patch 7.0.039
+Problem:    Calling inputdialog() with a third argument in the console doesn't
+            work.
+Solution:   Make a separate function for input() and inputdialog(). (Yegappan
+            Lakshmanan)
+Files:      src/eval.c
+
+
+*** ../vim-7.0.038/src/eval.c	Wed Jul 12 21:48:56 2006
+--- src/eval.c	Mon Jul 10 23:03:13 2006
+***************
+*** 11321,11334 ****
+  
+  static int inputsecret_flag = 0;
+  
+  /*
+!  * "input()" function
+!  *     Also handles inputsecret() when inputsecret is set.
+   */
+      static void
+! f_input(argvars, rettv)
+      typval_T	*argvars;
+      typval_T	*rettv;
+  {
+      char_u	*prompt = get_tv_string_chk(&argvars[0]);
+      char_u	*p = NULL;
+--- 11321,11339 ----
+  
+  static int inputsecret_flag = 0;
+  
++ static void get_user_input __ARGS((typval_T *argvars, typval_T *rettv, int inputdialog));
++ 
+  /*
+!  * This function is used by f_input() and f_inputdialog() functions. The third
+!  * argument to f_input() specifies the type of completion to use at the
+!  * prompt. The third argument to f_inputdialog() specifies the value to return
+!  * when the user cancels the prompt.
+   */
+      static void
+! get_user_input(argvars, rettv, inputdialog)
+      typval_T	*argvars;
+      typval_T	*rettv;
++     int		inputdialog;
+  {
+      char_u	*prompt = get_tv_string_chk(&argvars[0]);
+      char_u	*p = NULL;
+***************
+*** 11378,11384 ****
+  	    if (defstr != NULL)
+  		stuffReadbuffSpec(defstr);
+  
+! 	    if (argvars[2].v_type != VAR_UNKNOWN)
+  	    {
+  		char_u	*xp_name;
+  		int	xp_namelen;
+--- 11383,11389 ----
+  	    if (defstr != NULL)
+  		stuffReadbuffSpec(defstr);
+  
+! 	    if (!inputdialog && argvars[2].v_type != VAR_UNKNOWN)
+  	    {
+  		char_u	*xp_name;
+  		int	xp_namelen;
+***************
+*** 11413,11418 ****
+--- 11418,11435 ----
+  }
+  
+  /*
++  * "input()" function
++  *     Also handles inputsecret() when inputsecret is set.
++  */
++     static void
++ f_input(argvars, rettv)
++     typval_T	*argvars;
++     typval_T	*rettv;
++ {
++     get_user_input(argvars, rettv, FALSE);
++ }
++ 
++ /*
+   * "inputdialog()" function
+   */
+      static void
+***************
+*** 11452,11458 ****
+      }
+      else
+  #endif
+! 	f_input(argvars, rettv);
+  }
+  
+  /*
+--- 11469,11475 ----
+      }
+      else
+  #endif
+! 	get_user_input(argvars, rettv, TRUE);
+  }
+  
+  /*
+*** ../vim-7.0.038/src/version.c	Wed Jul 12 21:48:56 2006
+--- src/version.c	Wed Jul 12 21:56:30 2006
+***************
+*** 668,669 ****
+--- 668,671 ----
+  {   /* Add new patch number below this line */
++ /**/
++     39,
+  /**/
+
+-- 
+A consultant is a person who takes your money and annoys your employees while
+tirelessly searching for the best way to extend the consulting contract.
+				(Scott Adams - The Dilbert principle)
+
+ /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
+///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
+\\\        download, build and distribute -- http://www.A-A-P.org        ///
+ \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
diff --git a/README.patches b/README.patches
index 17a8466..ffa66ba 100644
--- a/README.patches
+++ b/README.patches
@@ -60,3 +60,7 @@ Individual patches for Vim 7.0:
   2431  7.0.033  pasting after autoindent removes the indent
   2042  7.0.034  repeating completion was wrong after typing text or using BS
   5905  7.0.035  repeating Insert mode completion doesn't work properly
+  3990  7.0.036  can't compile with small features and syntax HL
+  1880  7.0.037  crash when resizing Vim window when a line doesn't fit
+  3236  7.0.038  complete() can be used from expr. mapping after inserting text
+  3240  7.0.039  third argument for inputdialog() doesn't work in the console
diff --git a/vim.spec b/vim.spec
index 458d836..d916abb 100644
--- a/vim.spec
+++ b/vim.spec
@@ -24,12 +24,12 @@
 #used for pre-releases:
 %define beta %{nil}
 %define vimdir vim70%{?beta}
-%define patchlevel 035
+%define patchlevel 039
 
 Summary: The VIM editor.
 Name: vim
 Version: %{baseversion}.%{beta}%{patchlevel}
-Release: 1.1
+Release: 1
 License: freeware
 Group: Applications/Editors
 Source0: ftp://ftp.vim.org/pub/vim/unix/vim-%{baseversion}%{?beta}%{?CVSDATE}.tar.bz2
@@ -89,6 +89,10 @@ Patch032: ftp://ftp.vim.org/pub/vim/patches/7.0/7.0.032
 Patch033: ftp://ftp.vim.org/pub/vim/patches/7.0/7.0.033
 Patch034: ftp://ftp.vim.org/pub/vim/patches/7.0/7.0.034
 Patch035: ftp://ftp.vim.org/pub/vim/patches/7.0/7.0.035
+Patch036: ftp://ftp.vim.org/pub/vim/patches/7.0/7.0.036
+Patch037: ftp://ftp.vim.org/pub/vim/patches/7.0/7.0.037
+Patch038: ftp://ftp.vim.org/pub/vim/patches/7.0/7.0.038
+Patch039: ftp://ftp.vim.org/pub/vim/patches/7.0/7.0.039
 
 
 Patch3000: vim-7.0-syntax.patch
@@ -258,6 +262,10 @@ perl -pi -e "s,bin/nawk,bin/awk,g" runtime/tools/mve.awk
 %patch033 -p0
 %patch034 -p0
 %patch035 -p0
+%patch036 -p0
+%patch037 -p0
+%patch038 -p0
+%patch039 -p0
 
 %patch3000 -p1
 %patch3001 -p1
@@ -287,8 +295,8 @@ patch -p1 < %{PATCH3008}
 %build
 cd src
 autoconf
-perl -pi -e "s,\\\$VIMRUNTIME,/usr/share/vim/%{vimdir},g" os_unix.h
-perl -pi -e "s,\\\$VIM,/usr/share/vim/%{vimdir}/macros,g" os_unix.h
+#perl -pi -e "s,\\\$VIMRUNTIME,/usr/share/vim/%{vimdir},g" os_unix.h
+#perl -pi -e "s,\\\$VIM,/usr/share/vim/%{vimdir}/macros,g" os_unix.h
 
 export CFLAGS="$RPM_OPT_FLAGS -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2"
 export CXXFLAGS="$RPM_OPT_FLAGS -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2"
@@ -594,6 +602,10 @@ rm -rf $RPM_BUILD_ROOT
 %{_datadir}/icons/hicolor/*/apps/*
 
 %changelog
+* Wed Jul 20 2006 Karsten Hopp <karsten@redhat.de> 7.0.039-1
+- patchlevel 39
+- allow usage of $VIM variable (#199465)
+
 * Wed Jul 12 2006 Jesse Keating <jkeating@redhat.com> - 2:7.0.035-1.1
 - rebuild