changeset 108058:5e867bd030c8

Merge from mainline.
author Katsumi Yamaoka <yamaoka@jpl.org>
date Wed, 21 Apr 2010 23:03:28 +0000
parents 92bb32f41a3a (current diff) 8ff86e76b50f (diff)
children 9b320fa52b94
files lisp/dynamic-setting.el lisp/font-setting.el
diffstat 58 files changed, 1799 insertions(+), 805 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Apr 20 23:33:39 2010 +0000
+++ b/ChangeLog	Wed Apr 21 23:03:28 2010 +0000
@@ -1,3 +1,23 @@
+2010-04-21  Andreas Schwab  <schwab@linux-m68k.org>
+
+	Avoid non-portable shell command negation
+	* configure.in: Revert last change.
+
+2010-04-21  Jan Djärv  <jan.h.d@swipnet.se>
+
+	* configure.in: Change "if test ! -f" to "if ! test -f".
+
+2010-04-21  Glenn Morris  <rgm@gnu.org>
+
+	* configure.in (LIBSELINUX_LIBS): Always substitute in Makefiles.
+	(GTK_OBJ, DBUS_OBJ, LIBXSM, XMENU_OBJ, XOBJ): New output variables.
+
+2010-04-21  Karel Klíč  <kklic@redhat.com>
+
+	* configure.in: New option: --with(out)-selinux, on by default.
+	Set HAVE_LIBSELINUX if we find libselinux, and substitute
+	LIBSELINUX_LIBS in Makefiles.
+
 2010-04-01  Dan Nicolaescu  <dann@ics.uci.edu>
 
 	* configure.in: Remove all references to LIBX11_SYSTEM.
--- a/admin/CPP-DEFINES	Tue Apr 20 23:33:39 2010 +0000
+++ b/admin/CPP-DEFINES	Wed Apr 21 23:03:28 2010 +0000
@@ -57,7 +57,6 @@
 INTERRUPT_INPUT
 MAIL_USE_FLOCK
 NARROWPROTO
-NOMULTIPLEJOBS
 SEPCHAR
 SIGTYPE
 SYSTEM_TYPE
--- a/configure	Tue Apr 20 23:33:39 2010 +0000
+++ b/configure	Wed Apr 21 23:03:28 2010 +0000
@@ -714,10 +714,13 @@
 RSVG_LIBS
 GTK_CFLAGS
 GTK_LIBS
+GTK_OBJ
 DBUS_CFLAGS
 DBUS_LIBS
+DBUS_OBJ
 GCONF_CFLAGS
 GCONF_LIBS
+LIBSELINUX_LIBS
 FONTCONFIG_CFLAGS
 FONTCONFIG_LIBS
 XFT_CFLAGS
@@ -734,6 +737,7 @@
 LIBTIFF
 LIBGIF
 LIBGPM
+LIBXSM
 ALLOCA
 liblockfile
 LIBS_MAIL
@@ -781,6 +785,8 @@
 GNU_OBJC_CFLAGS
 LIB_SRC_EXTRA_INSTALLABLES
 OTHER_FILES
+XMENU_OBJ
+XOBJ
 LTLIBOBJS'
 ac_subst_files=''
 ac_user_opts='
@@ -811,6 +817,7 @@
 with_gpm
 with_dbus
 with_gconf
+with_selinux
 with_makeinfo
 with_gtk
 with_gcc
@@ -1524,6 +1531,7 @@
                           console
   --without-dbus          don't compile with D-Bus support
   --without-gconf         don't compile with GConf support
+  --without-selinux       don't compile with SELinux support
   --without-makeinfo      don't require makeinfo for building manuals
 
   --with-pkg-config-prog=PATH
@@ -2316,6 +2324,14 @@
 fi
 
 
+# Check whether --with-selinux was given.
+if test "${with_selinux+set}" = set; then
+  withval=$with_selinux;
+else
+     with_selinux=yes
+fi
+
+
 ## For the times when you want to build Emacs but don't have
 ## a suitable makeinfo, and can live without the manuals.
 
@@ -2773,15 +2789,6 @@
     esac
   ;;
 
-  ## LynxOS ports
-  *-*-lynxos* )
-    opsys=lynxos
-    case "${canonical}" in
-      i[3456]86-*-lynxos*) machine=intel386 ;;
-      powerpc-*-lynxos*) machine=powerpc ;;
-    esac
-  ;;
-
   alpha*-*-linux-gnu* )
     machine=alpha opsys=gnu-linux
   ;;
@@ -2865,30 +2872,14 @@
 
   *-sun-solaris* \
     | i[3456]86-*-solaris2* | i[3456]86-*-sunos5* \
-    | x86_64-*-solaris2*    | x86_64-*-sunos5*    \
-    | powerpc*-*-solaris2*  | rs6000-*-solaris2*)
+    | x86_64-*-solaris2*    | x86_64-*-sunos5*)
     case "${canonical}" in
       i[3456]86-*-* )     machine=intel386 ;;
       amd64-*-*|x86_64-*-*)	machine=amdx86-64 ;;
-      powerpc* | rs6000* )  machine=ibmrs6000 ;;
       sparc* )		machine=sparc ;;
       * )		unported=yes ;;
     esac
     case "${canonical}" in
-      *-sunos5.3* | *-solaris2.3* )
-		opsys=sol2-3
-		NON_GNU_CPP=/usr/ccs/lib/cpp
-		;;
-      *-sunos5.4* | *-solaris2.4* )
-		opsys=sol2-4
-		NON_GNU_CPP=/usr/ccs/lib/cpp
-		RANLIB="ar -ts"
-		;;
-      *-sunos5.5* | *-solaris2.5* )
-		opsys=sol2-5
-		NON_GNU_CPP=/usr/ccs/lib/cpp
-		RANLIB="ar -ts"
-		;;
       *-sunos5.6* | *-solaris2.6* )
 		opsys=sol2-6
 		NON_GNU_CPP=/usr/ccs/lib/cpp
@@ -2979,22 +2970,6 @@
 if test x"${opsys}" = x; then
   case "${canonical}" in
     *-gnu* )				opsys=gnu ;;
-    *-sysv4.2uw* )			opsys=unixware ;;
-    *-sysv5uw* )			opsys=unixware ;;
-    *-sysv5OpenUNIX* )			opsys=unixware ;;
-    *-sysv4.1* | *-sysvr4.1* )
-	NON_GNU_CPP=/usr/lib/cpp
-	opsys=usg5-4 ;;
-    *-sysv4.[2-9]* | *-sysvr4.[2-9]* )
-	if [ x$NON_GNU_CPP = x ]; then
-	  if [ -f /usr/ccs/lib/cpp ]; then
-	    NON_GNU_CPP=/usr/ccs/lib/cpp
-	  else
-	    NON_GNU_CPP=/lib/cpp
-	  fi
-	fi
-	opsys=usg5-4-2 ;;
-    *-sysv4* | *-sysvr4* )		opsys=usg5-4 ;;
     * )
       unported=yes
     ;;
@@ -5676,7 +5651,7 @@
 if test "$MAKEINFO" = "no"; then
   if test "x${with_makeinfo}" = "xno"; then
     MAKEINFO=off
-  elif ! test -e $srcdir/info/emacs; then
+  elif test ! -e $srcdir/info/emacs; then
     { { $as_echo "$as_me:$LINENO: error: You do not seem to have makeinfo >= 4.6, and your
 source tree does not seem to have pre-built manuals in the \`info' directory.
 Either install a suitable version of makeinfo, or re-run configure
@@ -5816,10 +5791,6 @@
 configure___ use_mmap_for_buffers=no
 #endif
 
-#ifndef C_DEBUG_SWITCH
-#define C_DEBUG_SWITCH -g
-#endif
-
 #ifndef C_OPTIMIZE_SWITCH
 #ifdef __GNUC__
 #define C_OPTIMIZE_SWITCH -O2
@@ -5851,18 +5822,18 @@
 
 /* Get the CFLAGS for tests in configure.  */
 #ifdef __GNUC__
-configure___ CFLAGS=C_DEBUG_SWITCH C_OPTIMIZE_SWITCH '${SPECIFIED_CFLAGS}'
-#else
-configure___ CFLAGS=C_DEBUG_SWITCH '${SPECIFIED_CFLAGS}'
+configure___ CFLAGS=C_OPTIMIZE_SWITCH '${SPECIFIED_CFLAGS}'
+#else
+configure___ CFLAGS='${SPECIFIED_CFLAGS}'
 #endif
 
 #else /* not THIS_IS_CONFIGURE */
 
 /* Get the CFLAGS for real compilation.  */
 #ifdef __GNUC__
-configure___ REAL_CFLAGS=C_DEBUG_SWITCH C_OPTIMIZE_SWITCH C_WARNINGS_SWITCH ${PROFILING_CFLAGS} '${SPECIFIED_CFLAGS}'
-#else
-configure___ REAL_CFLAGS=C_DEBUG_SWITCH '${SPECIFIED_CFLAGS}'
+configure___ REAL_CFLAGS=C_OPTIMIZE_SWITCH C_WARNINGS_SWITCH ${PROFILING_CFLAGS} '${SPECIFIED_CFLAGS}'
+#else
+configure___ REAL_CFLAGS='${SPECIFIED_CFLAGS}'
 #endif
 
 #endif /* not THIS_IS_CONFIGURE */
@@ -11612,6 +11583,7 @@
 fi
 
 
+GTK_OBJ=
 if test x"$pkg_check_gtk" = xyes; then
 
 
@@ -11733,6 +11705,7 @@
 #define USE_GTK 1
 _ACEOF
 
+    GTK_OBJ=gtkutil.o
     USE_X_TOOLKIT=none
     if $PKG_CONFIG --atleast-version=2.10 gtk+-2.0; then
       :
@@ -11752,6 +11725,7 @@
 fi
 
 
+
 if test "${HAVE_GTK}" = "yes"; then
 
       if test "$with_toolkit_scroll_bars" != no; then
@@ -12443,6 +12417,7 @@
 fi
 
 HAVE_DBUS=no
+DBUS_OBJ=
 if test "${with_dbus}" = "yes"; then
 
   succeeded=no
@@ -12645,9 +12620,11 @@
 fi
 done
 
+     DBUS_OBJ=dbusbind.o
    fi
 fi
 
+
 HAVE_GCONF=no
 if test "${HAVE_X11}" = "yes" && test "${with_gconf}" = "yes"; then
 
@@ -12753,6 +12730,91 @@
    fi
 fi
 
+HAVE_LIBSELINUX=no
+LIBSELINUX_LIBS=
+if test "${with_selinux}" = "yes"; then
+   { $as_echo "$as_me:$LINENO: checking for lgetfilecon in -lselinux" >&5
+$as_echo_n "checking for lgetfilecon in -lselinux... " >&6; }
+if test "${ac_cv_lib_selinux_lgetfilecon+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lselinux  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char lgetfilecon ();
+int
+main ()
+{
+return lgetfilecon ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext && {
+	 test "$cross_compiling" = yes ||
+	 $as_test_x conftest$ac_exeext
+       }; then
+  ac_cv_lib_selinux_lgetfilecon=yes
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_selinux_lgetfilecon=no
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_selinux_lgetfilecon" >&5
+$as_echo "$ac_cv_lib_selinux_lgetfilecon" >&6; }
+if test $ac_cv_lib_selinux_lgetfilecon = yes; then
+  HAVE_LIBSELINUX=yes
+else
+  HAVE_LIBSELINUX=no
+fi
+
+   if test "$HAVE_LIBSELINUX" = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_LIBSELINUX 1
+_ACEOF
+
+      LIBSELINUX_LIBS=-lselinux
+   fi
+fi
+
+
 HAVE_XAW3D=no
 if test x"${USE_X_TOOLKIT}" = xmaybe || test x"${USE_X_TOOLKIT}" = xLUCID; then
   if test "$with_xaw3d" != no; then
@@ -16018,6 +16080,7 @@
 
 ### Use session management (-lSM -lICE) if available
 HAVE_X_SM=no
+LIBXSM=
 if test "${HAVE_X11}" = "yes"; then
   if test "${ac_cv_header_X11_SM_SMlib_h+set}" = set; then
   { $as_echo "$as_me:$LINENO: checking for X11/SM/SMlib.h" >&5
@@ -16226,13 +16289,15 @@
 #define HAVE_X_SM 1
 _ACEOF
 
+    LIBXSM="-lSM -lICE"
     case "$LIBS" in
       *-lSM*) ;;
-      *)      LIBS="-lSM -lICE $LIBS" ;;
+      *)      LIBS="$LIBXSM $LIBS" ;;
     esac
   fi
 fi
 
+
 # If netdb.h doesn't declare h_errno, we must declare it by hand.
 { $as_echo "$as_me:$LINENO: checking whether netdb declares h_errno" >&5
 $as_echo_n "checking whether netdb declares h_errno... " >&6; }
@@ -21156,6 +21221,7 @@
    { (exit 1); exit 1; }; }
 fi
 # Must define this when any termcap library is found.
+
 cat >>confdefs.h <<\_ACEOF
 #define HAVE_LIBNCURSES 1
 _ACEOF
@@ -25833,13 +25899,20 @@
 _ACEOF
 
 
+XMENU_OBJ=
+XOBJ=
 if test "${HAVE_X_WINDOWS}" = "yes" ; then
 
 cat >>confdefs.h <<\_ACEOF
 #define HAVE_X_WINDOWS 1
 _ACEOF
 
-fi
+  XMENU_OBJ=xmenu.o
+  XOBJ="xterm.o xfns.o xselect.o xrdb.o fontset.o xsmfns.o fringe.o image.o xsettings.o xgselect.o"
+fi
+
+
+
 if test "${USE_X_TOOLKIT}" != "none" ; then
 
 cat >>confdefs.h <<\_ACEOF
@@ -25936,6 +26009,7 @@
 echo "  Does Emacs use -lgpm?                                   ${HAVE_GPM}"
 echo "  Does Emacs use -ldbus?                                  ${HAVE_DBUS}"
 echo "  Does Emacs use -lgconf?                                 ${HAVE_GCONF}"
+echo "  Does Emacs use -lselinux?                               ${HAVE_LIBSELINUX}"
 
 echo "  Does Emacs use -lfreetype?                              ${HAVE_FREETYPE}"
 echo "  Does Emacs use -lm17n-flt?                              ${HAVE_M17N_FLT}"
--- a/configure.in	Tue Apr 20 23:33:39 2010 +0000
+++ b/configure.in	Wed Apr 21 23:03:28 2010 +0000
@@ -161,6 +161,7 @@
 OPTION_DEFAULT_ON([gpm],[don't use -lgpm for mouse support on a GNU/Linux console])
 OPTION_DEFAULT_ON([dbus],[don't compile with D-Bus support])
 OPTION_DEFAULT_ON([gconf],[don't compile with GConf support])
+OPTION_DEFAULT_ON([selinux],[don't compile with SELinux support])
 
 ## For the times when you want to build Emacs but don't have
 ## a suitable makeinfo, and can live without the manuals.
@@ -782,7 +783,7 @@
 if test "$MAKEINFO" = "no"; then
   if test "x${with_makeinfo}" = "xno"; then
     MAKEINFO=off
-  elif ! test -e $srcdir/info/emacs; then
+  elif test ! -e $srcdir/info/emacs; then
     AC_MSG_ERROR( [You do not seem to have makeinfo >= 4.6, and your
 source tree does not seem to have pre-built manuals in the `info' directory.
 Either install a suitable version of makeinfo, or re-run configure
@@ -1611,6 +1612,7 @@
 fi
 
 
+GTK_OBJ=
 if test x"$pkg_check_gtk" = xyes; then
 
   AC_SUBST(GTK_CFLAGS)
@@ -1628,6 +1630,7 @@
   else
     HAVE_GTK=yes
     AC_DEFINE(USE_GTK, 1, [Define to 1 if using GTK.])
+    GTK_OBJ=gtkutil.o
     USE_X_TOOLKIT=none
     if $PKG_CONFIG --atleast-version=2.10 gtk+-2.0; then
       :
@@ -1641,6 +1644,7 @@
   fi
 
 fi
+AC_SUBST(GTK_OBJ)
 
 
 if test "${HAVE_GTK}" = "yes"; then
@@ -1712,14 +1716,17 @@
 dnl other platforms.  Support for higher D-Bus versions than 1.0 is
 dnl also not configured.
 HAVE_DBUS=no
+DBUS_OBJ=
 if test "${with_dbus}" = "yes"; then
    PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.0, HAVE_DBUS=yes, HAVE_DBUS=no)
    if test "$HAVE_DBUS" = yes; then
      LIBS="$LIBS $DBUS_LIBS"
      AC_DEFINE(HAVE_DBUS, 1, [Define to 1 if using D-Bus.])
      AC_CHECK_FUNCS([dbus_watch_get_unix_fd])
+     DBUS_OBJ=dbusbind.o
    fi
 fi
+AC_SUBST(DBUS_OBJ)
 
 dnl GConf has been tested under GNU/Linux only.
 dnl The version is really arbitrary, it is about the same age as Gtk+ 2.6.
@@ -1731,6 +1738,18 @@
    fi
 fi
 
+dnl SELinux is available for GNU/Linux only.
+HAVE_LIBSELINUX=no
+LIBSELINUX_LIBS=
+if test "${with_selinux}" = "yes"; then
+   AC_CHECK_LIB([selinux], [lgetfilecon], HAVE_LIBSELINUX=yes, HAVE_LIBSELINUX=no)
+   if test "$HAVE_LIBSELINUX" = yes; then
+      AC_DEFINE(HAVE_LIBSELINUX, 1, [Define to 1 if using SELinux.])
+      LIBSELINUX_LIBS=-lselinux
+   fi
+fi
+AC_SUBST(LIBSELINUX_LIBS)
+
 dnl Do not put whitespace before the #include statements below.
 dnl Older compilers (eg sunos4 cc) choke on it.
 HAVE_XAW3D=no
@@ -2230,18 +2249,21 @@
 
 ### Use session management (-lSM -lICE) if available
 HAVE_X_SM=no
+LIBXSM=
 if test "${HAVE_X11}" = "yes"; then
   AC_CHECK_HEADER(X11/SM/SMlib.h,
     [AC_CHECK_LIB(SM, SmcOpenConnection, HAVE_X_SM=yes, , -lICE)])
 
   if test "${HAVE_X_SM}" = "yes"; then
     AC_DEFINE(HAVE_X_SM, 1, [Define to 1 if you have the SM library (-lSM).])
+    LIBXSM="-lSM -lICE"
     case "$LIBS" in
       *-lSM*) ;;
-      *)      LIBS="-lSM -lICE $LIBS" ;;
+      *)      LIBS="$LIBXSM $LIBS" ;;
     esac
   fi
 fi
+AC_SUBST(LIBXSM)
 
 # If netdb.h doesn't declare h_errno, we must declare it by hand.
 AC_CACHE_CHECK(whether netdb declares h_errno,
@@ -2749,10 +2771,17 @@
 AC_DEFINE_UNQUOTED(UNEXEC_SRC,       ${UNEXEC_SRC},
 		   [Define to the unexec source file name.])
 
+XMENU_OBJ=
+XOBJ=
 if test "${HAVE_X_WINDOWS}" = "yes" ; then
   AC_DEFINE(HAVE_X_WINDOWS, 1,
 	    [Define to 1 if you want to use the X window system.])
+  XMENU_OBJ=xmenu.o
+  XOBJ="xterm.o xfns.o xselect.o xrdb.o fontset.o xsmfns.o fringe.o image.o xsettings.o xgselect.o"
 fi
+AC_SUBST(XMENU_OBJ)
+AC_SUBST(XOBJ)
+
 if test "${USE_X_TOOLKIT}" != "none" ; then
   AC_DEFINE(USE_X_TOOLKIT, 1, [Define to 1 if using an X toolkit.])
   if test "${USE_X_TOOLKIT}" = "LUCID"; then
@@ -3083,6 +3112,7 @@
 echo "  Does Emacs use -lgpm?                                   ${HAVE_GPM}"
 echo "  Does Emacs use -ldbus?                                  ${HAVE_DBUS}"
 echo "  Does Emacs use -lgconf?                                 ${HAVE_GCONF}"
+echo "  Does Emacs use -lselinux?                               ${HAVE_LIBSELINUX}"
 
 echo "  Does Emacs use -lfreetype?                              ${HAVE_FREETYPE}"
 echo "  Does Emacs use -lm17n-flt?                              ${HAVE_M17N_FLT}"
--- a/doc/emacs/ChangeLog	Tue Apr 20 23:33:39 2010 +0000
+++ b/doc/emacs/ChangeLog	Wed Apr 21 23:03:28 2010 +0000
@@ -1,3 +1,11 @@
+2010-04-21  Jan Djärv  <jan.h.d@swipnet.se>
+
+	* frames.texi (Tool Bars): Add tool-bar-style.
+
+2010-04-21  Glenn Morris  <rgm@gnu.org>
+
+	* ack.texi, emacs.texi (Acknowledgments): Add SELinux support.
+
 2010-04-18  Chong Yidong  <cyd@stupidchicken.com>
 
 	* programs.texi (Semantic): New node.
--- a/doc/emacs/ack.texi	Tue Apr 20 23:33:39 2010 +0000
+++ b/doc/emacs/ack.texi	Wed Apr 21 23:03:28 2010 +0000
@@ -574,6 +574,10 @@
 Emacs.
 
 @item
+Karel Kl@'{@dotless{i}}@v{c} contributed SELinux support, for preserving the
+Security-Enchanced Linux context of files on backup and copy.
+
+@item
 Shuhei Kobayashi wrote @file{hex-util.el}, for operating on hexadecimal
 strings; support for HMAC (Keyed-Hashing for Message Authentication);
 and a Lisp implementation of the SHA1 Secure Hash Algorithm.
--- a/doc/emacs/emacs.texi	Tue Apr 20 23:33:39 2010 +0000
+++ b/doc/emacs/emacs.texi	Wed Apr 21 23:03:28 2010 +0000
@@ -1375,12 +1375,12 @@
 Jones, Simon Josefsson, Arne J@o{}rgensen, Tomoji Kagatani, Brewster
 Kahle, Tokuya Kameshima, Lute Kamstra, David Kastrup, David Kaufman,
 Henry Kautz, Taichi Kawabata, Howard Kaye, Michael Kifer, Richard King,
-Peter Kleiweg, Shuhei Kobayashi, Pavel Kobiakov, Larry K.@: Kolodney,
-David M.@: Koppelman, Koseki Yoshinori, Robert Krawitz, Sebastian
-Kremer, Ryszard Kubiak, David K@aa{}gedal, Daniel LaLiberte, Karl
-Landstrom, Mario Lang, Aaron Larson, James R.@: Larus, Vinicius Jose
-Latorre, Werner Lemberg, Frederic Lepied, Peter Liljenberg, Lars
-Lindberg, Chris Lindblad, Anders Lindgren, Thomas Link, Juri Linkov,
+Peter Kleiweg, Karel Kl@'{@dotless{i}}@v{c}, Shuhei Kobayashi, Pavel
+Kobiakov, Larry K.@: Kolodney, David M.@: Koppelman, Koseki Yoshinori,
+Robert Krawitz, Sebastian Kremer, Ryszard Kubiak, David K@aa{}gedal, Daniel
+LaLiberte, Karl Landstrom, Mario Lang, Aaron Larson, James R.@: Larus,
+Vinicius Jose Latorre, Werner Lemberg, Frederic Lepied, Peter Liljenberg,
+Lars Lindberg, Chris Lindblad, Anders Lindgren, Thomas Link, Juri Linkov,
 Francis Litterio, Emilio C. Lopes, K@'{a}roly L@H{o}rentey, Dave Love,
 Sascha L@"{u}decke, Eric Ludlam, Alan Mackenzie, Christopher J.@:
 Madsen, Neil M.@: Mager, Ken Manheimer, Bill Mann, Brian Marick, Simon
--- a/doc/emacs/frames.texi	Tue Apr 20 23:33:39 2010 +0000
+++ b/doc/emacs/frames.texi	Wed Apr 21 23:03:28 2010 +0000
@@ -1262,6 +1262,13 @@
   You can turn display of tool bars on or off with @kbd{M-x
 tool-bar-mode} or by customizing the option @code{tool-bar-mode}.
 
+@vindex tool-bar-style
+@cindex Tool Bar style
+  When Emacs is compiled with GTK+ support, tool bars can have text and images.
+Customize @code{tool-bar-style} to select style.  The default style is
+the same as for the desktop in the Gnome case.  If no default is found,
+the tool bar uses just images.
+
 @node Dialog Boxes
 @section Using Dialog Boxes
 @cindex dialog boxes
--- a/etc/NEWS	Tue Apr 20 23:33:39 2010 +0000
+++ b/etc/NEWS	Wed Apr 21 23:03:28 2010 +0000
@@ -30,6 +30,9 @@
 These provide no new functionality, they just remove the need to edit
 lib-src/Makefile by hand in order to use the associated features.
 
+** Configure links against libselinux if it is found.
+You can disable this by using --without-selinux.
+
 
 * Startup Changes in Emacs 24.1
 
@@ -65,9 +68,21 @@
 ** GTK scroll-bars are now placed on the right by default.
 Use `set-scroll-bar-mode' to change this.
 
+** GTK tool bars can have just text, just images or images and text.
+Customize `tool-bar-style´ to choose style.  On a Gnome desktop, the default
+is taken from the desktop settings.
+
 ** Lucid menus and dialogs can display antialiased fonts if Emacs is built
 with Xft.
 
+** Basic SELinux support has been added.
+This requires Emacs to be linked with libselinux at build time.
+
+*** Emacs preserves the SELinux file context when backing up or copying files.
+
+*** The new functions file-selinux-context and set-file-selinux-context
+get and set the SELinux context of a file.
+
 ** New scrolling commands `scroll-up-command' and `scroll-down-command'
 (bound to C-v/[next] and M-v/[prior]) does not signal errors at top/bottom
 of buffer at first key-press (instead moves to top/bottom of buffer)
@@ -88,6 +103,8 @@
 ** Archive Mode has basic support to browse 7z archives.
 
 ** partial-completion-mode is now obsolete.
+You can get the same behavior with
+(setq completion-styles '(partial-completion initials)).
 
 ** mpc.el: Can use pseudo tags of the form tag1|tag2 as a union of two tags.
 ** Customize
@@ -106,23 +123,18 @@
 
 ** VC and related modes
 
-*** New VC commands: vc-log-incoming and vc-log-outgoing.
+*** New VC commands: vc-log-incoming, vc-log-outgoing, vc-find-conflicted-file.
 
 *** vc-dir for Bzr supports viewing shelve contents and shelving snapshots.
 
 *** Special markup can be added to log-edit buffers.
-
-**** For Bzr, adding an
-Author: NAME
-line will add "--author NAME" to the "bzr commit" command.
-
-**** For Git, adding an
-Author: NAME
-line will add "--author NAME" to the "git commit" command.
-
-**** For Hg, adding an
-Author: NAME
-line will add "--user NAME" to the "hg commit" command.
+The log-edit buffers are expected to have a format similar to email messages
+with headers of the form:
+  Author: <author of this change>
+  Summary: <one line summary of this change>
+  Fixes: <reference to the bug fixed by this change>
+Some backends handle some of those headers specially, but any unknown header
+is just left as is in the message, so it is not lost.
 
 ** Directory local variables can apply to file-less buffers.
 For example, adding "(diff-mode . ((mode . whitespace)))" to your
--- a/lisp/ChangeLog	Tue Apr 20 23:33:39 2010 +0000
+++ b/lisp/ChangeLog	Wed Apr 21 23:03:28 2010 +0000
@@ -1,3 +1,107 @@
+2010-04-21  Michael Albinus  <michael.albinus@gmx.de>
+
+	Fix Bug#5840.
+
+	* icomplete.el (icomplete-completions): Use `non-essential'.
+
+	* net/tramp.el (tramp-connectable-p): New defun.
+	(tramp-handle-expand-file-name)
+	(tramp-completion-handle-file-name-all-completions)
+	(tramp-completion-handle-file-name-completion): Use it.
+
+2010-04-21  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* emacs-lisp/lisp.el (lisp-completion-at-point): Try and handle errors.
+
+2010-04-21  Jan Djärv  <jan.h.d@swipnet.se>
+
+	* vc-dir.el (vc-dir-tool-bar-map): Add :label on some tool bar items.
+
+	* tool-bar.el (tool-bar-setup): Add :label on some tool bar items.
+
+	* loadup.el: Load dynamic-setting.el if feature dynamic-setting
+	is present.
+
+	* info.el (info-tool-bar-map): Add labels.
+
+	* cus-start.el (all): Add tool-bar-style and tool-bar-max-label-size.
+
+	* cus-edit.el (custom-commands): Add labels for tool bar.
+	(custom-buffer-create-internal, Custom-mode): Adjust for
+	labels in custom-commands.
+
+	* dynamic-setting.el: Renamed from font-setting.el.
+
+2010-04-21  John Wiegley  <jwiegley@gmail.com>
+
+	* ido.el (ido-init-completion-maps): For ido-switch-buffer, C-o
+	toggles the use of virtual buffers.
+	(ido-buffer-internal): Guard `ido-use-virtual-buffers' global
+	value.
+	(ido-toggle-virtual-buffers): New function.
+
+2010-04-21  Juanma Barranquero  <lekktu@gmail.com>
+
+	Use `define-derived-mode'; fix window selection; doc fixes.
+	* play/tetris.el (tetris, tetris-update-speed-function)
+	(tetris-tty-colors, tetris-x-colors, tetris-move-bottom)
+	(tetris-move-left, tetris-move-right, tetris-rotate-prev)
+	(tetris-rotate-next, tetris-end-game, tetris-start-game)
+	(tetris-pause-game): Fix typos in docstrings.
+	(tetris-mode-map, tetris-null-map):
+	Move initialization into declaration.
+	(tetris-mode): Define with `define-derived-mode';
+	set show-trailing-whitespace to nil.
+	(tetris): Prefer window already displaying the "*Tetris*" buffer.
+
+2010-04-21  Karel Klíč  <kklic@redhat.com>
+
+	* files.el (backup-buffer): Handle SELinux context, and return it
+	if a backup was made by renaming.
+	(backup-buffer-copy): Set SELinux context to the target file.
+	(basic-save-buffer): Set SELinux context of the newly written file.
+	(basic-save-buffer-1): Now it also returns any SELinux context.
+	(basic-save-buffer-2): Set SELinux context of the newly created file,
+	and return it.
+	* net/tramp.el (tramp-file-name-for-operation):
+	Add file-selinux-context.
+
+2010-04-21  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* vc.el (vc-checkin, vc-modify-change-comment):
+	Adjust to new vc-start/finish-logentry.
+	(vc-find-conflicted-file): New command.
+	(vc-transfer-file): Adjust to new vc-checkin.
+	(vc-next-action): Improve scoping.
+
+	* vc-hg.el (vc-hg-log-edit-mode): Remove.
+	(vc-hg-checkin): Remove extra arg.  Use log-edit-extract-headers.
+
+	* vc-git.el (vc-git-log-edit-mode): Remove.
+	(vc-git-checkin): Remove extra arg.  Use log-edit-extract-headers.
+	(vc-git-commits-coding-system): Rename from git-commits-coding-system.
+
+	* vc-dispatcher.el (vc-log-edit): Shorten names for log-edit-show-files.
+	(vc-start-logentry): Remove argument `extra'.
+	(vc-finish-logentry): Remove extra args.
+
+	* vc-bzr.el (vc-bzr-log-edit-mode): Remove.
+	(vc-bzr-checkin): Remove extra arg.  Use log-edit-extract-headers.
+	(vc-bzr-conflicted-files): New function.
+
+	* log-edit.el (log-edit-extra-flags)
+	(log-edit-before-checkin-process): Remove.
+	(log-edit-summary, log-edit-header, log-edit-unknown-header): New faces.
+	(log-edit-headers-alist): New var.
+	(log-edit-header-contents-regexp): New const.
+	(log-edit-match-to-eoh): New function.
+	(log-edit-font-lock-keywords): Use them.
+	(log-edit): Insert a "Summary:" header as default.
+	(log-edit-mode): Mark font-lock rules as case-insensitive.
+	(log-edit-done): Cleanup headers.
+	(log-view-process-buffer): Remove.
+	(log-edit-extract-headers): New function to replace it.
+
 2010-04-20  Juanma Barranquero  <lekktu@gmail.com>
 
 	* subr.el (default-direction-reversed): Remove obsolescence info.
--- a/lisp/cus-edit.el	Tue Apr 20 23:33:39 2010 +0000
+++ b/lisp/cus-edit.el	Wed Apr 21 23:03:28 2010 +0000
@@ -739,25 +739,31 @@
 (defvar custom-commands
   '(("Set for current session" Custom-set t
      "Apply all settings in this buffer to the current session"
-     "index")
+     "index"
+     "Apply")
     ("Save for future sessions" Custom-save
      (or custom-file user-init-file)
      "Apply all settings in this buffer and save them for future Emacs sessions."
-     "save")
+     "save"
+     "Save")
     ("Undo edits" Custom-reset-current t
      "Restore all settings in this buffer to reflect their current values."
-     "refresh")
+     "refresh"
+     "Undo")
     ("Reset to saved" Custom-reset-saved t
      "Restore all settings in this buffer to their saved values (if any)."
-     "undo")
+     "undo"
+     "Reset")
     ("Erase customizations" Custom-reset-standard
      (or custom-file user-init-file)
      "Un-customize all settings in this buffer and save them with standard values."
-     "delete")
+     "delete"
+     "Uncustomize")
     ("Help for Customize" Custom-help t
      "Get help for using Customize."
-     "help")
-    ("Exit" Custom-buffer-done t "Exit Customize." "exit")))
+     "help"
+     "Help")
+    ("Exit" Custom-buffer-done t "Exit Customize." "exit" "Exit")))
 
 (defun Custom-help ()
   "Read the node on Easy Customization in the Emacs manual."
@@ -1616,7 +1622,7 @@
     (if custom-buffer-verbose-help
 	(widget-insert "
  Operate on all settings in this buffer:\n"))
-    (let ((button (lambda (tag action active help icon)
+    (let ((button (lambda (tag action active help icon label)
 		    (widget-insert " ")
 		    (if (eval active)
 			(widget-create 'push-button :tag tag
@@ -4680,7 +4686,8 @@
 	     (mapc
 	      (lambda (arg)
 		(tool-bar-local-item-from-menu
-		 (nth 1 arg) (nth 4 arg) map custom-mode-map))
+		 (nth 1 arg) (nth 4 arg) map custom-mode-map
+		 :label (nth 5 arg)))
 	      custom-commands)
 	     (setq custom-tool-bar-map map))))
   (make-local-variable 'custom-options)
--- a/lisp/cus-start.el	Tue Apr 20 23:33:39 2010 +0000
+++ b/lisp/cus-start.el	Wed Apr 21 23:03:28 2010 +0000
@@ -339,6 +339,15 @@
 		       (const :tag "Off (nil)" :value nil)
 		       (const :tag "Immediate" :value t)
 		       (number :tag "Delay by secs" :value 0.5)) "22.1")
+             (tool-bar-style
+	      frames (choice
+		      (const :tag "Images" :value image)
+		      (const :tag "Text" :value text)
+		      (const :tag "Both" :value both)
+		      (const :tag "Both-horiz" :value both-horiz)
+		      (const :tag "System default" :value nil)) "23.3")
+             (tool-bar-max-label-size frames integer "23.3")
+
 	     ;; xfaces.c
 	     (scalable-fonts-allowed display boolean "22.1")
 	     ;; xfns.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lisp/dynamic-setting.el	Wed Apr 21 23:03:28 2010 +0000
@@ -0,0 +1,105 @@
+;;; dynamic-setting.el --- Support dynamic changes
+
+;; Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+
+;; Author: Jan Djärv <jan.h.d@swipnet.se>
+;; Maintainer: FSF
+;; Keywords: font, system-font, tool-bar-style
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; This file provides the lisp part of the GConf and XSetting code in
+;; xsetting.c.  But it is nothing that prevents it from being used by
+;; other configuration schemes.
+
+;;; Code:
+
+;;; Customizable variables
+
+(declare-function font-get-system-font "xsettings.c" ())
+
+(defvar font-use-system-font)
+
+(defun font-setting-change-default-font (display-or-frame set-font)
+  "Change font and/or font settings for frames on display DISPLAY-OR-FRAME.
+If DISPLAY-OR-FRAME is a frame, the display is the one for that frame.
+
+If SET-FONT is non-nil, change the font for frames.  Otherwise re-apply the
+current form for the frame (i.e. hinting or somesuch changed)."
+
+  (let ((new-font (and (fboundp 'font-get-system-font)
+		       (font-get-system-font))))
+    (when new-font
+      ;; Be careful here: when set-face-attribute is called for the
+      ;; :font attribute, Emacs tries to guess the best matching font
+      ;; by examining the other face attributes (Bug#2476).
+
+      (clear-font-cache)
+      ;; Set for current frames. Only change font for those that have
+      ;; the old font now. If they don't have the old font, the user
+      ;; probably changed it.
+      (dolist (f (frames-on-display-list display-or-frame))
+	(if (display-graphic-p f)
+	    (let* ((frame-font
+		    (or (font-get (face-attribute 'default :font f
+						  'default) :user-spec)
+			(frame-parameter f 'font-parameter)))
+		   (font-to-set
+		    (if set-font new-font
+		      ;; else set font again, hinting etc. may have changed.
+		      frame-font)))
+	      (if font-to-set
+		  (progn
+		    (message "setting %s" font-to-set)
+		    (set-frame-parameter f 'font-parameter font-to-set)
+		    (set-face-attribute 'default f
+					:width 'normal
+					:weight 'normal
+					:slant 'normal
+					:font font-to-set))))))
+
+      ;; Set for future frames.
+      (set-face-attribute 'default t :font new-font)
+      (let ((spec (list (list t (face-attr-construct 'default)))))
+	(progn
+	  (put 'default 'customized-face spec)
+	  (custom-push-theme 'theme-face 'default 'user 'set spec)
+	  (put 'default 'face-modified nil))))))
+
+(defun dynamic-setting-handle-config-changed-event (event)
+  "Handle config-changed-event on the display in EVENT.
+Changes can be
+  The monospace font. If `font-use-system-font' is nil, the font
+    is not changed.
+  Xft parameters, like DPI and hinting.
+  The tool bar style."
+  (interactive "e")
+  (let ((type (nth 1 event))
+	(display-name (nth 2 event)))
+    (cond ((and (eq type 'monospace-font-name) font-use-system-font)
+	   (font-setting-change-default-font display-name t))
+
+	  ((eq type 'font-render)
+	   (font-setting-change-default-font display-name nil))
+
+	  ((eq type 'tool-bar-style) (force-mode-line-update t)))))
+
+(define-key special-event-map [config-changed-event]
+  'dynamic-setting-handle-config-changed-event)
+
+;; arch-tag: 3a57e78f-1cd6-48b6-ab75-98f160dcc017
--- a/lisp/emacs-lisp/cl-loaddefs.el	Tue Apr 20 23:33:39 2010 +0000
+++ b/lisp/emacs-lisp/cl-loaddefs.el	Wed Apr 21 23:03:28 2010 +0000
@@ -1242,7 +1242,6 @@
 ;; version-control: never
 ;; no-byte-compile: t
 ;; no-update-autoloads: t
+;; coding: utf-8
 ;; End:
-
-;; arch-tag: 08cc5aab-e992-47f6-992e-12a7428c1a0e
 ;;; cl-loaddefs.el ends here
--- a/lisp/emacs-lisp/lisp.el	Tue Apr 20 23:33:39 2010 +0000
+++ b/lisp/emacs-lisp/lisp.el	Wed Apr 21 23:03:28 2010 +0000
@@ -633,10 +633,12 @@
   ;; FIXME: the `end' could be after point?
   (let* ((pos (point))
          (beg (with-syntax-table emacs-lisp-mode-syntax-table
-                (save-excursion
-                  (backward-sexp 1)
-                  (skip-syntax-forward "'")
-                  (point))))
+                (condition-case nil
+                    (save-excursion
+                      (backward-sexp 1)
+                      (skip-syntax-forward "'")
+                      (point))
+                  (scan-error pos))))
          (predicate
           (or predicate
               (save-excursion
@@ -658,12 +660,14 @@
                     'fboundp)))))
          (end
           (unless (or (eq beg (point-max))
-                      (member (char-syntax (char-after beg)) '(?\( ?\))))
-            (save-excursion
-              (goto-char beg)
-              (forward-sexp 1)
-              (when (>= (point) pos)
-                (point))))))
+                      (member (char-syntax (char-after beg)) '(?\" ?\( ?\))))
+            (condition-case nil
+                (save-excursion
+                  (goto-char beg)
+                  (forward-sexp 1)
+                  (when (>= (point) pos)
+                    (point)))
+                  (scan-error pos)))))
     (when end
       (list beg end obarray
             :predicate predicate
--- a/lisp/files.el	Tue Apr 20 23:33:39 2010 +0000
+++ b/lisp/files.el	Wed Apr 21 23:03:28 2010 +0000
@@ -3625,10 +3625,13 @@
 no longer accessible under its old name.
 
 The value is non-nil after a backup was made by renaming.
-It has the form (MODES . BACKUPNAME).
+It has the form (MODES SELINUXCONTEXT BACKUPNAME).
 MODES is the result of `file-modes' on the original
 file; this means that the caller, after saving the buffer, should change
 the modes of the new file to agree with the old modes.
+SELINUXCONTEXT is the result of `file-selinux-context' on the original
+file; this means that the caller, after saving the buffer, should change
+the SELinux context of the new file to agree with the old context.
 BACKUPNAME is the backup file name, which is the old file renamed."
   (if (and make-backup-files (not backup-inhibited)
 	   (not buffer-backed-up)
@@ -3656,7 +3659,8 @@
 			    (or delete-old-versions
 				(y-or-n-p (format "Delete excess backup versions of %s? "
 						  real-file-name)))))
-		      (modes (file-modes buffer-file-name)))
+		      (modes (file-modes buffer-file-name))
+		      (context (file-selinux-context buffer-file-name)))
 		  ;; Actually write the back up file.
 		  (condition-case ()
 		      (if (or file-precious-flag
@@ -3676,10 +3680,10 @@
 						   (<= (nth 2 attr) backup-by-copying-when-privileged-mismatch)))
 					  (or (nth 9 attr)
 					      (not (file-ownership-preserved-p real-file-name)))))))
-			  (backup-buffer-copy real-file-name backupname modes)
+			  (backup-buffer-copy real-file-name backupname modes context)
 			;; rename-file should delete old backup.
 			(rename-file real-file-name backupname t)
-			(setq setmodes (cons modes backupname)))
+			(setq setmodes (list modes context backupname)))
 		    (file-error
 		     ;; If trouble writing the backup, write it in ~.
 		     (setq backupname (expand-file-name
@@ -3688,7 +3692,7 @@
 		     (message "Cannot write backup file; backing up in %s"
 			      backupname)
 		     (sleep-for 1)
-		     (backup-buffer-copy real-file-name backupname modes)))
+		     (backup-buffer-copy real-file-name backupname modes context)))
 		  (setq buffer-backed-up t)
 		  ;; Now delete the old versions, if desired.
 		  (if delete-old-versions
@@ -3700,7 +3704,7 @@
 		  setmodes)
 	    (file-error nil))))))
 
-(defun backup-buffer-copy (from-name to-name modes)
+(defun backup-buffer-copy (from-name to-name modes context)
   (let ((umask (default-file-modes)))
     (unwind-protect
 	(progn
@@ -3727,7 +3731,9 @@
       ;; Reset the umask.
       (set-default-file-modes umask)))
   (and modes
-       (set-file-modes to-name (logand modes #o1777))))
+       (set-file-modes to-name (logand modes #o1777)))
+  (and context
+       (set-file-selinux-context to-name context)))
 
 (defun file-name-sans-versions (name &optional keep-backup-version)
   "Return file NAME sans backup versions or strings.
@@ -4257,7 +4263,9 @@
 		  (nthcdr 10 (file-attributes buffer-file-name)))
 	    (if setmodes
 		(condition-case ()
-		    (set-file-modes buffer-file-name (car setmodes))
+		    (progn
+		      (set-file-modes buffer-file-name (car setmodes))
+		      (set-file-selinux-context buffer-file-name (nth 1 setmodes)))
 		  (error nil))))
 	  ;; If the auto-save file was recent before this command,
 	  ;; delete it now.
@@ -4270,7 +4278,7 @@
 ;; This does the "real job" of writing a buffer into its visited file
 ;; and making a backup file.  This is what is normally done
 ;; but inhibited if one of write-file-functions returns non-nil.
-;; It returns a value (MODES . BACKUPNAME), like backup-buffer.
+;; It returns a value (MODES SELINUXCONTEXT BACKUPNAME), like backup-buffer.
 (defun basic-save-buffer-1 ()
   (prog1
       (if save-buffer-coding-system
@@ -4282,7 +4290,7 @@
       (setq buffer-file-coding-system-explicit
 	    (cons last-coding-system-used nil)))))
 
-;; This returns a value (MODES . BACKUPNAME), like backup-buffer.
+;; This returns a value (MODES SELINUXCONTEXT BACKUPNAME), like backup-buffer.
 (defun basic-save-buffer-2 ()
   (let (tempsetmodes setmodes)
     (if (not (file-writable-p buffer-file-name))
@@ -4353,8 +4361,9 @@
 	    ;; Since we have created an entirely new file,
 	    ;; make sure it gets the right permission bits set.
 	    (setq setmodes (or setmodes
- 			       (cons (or (file-modes buffer-file-name)
+ 			       (list (or (file-modes buffer-file-name)
 					 (logand ?\666 umask))
+				     (file-selinux-context buffer-file-name)
 				     buffer-file-name)))
 	    ;; We succeeded in writing the temp file,
 	    ;; so rename it.
@@ -4365,8 +4374,11 @@
 	;; (setmodes is set) because that says we're superseding.
 	(cond ((and tempsetmodes (not setmodes))
 	       ;; Change the mode back, after writing.
-	       (setq setmodes (cons (file-modes buffer-file-name) buffer-file-name))
-	       (set-file-modes buffer-file-name (logior (car setmodes) 128))))
+	       (setq setmodes (list (file-modes buffer-file-name)
+				    (file-selinux-context buffer-file-name)
+				    buffer-file-name))
+	       (set-file-modes buffer-file-name (logior (car setmodes) 128))
+	       (set-file-selinux-context buffer-file-name (nth 1 setmodes)))))
 	(let (success)
 	  (unwind-protect
 	      (progn
@@ -4380,8 +4392,8 @@
 	    ;; the backup by renaming, undo the backing-up.
 	    (and setmodes (not success)
 		 (progn
-		   (rename-file (cdr setmodes) buffer-file-name t)
-		   (setq buffer-backed-up nil)))))))
+		   (rename-file (nth 2 setmodes) buffer-file-name t)
+		   (setq buffer-backed-up nil))))))
     setmodes))
 
 (defun diff-buffer-with-file (&optional buffer)
--- a/lisp/font-setting.el	Tue Apr 20 23:33:39 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,101 +0,0 @@
-;;; font-setting.el --- Support dynamic font changes
-
-;; Copyright (C) 2009, 2010 Free Software Foundation, Inc.
-
-;; Author: Jan Djärv <jan.h.d@swipnet.se>
-;; Maintainer: FSF
-;; Keywords: font, system-font
-
-;; This file is part of GNU Emacs.
-
-;; GNU Emacs is free software: you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation, either version 3 of the License, or
-;; (at your option) any later version.
-
-;; GNU Emacs is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-;; GNU General Public License for more details.
-
-;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
-
-;;; Commentary:
-
-;; This file provides the lisp part of the GConf and XSetting code in
-;; xsetting.c.  But it is nothing that prevents it from being used by
-;; other configuration schemes.
-
-;;; Code:
-
-;;; Customizable variables
-
-(declare-function font-get-system-font "xsettings.c" ())
-
-(defvar font-use-system-font)
-
-(defun font-setting-change-default-font (display-or-frame set-font)
-  "Change font and/or font settings for frames on display DISPLAY-OR-FRAME.
-If DISPLAY-OR-FRAME is a frame, the display is the one for that frame.
-
-If SET-FONT is non-nil, change the font for frames.  Otherwise re-apply the
-current form for the frame (i.e. hinting or somesuch changed)."
-
-  (let ((new-font (and (fboundp 'font-get-system-font)
-		       (font-get-system-font))))
-    (when new-font
-      ;; Be careful here: when set-face-attribute is called for the
-      ;; :font attribute, Emacs tries to guess the best matching font
-      ;; by examining the other face attributes (Bug#2476).
-
-      (clear-font-cache)
-      ;; Set for current frames. Only change font for those that have
-      ;; the old font now. If they don't have the old font, the user
-      ;; probably changed it.
-      (dolist (f (frames-on-display-list display-or-frame))
-	(if (display-graphic-p f)
-	    (let* ((frame-font
-		    (or (font-get (face-attribute 'default :font f
-						  'default) :user-spec)
-			(frame-parameter f 'font-parameter)))
-		   (font-to-set
-		    (if set-font new-font
-		      ;; else set font again, hinting etc. may have changed.
-		      frame-font)))
-	      (if font-to-set
-		  (progn
-		    (message "setting %s" font-to-set)
-		    (set-frame-parameter f 'font-parameter font-to-set)
-		    (set-face-attribute 'default f
-					:width 'normal
-					:weight 'normal
-					:slant 'normal
-					:font font-to-set))))))
-
-      ;; Set for future frames.
-      (set-face-attribute 'default t :font new-font)
-      (let ((spec (list (list t (face-attr-construct 'default)))))
-	(progn
-	  (put 'default 'customized-face spec)
-	  (custom-push-theme 'theme-face 'default 'user 'set spec)
-	  (put 'default 'face-modified nil))))))
-
-(defun font-setting-handle-config-changed-event (event)
-  "Handle config-changed-event to change fonts on the display in EVENT.
-If `font-use-system-font' is nil, the font is not changed."
-  (interactive "e")
-  (let ((type (nth 1 event)) ;; font-name or font-render
-	(display-name (nth 2 event)))
-    (if (or (not (eq type 'font-name))
-	    font-use-system-font)
-	(font-setting-change-default-font display-name
-					  (eq type 'font-name)))))
-
-(if (or (featurep 'system-font-setting) (featurep 'font-render-setting))
-  (define-key special-event-map [config-changed-event]
-    'font-setting-handle-config-changed-event))
-
-(provide 'font-setting)
-
-;; arch-tag: 3a57e78f-1cd6-48b6-ab75-98f160dcc017
--- a/lisp/icomplete.el	Tue Apr 20 23:33:39 2010 +0000
+++ b/lisp/icomplete.el	Wed Apr 21 23:03:28 2010 +0000
@@ -283,7 +283,8 @@
 matches exist.  \(Keybindings for uniquely matched commands
 are exhibited within the square braces.)"
 
-  (let* ((comps (completion-all-sorted-completions))
+  (let* ((non-essential t)
+	 (comps (completion-all-sorted-completions))
          (last (if (consp comps) (last comps)))
          (base-size (cdr last))
          (open-bracket (if require-match "(" "["))
--- a/lisp/ido.el	Tue Apr 20 23:33:39 2010 +0000
+++ b/lisp/ido.el	Wed Apr 21 23:03:28 2010 +0000
@@ -1633,6 +1633,7 @@
     (define-key map "\C-x\C-f" 'ido-enter-find-file)
     (define-key map "\C-x\C-b" 'ido-fallback-command)
     (define-key map "\C-k" 'ido-kill-buffer-at-head)
+    (define-key map "\C-o" 'ido-toggle-virtual-buffers)
     (set-keymap-parent map ido-common-completion-map)
     (setq ido-buffer-completion-map map)))
 
@@ -2182,6 +2183,7 @@
 	   (ido-current-directory nil)
 	   (ido-directory-nonreadable nil)
 	   (ido-directory-too-big nil)
+	   (ido-use-virtual-buffers ido-use-virtual-buffers)
 	   (require-match (confirm-nonexistent-file-or-buffer))
 	   (buf (ido-read-internal 'buffer (or prompt "Buffer: ") 'ido-buffer-history default
 				   require-match initial))
@@ -2705,6 +2707,16 @@
 	(setq ido-exit 'keep)
 	(exit-minibuffer))))
 
+(defun ido-toggle-virtual-buffers ()
+  "Toggle the use of virtual buffers.
+See `ido-use-virtual-buffers' for explanation of virtual buffer."
+  (interactive)
+  (when (and ido-mode (eq ido-cur-item 'buffer))
+    (setq ido-use-virtual-buffers (not ido-use-virtual-buffers))
+    (setq ido-text-init ido-text)
+    (setq ido-exit 'refresh)
+    (exit-minibuffer)))
+
 (defun ido-reread-directory ()
   "Read current directory again.
 May be useful if cached version is no longer valid, but directory
--- a/lisp/info.el	Tue Apr 20 23:33:39 2010 +0000
+++ b/lisp/info.el	Wed Apr 21 23:03:28 2010 +0000
@@ -3736,9 +3736,11 @@
 (defvar info-tool-bar-map
   (let ((map (make-sparse-keymap)))
     (tool-bar-local-item-from-menu 'Info-history-back "left-arrow" map Info-mode-map
-				   :rtl "right-arrow")
+				   :rtl "right-arrow"
+				   :label "Back")
     (tool-bar-local-item-from-menu 'Info-history-forward "right-arrow" map Info-mode-map
-				   :rtl "left-arrow")
+				   :rtl "left-arrow"
+				   :label "Forward")
     (tool-bar-local-item-from-menu 'Info-prev "prev-node" map Info-mode-map
 				   :rtl "next-node")
     (tool-bar-local-item-from-menu 'Info-next "next-node" map Info-mode-map
@@ -3746,7 +3748,8 @@
     (tool-bar-local-item-from-menu 'Info-up "up-node" map Info-mode-map)
     (tool-bar-local-item-from-menu 'Info-top-node "home" map Info-mode-map)
     (tool-bar-local-item-from-menu 'Info-goto-node "jump-to" map Info-mode-map)
-    (tool-bar-local-item-from-menu 'Info-index "index" map Info-mode-map)
+    (tool-bar-local-item-from-menu 'Info-index "index" map Info-mode-map
+				   :label "Index Search")
     (tool-bar-local-item-from-menu 'Info-search "search" map Info-mode-map)
     (tool-bar-local-item-from-menu 'Info-exit "exit" map Info-mode-map)
     map))
--- a/lisp/loadup.el	Tue Apr 20 23:33:39 2010 +0000
+++ b/lisp/loadup.el	Wed Apr 21 23:03:28 2010 +0000
@@ -203,8 +203,8 @@
       (load "dnd")
       (load "tool-bar")))
 
-(if (or (featurep 'system-font-setting) (featurep 'font-render-setting))
-    (load "font-setting"))
+(if (featurep 'dynamic-setting)
+    (load "dynamic-setting"))
 
 (if (featurep 'x)
     (progn
--- a/lisp/log-edit.el	Tue Apr 20 23:33:39 2010 +0000
+++ b/lisp/log-edit.el	Wed Apr 21 23:03:28 2010 +0000
@@ -125,6 +125,7 @@
   :type 'boolean)
 
 (defcustom log-edit-hook '(log-edit-insert-cvs-template
+                           log-edit-show-files
 			   log-edit-insert-changelog)
   "Hook run at the end of `log-edit'."
   :group 'log-edit
@@ -188,22 +189,6 @@
 (defvar log-edit-callback nil)
 (defvar log-edit-diff-function nil)
 (defvar log-edit-listfun nil)
-(defvar log-edit-extra-flags nil
-  "List of extra flags to pass to the check in command.")
-(defvar log-edit-before-checkin-process nil
-  "Alist with instructions for processing the commit message before check in.
-The format is: (REGEXP . INSTRUCTIONS).
-All lines matching REGEXP are removed.  For example:
-
-\(\"^#.*\" . nil)
-
-means: just remove all lines starting with #.  This can be used
-to insert lines in the commit buffer that contain, for example, the
-list of files to be committed.
-
-\(\"Author: \\\\(.*\\\\)\" . (list \"--author\" (match-string 1)))
-
-means: append (list \"--author\" (match-string 1)) to `log-edit-extra-flags'.")
 
 (defvar log-edit-parent-buffer nil)
 
@@ -329,10 +314,53 @@
 ;;; Actual code
 ;;;
 
+(defface log-edit-summary '((t :inherit font-lock-function-name-face))
+  "Face for the summary in `log-edit-mode' buffers.")
+
+(defface log-edit-header '((t :inherit font-lock-keyword-face))
+  "Face for the headers in `log-edit-mode' buffers.")
+
+(defface log-edit-unknown-header '((t :inherit font-lock-comment-face))
+  "Face for unknown headers in `log-edit-mode' buffers.")
+
+(defvar log-edit-headers-alist '(("Summary" . log-edit-summary)
+                                 ("Fixes") ("Author"))
+  "AList of known headers and the face to use to highlight them.")
+
+(defconst log-edit-header-contents-regexp
+  "[ \t]*\\(.*\\(\n[ \t].*\\)*\\)\n?")
+
+(defun log-edit-match-to-eoh (limit)
+  ;; FIXME: copied from message-match-to-eoh.
+  (let ((start (point)))
+    (rfc822-goto-eoh)
+    ;; Typical situation: some temporary change causes the header to be
+    ;; incorrect, so EOH comes earlier than intended: the last lines of the
+    ;; intended headers are now not considered part of the header any more,
+    ;; so they don't have the multiline property set.  When the change is
+    ;; completed and the header has its correct shape again, the lack of the
+    ;; multiline property means we won't rehighlight the last lines of
+    ;; the header.
+    (if (< (point) start)
+        nil                             ;No header within start..limit.
+      ;; Here we disregard LIMIT so that we may extend the area again.
+      (set-match-data (list start (point)))
+      (point))))
+
 (defvar log-edit-font-lock-keywords
-  '(("\\`\\(Summary:\\)\\(.*\\)"
-     (1 font-lock-keyword-face)
-     (2 font-lock-function-name-face))))
+  ;; Copied/inspired by message-font-lock-keywords.
+  `((log-edit-match-to-eoh
+     (,(concat "^\\(\\([a-z]+\\):\\)" log-edit-header-contents-regexp
+               "\\|\\(.*\\)")
+      (progn (goto-char (match-beginning 0)) (match-end 0)) nil
+      (1 (if (assoc (match-string 2) log-edit-headers-alist)
+             'log-edit-header
+           'log-edit-unknown-header)
+         nil lax)
+      (3 (or (cdr (assoc (match-string 2) log-edit-headers-alist))
+             'log-edit-header)
+         nil lax)
+      (4 font-lock-warning-face)))))
 
 ;;;###autoload
 (defun log-edit (callback &optional setup params buffer mode &rest ignore)
@@ -358,7 +386,10 @@
     (if buffer (pop-to-buffer buffer))
     (when (and log-edit-setup-invert (not (eq setup 'force)))
       (setq setup (not setup)))
-    (when setup (erase-buffer))
+    (when setup
+      (erase-buffer)
+      (insert "Summary: ")
+      (save-excursion (insert "\n\n")))
     (if mode
 	(funcall mode)
       (log-edit-mode))
@@ -387,7 +418,7 @@
 
 \\{log-edit-mode-map}"
   (set (make-local-variable 'font-lock-defaults)
-       '(log-edit-font-lock-keywords t))
+       '(log-edit-font-lock-keywords t t))
   (make-local-variable 'log-edit-comment-ring-index)
   (hack-dir-local-variables-non-file-buffer))
 
@@ -401,6 +432,17 @@
   "Finish editing the log message and commit the files.
 If you want to abort the commit, simply delete the buffer."
   (interactive)
+  ;; Clean up empty headers.
+  (goto-char (point-min))
+  (while (looking-at (concat "^[a-z]*:" log-edit-header-contents-regexp))
+    (let ((beg (match-beginning 0)))
+      (goto-char (match-end 0))
+      (if (string-match "\\`[ \n\t]*\\'" (match-string 1))
+          (delete-region beg (point)))))
+  ;; Get rid of leading empty lines.
+  (goto-char (point-min))
+  (when (looking-at "\\([ \t]*\n\\)+")
+    (delete-region (match-beginning 0) (match-end 0)))
   ;; Get rid of trailing empty lines
   (goto-char (point-max))
   (skip-syntax-backward " ")
@@ -458,12 +500,13 @@
   "(Un)Indent the current buffer rigidly to `log-edit-common-indent'."
   (save-excursion
     (let ((common (point-max)))
-      (goto-char (point-min))
+      (rfc822-goto-eoh)
       (while (< (point) (point-max))
         (if (not (looking-at "^[ \t]*$"))
             (setq common (min common (current-indentation))))
         (forward-line 1))
-      (indent-rigidly (point-min) (point-max)
+      (rfc822-goto-eoh)
+      (indent-rigidly (point) (point-max)
 		      (- log-edit-common-indent common)))))
 
 (defun log-edit-show-diff ()
@@ -546,6 +589,10 @@
 or if the command is repeated a second time in a row, use the first log entry
 regardless of user name or time."
   (interactive "P")
+  (let ((eoh (save-excursion (rfc822-goto-eoh) (point))))
+    (when (<= (point) eoh)
+      (goto-char eoh)
+      (if (looking-at "\n") (forward-char 1))))
   (let ((log-edit-changelog-use-first
 	 (or use-first (eq last-command 'log-edit-insert-changelog))))
     (log-edit-insert-changelog-entries (log-edit-files)))
@@ -731,16 +778,39 @@
       (log-edit-changelog-insert-entries (car buffer-entry) (cdr buffer-entry))
       (when (cdr buffer-entry) (newline)))))
 
-(defun log-view-process-buffer ()
-  (when log-edit-before-checkin-process
-    (dolist (crt log-edit-before-checkin-process)
-      ;; Remove all lines matching (car crt)
-      ;; Append to `log-edit-extra-flags' the results of (cdr crt).
+(defun log-edit-extract-headers (headers comment)
+  "Extract headers from COMMENT to form command line arguments.
+HEADERS should be an alist with elements of the form (HEADER . CMDARG)
+associating header names to the corresponding cmdline option name and the
+result is then a list of the form (MSG CMDARG1 HDRTEXT1 CMDARG2 HDRTEXT2...).
+where MSG is the remaining text from STRING.
+If \"Summary\" is not in HEADERS, then the \"Summary\" header is extracted
+anyway and put back as the first line of MSG."
+  (with-temp-buffer
+    (insert comment)
+    (rfc822-goto-eoh)
+    (narrow-to-region (point-min) (point))
+    (let ((case-fold-search t)
+          (summary ())
+          (res ()))
+      (dolist (header (if (assoc "Summary" headers) headers
+                        (cons '("Summary" . t) headers)))
+        (goto-char (point-min))
+        (while (re-search-forward (concat "^" (car header)
+                                          ":" log-edit-header-contents-regexp)
+                                  nil t)
+          (if (eq t (cdr header))
+              (setq summary (match-string 1))
+            (push (match-string 1) res)
+            (push (or (cdr header) (car header)) res))
+          (replace-match "" t t)))
+      ;; Remove header separator if the header is empty.
+      (widen)
       (goto-char (point-min))
-      (while (re-search-forward (car crt) nil t)
-	(when (cdr crt)
-	  (setq log-edit-extra-flags (append log-edit-extra-flags (eval (cdr crt)))))
-	(replace-match "" nil t)))))
+      (when (looking-at "\\([ \t]*\n\\)+")
+        (delete-region (match-beginning 0) (match-end 0)))
+      (if summary (insert summary "\n"))
+      (cons (buffer-string) res))))
 
 (provide 'log-edit)
 
--- a/lisp/net/tramp.el	Tue Apr 20 23:33:39 2010 +0000
+++ b/lisp/net/tramp.el	Wed Apr 21 23:03:28 2010 +0000
@@ -4225,7 +4225,7 @@
   (unless (file-name-absolute-p name)
     (setq name (concat (file-name-as-directory dir) name)))
   ;; If NAME is not a Tramp file, run the real handler.
-  (if (not (tramp-tramp-file-p name))
+  (if (not (tramp-connectable-p name))
       (tramp-run-real-handler 'expand-file-name (list name nil))
     ;; Dissect NAME.
     (with-parsed-tramp-file-name name nil
@@ -5326,7 +5326,7 @@
 		  'dired-compress-file 'dired-uncache
 		  'file-accessible-directory-p 'file-attributes
 		  'file-directory-p 'file-executable-p 'file-exists-p
-		  'file-local-copy 'file-remote-p 'file-modes
+		  'file-local-copy 'file-remote-p 'file-modes 'file-selinux-context
 		  'file-name-as-directory 'file-name-directory
 		  'file-name-nondirectory 'file-name-sans-versions
 		  'file-ownership-preserved-p 'file-readable-p
@@ -5647,6 +5647,15 @@
 		   (funcall (symbol-function 'event-to-character)
 			    last-input-event) ?\ )))))))
 
+(defun tramp-connectable-p (filename)
+  "Check, whether it is possible to connect the remote host w/o side-effects.
+This is true, if either the remote host is already connected, or if we are
+not in completion mode."
+  (and (tramp-tramp-file-p filename)
+       (with-parsed-tramp-file-name filename nil
+	 (or (get-buffer (tramp-buffer-name v))
+	     (not (tramp-completion-mode-p))))))
+
 ;; Method, host name and user name completion.
 ;; `tramp-completion-dissect-file-name' returns a list of
 ;; tramp-file-name structures. For all of them we return possible completions.
@@ -5710,8 +5719,9 @@
     (append
      result1
      (condition-case nil
-	 (tramp-completion-run-real-handler
-	  'file-name-all-completions (list filename directory))
+	 (when (tramp-connectable-p fullname)
+	   (tramp-completion-run-real-handler
+	    'file-name-all-completions (list filename directory)))
        (error nil)))))
 
 ;; Method, host name and user name completion for a file.
@@ -5722,7 +5732,8 @@
   (try-completion
    filename
    (mapcar 'list (file-name-all-completions filename directory))
-   (when predicate
+   (when (and predicate
+	      (tramp-connectable-p (expand-file-name filename directory)))
      (lambda (x) (funcall predicate (expand-file-name (car x) directory))))))
 
 ;; I misuse a little bit the tramp-file-name structure in order to handle
--- a/lisp/play/tetris.el	Tue Apr 20 23:33:39 2010 +0000
+++ b/lisp/play/tetris.el	Wed Apr 21 23:03:28 2010 +0000
@@ -35,7 +35,7 @@
 ;; ;;;;;;;;;;;;; customization variables ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 (defgroup tetris nil
-  "Play a game of tetris."
+  "Play a game of Tetris."
   :prefix "tetris-"
   :group 'games)
 
@@ -61,10 +61,10 @@
 
 (defcustom tetris-update-speed-function
   'tetris-default-update-speed-function
-  "Function run whenever the Tetris score changes
+  "Function run whenever the Tetris score changes.
 Called with two arguments: (SHAPES ROWS)
-SHAPES is the number of shapes which have been dropped
-ROWS is the number of rows which have been completed
+SHAPES is the number of shapes which have been dropped.
+ROWS is the number of rows which have been completed.
 
 If the return value is a number, it is used as the timer period."
   :group 'tetris
@@ -77,7 +77,7 @@
 
 (defcustom tetris-tty-colors
   [nil "blue" "white" "yellow" "magenta" "cyan" "green" "red"]
-  "Vector of colors of the various shapes in text mode
+  "Vector of colors of the various shapes in text mode.
 Element 0 is ignored."
   :group 'tetris
   :type (let ((names `("Shape 1" "Shape 2" "Shape 3"
@@ -97,7 +97,7 @@
 
 (defcustom tetris-x-colors
   [nil [0 0 1] [0.7 0 1] [1 1 0] [1 0 1] [0 1 1] [0 1 0] [1 0 0]]
-  "Vector of colors of the various shapes
+  "Vector of colors of the various shapes.
 Element 0 is ignored."
   :group 'tetris
   :type 'sexp)
@@ -274,22 +274,22 @@
 ;; ;;;;;;;;;;;;; keymaps ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 (defvar tetris-mode-map
-  (make-sparse-keymap 'tetris-mode-map))
-
-(define-key tetris-mode-map "n"		'tetris-start-game)
-(define-key tetris-mode-map "q"		'tetris-end-game)
-(define-key tetris-mode-map "p"		'tetris-pause-game)
+  (let ((map (make-sparse-keymap 'tetris-mode-map)))
+    (define-key map "n"		'tetris-start-game)
+    (define-key map "q"		'tetris-end-game)
+    (define-key map "p"		'tetris-pause-game)
 
-(define-key tetris-mode-map " "		'tetris-move-bottom)
-(define-key tetris-mode-map [left]	'tetris-move-left)
-(define-key tetris-mode-map [right]	'tetris-move-right)
-(define-key tetris-mode-map [up]	'tetris-rotate-prev)
-(define-key tetris-mode-map [down]	'tetris-rotate-next)
+    (define-key map " "		'tetris-move-bottom)
+    (define-key map [left]	'tetris-move-left)
+    (define-key map [right]	'tetris-move-right)
+    (define-key map [up]	'tetris-rotate-prev)
+    (define-key map [down]	'tetris-rotate-next)
+    map))
 
 (defvar tetris-null-map
-  (make-sparse-keymap 'tetris-null-map))
-
-(define-key tetris-null-map "n"		'tetris-start-game)
+  (let ((map (make-sparse-keymap 'tetris-null-map)))
+    (define-key map "n"		'tetris-start-game)
+    map))
 
 ;; ;;;;;;;;;;;;;;;; game functions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
@@ -508,7 +508,7 @@
 	    (tetris-shape-done)))))
 
 (defun tetris-move-bottom ()
-  "Drops the shape to the bottom of the playing area"
+  "Drop the shape to the bottom of the playing area."
   (interactive)
   (if (not tetris-paused)
       (let ((hit nil))
@@ -521,7 +521,7 @@
         (tetris-shape-done))))
 
 (defun tetris-move-left ()
-  "Moves the shape one square to the left"
+  "Move the shape one square to the left."
   (interactive)
   (unless (or (= tetris-pos-x 0)
               tetris-paused)
@@ -532,7 +532,7 @@
     (tetris-draw-shape)))
 
 (defun tetris-move-right ()
-  "Moves the shape one square to the right"
+  "Move the shape one square to the right."
   (interactive)
   (unless (or (= (+ tetris-pos-x (tetris-shape-width))
                  tetris-width)
@@ -544,7 +544,7 @@
     (tetris-draw-shape)))
 
 (defun tetris-rotate-prev ()
-  "Rotates the shape clockwise"
+  "Rotate the shape clockwise."
   (interactive)
   (if (not tetris-paused)
       (progn (tetris-erase-shape)
@@ -554,7 +554,7 @@
              (tetris-draw-shape))))
 
 (defun tetris-rotate-next ()
-  "Rotates the shape anticlockwise"
+  "Rotate the shape anticlockwise."
   (interactive)
   (if (not tetris-paused)
       (progn
@@ -565,14 +565,14 @@
         (tetris-draw-shape))))
 
 (defun tetris-end-game ()
-  "Terminates the current game"
+  "Terminate the current game."
   (interactive)
   (gamegrid-kill-timer)
   (use-local-map tetris-null-map)
   (gamegrid-add-score tetris-score-file tetris-score))
 
 (defun tetris-start-game ()
-  "Starts a new game of Tetris"
+  "Start a new game of Tetris."
   (interactive)
   (tetris-reset-game)
   (use-local-map tetris-mode-map)
@@ -581,7 +581,7 @@
     (gamegrid-start-timer period 'tetris-update-game)))
 
 (defun tetris-pause-game ()
-  "Pauses (or resumes) the current game"
+  "Pause (or resume) the current game."
   (interactive)
   (setq tetris-paused (not tetris-paused))
   (message (and tetris-paused "Game paused (press p to resume)")))
@@ -591,21 +591,13 @@
 
 (put 'tetris-mode 'mode-class 'special)
 
-(defun tetris-mode ()
-  "A mode for playing Tetris.
-
-tetris-mode keybindings:
-   \\{tetris-mode-map}
-"
-  (kill-all-local-variables)
+(define-derived-mode tetris-mode nil "Tetris"
+  "A mode for playing Tetris."
 
   (add-hook 'kill-buffer-hook 'gamegrid-kill-timer nil t)
 
   (use-local-map tetris-null-map)
 
-  (setq major-mode 'tetris-mode)
-  (setq mode-name "Tetris")
-
   (unless (featurep 'emacs)
     (setq mode-popup-menu
 	  '("Tetris Commands"
@@ -617,12 +609,12 @@
 	    ["Resume"		tetris-pause-game
 	     (and (tetris-active-p) tetris-paused)])))
 
+  (setq show-trailing-whitespace nil)
+
   (setq gamegrid-use-glyphs tetris-use-glyphs)
   (setq gamegrid-use-color tetris-use-color)
 
-  (gamegrid-init (tetris-display-options))
-
-  (run-mode-hooks 'tetris-mode-hook))
+  (gamegrid-init (tetris-display-options)))
 
 ;;;###autoload
 (defun tetris ()
@@ -645,6 +637,8 @@
 "
   (interactive)
 
+  (select-window (or (get-buffer-window tetris-buffer-name)
+		     (selected-window)))
   (switch-to-buffer tetris-buffer-name)
   (gamegrid-kill-timer)
   (tetris-mode)
--- a/lisp/tool-bar.el	Tue Apr 20 23:33:39 2010 +0000
+++ b/lisp/tool-bar.el	Wed Apr 21 23:03:28 2010 +0000
@@ -267,7 +267,7 @@
   ;; People say it's bad to have EXIT on the tool bar, since users
   ;; might inadvertently click that button.
   ;;(tool-bar-add-item-from-menu 'save-buffers-kill-emacs "exit")
-  (tool-bar-add-item-from-menu 'find-file "new")
+  (tool-bar-add-item-from-menu 'find-file "new" nil :label "New File")
   (tool-bar-add-item-from-menu 'menu-find-file-existing "open")
   (tool-bar-add-item-from-menu 'dired "diropen")
   (tool-bar-add-item-from-menu 'kill-this-buffer "close")
@@ -294,14 +294,15 @@
 			       "paste" nil
 			       :visible '(not (eq 'special (get major-mode
 								'mode-class))))
-  (tool-bar-add-item-from-menu 'nonincremental-search-forward "search")
+  (tool-bar-add-item-from-menu 'nonincremental-search-forward "search"
+			       nil :label "Search")
   ;;(tool-bar-add-item-from-menu 'ispell-buffer "spell")
 
   ;; There's no icon appropriate for News and we need a command rather
   ;; than a lambda for Read Mail.
   ;;(tool-bar-add-item-from-menu 'compose-mail "mail/compose")
 
-  (tool-bar-add-item-from-menu 'print-buffer "print")
+  (tool-bar-add-item-from-menu 'print-buffer "print" nil :label "Print")
 
   ;; tool-bar-add-item-from-menu itself operates on
   ;; (default-value 'tool-bar-map), but when we don't use that function,
--- a/lisp/vc-bzr.el	Tue Apr 20 23:33:39 2010 +0000
+++ b/lisp/vc-bzr.el	Wed Apr 21 23:03:28 2010 +0000
@@ -451,11 +451,16 @@
   "Unregister FILE from bzr."
   (vc-bzr-command "remove" nil 0 file "--keep"))
 
-(defun vc-bzr-checkin (files rev comment &optional extra-args)
+(declare-function log-edit-extract-headers "log-edit" (headers string))
+
+(defun vc-bzr-checkin (files rev comment)
   "Check FILE in to bzr with log message COMMENT.
 REV non-nil gets an error."
   (if rev (error "Can't check in a specific revision with bzr"))
-  (apply 'vc-bzr-command "commit" nil 0 files (append (list "-m" comment) extra-args)))
+  (apply 'vc-bzr-command "commit" nil 0
+         files (cons "-m" (log-edit-extract-headers '(("Author" . "--author")
+                                                      ("Fixes" . "--fixes"))
+                                                    comment))))
 
 (defun vc-bzr-find-revision (file rev buffer)
   "Fetch revision REV of file FILE and put it into BUFFER."
@@ -552,23 +557,6 @@
 	(goto-char (point-min)))
       found)))
 
-(declare-function log-edit-mode "log-edit" ())
-(defvar log-edit-extra-flags)
-(defvar log-edit-before-checkin-process)
-
-(define-derived-mode vc-bzr-log-edit-mode log-edit-mode "Bzr-Log-Edit"
-  "Mode for editing Bzr commit logs.
-If a line like:
-Author: NAME
-is present in the log, it is removed, and
---author NAME
-is passed to the bzr commit command.  Similarly with Fixes: and --fixes."
-  (set (make-local-variable 'log-edit-extra-flags) nil)
-  (set (make-local-variable 'log-edit-before-checkin-process)
-       '(("^\\(Author\\|Fixes\\):[ \t]+\\(.*\\)[ \t]*$" .
-          (list (format "--%s" (downcase (match-string 1)))
-                (match-string 2))))))
-
 (defun vc-bzr-diff (files &optional rev1 rev2 buffer)
   "VC bzr backend for diff."
   ;; `bzr diff' exits with code 1 if diff is non-empty.
@@ -983,6 +971,19 @@
           (setq loglines (buffer-substring-no-properties start (point-max))))))
     vc-bzr-revisions))
 
+(defun vc-bzr-conflicted-files (dir)
+  (let ((default-directory (vc-bzr-root dir))
+        (files ()))
+    (with-temp-buffer
+      (vc-bzr-command "status" t 0 default-directory)
+      (goto-char (point-min))
+      (when (re-search-forward "^conflicts:\n" nil t)
+        (while (looking-at "  \\(?:Text conflict in \\(.*\\)\\|.*\\)\n")
+          (if (match-end 1)
+              (push (expand-file-name (match-string 1)) files))
+          (goto-char (match-end 0)))))
+    files))
+
 ;;; Revision completion
 
 (eval-and-compile
--- a/lisp/vc-dir.el	Tue Apr 20 23:33:39 2010 +0000
+++ b/lisp/vc-dir.el	Wed Apr 21 23:03:28 2010 +0000
@@ -301,7 +301,8 @@
 				   map vc-dir-mode-map)
     (tool-bar-local-item "bookmark_add"
 			 'vc-dir-toggle-mark 'vc-dir-toggle-mark map
-			 :help "Toggle mark on current item")
+			 :help "Toggle mark on current item"
+			 :label "Toggle Mark")
     (tool-bar-local-item-from-menu 'vc-dir-previous-line "left-arrow"
 				   map vc-dir-mode-map
 				   :rtl "right-arrow")
@@ -313,11 +314,14 @@
     (tool-bar-local-item-from-menu 'revert-buffer "refresh"
 				   map vc-dir-mode-map)
     (tool-bar-local-item-from-menu 'nonincremental-search-forward
-				   "search" map)
+				   "search" map nil
+				   :label "Search")
     (tool-bar-local-item-from-menu 'vc-dir-query-replace-regexp
-				   "search-replace" map vc-dir-mode-map)
+				   "search-replace" map vc-dir-mode-map
+				   :label "Replace")
     (tool-bar-local-item-from-menu 'vc-dir-kill-dir-status-process "cancel"
-				   map vc-dir-mode-map)
+				   map vc-dir-mode-map
+				   :label "Cancel")
     (tool-bar-local-item-from-menu 'quit-window "exit"
 				   map vc-dir-mode-map)
     map))
--- a/lisp/vc-dispatcher.el	Tue Apr 20 23:33:39 2010 +0000
+++ b/lisp/vc-dispatcher.el	Wed Apr 21 23:03:28 2010 +0000
@@ -141,7 +141,6 @@
 (defvar vc-log-operation nil)
 (defvar vc-log-after-operation-hook nil)
 (defvar vc-log-fileset)
-(defvar vc-log-extra)
 
 ;; In a log entry buffer, this is a local variable
 ;; that points to the buffer for which it was made
@@ -521,17 +520,20 @@
 	(with-current-buffer vc-parent-buffer default-directory))
   (log-edit 'vc-finish-logentry
 	    nil
-	    `((log-edit-listfun . (lambda () ',fileset))
+	    `((log-edit-listfun . (lambda ()
+                                    ;; FIXME: Should expand the list
+                                    ;; for directories.
+                                    (mapcar 'file-relative-name
+                                            ',fileset)))
 	      (log-edit-diff-function . (lambda () (vc-diff nil))))
 	    nil
 	    mode)
   (set (make-local-variable 'vc-log-fileset) fileset)
-  (make-local-variable 'vc-log-extra)
   (set-buffer-modified-p nil)
   (setq buffer-file-name nil))
 
-(defun vc-start-logentry (files extra comment initial-contents msg logbuf mode action &optional after-hook)
-  "Accept a comment for an operation on FILES with extra data EXTRA.
+(defun vc-start-logentry (files comment initial-contents msg logbuf mode action &optional after-hook)
+  "Accept a comment for an operation on FILES.
 If COMMENT is nil, pop up a LOGBUF buffer, emit MSG, and set the
 action on close to ACTION.  If COMMENT is a string and
 INITIAL-CONTENTS is non-nil, then COMMENT is used as the initial
@@ -561,7 +563,6 @@
     (when after-hook
       (setq vc-log-after-operation-hook after-hook))
     (setq vc-log-operation action)
-    (setq vc-log-extra extra)
     (when comment
       (erase-buffer)
       (when (stringp comment) (insert comment)))
@@ -570,10 +571,8 @@
       (vc-finish-logentry (eq comment t)))))
 
 (declare-function vc-dir-move-to-goal-column "vc-dir" ())
-;; vc-finish-logentry is called from a log-edit buffer (see above).
-(declare-function log-view-process-buffer "log-edit" ())
-(defvar log-edit-extra-flags)
-
+;; vc-finish-logentry is typically called from a log-edit buffer (see
+;; vc-start-logentry).
 (defun vc-finish-logentry (&optional nocomment)
   "Complete the operation implied by the current log entry.
 Use the contents of the current buffer as a check-in or registration
@@ -590,25 +589,21 @@
   (unless vc-log-operation
     (error "No log operation is pending"))
 
-  (log-view-process-buffer)
-
   ;; save the parameters held in buffer-local variables
   (let ((logbuf (current-buffer))
 	(log-operation vc-log-operation)
+        ;; FIXME: When coming from VC-Dir, we should check that the
+        ;; set of selected files is still equal to vc-log-fileset,
+        ;; to avoid surprises.
 	(log-fileset vc-log-fileset)
-	(log-extra vc-log-extra)
 	(log-entry (buffer-string))
-	(extra-flags log-edit-extra-flags)
 	(after-hook vc-log-after-operation-hook))
     (pop-to-buffer vc-parent-buffer)
     ;; OK, do it to it
     (save-excursion
       (funcall log-operation
 	       log-fileset
-	       log-extra
-	       log-entry
-	       extra-flags
-	       ))
+	       log-entry))
     ;; Remove checkin window (after the checkin so that if that fails
     ;; we don't zap the log buffer and the typing therein).
     ;; -- IMO this should be replaced with quit-window
--- a/lisp/vc-git.el	Tue Apr 20 23:33:39 2010 +0000
+++ b/lisp/vc-git.el	Wed Apr 21 23:03:28 2010 +0000
@@ -118,7 +118,7 @@
   :version "23.1"
   :group 'vc)
 
-(defvar git-commits-coding-system 'utf-8
+(defvar vc-git-commits-coding-system 'utf-8
   "Default coding system for git commits.")
 
 ;;; BACKEND PROPERTIES
@@ -548,11 +548,15 @@
 (defun vc-git-unregister (file)
   (vc-git-command nil 0 file "rm" "-f" "--cached" "--"))
 
+(declare-function log-edit-extract-headers "log-edit" (headers string))
 
-(defun vc-git-checkin (files rev comment  &optional extra-args)
-  (let ((coding-system-for-write git-commits-coding-system))
+(defun vc-git-checkin (files rev comment)
+  (let ((coding-system-for-write vc-git-commits-coding-system))
     (apply 'vc-git-command nil 0 files
-	   (nconc (list "commit" "-m" comment) extra-args (list "--only" "--")))))
+	   (nconc (list "commit" "-m")
+                  (log-edit-extract-headers '(("Author" . "--author"))
+                                            comment)
+                  (list "--only" "--")))))
 
 (defun vc-git-find-revision (file rev buffer)
   (let* (process-file-side-effects
@@ -582,7 +586,7 @@
   "Get change log associated with FILES.
 Note that using SHORTLOG requires at least Git version 1.5.6,
 for the --graph option."
-  (let ((coding-system-for-read git-commits-coding-system))
+  (let ((coding-system-for-read vc-git-commits-coding-system))
     ;; `vc-do-command' creates the buffer, but we need it before running
     ;; the command.
     (vc-setup-buffer buffer)
@@ -793,21 +797,6 @@
                    (progn (forward-line 1) (1- (point)))))))))
     (or (vc-git-symbolic-commit next-rev) next-rev)))
 
-(declare-function log-edit-mode "log-edit" ())
-(defvar log-edit-extra-flags)
-(defvar log-edit-before-checkin-process)
-
-(define-derived-mode vc-git-log-edit-mode log-edit-mode "Git-log-edit"
-  "Mode for editing Git commit logs.
-If a line like:
-Author: NAME
-is present in the log, it is removed, and
---author=NAME
-is passed to the git commit command."
-  (set (make-local-variable 'log-edit-extra-flags) nil)
-  (set (make-local-variable 'log-edit-before-checkin-process)
-       '(("^Author:[ \t]+\\(.*\\)[ \t]*$" . (list "--author" (match-string 1))))))
-
 (defun vc-git-delete-file (file)
   (vc-git-command nil 0 file "rm" "-f" "--"))
 
--- a/lisp/vc-hg.el	Tue Apr 20 23:33:39 2010 +0000
+++ b/lisp/vc-hg.el	Wed Apr 21 23:03:28 2010 +0000
@@ -296,20 +296,7 @@
 	  ("^tag: +\\([^ ]+\\)$" (1 'highlight))
 	  ("^summary:[ \t]+\\(.+\\)" (1 'log-view-message)))))))
 
-(declare-function log-edit-mode "log-edit" ())
-(defvar log-edit-extra-flags)
-(defvar log-edit-before-checkin-process)
-
-(define-derived-mode vc-hg-log-edit-mode log-edit-mode "Hg-log-edit"
-  "Mode for editing Hg commit logs.
-If a line like:
-Author: NAME
-is present in the log, it is removed, and
---author NAME
-is passed to the hg commit command."
-  (set (make-local-variable 'log-edit-extra-flags) nil)
-  (set (make-local-variable 'log-edit-before-checkin-process)
-       '(("^Author:[ \t]+\\(.*\\)[ \t]*$" . (list "--user" (match-string 1))))))
+(declare-function log-edit-extract-headers "log-edit" (headers string))
 
 (defun vc-hg-diff (files &optional oldvers newvers buffer)
   "Get a difference report using hg between two revisions of FILES."
@@ -434,11 +421,15 @@
 ;;   "Unregister FILE from hg."
 ;;   (vc-hg-command nil nil file "remove"))
 
-(defun vc-hg-checkin (files rev comment &optional extra-args)
+(declare-function log-edit-extract-headers "log-edit" (headers string))
+
+(defun vc-hg-checkin (files rev comment)
   "Hg-specific version of `vc-backend-checkin'.
 REV is ignored."
   (apply 'vc-hg-command nil 0 files
-         (nconc (list "commit" "-m" comment) extra-args)))
+         (nconc (list "commit" "-m")
+                (log-edit-extract-headers '(("Author" . "--user"))
+                                          comment))))
 
 (defun vc-hg-find-revision (file rev buffer)
   (let ((coding-system-for-read 'binary)
--- a/lisp/vc.el	Tue Apr 20 23:33:39 2010 +0000
+++ b/lisp/vc.el	Wed Apr 21 23:03:28 2010 +0000
@@ -268,15 +268,12 @@
 ;;   Unregister FILE from this backend.  This is only needed if this
 ;;   backend may be used as a "more local" backend for temporary editing.
 ;;
-;; * checkin (files rev comment &optional extra-args)
+;; * checkin (files rev comment)
 ;;
-;;   Commit changes in FILES to this backend.  If REV is non-nil, that
-;;   should become the new revision number (not all backends do
-;;   anything with it).  COMMENT is used as a check-in comment.  The
-;;   implementation should pass the value of vc-checkin-switches to
-;;   the backend command.  (Note: in older versions of VC, this
-;;   command took a single file argument and not a list.)
-;;   EXTRA-ARGS should be passed to the backend command.
+;;   Commit changes in FILES to this backend.  REV is a historical artifact
+;;   and should be ignored.  COMMENT is used as a check-in comment.
+;;   The implementation should pass the value of vc-checkin-switches to
+;;   the backend command.
 ;;
 ;; * find-revision (file rev buffer)
 ;;
@@ -548,6 +545,12 @@
 ;;   makes it possible to provide menu entries for functionality that
 ;;   is specific to a backend and which does not map to any of the VC
 ;;   generic concepts.
+;;
+;; - conflicted-files (dir)
+;;
+;;   Return the list of files where conflict resolution is needed in
+;;   the project that contains DIR.
+;;   FIXME: what should it do with non-text conflicts?
 
 ;;; Todo:
 
@@ -1054,8 +1057,7 @@
          (state (nth 3 vc-fileset))
          ;; The backend should check that the checkout-model is consistent
          ;; among all the `files'.
-	 (model (nth 4 vc-fileset))
-	 revision)
+	 (model (nth 4 vc-fileset)))
 
     ;; Do the right thing
     (cond
@@ -1070,11 +1072,13 @@
       (cond
        (verbose
 	;; go to a different revision
-	(setq revision (read-string "Branch, revision, or backend to move to: "))
-	(let ((revision-downcase (downcase revision)))
+	(let* ((revision
+                (read-string "Branch, revision, or backend to move to: "))
+               (revision-downcase (downcase revision)))
 	  (if (member
 	       revision-downcase
-	       (mapcar (lambda (arg) (downcase (symbol-name arg))) vc-handled-backends))
+	       (mapcar (lambda (arg) (downcase (symbol-name arg)))
+                       vc-handled-backends))
 	      (let ((vsym (intern-soft revision-downcase)))
 		(dolist (file files) (vc-transfer-file file vsym)))
 	    (dolist (file files)
@@ -1119,8 +1123,8 @@
 	    (message "No files remain to be committed")
 	  (if (not verbose)
 	      (vc-checkin ready-for-commit backend)
-	    (setq revision (read-string "New revision or backend: "))
-	    (let ((revision-downcase (downcase revision)))
+	    (let* ((revision (read-string "New revision or backend: "))
+                   (revision-downcase (downcase revision)))
 	      (if (member
 		   revision-downcase
 		   (mapcar (lambda (arg) (downcase (symbol-name arg)))
@@ -1365,7 +1369,7 @@
 (defun vc-checkin (files backend &optional rev comment initial-contents)
   "Check in FILES.
 The optional argument REV may be a string specifying the new revision
-level (if nil increment the current level).  COMMENT is a comment
+level (strongly deprecated).  COMMENT is a comment
 string; if omitted, a buffer is popped up to accept a comment.  If
 INITIAL-CONTENTS is non-nil, then COMMENT is used as the initial contents
 of the log entry buffer.
@@ -1379,28 +1383,30 @@
   (lexical-let
    ((backend backend))
    (vc-start-logentry
-    files rev comment initial-contents
+    files comment initial-contents
     "Enter a change comment."
     "*VC-log*"
     (lambda ()
       (vc-call-backend backend 'log-edit-mode))
-    (lambda (files rev comment extra-flags)
-      (message "Checking in %s..." (vc-delistify files))
-      ;; "This log message intentionally left almost blank".
-      ;; RCS 5.7 gripes about white-space-only comments too.
-      (or (and comment (string-match "[^\t\n ]" comment))
-	  (setq comment "*** empty log message ***"))
-      (with-vc-properties
-       files
-       ;; We used to change buffers to get local value of vc-checkin-switches,
-       ;; but 'the' local buffer is not a well-defined concept for filesets.
-       (progn
-	 (vc-call-backend backend 'checkin files rev comment extra-flags)
-	 (mapc 'vc-delete-automatic-version-backups files))
-       `((vc-state . up-to-date)
-	 (vc-checkout-time . ,(nth 5 (file-attributes file)))
-	 (vc-working-revision . nil)))
-      (message "Checking in %s...done" (vc-delistify files)))
+    (lexical-let ((rev rev))
+      (lambda (files comment)
+        (message "Checking in %s..." (vc-delistify files))
+        ;; "This log message intentionally left almost blank".
+        ;; RCS 5.7 gripes about white-space-only comments too.
+        (or (and comment (string-match "[^\t\n ]" comment))
+            (setq comment "*** empty log message ***"))
+        (with-vc-properties
+            files
+          ;; We used to change buffers to get local value of
+          ;; vc-checkin-switches, but 'the' local buffer is
+          ;; not a well-defined concept for filesets.
+          (progn
+            (vc-call-backend backend 'checkin files rev comment)
+            (mapc 'vc-delete-automatic-version-backups files))
+          `((vc-state . up-to-date)
+            (vc-checkout-time . ,(nth 5 (file-attributes file)))
+            (vc-working-revision . nil)))
+        (message "Checking in %s...done" (vc-delistify files))))
     'vc-checkin-hook)))
 
 ;;; Additional entry points for examining version histories
@@ -1772,13 +1778,14 @@
   ;; case the more general operation ever becomes meaningful.
   (let ((backend (vc-responsible-backend (car files))))
     (vc-start-logentry
-     files rev oldcomment t
+     files oldcomment t
      "Enter a replacement change comment."
      "*VC-log*"
      (lambda () (vc-call-backend backend 'log-edit-mode))
-     (lambda (files rev comment ignored)
-       (vc-call-backend backend
-                        'modify-change-comment files rev comment)))))
+     (lexical-let ((rev rev))
+       (lambda (files comment)
+         (vc-call-backend backend
+                          'modify-change-comment files rev comment))))))
 
 ;;;###autoload
 (defun vc-merge ()
@@ -1839,6 +1846,31 @@
 ;;;###autoload
 (defalias 'vc-resolve-conflicts 'smerge-ediff)
 
+;; TODO: This is OK but maybe we could integrate it better.
+;; E.g. it could be run semi-automatically (via a prompt?) when saving a file
+;; that was conflicted (i.e. upon mark-resolved).
+;; FIXME: should we add an "other-window" version?  Or maybe we should
+;; hook it inside find-file so it automatically works for
+;; find-file-other-window as well.  E.g. find-file could use a new
+;; `default-next-file' variable for its default file (M-n), and
+;; we could then set it upon mark-resolve, so C-x C-s C-x C-f M-n would
+;; automatically offer the next conflicted file.
+(defun vc-find-conflicted-file ()
+  "Visit the next conflicted file in the current project."
+  (interactive)
+  (let* ((backend (or (if buffer-file-name (vc-backend buffer-file-name))
+                      (vc-responsible-backend default-directory)
+                      (error "No VC backend")))
+         (files (vc-call-backend backend
+                                 'conflicted-files default-directory)))
+    ;; Don't try and visit the current file.
+    (if (equal (car files) buffer-file-name) (pop files))
+    (if (null files)
+        (message "No more conflicted files")
+      (find-file (pop files))
+      (message "%s more conflicted files after this one"
+               (if files (length files) "No")))))
+
 ;; Named-configuration entry points
 
 (defun vc-tag-precondition (dir)
--- a/lwlib/ChangeLog	Tue Apr 20 23:33:39 2010 +0000
+++ b/lwlib/ChangeLog	Wed Apr 21 23:03:28 2010 +0000
@@ -1,3 +1,8 @@
+2010-04-21  Jan Djärv  <jan.h.d@swipnet.se>
+
+	* xlwmenu.c (expose_cb):
+	* lwlib-Xaw.c (fill_xft_data): Declarations before code.
+
 2010-04-17  Jan Djärv  <jan.h.d@swipnet.se>
 
 	* xlwmenu.c: Include Shell.h, remove duplicate declaration of
--- a/lwlib/lwlib-Xaw.c	Tue Apr 20 23:33:39 2010 +0000
+++ b/lwlib/lwlib-Xaw.c	Wed Apr 21 23:03:28 2010 +0000
@@ -150,12 +150,12 @@
 static void
 fill_xft_data (struct widget_xft_data *data, Widget widget, XftFont *font)
 {
-  data->widget = widget;
-  data->xft_font = font;
   Pixel bg, fg;
   XColor colors[2];
   int screen = XScreenNumberOfScreen (XtScreen (widget));
 
+  data->widget = widget;
+  data->xft_font = font;
   XtVaGetValues (widget,
                  XtNbackground, &bg,
                  XtNforeground, &fg,
--- a/lwlib/xlwmenu.c	Tue Apr 20 23:33:39 2010 +0000
+++ b/lwlib/xlwmenu.c	Wed Apr 21 23:03:28 2010 +0000
@@ -1304,10 +1304,10 @@
            XEvent* event,
            Boolean* continue_to_dispatch)
 {
-  *continue_to_dispatch = False;
   XlwMenuWidget mw = (XlwMenuWidget) closure;
   int i;
 
+  *continue_to_dispatch = False;
   for (i = 0; i < mw->menu.windows_length; ++i)
     if (mw->menu.windows [i].w == widget) break;
   if (i < mw->menu.windows_length && i < mw->menu.old_depth)
--- a/src/ChangeLog	Tue Apr 20 23:33:39 2010 +0000
+++ b/src/ChangeLog	Wed Apr 21 23:03:28 2010 +0000
@@ -1,3 +1,128 @@
+2010-04-21  Dan Nicolaescu  <dann@ics.uci.edu>
+
+	Clean up HP-UX files.
+	* m/hp800.h (NO_REMAP, VIRT_ADDR_VARIES, DATA_SEG_BITS)
+	(DATA_START, TEXT_START, LOAD_AVE_TYPE, LOAD_AVE_CVT)
+	(LDAV_SYMBOL, index, rindex): Move definitions only used in HP-UX ...
+	* s/hpux10-20.h: ... to the only user, here.
+
+2010-04-21  Eli Zaretskii  <eliz@gnu.org>
+
+	* bidi.c (bidi_find_paragraph_start, bidi_at_paragraph_end): Don't
+	use buffer-local values of paragraph-start and paragraph-separate.
+	<paragraph_start_re, paragraph_separate_re>: Rename from
+	fallback_paragraph_start_re and fallback_paragraph_separate_re.
+	(Bug#5992)
+
+2010-04-21  Jan Djärv  <jan.h.d@swipnet.se>
+
+	* xsettings.c: Qmonospace_font_name, Qtool_bar_style and
+	current_tool_bar_style are new.
+	(store_config_changed_event): Rename from store_font_changed_event.
+	(XSETTINGS_TOOL_BAR_STYLE): New define.
+	(SEEN_FONT, SEEN_TB_STYLE): New enum values.
+	(struct xsettings): Add font and tb_style, set xft stuff inside #ifdef
+	HAVE_XFT.
+	(something_changedCB): store_font_changed_event is now
+	store_config_changed_event
+	(parse_settings): Rename from parse_xft_settings.  Read
+	non-xft xsettings outside #ifdef HAVE_XFT.
+	(read_settings): Renamed from read_xft_settings.
+	(apply_xft_settings): Take current settings as parameter.  Do not
+	call read_(xft)_settings.
+	(read_and_apply_settings): New function.
+	(xft_settings_event): Do non-xft stuff out of HAVE_XFT.  Call
+	read_and_apply_settings if there are settings to be read.
+	(init_xsettings): Renamed from init_xfd_settings.
+	Call read_and_apply_settings unconditionally.
+	(xsettings_initialize): Call init_xsettings.
+	(Ftool_bar_get_system_style): New function.
+	(syms_of_xsettings): Define Qmonospace_font_name and
+	Qtool_bar_style.  Initialize current_tool_bar_style to nil.
+	defsubr Stool_bar_get_system_style. Fprovide on
+	dynamic-setting.
+	Move misplaced HAVE_GCONF
+
+	* xsettings.h (Ftool_bar_get_system_style): Declare.
+
+	* xdisp.c: Vtool_bar_style, tool_bar_max_label_size,
+	Qtext, Qboth, Qboth_horiz are new.
+	(syms_of_xdisp): Intern Qtext, Qboth, Qboth_horiz, DEFVAR
+	Vtool_bar_style, tool_bar_max_label_size.
+
+	* lisp.h: Extern declare Qtext, Qboth, Qboth_horiz.
+
+	* keyboard.c: QClabel is new.
+	(parse_tool_bar_item): Take out QClabel from tool bar items.
+	Try to construct a label if ther is no QClabel.
+	(syms_of_keyboard): Intern :label as QClabel.
+
+	* dispextern.h (tool_bar_item_idx): TOOL_BAR_ITEM_LABEL is new.
+	(Vtool_bar_style, tool_bar_max_label_size, DEFAULT_TOOL_BAR_LABEL_SIZE):
+	New.
+
+	* Makefile.in (SOME_MACHINE_LISP): font-setting.el renamed to
+	dynamic-setting.el.
+
+	* gtkutil.c (xg_tool_bar_menu_proxy): Handle label in tool bar item.
+	(xg_make_tool_item, xg_show_toolbar_item): New function.
+	(update_frame_tool_bar): Take label from TOOL_BAR_ITEM_LABEL.
+	Call xg_make_tool_item to make a tool bar item.
+	Call xg_show_toolbar_item.  Use wtoolbar instead of x->toolbar_widget.
+
+	* xterm.c (x_draw_image_relief): Take Vtool_bar_button_margin
+	into account for toolbars.
+
+2010-04-21  Jan Djärv  <jan.h.d@swipnet.se>
+
+	* data.c (make_blv): Declarations before code (Bug#5993).
+
+2010-04-21  Glenn Morris  <rgm@gnu.org>
+
+	* Makefile.in (DBUS_OBJ, GTK_OBJ, XMENU_OBJ, XOBJ):
+	Define using autoconf, not cpp.
+	(LIBXSM): New variable, set by autoconf.
+	(LIBXT): Use $LIBXSM.
+
+2010-04-21  Dan Nicolaescu  <local_user@dannlt>
+
+	Remove NOMULTIPLEJOBS, unused.
+	* s/template.h (NOMULTIPLEJOBS):
+	* s/msdos.h (NOMULTIPLEJOBS): Remove, unused.
+
+	Simplify LD_SWITCH_SYSTEM_TEMACS usage.
+	* s/freebsd.h (LD_SWITCH_SYSTEM_TEMACS):
+	* s/gnu-linux.h (LD_SWITCH_SYSTEM_TEMACS): Remove, configure
+	detects -znocombreloc and passes it to the linker
+	* s/hpux10-20.h (LD_SWITCH_SYSTEM_TEMACS): Remove, empty.
+
+2010-04-21  Glenn Morris  <rgm@gnu.org>
+
+	* Makefile.in (LIBSELINUX_LIBS): Move out of #ifdef.
+
+2010-04-21  Karel Klíč  <kklic@redhat.com>
+
+	* Makefile.in (LIBSELINUX_LIBS): New.
+	(LIBES): Add $LIBSELINUX_LIBS.
+	* eval.c, lisp.h (call7): New function.
+	* fileio.c [HAVE_LIBSELINUX]: Include selinux headers.
+	(Ffile_selinux_context, Fset_file_selinux_context):
+	New functions.
+	(Fcopy_file): New parameter preserve-selinux-context.
+	(Frename_file): Preserve selinux context when renaming by copy-file.
+
+2010-04-21  Juanma Barranquero  <lekktu@gmail.com>
+	    Eli Zaretskii  <eliz@gnu.org>
+
+	Don't depend on cm.c or termcap.c on Windows, use stubs.
+	* makefile.w32-in (OBJ1): Remove cm.$(O) and termcap.$(O).
+	($(BLD)/cm.$(O), $(BLD)/termcap.$(O)): Remove.
+	* w32console.c (current_tty, cost): New vars; lifted from cm.c.
+	(evalcost, cmputc, cmcheckmagic, cmcostinit, cmgoto, Wcm_clear)
+	(sys_tputs, sys_tgetstr): New stubs.
+	* s/ms-w32.h (chcheckmagic, cmcostinit, cmgoto, cmputc, Wcm_clear)
+	(tputs, tgetstr): New; define to sys_*.
+
 2010-04-20  Juanma Barranquero  <lekktu@gmail.com>
 
 	* buffer.c (syms_of_buffer) <bidi-display-reordering>: Doc fix.
@@ -187,14 +312,6 @@
 
 	* frame.h (FRAME_LINE_TO_PIXEL_Y): Add missing parenthesis.
 
-2010-04-19  Jan Djärv  <jan.h.d@swipnet.se>
-
-	* frame.h (FRAME_TEXT_LINES_TO_PIXEL_HEIGHT): Don't use
-	FRAME_LINE_TO_PIXEL_Y.
-
-	* xterm.c (x_set_window_size_1): Don't add border_width/height to
-	pixelwidth/height.
-
 2010-04-19  Chong Yidong  <cyd@stupidchicken.com>
 
 	* xdisp.c (prepare_menu_bars): Don't call ns_set_doc_edited for
@@ -329,7 +446,8 @@
 
 2010-04-12  Dan Nicolaescu  <dann@ics.uci.edu>
 
-	* Makefile.in (C_SWITCH_SYSTEM,C_SWITCH_MACHINE,C_SWITCH_X_SITE): Undefine.
+	* Makefile.in (C_SWITCH_SYSTEM,C_SWITCH_MACHINE,C_SWITCH_X_SITE):
+	Undefine.
 
 2010-04-11  Dan Nicolaescu  <dann@ics.uci.edu>
 
@@ -403,10 +521,10 @@
 	(parse_xft_settings): Also check for XSETTINGS_FONT_NAME and save that
 	in current_font.
 	(init_gconf): Read value of SYSTEM_FONT and save it in current_font.
-	(Ffont_get_system_normal_font, xsettings_get_system_normal_font): New
-	functions.
-	(syms_of_xsettings): Initialize current_font. defsubr
-	Sfont_get_system_normal_font.
+	(Ffont_get_system_normal_font, xsettings_get_system_normal_font):
+	New functions.
+	(syms_of_xsettings): Initialize current_font.
+	defsubr Sfont_get_system_normal_font.
 
 	* xsettings.h (Ffont_get_system_normal_font,
 	xsettings_get_system_normal_font): Declare.
@@ -3033,7 +3151,7 @@
 	* xterm.h: Rename x_non_menubar_window_to_frame to
 	x_menubar_window_to_frame.
 
-	* xterm.c: Remove declarations also in xterm.h
+	* xterm.c: Remove declarations also in xterm.h.
 	(XTmouse_position): Do not return valid positions
 	for clicks in the menubar and the toolbar for Gtk+.
 
@@ -3593,7 +3711,7 @@
 2009-07-04  Eli Zaretskii  <eliz@gnu.org>
 
 	Emulation of `getloadavg' on MS-Windows.
-	* w32.c: Include float.h
+	* w32.c: Include float.h.
 	(g_b_init_get_native_system_info, g_b_init_get_system_times)
 	(GetNativeSystemInfo_Proc, GetSystemTimes_Proc): Declare.
 	(get_native_system_info, get_system_times): New functions.
@@ -9539,7 +9657,7 @@
 2008-07-10  Dan Nicolaescu  <dann@ics.uci.edu>
 
 	* fileio.c:
-	* sysdep.c
+	* sysdep.c:
 	* systty.h:
 	* m/ibmrs6000.h:
 	* m/iris4d.h:
--- a/src/Makefile.in	Tue Apr 20 23:33:39 2010 +0000
+++ b/src/Makefile.in	Wed Apr 21 23:03:28 2010 +0000
@@ -82,16 +82,26 @@
 
 DBUS_CFLAGS = @DBUS_CFLAGS@
 DBUS_LIBS = @DBUS_LIBS@
+DBUS_OBJ = @DBUS_OBJ@
 
 GCONF_CFLAGS = @GCONF_CFLAGS@
 GCONF_LIBS = @GCONF_LIBS@
 
+GTK_OBJ=@GTK_OBJ@
+
+LIBXSM=@LIBXSM@
+
+XMENU_OBJ=@XMENU_OBJ@
+XOBJ=@XOBJ@
+
 LIBSOUND= @LIBSOUND@
 CFLAGS_SOUND= @CFLAGS_SOUND@
 
 RSVG_LIBS= @RSVG_LIBS@
 RSVG_CFLAGS= @RSVG_CFLAGS@
 
+LIBSELINUX_LIBS = @LIBSELINUX_LIBS@
+
 INTERVALS_H = dispextern.h intervals.h composite.h
 
 GETLOADAVG_LIBS = @GETLOADAVG_LIBS@
@@ -239,10 +249,6 @@
 shared=no
 #endif
 
-#ifdef HAVE_DBUS
-DBUS_OBJ = dbusbind.o
-#endif
-
 /* DO NOT use -R.  There is a special hack described in lastfile.c
    which is used instead.  Some initialized data areas are modified
    at initial startup, then labeled as part of the text area when
@@ -280,16 +286,8 @@
 #endif
 
 #ifdef HAVE_X_WINDOWS
-XMENU_OBJ = xmenu.o
-XOBJ= xterm.o xfns.o xselect.o xrdb.o fontset.o xsmfns.o fringe.o image.o \
-      xsettings.o xgselect.o
-
 #ifdef HAVE_MENUS
 
-#ifdef USE_GTK
-GTK_OBJ= gtkutil.o
-#endif
-
 /* The X Menu stuff is present in the X10 distribution, but missing
    from X11.  If we have X10, just use the installed library;
    otherwise, use our own copy.  */
@@ -352,11 +350,7 @@
 LIBXMENU=
 #endif /* USE_GTK */
 
-#ifdef HAVE_X_SM
-LIBXT=$(LIBW) -lSM -lICE
-#else
-LIBXT=$(LIBW)
-#endif
+LIBXT=$(LIBW) $(LIBXSM)
 #endif /* not USE_X_TOOLKIT */
 
 #ifdef HAVE_X11
@@ -572,7 +566,7 @@
  ${lispsource}international/fontset.elc ${lispsource}dnd.elc \
  ${lispsource}tool-bar.elc ${lispsource}mwheel.elc ${lispsource}x-dnd.elc \
  ${lispsource}term/common-win.elc ${lispsource}term/x-win.elc \
- ${lispsource}font-setting.elc
+ ${lispsource}dynamic-setting.elc
 #else
 #define WINDOW_SUPPORT ${lispsource}fringe.elc ${lispsource}image.elc \
  ${lispsource}international/fontset.elc ${lispsource}dnd.elc \
@@ -807,7 +801,7 @@
   ../lisp/tooltip.elc ../lisp/image.elc \
   ../lisp/fringe.elc ../lisp/dnd.elc \
   ../lisp/mwheel.elc ../lisp/tool-bar.elc \
-  ../lisp/x-dnd.elc ../lisp/font-setting.elc \
+  ../lisp/x-dnd.elc ../lisp/dynamic-setting.elc \
   ../lisp/international/ccl.elc \
   ../lisp/international/fontset.elc \
   ../lisp/mouse.elc \
@@ -824,7 +818,7 @@
 
 LIBES = $(LOADLIBES) $(LIBS) $(LIBX) $(LIBSOUND) $(RSVG_LIBS) $(DBUS_LIBS) \
    @LIBGPM@ @LIBRESOLV@ LIBS_SYSTEM LIBS_MACHINE LIBS_TERMCAP \
-   $(GETLOADAVG_LIBS) ${GCONF_LIBS} \
+   $(GETLOADAVG_LIBS) ${GCONF_LIBS} ${LIBSELINUX_LIBS} \
    @FREETYPE_LIBS@ @FONTCONFIG_LIBS@ @LIBOTF_LIBS@ @M17N_FLT_LIBS@ \
    $(GNULIB_VAR) LIB_MATH LIB_STANDARD $(GNULIB_VAR)
 
--- a/src/bidi.c	Tue Apr 20 23:33:39 2010 +0000
+++ b/src/bidi.c	Wed Apr 21 23:03:28 2010 +0000
@@ -102,7 +102,7 @@
 
 int bidi_ignore_explicit_marks_for_paragraph_level = 1;
 
-static Lisp_Object fallback_paragraph_start_re, fallback_paragraph_separate_re;
+static Lisp_Object paragraph_start_re, paragraph_separate_re;
 static Lisp_Object Qparagraph_start, Qparagraph_separate;
 
 static void
@@ -401,16 +401,16 @@
 
   Qparagraph_start = intern ("paragraph-start");
   staticpro (&Qparagraph_start);
-  fallback_paragraph_start_re = Fsymbol_value (Qparagraph_start);
-  if (!STRINGP (fallback_paragraph_start_re))
-    fallback_paragraph_start_re = build_string ("\f\\|[ \t]*$");
-  staticpro (&fallback_paragraph_start_re);
+  paragraph_start_re = Fsymbol_value (Qparagraph_start);
+  if (!STRINGP (paragraph_start_re))
+    paragraph_start_re = build_string ("\f\\|[ \t]*$");
+  staticpro (&paragraph_start_re);
   Qparagraph_separate = intern ("paragraph-separate");
   staticpro (&Qparagraph_separate);
-  fallback_paragraph_separate_re = Fsymbol_value (Qparagraph_separate);
-  if (!STRINGP (fallback_paragraph_separate_re))
-    fallback_paragraph_separate_re = build_string ("[ \t\f]*$");
-  staticpro (&fallback_paragraph_separate_re);
+  paragraph_separate_re = Fsymbol_value (Qparagraph_separate);
+  if (!STRINGP (paragraph_separate_re))
+    paragraph_separate_re = build_string ("[ \t\f]*$");
+  staticpro (&paragraph_separate_re);
   bidi_initialized = 1;
 }
 
@@ -751,16 +751,12 @@
 bidi_at_paragraph_end (EMACS_INT charpos, EMACS_INT bytepos)
 {
   /* FIXME: Why Fbuffer_local_value rather than just Fsymbol_value?  */
-  Lisp_Object sep_re = Fbuffer_local_value (Qparagraph_separate,
-					    Fcurrent_buffer ());
-  Lisp_Object start_re = Fbuffer_local_value (Qparagraph_start,
-					      Fcurrent_buffer ());
+  Lisp_Object sep_re;
+  Lisp_Object start_re;
   EMACS_INT val;
 
-  if (!STRINGP (sep_re))
-    sep_re = fallback_paragraph_separate_re;
-  if (!STRINGP (start_re))
-    start_re = fallback_paragraph_start_re;
+  sep_re = paragraph_separate_re;
+  start_re = paragraph_start_re;
 
   val = fast_looking_at (sep_re, charpos, bytepos, ZV, ZV_BYTE, Qnil);
   if (val < 0)
@@ -829,12 +825,9 @@
 static EMACS_INT
 bidi_find_paragraph_start (EMACS_INT pos, EMACS_INT pos_byte)
 {
-  /* FIXME: Why Fbuffer_local_value rather than just Fsymbol_value?  */
-  Lisp_Object re = Fbuffer_local_value (Qparagraph_start, Fcurrent_buffer ());
+  Lisp_Object re = paragraph_start_re;
   EMACS_INT limit = ZV, limit_byte = ZV_BYTE;
 
-  if (!STRINGP (re))
-    re = fallback_paragraph_start_re;
   while (pos_byte > BEGV_BYTE
 	 && fast_looking_at (re, pos, pos_byte, limit, limit_byte, Qnil) < 0)
     {
--- a/src/config.in	Tue Apr 20 23:33:39 2010 +0000
+++ b/src/config.in	Wed Apr 21 23:03:28 2010 +0000
@@ -318,10 +318,10 @@
 /* Define to 1 if you have the <kerberos/krb.h> header file. */
 #undef HAVE_KERBEROS_KRB_H
 
-/* Define to 1 if `e_text' is a member of `krb5_error'. */
+/* Define to 1 if `e_text' is member of `krb5_error'. */
 #undef HAVE_KRB5_ERROR_E_TEXT
 
-/* Define to 1 if `text' is a member of `krb5_error'. */
+/* Define to 1 if `text' is member of `krb5_error'. */
 #undef HAVE_KRB5_ERROR_TEXT
 
 /* Define to 1 if you have the <krb5.h> header file. */
@@ -399,6 +399,9 @@
 /* Define to 1 if you have the resolv library (-lresolv). */
 #undef HAVE_LIBRESOLV
 
+/* Define to 1 if using SELinux. */
+#undef HAVE_LIBSELINUX
+
 /* Define to 1 if you have the `Xext' library (-lXext). */
 #undef HAVE_LIBXEXT
 
@@ -615,25 +618,25 @@
 /* Define to 1 if you have the `strsignal' function. */
 #undef HAVE_STRSIGNAL
 
-/* Define to 1 if `ifr_addr' is a member of `struct ifreq'. */
+/* Define to 1 if `ifr_addr' is member of `struct ifreq'. */
 #undef HAVE_STRUCT_IFREQ_IFR_ADDR
 
-/* Define to 1 if `ifr_broadaddr' is a member of `struct ifreq'. */
+/* Define to 1 if `ifr_broadaddr' is member of `struct ifreq'. */
 #undef HAVE_STRUCT_IFREQ_IFR_BROADADDR
 
-/* Define to 1 if `ifr_flags' is a member of `struct ifreq'. */
+/* Define to 1 if `ifr_flags' is member of `struct ifreq'. */
 #undef HAVE_STRUCT_IFREQ_IFR_FLAGS
 
-/* Define to 1 if `ifr_hwaddr' is a member of `struct ifreq'. */
+/* Define to 1 if `ifr_hwaddr' is member of `struct ifreq'. */
 #undef HAVE_STRUCT_IFREQ_IFR_HWADDR
 
-/* Define to 1 if `ifr_netmask' is a member of `struct ifreq'. */
+/* Define to 1 if `ifr_netmask' is member of `struct ifreq'. */
 #undef HAVE_STRUCT_IFREQ_IFR_NETMASK
 
-/* Define to 1 if `n_un.n_name' is a member of `struct nlist'. */
+/* Define to 1 if `n_un.n_name' is member of `struct nlist'. */
 #undef HAVE_STRUCT_NLIST_N_UN_N_NAME
 
-/* Define to 1 if `tm_zone' is a member of `struct tm'. */
+/* Define to 1 if `tm_zone' is member of `struct tm'. */
 #undef HAVE_STRUCT_TM_TM_ZONE
 
 /* Define to 1 if `struct utimbuf' is declared by <utime.h>. */
@@ -860,9 +863,6 @@
 /* Define to the one symbol short name of this package. */
 #undef PACKAGE_TARNAME
 
-/* Define to the home page for this package. */
-#undef PACKAGE_URL
-
 /* Define to the version of this package. */
 #undef PACKAGE_VERSION
 
@@ -922,28 +922,6 @@
 /* Define to 1 if using the Motif X toolkit. */
 #undef USE_MOTIF
 
-/* Enable extensions on AIX 3, Interix.  */
-#ifndef _ALL_SOURCE
-# undef _ALL_SOURCE
-#endif
-/* Enable GNU extensions on systems that have them.  */
-#ifndef _GNU_SOURCE
-# undef _GNU_SOURCE
-#endif
-/* Enable threading extensions on Solaris.  */
-#ifndef _POSIX_PTHREAD_SEMANTICS
-# undef _POSIX_PTHREAD_SEMANTICS
-#endif
-/* Enable extensions on HP NonStop.  */
-#ifndef _TANDEM_SOURCE
-# undef _TANDEM_SOURCE
-#endif
-/* Enable general extensions on Solaris.  */
-#ifndef __EXTENSIONS__
-# undef __EXTENSIONS__
-#endif
-
-
 /* Define to 1 if we should use toolkit scroll bars. */
 #undef USE_TOOLKIT_SCROLL_BARS
 
@@ -979,6 +957,28 @@
 /* Define to 1 if you need to in order for `stat' and other things to work. */
 #undef _POSIX_SOURCE
 
+/* Enable extensions on AIX 3, Interix.  */
+#ifndef _ALL_SOURCE
+# undef _ALL_SOURCE
+#endif
+/* Enable GNU extensions on systems that have them.  */
+#ifndef _GNU_SOURCE
+# undef _GNU_SOURCE
+#endif
+/* Enable threading extensions on Solaris.  */
+#ifndef _POSIX_PTHREAD_SEMANTICS
+# undef _POSIX_PTHREAD_SEMANTICS
+#endif
+/* Enable extensions on HP NonStop.  */
+#ifndef _TANDEM_SOURCE
+# undef _TANDEM_SOURCE
+#endif
+/* Enable general extensions on Solaris.  */
+#ifndef __EXTENSIONS__
+# undef __EXTENSIONS__
+#endif
+
+
 /* Define to rpl_ if the getopt replacement functions and variables should be
    used. */
 #undef __GETOPT_PREFIX
--- a/src/data.c	Tue Apr 20 23:33:39 2010 +0000
+++ b/src/data.c	Wed Apr 21 23:03:28 2010 +0000
@@ -1558,10 +1558,14 @@
 {
   struct Lisp_Buffer_Local_Value *blv
     = xmalloc (sizeof (struct Lisp_Buffer_Local_Value));
-  Lisp_Object symbol; XSETSYMBOL (symbol, sym);
-  Lisp_Object tem = Fcons (symbol, (forwarded
-				    ? do_symval_forwarding (valcontents.fwd)
-				    : valcontents.value));
+  Lisp_Object symbol;
+  Lisp_Object tem;
+
+ XSETSYMBOL (symbol, sym);
+ tem = Fcons (symbol, (forwarded
+                       ? do_symval_forwarding (valcontents.fwd)
+                       : valcontents.value));
+
   /* Buffer_Local_Values cannot have as realval a buffer-local
      or keyboard-local forwarding.  */
   eassert (!(forwarded && BUFFER_OBJFWDP (valcontents.fwd)));
--- a/src/dispextern.h	Tue Apr 20 23:33:39 2010 +0000
+++ b/src/dispextern.h	Wed Apr 21 23:03:28 2010 +0000
@@ -2793,6 +2793,9 @@
   /* Icon file name of right to left image when an RTL locale is used.  */
   TOOL_BAR_ITEM_RTL_IMAGE,
 
+  /* Label to show when text labels are enabled.  */
+  TOOL_BAR_ITEM_LABEL,
+
   /* Sentinel = number of slots in tool_bar_items occupied by one
      tool-bar item.  */
   TOOL_BAR_ITEM_NSLOTS
@@ -2814,6 +2817,15 @@
 
 extern Lisp_Object Vtool_bar_button_margin;
 
+/* Tool bar style */
+
+extern Lisp_Object Vtool_bar_style;
+
+/* Maximum number of characters a label can have to be shown.  */
+
+extern EMACS_INT tool_bar_max_label_size;
+#define DEFAULT_TOOL_BAR_LABEL_SIZE 14
+
 /* Thickness of relief to draw around tool-bar buttons.  */
 
 extern EMACS_INT tool_bar_button_relief;
--- a/src/eval.c	Tue Apr 20 23:33:39 2010 +0000
+++ b/src/eval.c	Wed Apr 21 23:03:28 2010 +0000
@@ -2952,6 +2952,33 @@
 #endif /* not NO_ARG_ARRAY */
 }
 
+/* Call function fn with 7 arguments arg1, arg2, arg3, arg4, arg5, arg6, arg7 */
+/* ARGSUSED */
+Lisp_Object
+call7 (fn, arg1, arg2, arg3, arg4, arg5, arg6, arg7)
+     Lisp_Object fn, arg1, arg2, arg3, arg4, arg5, arg6, arg7;
+{
+  struct gcpro gcpro1;
+#ifdef NO_ARG_ARRAY
+  Lisp_Object args[8];
+  args[0] = fn;
+  args[1] = arg1;
+  args[2] = arg2;
+  args[3] = arg3;
+  args[4] = arg4;
+  args[5] = arg5;
+  args[6] = arg6;
+  args[7] = arg7;
+  GCPRO1 (args[0]);
+  gcpro1.nvars = 8;
+  RETURN_UNGCPRO (Ffuncall (8, args));
+#else /* not NO_ARG_ARRAY */
+  GCPRO1 (fn);
+  gcpro1.nvars = 8;
+  RETURN_UNGCPRO (Ffuncall (8, &fn));
+#endif /* not NO_ARG_ARRAY */
+}
+
 /* The caller should GCPRO all the elements of ARGS.  */
 
 DEFUN ("funcall", Ffuncall, Sfuncall, 1, MANY, 0,
--- a/src/fileio.c	Tue Apr 20 23:33:39 2010 +0000
+++ b/src/fileio.c	Wed Apr 21 23:03:28 2010 +0000
@@ -53,6 +53,11 @@
 #include <ctype.h>
 #include <errno.h>
 
+#ifdef HAVE_LIBSELINUX
+#include <selinux/selinux.h>
+#include <selinux/context.h>
+#endif
+
 #include "lisp.h"
 #include "intervals.h"
 #include "buffer.h"
@@ -331,6 +336,8 @@
 Lisp_Object Qfile_modes;
 Lisp_Object Qset_file_modes;
 Lisp_Object Qset_file_times;
+Lisp_Object Qfile_selinux_context;
+Lisp_Object Qset_file_selinux_context;
 Lisp_Object Qfile_newer_than_file_p;
 Lisp_Object Qinsert_file_contents;
 Lisp_Object Qwrite_region;
@@ -1894,7 +1901,7 @@
   return;
 }
 
-DEFUN ("copy-file", Fcopy_file, Scopy_file, 2, 5,
+DEFUN ("copy-file", Fcopy_file, Scopy_file, 2, 6,
        "fCopy file: \nGCopy %s to file: \np\nP",
        doc: /* Copy FILE to NEWNAME.  Both args must be strings.
 If NEWNAME names a directory, copy FILE there.
@@ -1916,10 +1923,13 @@
 A prefix arg makes KEEP-TIME non-nil.
 
 If PRESERVE-UID-GID is non-nil, we try to transfer the
-uid and gid of FILE to NEWNAME.  */)
-  (file, newname, ok_if_already_exists, keep_time, preserve_uid_gid)
+uid and gid of FILE to NEWNAME.
+
+If PRESERVE-SELINUX-CONTEXT is non-nil and SELinux is enabled 
+on the system, we copy the SELinux context of FILE to NEWNAME.  */)
+     (file, newname, ok_if_already_exists, keep_time, preserve_uid_gid, preserve_selinux_context)
      Lisp_Object file, newname, ok_if_already_exists, keep_time;
-     Lisp_Object preserve_uid_gid;
+     Lisp_Object preserve_uid_gid, preserve_selinux_context;
 {
   int ifd, ofd, n;
   char buf[16 * 1024];
@@ -1929,6 +1939,10 @@
   int count = SPECPDL_INDEX ();
   int input_file_statable_p;
   Lisp_Object encoded_file, encoded_newname;
+#if HAVE_LIBSELINUX
+  security_context_t con;
+  int fail, conlength = 0;
+#endif
 
   encoded_file = encoded_newname = Qnil;
   GCPRO4 (file, newname, encoded_file, encoded_newname);
@@ -1949,8 +1963,9 @@
   if (NILP (handler))
     handler = Ffind_file_name_handler (newname, Qcopy_file);
   if (!NILP (handler))
-    RETURN_UNGCPRO (call6 (handler, Qcopy_file, file, newname,
-			   ok_if_already_exists, keep_time, preserve_uid_gid));
+    RETURN_UNGCPRO (call7 (handler, Qcopy_file, file, newname,
+			   ok_if_already_exists, keep_time, preserve_uid_gid,
+			   preserve_selinux_context));
 
   encoded_file = ENCODE_FILE (file);
   encoded_newname = ENCODE_FILE (newname);
@@ -2004,6 +2019,15 @@
      copyable by us. */
   input_file_statable_p = (fstat (ifd, &st) >= 0);
 
+#if HAVE_LIBSELINUX
+  if (!NILP (preserve_selinux_context) && is_selinux_enabled ())
+    {
+      conlength = fgetfilecon (ifd, &con);
+      if (conlength == -1)
+	report_file_error ("Doing fgetfilecon", Fcons (file, Qnil));
+    }
+#endif
+
   if (out_st.st_mode != 0
       && st.st_dev == out_st.st_dev && st.st_ino == out_st.st_ino)
     {
@@ -2061,6 +2085,18 @@
     }
 #endif	/* not MSDOS */
 
+#if HAVE_LIBSELINUX
+  if (conlength > 0)
+    {
+      /* Set the modified context back to the file. */
+      fail = fsetfilecon (ofd, con);
+      if (fail)
+	report_file_error ("Doing fsetfilecon", Fcons (newname, Qnil));
+
+      freecon (con);
+    }
+#endif
+
   /* Closing the output clobbers the file times on some systems.  */
   if (emacs_close (ofd) < 0)
     report_file_error ("I/O error", Fcons (newname, Qnil));
@@ -2287,7 +2323,7 @@
 	       have copy-file prompt again.  */
 	    Fcopy_file (file, newname,
 			NILP (ok_if_already_exists) ? Qnil : Qt,
-			Qt, Qt);
+			Qt, Qt, Qt);
 
 	  count = SPECPDL_INDEX ();
 	  specbind (Qdelete_by_moving_to_trash, Qnil);
@@ -2844,6 +2880,136 @@
 #endif
 }
 
+DEFUN ("file-selinux-context", Ffile_selinux_context,
+       Sfile_selinux_context, 1, 1, 0,
+       doc: /* Return SELinux context of file named FILENAME,
+as a list ("user", "role", "type", "range"). Return (nil, nil, nil, nil)
+if file does not exist, is not accessible, or SELinux is disabled */)
+     (filename)
+     Lisp_Object filename;
+{
+  Lisp_Object absname;
+  Lisp_Object values[4];
+  Lisp_Object handler;
+#if HAVE_LIBSELINUX
+  security_context_t con;
+  int conlength;
+  context_t context;
+#endif
+
+  absname = expand_and_dir_to_file (filename, current_buffer->directory);
+
+  /* If the file name has special constructs in it,
+     call the corresponding file handler.  */
+  handler = Ffind_file_name_handler (absname, Qfile_selinux_context);
+  if (!NILP (handler))
+    return call2 (handler, Qfile_selinux_context, absname);
+
+  absname = ENCODE_FILE (absname);
+
+  values[0] = Qnil;
+  values[1] = Qnil;
+  values[2] = Qnil;
+  values[3] = Qnil;
+#if HAVE_LIBSELINUX
+  if (is_selinux_enabled ())
+    {
+      conlength = lgetfilecon (SDATA (absname), &con);
+      if (conlength > 0)
+	{
+	  context = context_new (con);
+	  values[0] = build_string (context_user_get (context));
+	  values[1] = build_string (context_role_get (context));
+	  values[2] = build_string (context_type_get (context));
+	  values[3] = build_string (context_range_get (context));
+	  context_free (context);
+	}
+      if (con)
+	freecon (con);
+    }
+#endif
+
+  return Flist (sizeof(values) / sizeof(values[0]), values);
+}
+
+DEFUN ("set-file-selinux-context", Fset_file_selinux_context,
+       Sset_file_selinux_context, 2, 2, 0,
+       doc: /* Set SELinux context of file named FILENAME to CONTEXT
+as a list ("user", "role", "type", "range"). Has no effect if SELinux
+is disabled. */)
+     (filename, context)
+     Lisp_Object filename, context;
+{
+  Lisp_Object absname, encoded_absname;
+  Lisp_Object handler;
+  Lisp_Object user = CAR_SAFE (context);
+  Lisp_Object role = CAR_SAFE (CDR_SAFE (context));
+  Lisp_Object type = CAR_SAFE (CDR_SAFE (CDR_SAFE (context)));
+  Lisp_Object range = CAR_SAFE (CDR_SAFE (CDR_SAFE (CDR_SAFE (context))));
+#if HAVE_LIBSELINUX
+  security_context_t con;
+  int fail, conlength;
+  context_t parsed_con;
+#endif
+
+  absname = Fexpand_file_name (filename, current_buffer->directory);
+
+  /* If the file name has special constructs in it,
+     call the corresponding file handler.  */
+  handler = Ffind_file_name_handler (absname, Qset_file_selinux_context);
+  if (!NILP (handler))
+    return call3 (handler, Qset_file_selinux_context, absname, context);
+
+  encoded_absname = ENCODE_FILE (absname);
+
+#if HAVE_LIBSELINUX
+  if (is_selinux_enabled ())
+    {
+      /* Get current file context. */
+      conlength = lgetfilecon (SDATA (encoded_absname), &con);
+      if (conlength > 0)
+	{
+	  parsed_con = context_new (con);
+	  /* Change the parts defined in the parameter.*/
+	  if (STRINGP (user))
+	    {
+	      if (context_user_set (parsed_con, SDATA (user)))
+		error ("Doing context_user_set");
+	    }
+	  if (STRINGP (role))
+	    {
+	      if (context_role_set (parsed_con, SDATA (role)))
+		error ("Doing context_role_set");
+	    }
+	  if (STRINGP (type))
+	    {
+	      if (context_type_set (parsed_con, SDATA (type)))
+		error ("Doing context_type_set");
+	    }
+	  if (STRINGP (range))
+	    {
+	      if (context_range_set (parsed_con, SDATA (range)))
+		error ("Doing context_range_set");
+	    }
+
+	  /* Set the modified context back to the file. */
+	  fail = lsetfilecon (SDATA (encoded_absname), context_str (parsed_con));
+	  if (fail)
+	    report_file_error ("Doing lsetfilecon", Fcons (absname, Qnil));
+
+	  context_free (parsed_con);
+	}
+      else
+	report_file_error("Doing lgetfilecon", Fcons (absname, Qnil));
+
+      if (con)
+	freecon (con);
+    }
+#endif
+
+  return Qnil;
+}
+
 DEFUN ("file-modes", Ffile_modes, Sfile_modes, 1, 1, 0,
        doc: /* Return mode bits of file named FILENAME, as an integer.
 Return nil, if file does not exist or is not accessible.  */)
@@ -5505,6 +5671,8 @@
   Qfile_modes = intern_c_string ("file-modes");
   Qset_file_modes = intern_c_string ("set-file-modes");
   Qset_file_times = intern_c_string ("set-file-times");
+  Qfile_selinux_context = intern_c_string("file-selinux-context");
+  Qset_file_selinux_context = intern_c_string("set-file-selinux-context");
   Qfile_newer_than_file_p = intern_c_string ("file-newer-than-file-p");
   Qinsert_file_contents = intern_c_string ("insert-file-contents");
   Qwrite_region = intern_c_string ("write-region");
@@ -5540,6 +5708,8 @@
   staticpro (&Qfile_modes);
   staticpro (&Qset_file_modes);
   staticpro (&Qset_file_times);
+  staticpro (&Qfile_selinux_context);
+  staticpro (&Qset_file_selinux_context);
   staticpro (&Qfile_newer_than_file_p);
   staticpro (&Qinsert_file_contents);
   staticpro (&Qwrite_region);
@@ -5773,6 +5943,8 @@
   defsubr (&Sfile_modes);
   defsubr (&Sset_file_modes);
   defsubr (&Sset_file_times);
+  defsubr (&Sfile_selinux_context);
+  defsubr (&Sset_file_selinux_context);
   defsubr (&Sset_default_file_modes);
   defsubr (&Sdefault_file_modes);
   defsubr (&Sfile_newer_than_file_p);
--- a/src/gtkutil.c	Tue Apr 20 23:33:39 2010 +0000
+++ b/src/gtkutil.c	Wed Apr 21 23:03:28 2010 +0000
@@ -3522,7 +3522,16 @@
 {
   GtkWidget *weventbox = gtk_bin_get_child (GTK_BIN (toolitem));
   GtkButton *wbutton = GTK_BUTTON (gtk_bin_get_child (GTK_BIN (weventbox)));
-  GtkWidget *wmenuitem = gtk_image_menu_item_new_with_label ("");
+  GtkBox *vb = GTK_BOX (gtk_bin_get_child (GTK_BIN (wbutton)));
+  GtkBoxChild *c1 = (GtkBoxChild *) vb->children->data;
+  GtkBoxChild *c2 = (GtkBoxChild *) vb->children->next->data;
+  GtkImage *wimage = GTK_IS_IMAGE (c1->widget)
+    ? GTK_IMAGE (c1->widget) : GTK_IMAGE (c2->widget);
+  GtkLabel *wlbl = GTK_IS_LABEL (c1->widget)
+    ? GTK_LABEL (c1->widget) : GTK_LABEL (c2->widget);
+  GtkWidget *wmenuitem = gtk_image_menu_item_new_with_label
+    (gtk_label_get_text (wlbl));
+
   GtkWidget *wmenuimage;
 
   if (gtk_button_get_use_stock (wbutton))
@@ -3530,7 +3539,6 @@
                                            GTK_ICON_SIZE_MENU);
   else
     {
-      GtkImage *wimage = GTK_IMAGE (gtk_bin_get_child (GTK_BIN (wbutton)));
       GtkSettings *settings = gtk_widget_get_settings (GTK_WIDGET (wbutton));
       GtkImageType store_type = gtk_image_get_storage_type (wimage);
 
@@ -3834,6 +3842,132 @@
   return image;
 }
 
+static GtkToolItem *
+xg_make_tool_item (FRAME_PTR f,
+                   GtkWidget *wimage,
+                   GtkWidget **wbutton,
+                   char *label,
+                   int i)
+{
+  GtkToolItem *ti = gtk_tool_item_new ();
+  GtkWidget *vb = EQ (Vtool_bar_style, Qboth_horiz)
+    ? gtk_hbox_new (FALSE, 0) : gtk_vbox_new (FALSE, 0);
+  GtkWidget *wb = gtk_button_new ();
+  GtkWidget *weventbox = gtk_event_box_new ();
+
+  if (wimage)
+    gtk_box_pack_start_defaults (GTK_BOX (vb), wimage);
+
+  gtk_box_pack_start_defaults (GTK_BOX (vb), gtk_label_new (label));
+  gtk_button_set_focus_on_click (GTK_BUTTON (wb), FALSE);
+  gtk_button_set_relief (GTK_BUTTON (wb), GTK_RELIEF_NONE);
+  gtk_container_add (GTK_CONTAINER (wb), vb);
+  gtk_container_add (GTK_CONTAINER (weventbox), wb);
+  gtk_container_add (GTK_CONTAINER (ti), weventbox);
+
+  if (wimage)
+    {
+      /* The EMACS_INT cast avoids a warning. */
+      g_signal_connect (G_OBJECT (ti), "create-menu-proxy",
+                        G_CALLBACK (xg_tool_bar_menu_proxy),
+                        (gpointer) (EMACS_INT) i);
+
+      g_signal_connect (G_OBJECT (wb), "clicked",
+                        G_CALLBACK (xg_tool_bar_callback),
+                        (gpointer) (EMACS_INT) i);
+
+      gtk_widget_show_all (GTK_WIDGET (ti));
+
+      g_object_set_data (G_OBJECT (weventbox), XG_FRAME_DATA, (gpointer)f);
+
+      /* Catch expose events to overcome an annoying redraw bug, see
+         comment for xg_tool_bar_item_expose_callback.  */
+      g_signal_connect (G_OBJECT (ti),
+                        "expose-event",
+                        G_CALLBACK (xg_tool_bar_item_expose_callback),
+                        0);
+
+      gtk_tool_item_set_homogeneous (ti, FALSE);
+
+      /* Callback to save modifyer mask (Shift/Control, etc).  GTK makes
+         no distinction based on modifiers in the activate callback,
+         so we have to do it ourselves.  */
+      g_signal_connect (wb, "button-release-event",
+                        G_CALLBACK (xg_tool_bar_button_cb),
+                        NULL);
+
+      g_object_set_data (G_OBJECT (wb), XG_FRAME_DATA, (gpointer)f);
+          
+      /* Use enter/leave notify to show help.  We use the events
+         rather than the GtkButton specific signals "enter" and
+         "leave", so we can have only one callback.  The event
+         will tell us what kind of event it is.  */
+      /* The EMACS_INT cast avoids a warning. */
+      g_signal_connect (G_OBJECT (weventbox),
+                        "enter-notify-event",
+                        G_CALLBACK (xg_tool_bar_help_callback),
+                        (gpointer) (EMACS_INT) i);
+      g_signal_connect (G_OBJECT (weventbox),
+                        "leave-notify-event",
+                        G_CALLBACK (xg_tool_bar_help_callback),
+                        (gpointer) (EMACS_INT) i);
+    }
+  
+  if (wbutton) *wbutton = wb;
+
+  return ti;
+}
+
+static void
+xg_show_toolbar_item (GtkToolItem *ti)
+{
+  Lisp_Object style = Ftool_bar_get_system_style ();
+
+  int show_label = EQ (style, Qboth)
+    || EQ (style, Qboth_horiz) || EQ (style, Qtext);
+  int show_image = ! EQ (style, Qtext);
+  int horiz = EQ (style, Qboth_horiz);
+
+  GtkWidget *weventbox = gtk_bin_get_child (GTK_BIN (ti));
+  GtkWidget *wbutton = gtk_bin_get_child (GTK_BIN (weventbox));
+  GtkBox *vb = GTK_BOX (gtk_bin_get_child (GTK_BIN (wbutton)));
+  GtkBoxChild *c1 = (GtkBoxChild *) vb->children->data;
+  GtkBoxChild *c2 = (GtkBoxChild *) vb->children->next->data;
+  GtkWidget *wimage = GTK_IS_IMAGE (c1->widget)
+    ? c1->widget : c2->widget;
+  GtkWidget *wlbl = GTK_IS_LABEL (c1->widget)
+    ? c1->widget : c2->widget;
+  GtkWidget *new_box = NULL;
+
+  if (GTK_IS_VBOX (vb) && horiz)
+    new_box = gtk_hbox_new (FALSE, 0);
+  else if (GTK_IS_HBOX (vb) && !horiz && show_label && show_image)
+    new_box = gtk_vbox_new (FALSE, 0);
+  if (new_box)
+    {
+      gtk_widget_ref (wimage);
+      gtk_widget_ref (wlbl);
+      gtk_container_remove (GTK_CONTAINER (vb), wimage);
+      gtk_container_remove (GTK_CONTAINER (vb), wlbl);
+      gtk_widget_destroy (GTK_WIDGET (vb));
+      gtk_box_pack_start_defaults (GTK_BOX (new_box), wimage);
+      gtk_box_pack_start_defaults (GTK_BOX (new_box), wlbl);
+      gtk_container_add (GTK_CONTAINER (wbutton), new_box);
+      gtk_widget_unref (wimage);
+      gtk_widget_unref (wlbl);
+      vb = GTK_BOX (new_box);
+    }
+
+  if (show_label) gtk_widget_show (wlbl);
+  else gtk_widget_hide (wlbl);
+  if (show_image) gtk_widget_show (wimage);
+  else gtk_widget_hide (wimage);
+  gtk_widget_show (GTK_WIDGET (vb));
+  gtk_widget_show (GTK_WIDGET (wbutton));
+  gtk_widget_show (GTK_WIDGET (ti));
+}
+
+
 /* Update the tool bar for frame F.  Add new buttons and remove old.  */
 
 extern Lisp_Object Qx_gtk_map_stock;
@@ -3885,8 +4019,8 @@
 
   wtoolbar = GTK_TOOLBAR (x->toolbar_widget);
   gtk_widget_size_request (GTK_WIDGET (wtoolbar), &old_req);
-  dir = gtk_widget_get_direction (x->toolbar_widget);
-
+  dir = gtk_widget_get_direction (GTK_WIDGET (wtoolbar));
+  
   for (i = 0; i < f->n_tool_bar_items; ++i)
     {
       int enabled_p = !NILP (PROP (TOOL_BAR_ITEM_ENABLED_P));
@@ -3904,8 +4038,10 @@
       GtkWidget *wbutton = NULL;
       GtkWidget *weventbox;
       Lisp_Object specified_file;
-
-      ti = gtk_toolbar_get_nth_item (GTK_TOOLBAR (x->toolbar_widget), i);
+      Lisp_Object lbl = PROP (TOOL_BAR_ITEM_LABEL);
+      char *label = SSDATA (PROP (TOOL_BAR_ITEM_LABEL));
+      
+      ti = gtk_toolbar_get_nth_item (GTK_TOOLBAR (wtoolbar), i);
 
       if (ti)
         {
@@ -3913,6 +4049,7 @@
           wbutton = gtk_bin_get_child (GTK_BIN (weventbox));
         }
 
+
       image = PROP (TOOL_BAR_ITEM_IMAGES);
 
       /* Ignore invalid image specifications.  */
@@ -3944,7 +4081,7 @@
                 icon_size = gtk_toolbar_get_icon_size (wtoolbar);
             }
           else if (gtk_stock_lookup (SSDATA (stock), &stock_item))
-              icon_size = gtk_toolbar_get_icon_size (wtoolbar);
+            icon_size = gtk_toolbar_get_icon_size (wtoolbar);
           else
             {
               stock = Qnil;
@@ -3988,22 +4125,15 @@
 
           if (img->load_failed_p || img->pixmap == None)
             {
-                if (ti)
-                    gtk_widget_hide_all (GTK_WIDGET (ti));
-                else
+              if (ti)
+                gtk_widget_hide_all (GTK_WIDGET (ti));
+              else
                 {
-                    /* Insert an empty (non-image) button */
-                    weventbox = gtk_event_box_new ();
-                    wbutton = gtk_button_new ();
-                    gtk_button_set_focus_on_click (GTK_BUTTON (wbutton), FALSE);
-                    gtk_button_set_relief (GTK_BUTTON (wbutton),
-                                           GTK_RELIEF_NONE);
-                    gtk_container_add (GTK_CONTAINER (weventbox), wbutton);
-                    ti = gtk_tool_item_new ();
-                    gtk_container_add (GTK_CONTAINER (ti), weventbox);
-                    gtk_toolbar_insert (GTK_TOOLBAR (x->toolbar_widget), ti, -1);
+                  /* Insert an empty (non-image) button */
+                  ti = xg_make_tool_item (f, NULL, NULL, "", i);
+                  gtk_toolbar_insert (GTK_TOOLBAR (wtoolbar), ti, -1);
                 }
-                continue;
+              continue;
             }
         }
 
@@ -4034,73 +4164,27 @@
             }
 
           gtk_misc_set_padding (GTK_MISC (w), hmargin, vmargin);
-          wbutton = gtk_button_new ();
-          gtk_button_set_focus_on_click (GTK_BUTTON (wbutton), FALSE);
-          gtk_button_set_relief (GTK_BUTTON (wbutton), GTK_RELIEF_NONE);
-          gtk_container_add (GTK_CONTAINER (wbutton), w);
-          weventbox = gtk_event_box_new ();
-          gtk_container_add (GTK_CONTAINER (weventbox), wbutton);
-          ti = gtk_tool_item_new ();
-          gtk_container_add (GTK_CONTAINER (ti), weventbox);
-          gtk_toolbar_insert (GTK_TOOLBAR (x->toolbar_widget), ti, -1);
-
-
-          /* The EMACS_INT cast avoids a warning. */
-          g_signal_connect (G_OBJECT (ti), "create-menu-proxy",
-                            G_CALLBACK (xg_tool_bar_menu_proxy),
-                            (gpointer) (EMACS_INT) i);
-
-          g_signal_connect (G_OBJECT (wbutton), "clicked",
-                            G_CALLBACK (xg_tool_bar_callback),
-                            (gpointer) (EMACS_INT) i);
-
-          gtk_widget_show_all (GTK_WIDGET (ti));
-
-
-          g_object_set_data (G_OBJECT (weventbox), XG_FRAME_DATA, (gpointer)f);
-
-          /* Catch expose events to overcome an annoying redraw bug, see
-             comment for xg_tool_bar_item_expose_callback.  */
-          g_signal_connect (G_OBJECT (ti),
-                            "expose-event",
-                            G_CALLBACK (xg_tool_bar_item_expose_callback),
-                            0);
-
+          ti = xg_make_tool_item (f, w, &wbutton, label, i);
+          gtk_toolbar_insert (GTK_TOOLBAR (wtoolbar), ti, -1);
           gtk_widget_set_sensitive (wbutton, enabled_p);
-          gtk_tool_item_set_homogeneous (ti, FALSE);
-
-          /* Callback to save modifyer mask (Shift/Control, etc).  GTK makes
-             no distinction based on modifiers in the activate callback,
-             so we have to do it ourselves.  */
-          g_signal_connect (wbutton, "button-release-event",
-                            G_CALLBACK (xg_tool_bar_button_cb),
-                            NULL);
-
-          g_object_set_data (G_OBJECT (wbutton), XG_FRAME_DATA, (gpointer)f);
-          
-          /* Use enter/leave notify to show help.  We use the events
-             rather than the GtkButton specific signals "enter" and
-             "leave", so we can have only one callback.  The event
-             will tell us what kind of event it is.  */
-          /* The EMACS_INT cast avoids a warning. */
-          g_signal_connect (G_OBJECT (weventbox),
-                            "enter-notify-event",
-                            G_CALLBACK (xg_tool_bar_help_callback),
-                            (gpointer) (EMACS_INT) i);
-          g_signal_connect (G_OBJECT (weventbox),
-                            "leave-notify-event",
-                            G_CALLBACK (xg_tool_bar_help_callback),
-                            (gpointer) (EMACS_INT) i);
         }
       else
         {
-          GtkWidget *wimage = gtk_bin_get_child (GTK_BIN (wbutton));
+          GtkBox *vb = GTK_BOX (gtk_bin_get_child (GTK_BIN (wbutton)));
+          GtkBoxChild *c1 = (GtkBoxChild *) vb->children->data;
+          GtkBoxChild *c2 = (GtkBoxChild *) vb->children->next->data;
+          GtkWidget *wimage = GTK_IS_IMAGE (c1->widget)
+            ? c1->widget : c2->widget;
+          GtkWidget *wlbl = GTK_IS_LABEL (c1->widget)
+            ? c1->widget : c2->widget;
+
           Pixmap old_img = (Pixmap)g_object_get_data (G_OBJECT (wimage),
                                                       XG_TOOL_BAR_IMAGE_DATA);
           gpointer old_stock_name = g_object_get_data (G_OBJECT (wimage),
                                                        XG_TOOL_BAR_STOCK_NAME);
           gpointer old_icon_name = g_object_get_data (G_OBJECT (wimage),
                                                       XG_TOOL_BAR_ICON_NAME);
+          gtk_label_set_text (GTK_LABEL (wlbl), label);
           if (stock_name &&
               (! old_stock_name || strcmp (old_stock_name, stock_name) != 0))
             {
@@ -4111,7 +4195,8 @@
                                       (GDestroyNotify) xfree);
               g_object_set_data (G_OBJECT (wimage), XG_TOOL_BAR_IMAGE_DATA,
                                  NULL);
-              g_object_set_data (G_OBJECT (wimage), XG_TOOL_BAR_ICON_NAME, NULL);
+              g_object_set_data (G_OBJECT (wimage), XG_TOOL_BAR_ICON_NAME,
+                                 NULL);
             }
           else if (icon_name &&
                    (! old_icon_name || strcmp (old_icon_name, icon_name) != 0))
@@ -4134,14 +4219,15 @@
 
               g_object_set_data (G_OBJECT (wimage), XG_TOOL_BAR_STOCK_NAME,
                                  NULL);
-              g_object_set_data (G_OBJECT (wimage), XG_TOOL_BAR_ICON_NAME, NULL);
+              g_object_set_data (G_OBJECT (wimage), XG_TOOL_BAR_ICON_NAME,
+                                 NULL);
             }
 
           gtk_misc_set_padding (GTK_MISC (wimage), hmargin, vmargin);
 
           gtk_widget_set_sensitive (wbutton, enabled_p);
-          gtk_widget_show_all (GTK_WIDGET (ti));
-       }
+        }
+      xg_show_toolbar_item (ti);
 
 #undef PROP
     }
@@ -4150,16 +4236,16 @@
      can be reused later on.  */
   do
     {
-      ti = gtk_toolbar_get_nth_item (GTK_TOOLBAR (x->toolbar_widget), i++);
+      ti = gtk_toolbar_get_nth_item (GTK_TOOLBAR (wtoolbar), i++);
       if (ti) gtk_widget_hide_all (GTK_WIDGET (ti));
     } while (ti != NULL);
 
   new_req.height = 0;
   if (pack_tool_bar && f->n_tool_bar_items != 0)
-      xg_pack_tool_bar (f);
+    xg_pack_tool_bar (f);
   
 
-  gtk_widget_size_request (GTK_WIDGET (x->toolbar_widget), &new_req);
+  gtk_widget_size_request (GTK_WIDGET (wtoolbar), &new_req);
   if (old_req.height != new_req.height
       && ! FRAME_X_OUTPUT (f)->toolbar_detached)
     {
@@ -4203,7 +4289,7 @@
 
 /***********************************************************************
                       Initializing
- ***********************************************************************/
+***********************************************************************/
 void
 xg_initialize ()
 {
--- a/src/keyboard.c	Tue Apr 20 23:33:39 2010 +0000
+++ b/src/keyboard.c	Wed Apr 21 23:03:28 2010 +0000
@@ -496,7 +496,7 @@
 /* menu item parts */
 Lisp_Object Qmenu_enable;
 Lisp_Object QCenable, QCvisible, QChelp, QCfilter, QCkeys, QCkey_sequence;
-Lisp_Object QCbutton, QCtoggle, QCradio;
+Lisp_Object QCbutton, QCtoggle, QCradio, QClabel;
 extern Lisp_Object Qmenu_item;
 
 /* An event header symbol HEAD may have a property named
@@ -8248,7 +8248,11 @@
 
    - `:help HELP-STRING'.
 
-   Gives a help string to display for the tool bar item.  */
+   Gives a help string to display for the tool bar item.
+
+   - `:label LABEL-STRING'.
+
+   A text label to show with the tool bar button if labels are enabled.  */
 
 static int
 parse_tool_bar_item (key, item)
@@ -8259,7 +8263,7 @@
 
   Lisp_Object filter = Qnil;
   Lisp_Object caption;
-  int i;
+  int i, have_label = 0;
 
   /* Defininition looks like `(menu-item CAPTION BINDING PROPS...)'.
      Rule out items that aren't lists, don't start with
@@ -8337,6 +8341,12 @@
       else if (EQ (key, QChelp))
 	/* `:help HELP-STRING'.  */
 	PROP (TOOL_BAR_ITEM_HELP) = value;
+      else if (EQ (key, QClabel))
+        {
+          /* `:label LABEL-STRING'.  */
+          PROP (TOOL_BAR_ITEM_LABEL) = value;
+          have_label = 1;
+        }
       else if (EQ (key, QCfilter))
 	/* ':filter FORM'.  */
 	filter = value;
@@ -8364,6 +8374,49 @@
 	PROP (TOOL_BAR_ITEM_RTL_IMAGE) = value;
     }
 
+
+  if (!have_label)
+    {
+      /* Try to make one from caption and key.  */
+      Lisp_Object key = PROP (TOOL_BAR_ITEM_KEY);
+      Lisp_Object capt = PROP (TOOL_BAR_ITEM_CAPTION);
+      char *label = SYMBOLP (key) ? (char *) SDATA (SYMBOL_NAME (key)) : "";
+      char *caption = STRINGP (capt) ? (char *) SDATA (capt) : "";
+      char buf[64];
+      EMACS_INT max_lbl = 2*tool_bar_max_label_size;
+      Lisp_Object new_lbl;
+
+      if (strlen (caption) < max_lbl && caption[0] != '\0') 
+        {
+          strcpy (buf, caption);
+          while (buf[0] != '\0' &&  buf[strlen (buf) -1] == '.')
+            buf[strlen (buf)-1] = '\0';
+          if (strlen (buf) <= max_lbl)
+            caption = buf;
+        }
+
+      if (strlen (caption) <= max_lbl)
+        label = caption;
+
+      if (strlen (label) <= max_lbl && label[0] != '\0') 
+        {
+          int i;
+          if (label != buf) strcpy (buf, label);
+
+          for (i = 0; i < strlen (buf); ++i) 
+            {
+              if (buf[i] == '-') buf[i] = ' ';
+            }
+          label = buf;
+      
+        }
+      else label = "";
+
+      new_lbl = Fupcase_initials (make_string (label, strlen (label)));
+      if (SCHARS (new_lbl) <= tool_bar_max_label_size)
+        PROP (TOOL_BAR_ITEM_LABEL) = new_lbl;
+    }
+
   /* If got a filter apply it on binding.  */
   if (!NILP (filter))
     PROP (TOOL_BAR_ITEM_BINDING)
@@ -11699,6 +11752,8 @@
   staticpro (&QCtoggle);
   QCradio = intern_c_string (":radio");
   staticpro (&QCradio);
+  QClabel = intern_c_string (":label");
+  staticpro (&QClabel);
 
   Qmode_line = intern_c_string ("mode-line");
   staticpro (&Qmode_line);
--- a/src/lisp.h	Tue Apr 20 23:33:39 2010 +0000
+++ b/src/lisp.h	Wed Apr 21 23:03:28 2010 +0000
@@ -2635,7 +2635,7 @@
 extern Lisp_Object Qinhibit_redisplay, Qdisplay;
 extern Lisp_Object Qinhibit_eval_during_redisplay;
 extern Lisp_Object Qmessage_truncate_lines;
-extern Lisp_Object Qimage;
+extern Lisp_Object Qimage, Qtext, Qboth, Qboth_horiz;
 extern Lisp_Object Vmessage_log_max;
 extern int message_enable_multibyte;
 extern Lisp_Object echo_area_buffer[2];
@@ -2897,6 +2897,7 @@
 extern Lisp_Object call4 P_ ((Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object));
 extern Lisp_Object call5 P_ ((Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object));
 extern Lisp_Object call6 P_ ((Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object));
+extern Lisp_Object call7 P_ ((Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object));
 EXFUN (Fdo_auto_save, 2);
 extern Lisp_Object apply_lambda P_ ((Lisp_Object, Lisp_Object, int));
 extern Lisp_Object internal_catch P_ ((Lisp_Object, Lisp_Object (*) (Lisp_Object), Lisp_Object));
--- a/src/m/hp800.h	Tue Apr 20 23:33:39 2010 +0000
+++ b/src/m/hp800.h	Wed Apr 21 23:03:28 2010 +0000
@@ -40,58 +40,6 @@
 
 #define EXPLICIT_SIGN_EXTEND
 
-
-/* Stuff for just HPUX.  */
-
-#if defined (__hpux)
-
-/* Define NO_REMAP if memory segmentation makes it not work well
-   to change the boundary between the text section and data section
-   when Emacs is dumped.  If you define this, the preloaded Lisp
-   code will not be sharable; but that's better than failing completely.  */
-
-#define NO_REMAP
-
-/* Define VIRT_ADDR_VARIES if the virtual addresses of
-   pure and impure space as loaded can vary, and even their
-   relative order cannot be relied on.
-
-   Otherwise Emacs assumes that text space precedes data space,
-   numerically.  */
-
-#define VIRT_ADDR_VARIES
-
-/* the data segment on this machine always starts at address 0x40000000. */
-
-#define DATA_SEG_BITS 0x40000000
-
-#define DATA_START    0x40000000
-#define TEXT_START    0x00000000
-
-/* Data type of load average, as read out of kmem.  */
-
-#define LOAD_AVE_TYPE double
-
-/* Convert that into an integer that is 100 for a load average of 1.0  */
-
-#define LOAD_AVE_CVT(x) ((int) (x * 100.0))
-
-/* The symbol in the kernel where the load average is found
-   is named _avenrun.  At this time there are two major flavors
-   of hp-ux (there is the s800 and s300 (s200) flavors).  The
-   differences are thusly moved to the corresponding machine description file.
-*/
-
-/* no underscore please */
-#define LDAV_SYMBOL "avenrun"
-
-/* On USG systems these have different names. */
-
-#define index strchr
-#define rindex strrchr
-
-#endif /* __hpux */
-
 /* Systems with GCC don't need to lose. */
 #ifdef __NetBSD__
 # ifdef __GNUC__
--- a/src/makefile.w32-in	Tue Apr 20 23:33:39 2010 +0000
+++ b/src/makefile.w32-in	Wed Apr 21 23:03:28 2010 +0000
@@ -62,7 +62,6 @@
 	$(BLD)/callint.$(O)		\
 	$(BLD)/callproc.$(O)		\
 	$(BLD)/casefiddle.$(O)		\
-	$(BLD)/cm.$(O)			\
 	$(BLD)/cmds.$(O)		\
 	$(BLD)/data.$(O)		\
 	$(BLD)/dired.$(O)		\
@@ -98,7 +97,6 @@
 	$(BLD)/syntax.$(O)		\
 	$(BLD)/sysdep.$(O)		\
 	$(BLD)/term.$(O)		\
-	$(BLD)/termcap.$(O)		\
 	$(BLD)/tparam.$(O)		\
 	$(BLD)/undo.$(O)		\
 	$(BLD)/unexw32.$(O)		\
@@ -494,17 +492,6 @@
 	$(SRC)/character.h \
 	$(SRC)/charset.h
 
-$(BLD)/cm.$(O) : \
-	$(SRC)/cm.c \
-	$(CONFIG_H) \
-	$(SRC)/lisp.h \
-	$(SRC)/cm.h \
-	$(SRC)/dispextern.h \
-	$(SRC)/frame.h \
-	$(SRC)/termchar.h \
-	$(SRC)/termhooks.h \
-	$(SRC)/w32gui.h
-
 $(BLD)/cmds.$(O) : \
 	$(SRC)/cmds.c \
 	$(CONFIG_H) \
@@ -1407,13 +1394,6 @@
 	$(SRC)/w32gui.h \
 	$(SRC)/window.h
 
-$(BLD)/termcap.$(O) : \
-	$(SRC)/termcap.c \
-	$(CONFIG_H) \
-	$(EMACS_ROOT)/nt/inc/unistd.h \
-	$(EMACS_ROOT)/nt/inc/sys/file.h \
-	$(SRC)/lisp.h
-
 $(BLD)/terminal.$(O) : \
 	$(SRC)/terminal.c \
 	$(CONFIG_H) \
--- a/src/s/freebsd.h	Tue Apr 20 23:33:39 2010 +0000
+++ b/src/s/freebsd.h	Wed Apr 21 23:03:28 2010 +0000
@@ -113,13 +113,5 @@
 
 #define POSIX_SIGNALS		1
 
-/* The `combreloc' setting became the default, and it seems to be
-   incompatible with unexec.  Symptom is an immediate SEGV in
-   XtInitializeWidget when starting Emacs under X11.  */
-
-#if defined __FreeBSD_version && __FreeBSD_version >= 500042
-#define LD_SWITCH_SYSTEM_TEMACS -znocombreloc
-#endif
-
 /* arch-tag: 426529ca-b7c4-448f-b10a-d4dcdc9c78eb
    (do not change this comment) */
--- a/src/s/gnu-linux.h	Tue Apr 20 23:33:39 2010 +0000
+++ b/src/s/gnu-linux.h	Wed Apr 21 23:03:28 2010 +0000
@@ -179,12 +179,6 @@
 #define LD_SWITCH_SYSTEM LD_SWITCH_X_SITE_AUX
 #endif /* __mips__ */
 
-/* Link temacs with -z nocombreloc so that unexec works right, whether or
-   not -z combreloc is the default.  GNU ld ignores unknown -z KEYWORD
-   switches, so this also works with older versions that don't implement
-   -z combreloc.  */
-#define LD_SWITCH_SYSTEM_TEMACS -z nocombreloc
-
 #ifdef emacs
 #define INTERRUPT_INPUT
 #endif
@@ -201,7 +195,7 @@
 /* _BSD_SOURCE is redundant, at least in glibc2, since we define
    _GNU_SOURCE.  Left in in case it's relevant to libc5 systems and
    anyone's still using Emacs on those.  --fx 2002-12-14  */
-#define C_SWITCH_SYSTEM -D_BSD_SOURCE
+/* #define C_SWITCH_SYSTEM -D_BSD_SOURCE */
 
 /* Paul Abrahams <abrahams@equinox.shaysnet.com> says this is needed.  */
 #define LIB_MOTIF -lXm -lXpm
@@ -223,7 +217,7 @@
 /* Use BSD process groups, but use setpgid() instead of setpgrp() to
    actually set a process group. */
 /* Interesting: only GNU/Linux defines this,  but the BSDs do not... */
-#define BSD_PGRPS
+/* #define BSD_PGRPS */
 
 #define NARROWPROTO 1
 
--- a/src/s/hpux10-20.h	Tue Apr 20 23:33:39 2010 +0000
+++ b/src/s/hpux10-20.h	Wed Apr 21 23:03:28 2010 +0000
@@ -105,11 +105,6 @@
 /* This triggers a conditional in xfaces.c.  */
 #define XOS_NEEDS_TIME_H
 
-/* Don't use shared libraries.  unexec doesn't handle them.
-   Note GCC automatically passes -a archive to ld, and it has its own
-   conflicting -a.  */
-#define LD_SWITCH_SYSTEM_TEMACS
-
 #ifndef HAVE_LIBXMU
 /* HP-UX doesn't supply Xmu.  */
 #define LIBXMU
@@ -173,5 +168,50 @@
 /* otherwise sigunblock wont be defined */
 #define POSIX_SIGNALS
 
+/* Define NO_REMAP if memory segmentation makes it not work well
+   to change the boundary between the text section and data section
+   when Emacs is dumped.  If you define this, the preloaded Lisp
+   code will not be sharable; but that's better than failing completely.  */
+
+#define NO_REMAP
+
+/* Define VIRT_ADDR_VARIES if the virtual addresses of
+   pure and impure space as loaded can vary, and even their
+   relative order cannot be relied on.
+
+   Otherwise Emacs assumes that text space precedes data space,
+   numerically.  */
+
+#define VIRT_ADDR_VARIES
+
+/* the data segment on this machine always starts at address 0x40000000. */
+
+#define DATA_SEG_BITS 0x40000000
+
+#define DATA_START    0x40000000
+#define TEXT_START    0x00000000
+
+/* Data type of load average, as read out of kmem.  */
+
+#define LOAD_AVE_TYPE double
+
+/* Convert that into an integer that is 100 for a load average of 1.0  */
+
+#define LOAD_AVE_CVT(x) ((int) (x * 100.0))
+
+/* The symbol in the kernel where the load average is found
+   is named _avenrun.  At this time there are two major flavors
+   of hp-ux (there is the s800 and s300 (s200) flavors).  The
+   differences are thusly moved to the corresponding machine description file.
+*/
+
+/* no underscore please */
+#define LDAV_SYMBOL "avenrun"
+
+/* On USG systems these have different names. */
+
+#define index strchr
+#define rindex strrchr
+
 /* arch-tag: 8d8dcbf1-ca9b-48a1-94be-b750de18a5c6
    (do not change this comment) */
--- a/src/s/ms-w32.h	Tue Apr 20 23:33:39 2010 +0000
+++ b/src/s/ms-w32.h	Wed Apr 21 23:03:28 2010 +0000
@@ -260,6 +260,17 @@
 #define kill    sys_kill
 #define signal  sys_signal
 
+/* termcap.c calls that are emulated */
+#define tputs   sys_tputs
+#define tgetstr sys_tgetstr
+
+/* cm.c calls that are emulated */
+#define chcheckmagic sys_chcheckmagic
+#define cmcostinit   sys_cmcostinit
+#define cmgoto       sys_cmgoto
+#define cmputc       sys_cmputc
+#define Wcm_clear    sys_Wcm_clear
+
 #endif /* emacs */
 
 /* map to MSVC names */
--- a/src/s/msdos.h	Tue Apr 20 23:33:39 2010 +0000
+++ b/src/s/msdos.h	Wed Apr 21 23:03:28 2010 +0000
@@ -44,12 +44,6 @@
 
 #define SYMS_SYSTEM syms_of_dosfns();syms_of_msdos();syms_of_win16select()
 
-/* NOMULTIPLEJOBS should be defined if your system's shell
- does not have "job control" (the ability to stop a program,
- run some other program, then continue the first one).  */
-
-#define NOMULTIPLEJOBS
-
 #define SYSV_SYSTEM_DIR
 
 /* Define this symbol if your system has the functions bcopy, etc. */
--- a/src/s/template.h	Tue Apr 20 23:33:39 2010 +0000
+++ b/src/s/template.h	Wed Apr 21 23:03:28 2010 +0000
@@ -37,12 +37,6 @@
 
 #define SYSTEM_TYPE "berkeley-unix"
 
-/* NOMULTIPLEJOBS should be defined if your system's shell
- does not have "job control" (the ability to stop a program,
- run some other program, then continue the first one).  */
-
-/* #define NOMULTIPLEJOBS */
-
 /* Emacs can read input using SIGIO and buffering characters itself,
    or using CBREAK mode and making C-g cause SIGINT.
    The choice is controlled by the variable interrupt_input.
--- a/src/w32console.c	Tue Apr 20 23:33:39 2010 +0000
+++ b/src/w32console.c	Wed Apr 21 23:03:28 2010 +0000
@@ -488,6 +488,62 @@
 }
 
 /***********************************************************************
+			stubs from termcap.c
+ ***********************************************************************/
+
+void
+sys_tputs (char *str, int nlines, int (*outfun)())
+{
+}
+
+char *
+sys_tgetstr (char *cap, char **area)
+{
+  return NULL;
+}
+
+
+/***********************************************************************
+			stubs from cm.c
+ ***********************************************************************/
+
+struct tty_display_info *current_tty = NULL;
+int cost = 0;
+
+int
+evalcost (char c)
+{
+  return c;
+}
+
+int
+cmputc (char c)
+{
+  return c;
+}
+
+void
+cmcheckmagic (struct tty_display_info *tty)
+{
+}
+
+void
+cmcostinit (struct tty_display_info *tty)
+{
+}
+
+void
+cmgoto (struct tty_display_info *tty, int row, int col)
+{
+}
+
+void
+Wcm_clear (struct tty_display_info *tty)
+{
+}
+
+
+/***********************************************************************
 				Faces
  ***********************************************************************/
 
--- a/src/xdisp.c	Tue Apr 20 23:33:39 2010 +0000
+++ b/src/xdisp.c	Wed Apr 21 23:03:28 2010 +0000
@@ -357,6 +357,14 @@
 
 Lisp_Object Vauto_resize_tool_bars;
 
+/* Type of tool bar.  Can be symbols image, text, both or both-hroiz.  */
+
+Lisp_Object Vtool_bar_style;
+
+/* Maximum number of characters a label can have to be shown.  */
+
+EMACS_INT tool_bar_max_label_size;
+
 /* Non-zero means draw block and hollow cursor as wide as the glyph
    under it.  For example, if a block cursor is over a tab, it will be
    drawn as wide as that tab on the display.  */
@@ -442,7 +450,7 @@
 Lisp_Object Qnobreak_space;
 
 /* The symbol `image' which is the car of the lists used to represent
-   images in Lisp.  */
+   images in Lisp.  Also a tool bar style.  */
 
 Lisp_Object Qimage;
 
@@ -450,6 +458,9 @@
 Lisp_Object QCmap, QCpointer;
 Lisp_Object Qrect, Qcircle, Qpoly;
 
+/* Tool bar styles */
+Lisp_Object Qtext, Qboth, Qboth_horiz;
+
 /* Non-zero means print newline to stdout before next mini-buffer
    message.  */
 
@@ -25781,6 +25792,12 @@
   staticpro (&Qnobreak_space);
   Qimage = intern_c_string ("image");
   staticpro (&Qimage);
+  Qtext = intern_c_string ("text");
+  staticpro (&Qtext);
+  Qboth = intern_c_string ("both");
+  staticpro (&Qboth);
+  Qboth_horiz = intern_c_string ("both-horiz");
+  staticpro (&Qboth_horiz);
   QCmap = intern_c_string (":map");
   staticpro (&QCmap);
   QCpointer = intern_c_string (":pointer");
@@ -26121,6 +26138,22 @@
     doc: /* *Relief thickness of tool-bar buttons.  */);
   tool_bar_button_relief = DEFAULT_TOOL_BAR_BUTTON_RELIEF;
 
+  DEFVAR_LISP ("tool-bar-style", &Vtool_bar_style,
+    doc: /* *Tool bar style to use.
+It can be one of
+ image      - show images only
+ text       - show text only
+ both       - show both, text under image
+ both-horiz - show text to the right of the image
+ any other  - use system default or image if no system default.  */);
+  Vtool_bar_style = Qnil;
+
+  DEFVAR_INT ("tool-bar-max-label-size", &tool_bar_max_label_size,
+    doc: /* *Maximum number of characters a label can have to be shown.
+The tool bar style must also show labels for this to have any effect, see
+`tool-bar-style'.  */);
+  tool_bar_max_label_size = DEFAULT_TOOL_BAR_LABEL_SIZE;
+
   DEFVAR_LISP ("fontification-functions", &Vfontification_functions,
     doc: /* List of functions to call to fontify regions of text.
 Each function is called with one argument POS.  Functions must
--- a/src/xsettings.c	Tue Apr 20 23:33:39 2010 +0000
+++ b/src/xsettings.c	Wed Apr 21 23:03:28 2010 +0000
@@ -41,10 +41,11 @@
 static char *current_mono_font;
 static char *current_font;
 static struct x_display_info *first_dpyinfo;
-static Lisp_Object Qfont_name, Qfont_render;
+static Lisp_Object Qmonospace_font_name, Qfont_name, Qfont_render,
+  Qtool_bar_style;
 static int use_system_font;
 static Lisp_Object Vxft_settings;
-
+static Lisp_Object current_tool_bar_style;
 
 #ifdef HAVE_GCONF
 static GConfClient *gconf_client;
@@ -52,7 +53,7 @@
 
 
 static void
-store_font_changed_event (arg, display_name)
+store_config_changed_event (arg, display_name)
      Lisp_Object arg;
      Lisp_Object display_name;
 {
@@ -64,7 +65,32 @@
   kbd_buffer_store_event (&event);
 }
 
-#define XSETTINGS_FONT_NAME  "Gtk/FontName"
+#define XSETTINGS_FONT_NAME       "Gtk/FontName"
+#define XSETTINGS_TOOL_BAR_STYLE  "Gtk/ToolbarStyle"
+
+enum {
+  SEEN_AA         = 0x01,
+  SEEN_HINTING    = 0x02,
+  SEEN_RGBA       = 0x04,
+  SEEN_LCDFILTER  = 0x08,
+  SEEN_HINTSTYLE  = 0x10,
+  SEEN_DPI        = 0x20,
+  SEEN_FONT       = 0x40,
+  SEEN_TB_STYLE   = 0x80,
+};
+struct xsettings 
+{
+#ifdef HAVE_XFT
+  FcBool aa, hinting;
+  int rgba, lcdfilter, hintstyle;
+  double dpi;
+#endif
+
+  char *font;
+  char *tb_style;
+
+  unsigned seen;
+};
 
 #ifdef HAVE_GCONF
 
@@ -105,8 +131,8 @@
         found = dpyinfo == first_dpyinfo;
 
       if (found && use_system_font)
-        store_font_changed_event (Qfont_name,
-                                  XCAR (first_dpyinfo->name_list_element));
+        store_config_changed_event (Qmonospace_font_name,
+                                    XCAR (first_dpyinfo->name_list_element));
     }
 }
 #endif /* HAVE_GCONF */
@@ -124,6 +150,8 @@
 #define FC_LCD_FILTER "lcdfilter"
 #endif
 
+#endif /* HAVE_XFT */
+
 /* Find the window that contains the XSETTINGS property values.  */
 
 static void
@@ -144,23 +172,6 @@
   XUngrabServer (dpy);
 }
 
-enum {
-  SEEN_AA         = 0x01,
-  SEEN_HINTING    = 0x02,
-  SEEN_RGBA       = 0x04,
-  SEEN_LCDFILTER  = 0x08,
-  SEEN_HINTSTYLE  = 0x10,
-  SEEN_DPI        = 0x20,
-};
-struct xsettings 
-{
-  FcBool aa, hinting;
-  int rgba, lcdfilter, hintstyle;
-  double dpi;
-
-  unsigned seen;
-};
-
 #define SWAP32(nr) (((nr) << 24) | (((nr) << 8) & 0xff0000)     \
                     | (((nr) >> 8) & 0xff00) | ((nr) >> 24))
 #define SWAP16(nr) (((nr) << 8) | ((nr) >> 8))
@@ -217,7 +228,7 @@
 */
 
 static int
-parse_xft_settings (prop, bytes, settings)
+parse_settings (prop, bytes, settings)
      unsigned char *prop;
      unsigned long bytes;
      struct xsettings *settings;
@@ -268,8 +279,13 @@
       bytes_parsed += 4; /* Skip serial for this value */
       if (bytes_parsed > bytes) return BadLength;
 
-      want_this = (nlen > 6 && strncmp (name, "Xft/", 4) == 0)
-        || (strcmp (XSETTINGS_FONT_NAME, name) == 0);
+      want_this =
+#ifdef HAVE_XFT
+        (nlen > 6 && strncmp (name, "Xft/", 4) == 0)
+        ||
+#endif
+        (strcmp (XSETTINGS_FONT_NAME, name) == 0)
+        || (strcmp (XSETTINGS_TOOL_BAR_STYLE, name) == 0);
 
       switch (type) 
         {
@@ -311,7 +327,18 @@
       if (want_this) 
         {
           ++settings_seen;
-          if (strcmp (name, "Xft/Antialias") == 0)
+          if (strcmp (name, XSETTINGS_FONT_NAME) == 0)
+            {
+              settings->font = xstrdup (sval);
+              settings->seen |= SEEN_FONT;
+            }
+          else if (strcmp (name, XSETTINGS_TOOL_BAR_STYLE) == 0)
+            {
+              settings->tb_style = xstrdup (sval);
+              settings->seen |= SEEN_TB_STYLE;
+            }
+#ifdef HAVE_XFT
+          else if (strcmp (name, "Xft/Antialias") == 0)
             {
               settings->seen |= SEEN_AA;
               settings->aa = ival != 0;
@@ -366,11 +393,7 @@
               else
                 settings->seen &= ~SEEN_LCDFILTER;
             }
-          else if (strcmp (name, XSETTINGS_FONT_NAME) == 0)
-            {
-              free (current_font);
-              current_font = xstrdup (sval);
-            }
+#endif /* HAVE_XFT */
         }
     }
 
@@ -378,7 +401,7 @@
 }
 
 static int
-read_xft_settings (dpyinfo, settings)
+read_settings (dpyinfo, settings)
      struct x_display_info *dpyinfo;
      struct xsettings *settings;
 {
@@ -400,7 +423,7 @@
 
   if (rc == Success && prop != NULL && act_form == 8 && nitems > 0
       && act_type == dpyinfo->Xatom_xsettings_prop)
-    rc = parse_xft_settings (prop, nitems, settings);
+    rc = parse_settings (prop, nitems, settings);
 
   XFree (prop);
 
@@ -411,18 +434,17 @@
 
 
 static void
-apply_xft_settings (dpyinfo, send_event_p)
+apply_xft_settings (dpyinfo, send_event_p, settings)
      struct x_display_info *dpyinfo;
      int send_event_p;
+     struct xsettings *settings;
 {
+#ifdef HAVE_XFT
   FcPattern *pat;
-  struct xsettings settings, oldsettings;
+  struct xsettings oldsettings;
   int changed = 0;
   char buf[256];
 
-  if (!read_xft_settings (dpyinfo, &settings))
-    return;
-
   memset (&oldsettings, 0, sizeof (oldsettings));
   buf[0] = '\0';
   pat = FcPatternCreate ();
@@ -436,74 +458,74 @@
   FcPatternGetInteger (pat, FC_RGBA, 0, &oldsettings.rgba);
   FcPatternGetDouble (pat, FC_DPI, 0, &oldsettings.dpi);
 
-  if ((settings.seen & SEEN_AA) != 0 && oldsettings.aa != settings.aa)
+  if ((settings->seen & SEEN_AA) != 0 && oldsettings.aa != settings->aa)
     {
       FcPatternDel (pat, FC_ANTIALIAS);
-      FcPatternAddBool (pat, FC_ANTIALIAS, settings.aa);
+      FcPatternAddBool (pat, FC_ANTIALIAS, settings->aa);
       ++changed;
-      oldsettings.aa = settings.aa;
+      oldsettings.aa = settings->aa;
     }
   sprintf (buf, "Antialias: %d", oldsettings.aa);
 
-  if ((settings.seen & SEEN_HINTING) != 0
-      && oldsettings.hinting != settings.hinting)
+  if ((settings->seen & SEEN_HINTING) != 0
+      && oldsettings.hinting != settings->hinting)
     {
       FcPatternDel (pat, FC_HINTING);
-      FcPatternAddBool (pat, FC_HINTING, settings.hinting);
+      FcPatternAddBool (pat, FC_HINTING, settings->hinting);
       ++changed;
-      oldsettings.hinting = settings.hinting;
+      oldsettings.hinting = settings->hinting;
     }
   if (strlen (buf) > 0) strcat (buf, ", ");
   sprintf (buf+strlen (buf), "Hinting: %d", oldsettings.hinting);
-  if ((settings.seen & SEEN_RGBA) != 0 && oldsettings.rgba != settings.rgba)
+  if ((settings->seen & SEEN_RGBA) != 0 && oldsettings.rgba != settings->rgba)
     {
       FcPatternDel (pat, FC_RGBA);
-      FcPatternAddInteger (pat, FC_RGBA, settings.rgba);
-      oldsettings.rgba = settings.rgba;
+      FcPatternAddInteger (pat, FC_RGBA, settings->rgba);
+      oldsettings.rgba = settings->rgba;
       ++changed;
     }
   if (strlen (buf) > 0) strcat (buf, ", ");
   sprintf (buf+strlen (buf), "RGBA: %d", oldsettings.rgba);
 
   /* Older fontconfig versions don't have FC_LCD_FILTER. */
-  if ((settings.seen & SEEN_LCDFILTER) != 0
-      && oldsettings.lcdfilter != settings.lcdfilter)
+  if ((settings->seen & SEEN_LCDFILTER) != 0
+      && oldsettings.lcdfilter != settings->lcdfilter)
     {
       FcPatternDel (pat, FC_LCD_FILTER);
-      FcPatternAddInteger (pat, FC_LCD_FILTER, settings.lcdfilter);
+      FcPatternAddInteger (pat, FC_LCD_FILTER, settings->lcdfilter);
       ++changed;
-      oldsettings.lcdfilter = settings.lcdfilter;
+      oldsettings.lcdfilter = settings->lcdfilter;
     }
   if (strlen (buf) > 0) strcat (buf, ", ");
   sprintf (buf+strlen (buf), "LCDFilter: %d", oldsettings.lcdfilter);
 
-  if ((settings.seen & SEEN_HINTSTYLE) != 0
-      && oldsettings.hintstyle != settings.hintstyle)
+  if ((settings->seen & SEEN_HINTSTYLE) != 0
+      && oldsettings.hintstyle != settings->hintstyle)
     {
       FcPatternDel (pat, FC_HINT_STYLE);
-      FcPatternAddInteger (pat, FC_HINT_STYLE, settings.hintstyle);
+      FcPatternAddInteger (pat, FC_HINT_STYLE, settings->hintstyle);
       ++changed;
-      oldsettings.hintstyle = settings.hintstyle;
+      oldsettings.hintstyle = settings->hintstyle;
     }
   if (strlen (buf) > 0) strcat (buf, ", ");
   sprintf (buf+strlen (buf), "Hintstyle: %d", oldsettings.hintstyle);
 
-  if ((settings.seen & SEEN_DPI) != 0 && oldsettings.dpi != settings.dpi
-      && settings.dpi > 0)
+  if ((settings->seen & SEEN_DPI) != 0 && oldsettings.dpi != settings->dpi
+      && settings->dpi > 0)
     {
       Lisp_Object frame, tail;
 
       FcPatternDel (pat, FC_DPI);
-      FcPatternAddDouble (pat, FC_DPI, settings.dpi);
+      FcPatternAddDouble (pat, FC_DPI, settings->dpi);
       ++changed;
-      oldsettings.dpi = settings.dpi;
+      oldsettings.dpi = settings->dpi;
       
       /* Change the DPI on this display and all frames on the display.  */
-      dpyinfo->resy = dpyinfo->resx = settings.dpi;
+      dpyinfo->resy = dpyinfo->resx = settings->dpi;
       FOR_EACH_FRAME (tail, frame)
         if (FRAME_X_P (XFRAME (frame))
             && FRAME_X_DISPLAY_INFO (XFRAME (frame)) == dpyinfo)
-          XFRAME (frame)->resy = XFRAME (frame)->resx = settings.dpi;
+          XFRAME (frame)->resy = XFRAME (frame)->resx = settings->dpi;
     }
 
   if (strlen (buf) > 0) strcat (buf, ", ");
@@ -513,23 +535,68 @@
     {
       XftDefaultSet (dpyinfo->display, pat);
       if (send_event_p)
-        store_font_changed_event (Qfont_render,
-                                  XCAR (dpyinfo->name_list_element));
+        store_config_changed_event (Qfont_render,
+                                    XCAR (dpyinfo->name_list_element));
       Vxft_settings = make_string (buf, strlen (buf));
     }
   else
     FcPatternDestroy (pat);
+#endif /* HAVE_XFT */
 }
 
-#endif /* HAVE_XFT */
+static void
+read_and_apply_settings (dpyinfo, send_event_p)
+     struct x_display_info *dpyinfo;
+     int send_event_p;
+{
+  struct xsettings settings;
+  Lisp_Object dpyname = XCAR (dpyinfo->name_list_element);
+
+  if (!read_settings (dpyinfo, &settings))
+    return;
+
+  apply_xft_settings (dpyinfo, True, &settings);
+  if (settings.seen & SEEN_TB_STYLE)
+    {
+      Lisp_Object style = Qnil;
+      if (strcmp (settings.tb_style, "both") == 0)
+        style = Qboth;
+      else if (strcmp (settings.tb_style, "both-horiz") == 0)
+        style = Qboth_horiz;
+      else if (strcmp (settings.tb_style, "icons") == 0)
+        style = Qimage;
+      else if (strcmp (settings.tb_style, "text") == 0)
+        style = Qtext;
+      if (!NILP (style) && !EQ (style, current_tool_bar_style))
+        {
+          current_tool_bar_style = style;
+          if (send_event_p)
+            store_config_changed_event (Qtool_bar_style, dpyname);
+        }
+      free (settings.tb_style);
+    }
+
+  if (settings.seen & SEEN_FONT)
+    {
+      if (strcmp (current_font, settings.font) != 0) 
+        {
+          free (current_font);
+          current_font = settings.font;
+          if (send_event_p)
+            store_config_changed_event (Qfont_name, dpyname);
+        }
+      else
+        free (settings.font);
+    }
+}
 
 void
 xft_settings_event (dpyinfo, event)
      struct x_display_info *dpyinfo;
      XEvent *event;
 {
-#ifdef HAVE_XFT
   int check_window_p = 0;
+  int apply_settings = 0;
 
   switch (event->type)
     {
@@ -549,20 +616,21 @@
       if (event->xproperty.window == dpyinfo->xsettings_window
           && event->xproperty.state == PropertyNewValue
           && event->xproperty.atom == dpyinfo->Xatom_xsettings_prop)
-        {
-          apply_xft_settings (dpyinfo, True);
-        }
+        apply_settings = 1;
       break;
     }
 
+
   if (check_window_p)
     {
       dpyinfo->xsettings_window = None;
       get_prop_window (dpyinfo);
       if (dpyinfo->xsettings_window != None)
-        apply_xft_settings (dpyinfo, True);
+        apply_settings = 1;
     }
-#endif /* HAVE_XFT */
+
+  if (apply_settings)
+    read_and_apply_settings (dpyinfo, True);
 }
 
 
@@ -600,10 +668,9 @@
 }
 
 static void
-init_xfd_settings (dpyinfo)
+init_xsettings (dpyinfo)
      struct x_display_info *dpyinfo;
 {
-#ifdef HAVE_XFT
   char sel[64];
   Display *dpy = dpyinfo->display;
 
@@ -622,18 +689,9 @@
 
   get_prop_window (dpyinfo);
   if (dpyinfo->xsettings_window != None)
-    apply_xft_settings (dpyinfo, False);
+    read_and_apply_settings (dpyinfo, False);
 
   UNBLOCK_INPUT;
-
-#else /* ! HAVE_XFT */
-
-  dpyinfo->Xatom_xsettings_sel = None;
-  dpyinfo->Xatom_xsettings_prop = None;
-  dpyinfo->Xatom_xsettings_mgr = None;
-  dpyinfo->xsettings_window = None;
-
-#endif /* ! HAVE_XFT */
 }
 
 void
@@ -642,7 +700,7 @@
 {
   if (first_dpyinfo == NULL) first_dpyinfo = dpyinfo;
   init_gconf ();
-  init_xfd_settings (dpyinfo);
+  init_xsettings (dpyinfo);
 }
 
 const char *
@@ -678,6 +736,23 @@
     : Qnil;
 }
 
+DEFUN ("tool-bar-get-system-style", Ftool_bar_get_system_style, Stool_bar_get_system_style,
+       0, 0, 0,
+       doc: /* Get the system tool bar style.
+If no system tool bar style is known, return `tool-bar-style' is set to a
+known style.  Otherwise return image.  */)
+  ()
+{
+  if (EQ (Vtool_bar_style, Qimage)
+      || EQ (Vtool_bar_style, Qtext)
+      || EQ (Vtool_bar_style, Qboth)
+      || EQ (Vtool_bar_style, Qboth_horiz))
+    return Vtool_bar_style;
+  if (!NILP (current_tool_bar_style))
+    return current_tool_bar_style;
+  return Qimage;
+}
+
 void
 syms_of_xsettings ()
 {
@@ -688,6 +763,8 @@
   gconf_client = NULL;
 #endif
 
+  Qmonospace_font_name = intern_c_string ("monospace-font-name");
+  staticpro (&Qmonospace_font_name);
   Qfont_name = intern_c_string ("font-name");
   staticpro (&Qfont_name);
   Qfont_render = intern_c_string ("font-render");
@@ -709,6 +786,13 @@
   Fprovide (intern_c_string ("system-font-setting"), Qnil);
 #endif
 #endif
+
+  current_tool_bar_style = Qnil;
+  Qtool_bar_style = intern_c_string ("tool-bar-style");
+  staticpro (&Qtool_bar_style);
+  defsubr (&Stool_bar_get_system_style);
+
+  Fprovide (intern_c_string ("dynamic-setting"), Qnil);
 }
 
 /* arch-tag: 541716ed-2e6b-42e1-8212-3197e01ea61d
--- a/src/xsettings.h	Tue Apr 20 23:33:39 2010 +0000
+++ b/src/xsettings.h	Wed Apr 21 23:03:28 2010 +0000
@@ -22,6 +22,7 @@
 
 EXFUN (Ffont_get_system_font, 0);
 EXFUN (Ffont_get_system_normal_font, 0);
+EXFUN (Ftool_bar_get_system_style, 0);
 
 extern void xsettings_initialize P_ ((struct x_display_info *dpyinfo));
 extern void xft_settings_event P_ ((struct x_display_info *dpyinfo,
--- a/src/xterm.c	Tue Apr 20 23:33:39 2010 +0000
+++ b/src/xterm.c	Wed Apr 21 23:03:28 2010 +0000
@@ -2322,10 +2322,13 @@
       raised_p = s->img->relief > 0;
     }
 
-  x0 = x - thick;
-  y0 = y - thick;
-  x1 = x + s->slice.width + thick - 1;
-  y1 = y + s->slice.height + thick - 1;
+  int extra = s->face->id == TOOL_BAR_FACE_ID
+    ? XINT (Vtool_bar_button_margin) : 0;
+  
+  x0 = x - thick - extra;
+  y0 = y - thick - extra;
+  x1 = x + s->slice.width + thick - 1 + extra;
+  y1 = y + s->slice.height + thick - 1 + extra;
 
   x_setup_relief_colors (s);
   get_glyph_string_clip_rect (s, &r);