updated for version 7.0163
diff --git a/Makefile b/Makefile
index 75b53ec..6758e41 100644
--- a/Makefile
+++ b/Makefile
@@ -37,8 +37,6 @@
 #
 # TARGET	PRODUCES		CONTAINS
 # unixall	vim-#.#.tar.bz2		Runtime files and Sources for Unix
-#    unixrt	vim-#.#-rt[12].tar.gz	Runtime files for Unix
-#    unixsrc	vim-#.#-src[12].tar.gz	Sources for Unix
 #
 # extra		vim-#.#-extra.tar.gz	Extra source and runtime files
 # lang		vim-#.#-lang.tar.gz	multi-language files
@@ -66,7 +64,7 @@
 #
 #    All output files are created in the "dist" directory.  Existing files are
 #    overwritten!
-#    To do all this you need the unixrt, unixsrc, extra and lang archives, and
+#    To do all this you need the unix, extra and lang archives, and
 #    compiled binaries.
 #    Before creating an archive first delete all backup files, *.orig, etc.
 
@@ -83,7 +81,8 @@
 #   runtime/doc/*.txt and nsis/gvim.nsi. Other things in README_os2.txt.  For a
 #   minor/major version: src/GvimExt/GvimExt.reg, src/vim.def, src/vim16.def.
 # - Correct included_patches[] in src/version.c.
-# - Compile Vim with GTK, Perl, Python, TCL, Ruby, Cscope and "huge" features.
+# - Compile Vim with GTK, Perl, Python, TCL, Ruby, MZscheme, Cscope and "huge"
+#   features.  Exclude workshop and SNiFF.
 # - With these features: "make proto" (requires cproto and Motif installed;
 #   ignore warnings for missing include files, fix problems for syntax errors).
 # - With these features: "make depend" (works best with gcc).
@@ -262,10 +261,8 @@
 dist/$(COMMENT_LANG): dist/comment
 	echo "Vim - Vi IMproved - v$(VDOT) MS-Windows language files" > dist/$(COMMENT_LANG)
 
-unixrt: dist prepare
-	-rm -f dist/$(VIMVER)-rt1.tar.gz
-	-rm -f dist/$(VIMVER)-rt2.tar.gz
-# first runtime file
+unixall: dist prepare
+	-rm -f dist/$(VIMVER).tar.bz2
 	-rm -rf dist/$(VIMRTDIR)
 	mkdir dist/$(VIMRTDIR)
 	tar cf - \
@@ -273,36 +270,10 @@
 		$(RT_ALL_BIN) \
 		$(RT_UNIX) \
 		$(RT_UNIX_DOS_BIN) \
-		| (cd dist/$(VIMRTDIR); tar xf -)
-	cd dist && tar cf $(VIMVER)-rt1.tar $(VIMRTDIR)
-	gzip -9 dist/$(VIMVER)-rt1.tar
-# second runtime file (script and language files)
-	-rm -rf dist/$(VIMRTDIR)
-	mkdir dist/$(VIMRTDIR)
-	tar cf - \
 		$(RT_SCRIPTS) \
 		$(LANG_GEN) \
 		$(LANG_GEN_BIN) \
-		| (cd dist/$(VIMRTDIR); tar xf -)
-	cd dist && tar cf $(VIMVER)-rt2.tar $(VIMRTDIR)
-	gzip -9 dist/$(VIMVER)-rt2.tar
-
-unixsrc: dist prepare
-	-rm -f dist/$(VIMVER)-src1.tar.gz
-	-rm -f dist/$(VIMVER)-src2.tar.gz
-# first source file
-	-rm -rf dist/$(VIMRTDIR)
-	mkdir dist/$(VIMRTDIR)
-	tar cf - \
-		$(SRC_ALL1) \
-		| (cd dist/$(VIMRTDIR); tar xf -)
-	cd dist && tar cf $(VIMVER)-src1.tar $(VIMRTDIR)
-	gzip -9 dist/$(VIMVER)-src1.tar
-# second source file
-	-rm -rf dist/$(VIMRTDIR)
-	mkdir dist/$(VIMRTDIR)
-	tar cf - \
-		$(SRC_ALL2) \
+		$(SRC_ALL) \
 		$(SRC_UNIX) \
 		$(SRC_DOS_UNIX) \
 		| (cd dist/$(VIMRTDIR); tar xf -)
@@ -312,21 +283,6 @@
 	touch dist/$(VIMRTDIR)/src/auto/config.h
 # Make sure configure is newer than config.mk to force it to be generated
 	touch dist/$(VIMRTDIR)/src/configure
-	cd dist && tar cf $(VIMVER)-src2.tar $(VIMRTDIR)
-	gzip -9 dist/$(VIMVER)-src2.tar
-
-unixall: dist unixsrc unixrt
-	-rm -f dist/$(VIMVER).tar.bz2
-	-rm -rf dist/$(VIMRTDIR)
-	mkdir dist/$(VIMRTDIR)
-	cd dist && tar xfz $(VIMVER)-src1.tar.gz
-	cd dist && tar xfz $(VIMVER)-src2.tar.gz
-	cd dist && tar xfz $(VIMVER)-rt1.tar.gz
-	cd dist && tar xfz $(VIMVER)-rt2.tar.gz
-# Create an empty config.h file, make dependencies require it
-	touch dist/$(VIMRTDIR)/src/auto/config.h
-# Make sure configure is newer than config.mk to force it to be generated
-	touch dist/$(VIMRTDIR)/src/configure
 	cd dist && tar cf $(VIMVER).tar $(VIMRTDIR)
 	bzip2 dist/$(VIMVER).tar
 
@@ -405,8 +361,7 @@
 	mkdir dist/Vim/$(VIMRTDIR)
 	tar cf - \
 		$(ROOT_AMI) \
-		$(SRC_ALL1) \
-		$(SRC_ALL2) \
+		$(SRC_ALL) \
 		$(SRC_AMI) \
 		$(SRC_AMI_DOS) \
 		| (cd dist/Vim/$(VIMRTDIR); tar xf -)
@@ -593,8 +548,7 @@
 	mkdir dist/vim
 	mkdir dist/vim/$(VIMRTDIR)
 	tar cf - \
-		$(SRC_ALL1) \
-		$(SRC_ALL2) \
+		$(SRC_ALL) \
 		$(SRC_DOS) \
 		$(SRC_AMI_DOS) \
 		$(SRC_DOS_UNIX) \
diff --git a/runtime/autoload/htmlcomplete.vim b/runtime/autoload/htmlcomplete.vim
index bd138e6..806eb52 100644
--- a/runtime/autoload/htmlcomplete.vim
+++ b/runtime/autoload/htmlcomplete.vim
@@ -463,7 +463,7 @@
 
 	let tags = g:xmldata_xhtml10s[opentag][0]
 
-	for m in tags
+	for m in sort(tags)
 		if m =~ '^'.context
 			call add(res, m)
 		elseif m =~ context
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 4a4e89f..2a4fd14 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -205,7 +205,7 @@
 #else
 # define ex_tearoff		ex_ni
 #endif
-#if (defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_KDE) || defined(FEAT_GUI_GTK)) && defined(FEAT_MENU)
+#if (defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_GTK)) && defined(FEAT_MENU)
 static void	ex_popup __ARGS((exarg_T *eap));
 #else
 # define ex_popup		ex_ni
@@ -213,11 +213,11 @@
 #ifndef FEAT_GUI_MSWIN
 # define ex_simalt		ex_ni
 #endif
-#if !defined(FEAT_GUI_MSWIN) && !defined(FEAT_GUI_GTK) && !defined(FEAT_GUI_MOTIF) && !defined(FEAT_GUI_KDE)
+#if !defined(FEAT_GUI_MSWIN) && !defined(FEAT_GUI_GTK) && !defined(FEAT_GUI_MOTIF)
 # define gui_mch_find_dialog	ex_ni
 # define gui_mch_replace_dialog ex_ni
 #endif
-#if !defined(FEAT_GUI_GTK) && !defined(FEAT_GUI_KDE)
+#if !defined(FEAT_GUI_GTK)
 # define ex_helpfind		ex_ni
 #endif
 #ifndef FEAT_CSCOPE
@@ -4244,12 +4244,6 @@
 		if (!has_wildcards)
 #endif
 		    backslash_halve(eap->arg);
-#ifdef MACOS_CLASSIC
-		/*
-		 * translate unix-like path components
-		 */
-		slash_n_colon_adjust(eap->arg);
-#endif
 	    }
 
 	    if (has_wildcards)
@@ -7088,7 +7082,7 @@
 }
 #endif
 
-#if (defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_KDE) || defined(FEAT_GUI_GTK)) && defined(FEAT_MENU)
+#if (defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_GTK)) && defined(FEAT_MENU)
     static void
 ex_popup(eap)
     exarg_T	*eap;
@@ -7254,11 +7248,12 @@
 		    lnum = curbuf->b_ml.ml_line_count;
 		else
 		    lnum = 1;
-		if (*ml_get(lnum) == NUL)
+		if (*ml_get(lnum) == NUL && u_savedel(lnum, 1L) == OK)
 		{
 		    ml_delete(lnum, FALSE);
 		    deleted_lines_mark(lnum, 1L);
-		    if (curwin->w_cursor.lnum >= lnum)
+		    if (curwin->w_cursor.lnum > 1
+					     && curwin->w_cursor.lnum >= lnum)
 			--curwin->w_cursor.lnum;
 		}
 	    }
@@ -8126,6 +8121,12 @@
 	    (void)put_line(fd, "version 6.0");
 
 #ifdef FEAT_SESSION
+	if (eap->cmdidx == CMD_mksession)
+	{
+	    if (put_line(fd, "let SessionLoad = 1") == FAIL)
+		failed = TRUE;
+	}
+
 	if (eap->cmdidx != CMD_mkview)
 #endif
 	{
@@ -8190,8 +8191,15 @@
 	    if (put_line(fd, "let &so = s:so_save | let &siso = s:siso_save")
 								      == FAIL)
 		failed = TRUE;
+	    if (put_line(fd, "doautoall SessionLoadPost") == FAIL)
+		failed = TRUE;
+	    if (put_line(fd, "unlet SessionLoad") == FAIL)
+		failed = TRUE;
 	}
 #endif
+	if (put_line(fd, "\" vim: set ft=vim :") == FAIL)
+	    failed = TRUE;
+
 	failed |= fclose(fd);
 
 	if (failed)
@@ -9907,17 +9915,13 @@
 	    else if (vim_ispathsep(*p))
 	    {
 		*s++ = '=';
-#ifdef MACOS_CLASSIC /* TODO: Is it also needed for MACOS_X? (Dany) */
-		*s++ = '+';
-#else
-# if defined(BACKSLASH_IN_FILENAME) || defined(AMIGA) || defined(RISCOS) \
+#if defined(BACKSLASH_IN_FILENAME) || defined(AMIGA) || defined(RISCOS) \
 	|| defined(VMS)
 		if (*p == ':')
 		    *s++ = '-';
 		else
-# endif
-		    *s++ = '+';
 #endif
+		    *s++ = '+';
 	    }
 	    else
 		*s++ = *p;
diff --git a/src/main.aap b/src/main.aap
index 3b16f17..a1b9610 100644
--- a/src/main.aap
+++ b/src/main.aap
@@ -98,20 +98,6 @@
         GUI_TARGETS     = installglinks
         GUI_MAN_TARGETS = installghelplinks
         GUI_TESTTARGET  = gui
-    KDE
-        GUI_SRC         = gui.c pty.c gui_kde.cc gui_kde_x11.cc
-                            gui_kde_wid_moc.cc
-                            kvim_iface_skel.cc
-        GUI_OBJ         = $BDIR/gui_kde_wid.o
-        GUI_DEFS        = -DFEAT_GUI_KDE $NARROW_PROTO
-        GUI_IPATH       = $GUI_INC_LOC
-        GUI_LIBS_DIR    = $GUI_LIB_LOC
-        GUI_LIBS1       =
-        GUI_LIBS2       =
-        GUI_TARGETS     = installglinks installkdeicons
-        GUI_MAN_TARGETS = installghelplinks
-        GUI_TESTTARGET  = gui
-
     MOTIF
         GUI_SRC         = gui.c gui_motif.c gui_x11.c pty.c gui_beval.c
                           gui_xmdlg.c gui_xmebw.c
@@ -180,8 +166,6 @@
 POST_DEFS = $X_CFLAGS $MZSCHEME_CFLAGS $PERL_CFLAGS $PYTHON_CFLAGS $TCL_CFLAGS $RUBY_CFLAGS $?(EXTRA_DEFS)
 CFLAGS = $PRE_DEFS $CONF_CFLAGS $?(PROFILE_CFLAGS) $POST_DEFS
 CPPFLAGS =
-# Need C++ flags for KDE
-CXXFLAGS = $CFLAGS
 
 ALL_LIB_DIRS = $GUI_LIBS_DIR $X_LIBS_DIR
 LDFLAGS = $ALL_LIB_DIRS $CONF_LDFLAGS
@@ -208,8 +192,6 @@
 testclean {virtual}:
     :del {force} testdir/*.out testdir/test.log
 
-CLEANFILES += gui_kde_wid_moc.cc kvim_iface_skel.cc *.kidl
-
 # When no fetch target exists we are not a child of the ../main.aap recipe,
 # Use ../main.aap to do the fetching.
 # --- If you get an error here for wrong number of arguments, you need to
@@ -350,20 +332,6 @@
         :sys $PERL $PERLLIB/ExtUtils/xsubpp -prototypes -typemap \
             $PERLLIB/ExtUtils/typemap if_perl.xs >> $target
 
-$BDIR/gui_kde_wid.o: gui_kde_wid.cc
-        :sys $MOC -o gui_kde_wid_moc.cc gui_kde_wid.h
-        @try:
-            :sys $KDE_PREFIX/bin/dcopidl kvim_iface.h > kvim_iface.kidl
-        @except:
-            :del {f} kvim_iface.kidl
-        :sys $KDE_PREFIX/bin/dcopidl2cpp --c++-suffix cc --no-stub kvim_iface.kidl
-        :do compile gui_kde_wid.cc
-
-gui_kde_wid_moc.cc: $BDIR/gui_kde_wid.o
-
-kvim_iface_skel.cc: $BDIR/gui_kde_wid.o
-
-
 auto/osdef.h: auto/config.h osdef.sh osdef1.h.in osdef2.h.in
         :sys CC="$CC $CFLAGS" srcdir=$srcdir sh $srcdir/osdef.sh
 
@@ -871,20 +839,6 @@
            :copy $KMAPSOURCE/README.txt $KMAPSOURCE/*.vim $DEST_KMAP
            :chmod $FILEMOD $DEST_KMAP/*.vim
 
-# Install the icons for the KDE GUI.  This differs from the KDE icons for
-# other GUIs.
-installkdeicons:
-        :copy {mkdir} ../runtime/KVim.desktop $DESTDIR$KDE_PREFIX/share/applnk/Editors/
-        :chmod 644 $DESTDIR$KDE_PREFIX/share/applnk/Editors/KVim.desktop
-        :copy {mkdir} ../runtime/kvim32x32.png $DESTDIR$KDE_PREFIX/share/icons/hicolor/32x32/apps/gvim.png
-        :chmod 644 $DESTDIR$KDE_PREFIX/share/icons/hicolor/32x32/apps/gvim.png
-        :copy {mkdir} ../runtime/kvim48x48.png $DESTDIR$KDE_PREFIX/share/icons/hicolor/48x48/apps/gvim.png
-        :chmod 644 $DESTDIR$KDE_PREFIX/share/icons/hicolor/48x48/apps/gvim.png
-        :copy {mkdir} ../runtime/hi16-action-make.png $DESTDIR$KDE_PREFIX/share/icons/hicolor/16x16/actions/hi16-action-make.png
-        :copy {mkdir} ../runtime/hi22-action-make.png $DESTDIR$KDE_PREFIX/share/icons/hicolor/22x22/actions/hi22-action-make.png
-        :copy {mkdir} ../runtime/kde-tips $DESTDIR$KDE_PREFIX/share/apps/gvim/tips
-        :chmod 644 $DESTDIR$KDE_PREFIX/share/apps/kvim/tips
-
 # install the icons for KDE, if the directory exists and the icon doesn't.
 ICON48PATH = $DESTDIR$DATADIR/icons/hicolor/48x48/apps
 ICON32PATH = $DESTDIR$DATADIR/icons/locolor/32x32/apps
diff --git a/src/normal.c b/src/normal.c
index 405ac3d..c8e847a 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -2381,7 +2381,7 @@
 	     * NOTE: Ignore right button down and drag mouse events.
 	     * Windows only shows the popup menu on the button up event.
 	     */
-#if defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_GTK) || defined(FEAT_GUI_PHOTON) || defined(FEAT_GUI_KDE)
+#if defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_GTK) || defined(FEAT_GUI_PHOTON)
 	    if (!is_click)
 		return FALSE;
 #endif
@@ -2389,7 +2389,7 @@
 	    if (is_click || is_drag)
 		return FALSE;
 #endif
-#if defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_GTK) || defined(FEAT_GUI_KDE) \
+#if defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_GTK) \
 	    || defined(FEAT_GUI_ATHENA) || defined(FEAT_GUI_MSWIN) \
 	    || defined(FEAT_GUI_MAC) || defined(FEAT_GUI_PHOTON)
 	    if (gui.in_use)
diff --git a/src/os_mac.h b/src/os_mac.h
index 5ef7310..0641991 100644
--- a/src/os_mac.h
+++ b/src/os_mac.h
@@ -144,8 +144,8 @@
 				       comment */
 
 
-#undef  USE_FNAME_CASE		/* So that :e os_Mac.c, :w, save back the file
-				   as os_mac.c */
+#undef  USE_FNAME_CASE		/* TODO: make :e os_Mac.c, :w, save back the
+				   file as os_mac.c */
 #define BINARY_FILE_IO
 #define EOL_DEFAULT EOL_MAC
 #ifndef MACOS_X_UNIX		/* I hope that switching these two lines */
@@ -170,7 +170,6 @@
 # define HAVE_STRFTIME
 #endif
 
-
 /*
  * Names for the EXRC, HELP and temporary files.
  * Some of these may have been defined in the makefile.
diff --git a/src/proto.h b/src/proto.h
index 490f969..c81212c 100644
--- a/src/proto.h
+++ b/src/proto.h
@@ -20,7 +20,7 @@
  * Machine-dependent routines.
  */
 /* avoid errors in function prototypes */
-# if !defined(FEAT_X11) && !defined(FEAT_GUI_GTK) && !defined(FEAT_GUI_KDE)
+# if !defined(FEAT_X11) && !defined(FEAT_GUI_GTK)
 #  define Display int
 #  define Widget int
 # endif
@@ -62,9 +62,6 @@
 # ifdef __BEOS__
 #  include "os_beos.pro"
 # endif
-# ifdef MACOS
-#  include "os_mac.pro"
-# endif
 # ifdef RISCOS
 #  include "os_riscos.pro"
 # endif
@@ -198,10 +195,6 @@
 #  ifdef FEAT_GUI_W32
 #   include "gui_w32.pro"
 #  endif
-#  ifdef FEAT_GUI_KDE
-#   include "gui_kde.pro"
-#   include "gui_kde_x11.pro"
-#  endif
 #  ifdef FEAT_GUI_GTK
 #   include "gui_gtk.pro"
 #   include "gui_gtk_x11.pro"
diff --git a/src/vim.h b/src/vim.h
index 16dc879..8b76721 100644
--- a/src/vim.h
+++ b/src/vim.h
@@ -57,7 +57,7 @@
 /*
  * MACOS_CLASSIC compiling for MacOS prior to MacOS X
  * MACOS_X_UNIX  compiling for MacOS X (using os_unix.c)
- * MACOS_X       compiling for MacOS X (using os_unix.c or os_mac.c)
+ * MACOS_X       compiling for MacOS X (using os_unix.c)
  * MACOS	 compiling for either one
  */
 #if defined(macintosh) && !defined(MACOS_CLASSIC)
@@ -68,10 +68,6 @@
 # ifndef HAVE_CONFIG_H
 #  define UNIX
 # endif
-# ifdef HAVE_STRINGS_H
-/* On Mac OS X strings.h exists but produces an annoying warning message. */
-#  undef HAVE_STRINGS_H
-# endif
 #endif
 #if defined(MACOS_X) || defined(MACOS_CLASSIC)
 #  define MACOS
@@ -91,8 +87,7 @@
     || defined(FEAT_GUI_MAC) \
     || defined(FEAT_GUI_W32) \
     || defined(FEAT_GUI_W16) \
-    || defined(FEAT_GUI_PHOTON) \
-    || defined(FEAT_GUI_KDE)
+    || defined(FEAT_GUI_PHOTON)
 # if !defined(FEAT_GUI) && !defined(NO_X11_INCLUDES)
 #  define FEAT_GUI
 # endif
@@ -1091,6 +1086,7 @@
     EVENT_MENUPOPUP,		/* just before popup menu is displayed */
     EVENT_QUICKFIXCMDPOST,	/* after :make, :grep etc */
     EVENT_QUICKFIXCMDPRE,	/* before :make, :grep etc */
+    EVENT_SESSIONLOADPOST,	/* after loading a session file */
     EVENT_STDINREADPOST,	/* after reading from stdin */
     EVENT_STDINREADPRE,		/* before reading from stdin */
     EVENT_SYNTAX,		/* syntax selected */
@@ -1683,7 +1679,7 @@
  * been seen at that stage.  But it must be before globals.h, where error_ga
  * is declared. */
 #if !defined(FEAT_GUI_W32) && !defined(FEAT_GUI_X11) \
-	&& !defined(FEAT_GUI_GTK) && !defined(FEAT_GUI_KDE) && !defined(FEAT_GUI_MAC)
+	&& !defined(FEAT_GUI_GTK) && !defined(FEAT_GUI_MAC)
 # define mch_errmsg(str)	fprintf(stderr, "%s", (str))
 # define display_errors()	fflush(stderr)
 # define mch_msg(str)		printf("%s", (str))