changeset 108750:3339da3cfeb3

Redesign bidi-aware edge positions of glyph rows, fix bug #6036. dispextern.h (struct glyph_row): New members minpos and maxpos. (MATRIX_ROW_START_CHARPOS, MATRIX_ROW_START_BYTEPOS) (MATRIX_ROW_END_CHARPOS, MATRIX_ROW_END_BYTEPOS): Reference minpos and maxpos members instead of start.pos and end.pos, respectively. xdisp.c (display_line): Compare IT_CHARPOS with the position in row->start.pos, rather than with MATRIX_ROW_START_CHARPOS. (cursor_row_p): Use row->end.pos rather than MATRIX_ROW_END_CHARPOS. (try_window_reusing_current_matrix, try_window_id): Use ROW->minpos rather than ROW->start.pos. (init_from_display_pos, init_iterator): Use EMACS_INT for character and byte positions. (find_row_edges): Renamed from find_row_end. Accept additional arguments for minimum and maximum buffer positions seen by display_line for this row. Don't use iterator to find the position following the maximum one; instead, increment the position found by display_line directly. Fix logic; eol_pos should be tested before the rest. Handle the case of characters delivered from display vector (bug#6036). Fix tests related to it->method. Handle the truncated_on_right_p rows. (RECORD_MAX_MIN_POS): New macro. (display_line): Use it to record the minimum and maximum buffer positions for glyphs in the row being assembled. Record the position of the newline that terminates the line. If word wrap is in effect, restore minimum and maximum positions seen up to the wrap point, when iterator returns to it. (try_window_reusing_current_matrix): Give up if in bidi-reordered row and cursor not already at point. Restore original pre-bidi code for unidirectional buffers. dispnew.c (increment_row_positions, check_matrix_invariants): Increment and check row->start.pos and row->end.pos, in addition to MATRIX_ROW_START_CHARPOS and MATRIX_ROW_END_CHARPOS. .gdbinit (prowlims): Display row->minpos and row->maxpos. Display truncated_on_left_p and truncated_on_right_p flags. Formatting fixes. (pmtxrows): Display the ordinal number of each row. Don't display rows beyond the last one. bidi.c (bidi_cache_iterator_state): Don't zero out new_paragraph: it is not copied by bidi_copy_it.
author Eli Zaretskii <eliz@gnu.org>
date Sat, 22 May 2010 22:32:21 +0300
parents 48378bcd6c35 (diff) ab4686221ccf (current diff)
children c40b9bfe9167 0aaff477ec9f
files src/ChangeLog src/bidi.c src/xdisp.c
diffstat 81 files changed, 2187 insertions(+), 1221 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sat May 22 17:13:04 2010 +0300
+++ b/ChangeLog	Sat May 22 22:32:21 2010 +0300
@@ -1,3 +1,35 @@
+2010-05-21  Glenn Morris  <rgm@gnu.org>
+
+	* configure.in (MKDEPDIR): Parallel build tweak.
+
+	* configure.in (ns_frag): New output file.
+
+	* configure.in (OLDXMENU): Set to "nothing" if !HAVE_X11 || USE_GTK.
+	(OLDXMENU_TARGET): Set to empty if USE_GTK.
+
+	* configure.in (cannot_dump): New output variable.
+
+2010-05-20  enami tsugutomo  <tsugutomo.enami@jp.sony.com>
+
+	* configure.in: On NetBSD, if terminfo is found, use it in
+	preference to termcap.  (Bug#6190)
+
+2010-05-20  Glenn Morris  <rgm@gnu.org>
+
+	* make-dist (src): Include *.mk.
+	* config.bat: Concatenate deps.mk onto the end of src/Makefile.
+	* configure.in (DEPFLAGS, MKDEPDIR): New output variables.
+	(deps_frag): New output file.
+	(AUTO_DEPEND): Remove this definition.
+
+	* configure.in (--with-gtk, --with-gcc): Remove option stubs.
+
+2010-05-19  Glenn Morris  <rgm@gnu.org>
+
+	* configure.in (LINKER, YMF_PASS_LDFLAGS): New output variables.
+	(ORDINARY_LINK): New AC_DEFINE.
+	(LIB_GCC): No need to set if ORDINARY_LINK.
+
 2010-05-18  Glenn Morris  <rgm@gnu.org>
 
 	* configure.in (POST_ALLOC_OBJ) [cygwin]: Omit vm-limit.o.
--- a/admin/notes/bugtracker	Sat May 22 17:13:04 2010 +0300
+++ b/admin/notes/bugtracker	Sat May 22 22:32:21 2010 +0300
@@ -553,9 +553,13 @@
 If a non-spam message accidentally gets discarded, just do:
 
 cat /var/lib/mailman/spam/not-really-spam.msg | /usr/lib/debbugs/receive
+chown Debian-debbugs:Debian-debbugs /var/lib/debbugs/spool/incoming/*
 ... check it works ...
 mv /var/lib/mailman/spam/not-really-spam.msg /var/lib/mailman/not-spam/
 
+Also check that the sender was not added to the auto-discard/reject list
+in the debbugs-submit Mailman interface.
+
 ** Administrivia
 
 The debbugs-submit list should have the administrivia option off,
--- a/config.bat	Sat May 22 17:13:04 2010 +0300
+++ b/config.bat	Sat May 22 22:32:21 2010 +0300
@@ -190,10 +190,11 @@
 if exist dir.h ren dir.h vmsdir.h
 
 rem   Create "makefile" from "makefile.in".
-rm -f Makefile junk.c
+rm -f Makefile junk.c junk2.c
 sed -e "1,/== start of cpp stuff ==/s@^##*[ 	].*$@@" <Makefile.in >junk.c
-gcc -E -traditional junk.c | sed -f ../msdos/sed1v2.inp >Makefile
-rm -f junk.c
+copy junk.c + deps.mk junk2.c
+gcc -E -traditional junk2.c | sed -f ../msdos/sed1v2.inp >Makefile
+rm -f junk.c junk2.c
 
 if "%X11%" == "" goto src5
 mv Makefile makefile.tmp
--- a/configure	Sat May 22 17:13:04 2010 +0300
+++ b/configure	Sat May 22 22:32:21 2010 +0300
@@ -701,6 +701,7 @@
 INSTALL_INFO
 GZIP_PROG
 MAKEINFO
+cannot_dump
 LD_SWITCH_SYSTEM
 C_SWITCH_MACHINE
 C_SWITCH_SYSTEM
@@ -714,6 +715,8 @@
 ALSA_LIBS
 CFLAGS_SOUND
 SET_MAKE
+MKDEPDIR
+DEPFLAGS
 XMKMF
 LD_SWITCH_X_SITE_AUX
 LD_SWITCH_X_SITE_AUX_RPATH
@@ -818,12 +821,15 @@
 POST_ALLOC_OBJ
 LD_SWITCH_SYSTEM_TEMACS
 LD_SWITCH_SYSTEM_EXTRA
+YMF_PASS_LDFLAGS
+LINKER
 LIB_GCC
 MOUSE_SUPPORT
 TOOLTIP_SUPPORT
 WINDOW_SUPPORT
 LTLIBOBJS'
-ac_subst_files=''
+ac_subst_files='deps_frag
+ns_frag'
 ac_user_opts='
 enable_option_checking
 with_pop
@@ -854,8 +860,6 @@
 with_gconf
 with_selinux
 with_makeinfo
-with_gtk
-with_gcc
 with_pkg_config_prog
 with_crt_dir
 with_gnustep_conf
@@ -1569,7 +1573,6 @@
   --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
                           path to pkg-config for finding GTK and librsvg
   --with-crt-dir=DIR      directory containing crtn.o etc. The default is
@@ -2382,28 +2385,6 @@
 
 
 
-# Check whether --with-gtk was given.
-if test "${with_gtk+set}" = set; then
-  withval=$with_gtk; { { $as_echo "$as_me:$LINENO: error: --with-gtk has been removed.  Use --with-x-toolkit to
-specify a toolkit." >&5
-$as_echo "$as_me: error: --with-gtk has been removed.  Use --with-x-toolkit to
-specify a toolkit." >&2;}
-   { (exit 1); exit 1; }; }
-fi
-
-
-
-# Check whether --with-gcc was given.
-if test "${with_gcc+set}" = set; then
-  withval=$with_gcc; { { $as_echo "$as_me:$LINENO: error: --with-gcc has been removed.  Set the \`CC' environment
-variable to specify a compiler." >&5
-$as_echo "$as_me: error: --with-gcc has been removed.  Set the \`CC' environment
-variable to specify a compiler." >&2;}
-   { (exit 1); exit 1; }; }
-fi
-
-
-
 # Check whether --with-pkg-config-prog was given.
 if test "${with_pkg_config_prog+set}" = set; then
   withval=$with_pkg_config_prog;
@@ -5851,6 +5832,12 @@
 
 configure___ unexec=UNEXEC
 
+#ifdef CANNOT_DUMP
+configure___ cannot_dump=yes
+#else
+configure___ cannot_dump=no
+#endif
+
 #ifdef SYSTEM_MALLOC
 configure___ system_malloc=yes
 #else
@@ -5912,6 +5899,9 @@
 rm ${tempcname}
 
 
+
+
+
 LD_SWITCH_SYSTEM=
 case "$opsys" in
   freebsd)
@@ -9501,6 +9491,9 @@
 fi
 
 
+DEPFLAGS=
+MKDEPDIR=":"
+deps_frag=deps.mk
 if test "$GCC" = yes && test "$ac_enable_autodepend" = yes; then
    { $as_echo "$as_me:$LINENO: checking whether we are using GNU Make" >&5
 $as_echo_n "checking whether we are using GNU Make... " >&6; }
@@ -9567,13 +9560,19 @@
 $as_echo "$ac_enable_autodepend" >&6; }
    fi
    if test $ac_enable_autodepend = yes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define AUTO_DEPEND 1
-_ACEOF
-
+      DEPFLAGS='-MMD -MF ${DEPDIR}/$*.d'
+      ## In parallel builds, another make might create depdir between
+      ## the first test and mkdir, so stick another test on the end.
+      ## Or use mkinstalldirs?  mkdir -p is not portable.
+      MKDEPDIR='test -d ${DEPDIR} || mkdir ${DEPDIR} || test -d ${DEPDIR}'
+      deps_frag=autodeps.mk
    fi
 fi
+deps_frag=$srcdir/src/$deps_frag
+
+
+
+
 
 { $as_echo "$as_me:$LINENO: checking for long file names" >&5
 $as_echo_n "checking for long file names... " >&6; }
@@ -9960,6 +9959,7 @@
      GNUSTEP_SYSTEM_HEADERS="$(. $GNUSTEP_CONFIG_FILE; echo $GNUSTEP_SYSTEM_HEADERS)"
      GNUSTEP_SYSTEM_LIBRARIES="$(. $GNUSTEP_CONFIG_FILE; echo $GNUSTEP_SYSTEM_LIBRARIES)"
      ## Pull in stuff from GNUstep-make.
+     ## FIXME? Cleaner to use AC_SUBST_FILE for this?
      NS_IMPL_GNUSTEP_INC="FOUNDATION_LIB=gnu
 GUI_LIB=gnu
 include $GNUSTEP_MAKEFILES/Additional/base.make
@@ -10164,6 +10164,7 @@
 
 
 
+ns_frag=/dev/null
 NS_OBJ=
 NS_SUPPORT=
 if test "${HAVE_NS}" = yes; then
@@ -10175,6 +10176,7 @@
   if test "${EN_NS_SELF_CONTAINED}" = yes; then
      prefix=${ns_appresdir}
   fi
+  ns_frag=$srcdir/src/ns.mk
   NS_OBJ="nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o fontset.o fringe.o image.o"
   NS_SUPPORT="\${lispsource}emacs-lisp/easymenu.elc \${lispsource}term/ns-win.elc"
 fi
@@ -10184,6 +10186,7 @@
 
 
 
+
 case "${window_system}" in
   x11 )
     HAVE_X_WINDOWS=yes
@@ -21622,7 +21625,7 @@
 
 ## Use terminfo instead of termcap?
 ## Note only system files NOT using terminfo are:
-## freebsd < 40000, ms-w32, msdos, netbsd, and
+## freebsd < 40000, ms-w32, msdos, netbsd < 599002500, and
 ## darwin|gnu without ncurses.
 TERMINFO=no
 LIBS_TERMCAP=
@@ -21715,13 +21718,22 @@
     fi
     ;;
 
+  netbsd)
+    if test $ac_cv_search_tputs = -lterminfo; then
+      TERMINFO=yes
+      LIBS_TERMCAP="-lterminfo"
+    else
+      LIBS_TERMCAP="-ltermcap"
+    fi
+    ;;
+
 esac
 
 case "$opsys" in
   ## hpux: Make sure we get select from libc rather than from libcurses
   ##  because libcurses on HPUX 10.10 has a broken version of select.
   ##  We used to use -lc -lcurses, but this may be cleaner.
-  hpux*|netbsd) LIBS_TERMCAP="-ltermcap" ;;
+  hpux*) LIBS_TERMCAP="-ltermcap" ;;
 
   openbsd) LIBS_TERMCAP="-lncurses" ;;
 
@@ -26491,7 +26503,6 @@
 fi
 
 
-
 ## 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.
@@ -26511,7 +26522,9 @@
   LIBX_OTHER="\$(LIBXT) \$(LIBX_EXTRA)"
   OLDXMENU_DEPS="\${OLDXMENU} ../src/\${OLDXMENU}"
 else
-  OLDXMENU=
+  ## For a syntactically valid Makefile; not actually used for anything.
+  ## See comments in src/Makefile.in.
+  OLDXMENU=nothing
   ## FIXME This case (!HAVE_X11 && HAVE_X_WINDOWS) is no longer possible(?).
   if test "${HAVE_X_WINDOWS}" = "yes"; then
     LIBXMENU="-lXMenu"
@@ -26523,7 +26536,8 @@
 fi
 
 if test "$HAVE_GTK" = "yes" || test "$HAVE_MENUS" != "yes"; then
-  OLDXMENU=
+  OLDXMENU_TARGET=
+  OLDXMENU=nothing
   LIBXMENU=
   OLDXMENU_DEPS=
 fi
@@ -26533,6 +26547,7 @@
 
 
 
+
 if test "${HAVE_MENUS}" = "yes" ; then
 
 cat >>confdefs.h <<\_ACEOF
@@ -26616,8 +26631,79 @@
 
 
 
+LINKER=
+ORDINARY_LINK=
+case "$opsys" in
+  ## gnu: GNU needs its own crt0.
+  aix4-2|darwin|gnu|usg5-4|irix6-5|sol2*|unixware) ORDINARY_LINK=yes ;;
+
+  cygwin) LINKER="\$(CC)" ;;
+
+  ## On post 1.3 releases of NetBSD, gcc -nostdlib also clears the
+  ## library search parth, i.e. it won't search /usr/lib for libc and
+  ## friends.  Using -nostartfiles instead avoids this problem, and
+  ## will also work on earlier NetBSD releases.
+  netbsd|openbsd) LINKER="\$(CC) -nostartfiles" ;;
+
+  ## macpcc: NAKAJI Hiroyuki <nakaji@tutrp.tut.ac.jp> says
+  ##   MkLinux/LinuxPPC needs this.
+  ## ibms390x only supports opsys = gnu-linux so it can be added here.
+  gnu-*)
+    case "$machine" in
+      macppc|ibms390x) LINKER="\$(CC) -nostdlib" ;;
+    esac
+    ;;
+esac
+
+## A macro which other sections of Makefile can redefine to munge the
+## flags before they are passed to LD.  This is helpful if you have
+## redefined LD to something odd, like "gcc".
+## (The YMF prefix is a holdover from the old name "ymakefile".)
+YMF_PASS_LDFLAGS=flags
+if test "x$ORDINARY_LINK" = "xyes"; then
+
+  LINKER="\$(CC)"
+
+cat >>confdefs.h <<\_ACEOF
+#define ORDINARY_LINK 1
+_ACEOF
+
+
+## The system files defining neither ORDINARY_LINK nor LINKER are:
+## (bsd-common), freebsd, gnu-* not on macppc|ibms390x, hpux*.
+elif test "x$GCC" = "xyes" && test "x$LINKER" = "x"; then
+
+  ## Versions of GCC >= 2.0 put their library, libgcc.a, in obscure
+  ## places that are difficult to figure out at make time.  Fortunately,
+  ## these same versions allow you to pass arbitrary flags on to the
+  ## linker, so there is no reason not to use it as a linker.
+  ##
+  ## Well, it is not quite perfect.  The "-nostdlib" keeps GCC from
+  ## searching for libraries in its internal directories, so we have to
+  ## ask GCC explicitly where to find libgcc.a (LIB_GCC below).
+  LINKER="\$(CC) -nostdlib"
+  ## GCC passes any argument prefixed with -Xlinker directly to the linker.
+  ## See prefix-args.c for an explanation of why we do not do this with the
+  ## shell''s ``for'' construct.  Note that sane people do not have '.' in
+  ## their paths, so we must use ./prefix-args.
+  ## TODO either make prefix-args check ORDINARY_LINK internally,
+  ## or remove it altogether (bug#6184), removing the need for this macro.
+  YMF_PASS_LDFLAGS='`./prefix-args -Xlinker flags`'
+fi
+
+
+test "x$LINKER" = "x" && LINKER=ld
+## FIXME? What setting of YMF_PASS_LDFLAGS should this have?
+test "$NS_IMPL_GNUSTEP" = "yes" && LINKER="\$(CC) -rdynamic"
+
+
+
+
+## FIXME? The logic here is not precisely the same as that above
+## setting YMF_PASS_LDFLAGS.  There is no check here for a pre-defined
+## LINKER.  Should we only be setting LIB_GCC if LD ~ -nostdlib?
 LIB_GCC=
-if test "x$GCC" = "xyes"; then
+if test "x$GCC" = "xyes" && test "x$ORDINARY_LINK" != "xyes"; then
 
   case "$opsys" in
     ## cygwin: don't link against static libgcc.
@@ -27458,7 +27544,24 @@
 # This happens for instance with `./config.status config.h'.
 if test -n "$CONFIG_FILES"; then
 
-
+if $AWK 'BEGIN { getline <"/dev/null" }' </dev/null 2>/dev/null; then
+  ac_cs_awk_getline=:
+  ac_cs_awk_pipe_init=
+  ac_cs_awk_read_file='
+      while ((getline aline < (F[key])) > 0)
+	print(aline)
+      close(F[key])'
+  ac_cs_awk_pipe_fini=
+else
+  ac_cs_awk_getline=false
+  ac_cs_awk_pipe_init="print \"cat <<'|#_!!_#|' &&\""
+  ac_cs_awk_read_file='
+      print "|#_!!_#|"
+      print "cat " F[key] " &&"
+      '$ac_cs_awk_pipe_init
+  # The final `:' finishes the AND list.
+  ac_cs_awk_pipe_fini='END { print "|#_!!_#|"; print ":" }'
+fi
 ac_cr='
'
 ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
 if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
@@ -27470,6 +27573,19 @@
 echo 'BEGIN {' >"$tmp/subs1.awk" &&
 _ACEOF
 
+# Create commands to substitute file output variables.
+{
+  echo "cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1" &&
+  echo 'cat >>"\$tmp/subs1.awk" <<\\_ACAWK &&' &&
+  echo "$ac_subst_files" | sed 's/.*/F["&"]="$&"/' &&
+  echo "_ACAWK" &&
+  echo "_ACEOF"
+} >conf$$files.sh &&
+. ./conf$$files.sh ||
+  { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
+$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
+   { (exit 1); exit 1; }; }
+rm -f conf$$files.sh
 
 {
   echo "cat >conf$$subs.awk <<_ACEOF" &&
@@ -27551,7 +27667,7 @@
 cat >>"\$tmp/subs1.awk" <<_ACAWK &&
   for (key in S) S_is_set[key] = 1
   FS = ""
-
+  \$ac_cs_awk_pipe_init
 }
 {
   line = $ 0
@@ -27569,10 +27685,16 @@
     } else
       len += 1 + keylen
   }
-
+  if (nfields == 3 && !substed) {
+    key = field[2]
+    if (F[key] != "" && line ~ /^[	 ]*@.*@[	 ]*$/) {
+      \$ac_cs_awk_read_file
+      next
+    }
+  }
   print line
 }
-
+\$ac_cs_awk_pipe_fini
 _ACAWK
 _ACEOF
 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
@@ -27959,7 +28081,12 @@
 s&@INSTALL@&$ac_INSTALL&;t t
 $ac_datarootdir_hack
 "
-eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \
+eval sed \"\$ac_sed_extra\" "$ac_file_inputs" |
+if $ac_cs_awk_getline; then
+  $AWK -f "$tmp/subs.awk"
+else
+  $AWK -f "$tmp/subs.awk" | $SHELL
+fi >$tmp/out \
   || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
 $as_echo "$as_me: error: could not create $ac_file" >&2;}
    { (exit 1); exit 1; }; }
--- a/configure.in	Sat May 22 17:13:04 2010 +0300
+++ b/configure.in	Sat May 22 22:32:21 2010 +0300
@@ -2,9 +2,11 @@
 dnl To rebuild the `configure' script from this, execute the command
 dnl 	autoconf
 dnl in the directory containing this script.
+dnl If you changed any AC_DEFINES, also run autoheader.
 dnl
-dnl  Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2003,
-dnl    2004, 2005, 2006, 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
+dnl  Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2003, 2004,
+dnl    2005, 2006, 2007, 2008, 2009, 2010
+dnl    Free Software Foundation, Inc.
 dnl
 dnl  This file is part of GNU Emacs.
 dnl
@@ -168,15 +170,6 @@
 dnl http://lists.gnu.org/archive/html/emacs-devel/2008-04/msg01844.html
 OPTION_DEFAULT_ON([makeinfo],[don't require makeinfo for building manuals])
 
-dnl Can remove these in Emacs 24.
-AC_ARG_WITH([gtk],,
-  [AC_MSG_ERROR([--with-gtk has been removed.  Use --with-x-toolkit to
-specify a toolkit.])],,)
-
-AC_ARG_WITH([gcc],,
-  [AC_MSG_ERROR([--with-gcc has been removed.  Set the `CC' environment
-variable to specify a compiler.])],,)
-
 AC_ARG_WITH([pkg-config-prog],dnl
 [AS_HELP_STRING([--with-pkg-config-prog=PATH],
                   [path to pkg-config for finding GTK and librsvg])])
@@ -864,6 +857,12 @@
 
 configure___ unexec=UNEXEC
 
+#ifdef CANNOT_DUMP
+configure___ cannot_dump=yes
+#else
+configure___ cannot_dump=no
+#endif
+
 #ifdef SYSTEM_MALLOC
 configure___ system_malloc=yes
 #else
@@ -925,6 +924,9 @@
 rm ${tempcname}
 
 
+AC_SUBST(cannot_dump)
+
+
 LD_SWITCH_SYSTEM=
 case "$opsys" in
   freebsd)
@@ -1348,6 +1350,9 @@
 dnl check for Make feature
 AC_PROG_MAKE_SET
 
+DEPFLAGS=
+MKDEPDIR=":"
+deps_frag=deps.mk
 dnl check for GNU Make if we have GCC and autodepend is on.
 if test "$GCC" = yes && test "$ac_enable_autodepend" = yes; then
    AC_MSG_CHECKING([whether we are using GNU Make])
@@ -1370,9 +1375,19 @@
       AC_MSG_RESULT([$ac_enable_autodepend])
    fi
    if test $ac_enable_autodepend = yes; then
-      AC_DEFINE(AUTO_DEPEND, 1, [Generate dependencies with gcc.])
+      DEPFLAGS='-MMD -MF ${DEPDIR}/$*.d'
+      ## In parallel builds, another make might create depdir between
+      ## the first test and mkdir, so stick another test on the end.
+      ## Or use mkinstalldirs?  mkdir -p is not portable.
+      MKDEPDIR='test -d ${DEPDIR} || mkdir ${DEPDIR} || test -d ${DEPDIR}'
+      deps_frag=autodeps.mk
    fi
 fi
+deps_frag=$srcdir/src/$deps_frag
+AC_SUBST(MKDEPDIR)
+AC_SUBST(DEPFLAGS)
+AC_SUBST_FILE(deps_frag)
+
 
 dnl checks for operating system services
 AC_SYS_LONG_FILE_NAMES
@@ -1480,6 +1495,7 @@
      GNUSTEP_SYSTEM_HEADERS="$(. $GNUSTEP_CONFIG_FILE; echo $GNUSTEP_SYSTEM_HEADERS)"
      GNUSTEP_SYSTEM_LIBRARIES="$(. $GNUSTEP_CONFIG_FILE; echo $GNUSTEP_SYSTEM_LIBRARIES)"
      ## Pull in stuff from GNUstep-make.
+     ## FIXME? Cleaner to use AC_SUBST_FILE for this?
      NS_IMPL_GNUSTEP_INC="FOUNDATION_LIB=gnu
 GUI_LIB=gnu
 include $GNUSTEP_MAKEFILES/Additional/base.make
@@ -1512,6 +1528,7 @@
 AC_SUBST(NS_IMPL_GNUSTEP_TEMACS_LDFLAGS)
 AC_SUBST(TEMACS_LDFLAGS2)
 
+ns_frag=/dev/null
 NS_OBJ=
 NS_SUPPORT=
 if test "${HAVE_NS}" = yes; then
@@ -1523,6 +1540,7 @@
   if test "${EN_NS_SELF_CONTAINED}" = yes; then
      prefix=${ns_appresdir}
   fi
+  ns_frag=$srcdir/src/ns.mk
   NS_OBJ="nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o fontset.o fringe.o image.o"
   NS_SUPPORT="\${lispsource}emacs-lisp/easymenu.elc \${lispsource}term/ns-win.elc"
 fi
@@ -1531,6 +1549,7 @@
 AC_SUBST(NS_OBJ)
 AC_SUBST(NS_SUPPORT)
 AC_SUBST(LIB_STANDARD)
+AC_SUBST_FILE(ns_frag)
 
 case "${window_system}" in
   x11 )
@@ -2640,7 +2659,7 @@
 
 ## Use terminfo instead of termcap?
 ## Note only system files NOT using terminfo are:
-## freebsd < 40000, ms-w32, msdos, netbsd, and
+## freebsd < 40000, ms-w32, msdos, netbsd < 599002500, and
 ## darwin|gnu without ncurses.
 TERMINFO=no
 LIBS_TERMCAP=
@@ -2682,13 +2701,22 @@
     fi
     ;;
 
+  netbsd)
+    if test $ac_cv_search_tputs = -lterminfo; then
+      TERMINFO=yes
+      LIBS_TERMCAP="-lterminfo"
+    else
+      LIBS_TERMCAP="-ltermcap"
+    fi
+    ;;
+
 esac
 
 case "$opsys" in
   ## hpux: Make sure we get select from libc rather than from libcurses
   ##  because libcurses on HPUX 10.10 has a broken version of select.
   ##  We used to use -lc -lcurses, but this may be cleaner.
-  hpux*|netbsd) LIBS_TERMCAP="-ltermcap" ;;
+  hpux*) LIBS_TERMCAP="-ltermcap" ;;
 
   openbsd) LIBS_TERMCAP="-lncurses" ;;
 
@@ -3159,7 +3187,6 @@
   OLDXMENU_TARGET="really-lwlib"
 fi
 AC_SUBST(LIBXT_OTHER)
-AC_SUBST(OLDXMENU_TARGET)
 
 ## The X Menu stuff is present in the X10 distribution, but missing
 ## from X11.  If we have X10, just use the installed library;
@@ -3178,7 +3205,9 @@
   LIBX_OTHER="\$(LIBXT) \$(LIBX_EXTRA)"
   OLDXMENU_DEPS="\${OLDXMENU} ../src/\${OLDXMENU}"
 else
-  OLDXMENU=
+  ## For a syntactically valid Makefile; not actually used for anything.
+  ## See comments in src/Makefile.in.
+  OLDXMENU=nothing
   ## FIXME This case (!HAVE_X11 && HAVE_X_WINDOWS) is no longer possible(?).
   if test "${HAVE_X_WINDOWS}" = "yes"; then
     LIBXMENU="-lXMenu"
@@ -3190,11 +3219,13 @@
 fi
 
 if test "$HAVE_GTK" = "yes" || test "$HAVE_MENUS" != "yes"; then
-  OLDXMENU=
+  OLDXMENU_TARGET=
+  OLDXMENU=nothing  
   LIBXMENU=
   OLDXMENU_DEPS=
 fi
 
+AC_SUBST(OLDXMENU_TARGET)
 AC_SUBST(OLDXMENU)
 AC_SUBST(LIBXMENU)
 AC_SUBST(LIBX_OTHER)
@@ -3277,8 +3308,75 @@
 AC_SUBST(LD_SWITCH_SYSTEM_EXTRA)
 
 
+LINKER=
+ORDINARY_LINK=
+case "$opsys" in
+  ## gnu: GNU needs its own crt0.
+  aix4-2|darwin|gnu|usg5-4|irix6-5|sol2*|unixware) ORDINARY_LINK=yes ;;
+
+  cygwin) LINKER="\$(CC)" ;;
+
+  ## On post 1.3 releases of NetBSD, gcc -nostdlib also clears the
+  ## library search parth, i.e. it won't search /usr/lib for libc and
+  ## friends.  Using -nostartfiles instead avoids this problem, and
+  ## will also work on earlier NetBSD releases.
+  netbsd|openbsd) LINKER="\$(CC) -nostartfiles" ;;
+
+  ## macpcc: NAKAJI Hiroyuki <nakaji@tutrp.tut.ac.jp> says
+  ##   MkLinux/LinuxPPC needs this.
+  ## ibms390x only supports opsys = gnu-linux so it can be added here.
+  gnu-*)
+    case "$machine" in
+      macppc|ibms390x) LINKER="\$(CC) -nostdlib" ;;
+    esac
+    ;;
+esac
+
+## A macro which other sections of Makefile can redefine to munge the
+## flags before they are passed to LD.  This is helpful if you have
+## redefined LD to something odd, like "gcc".
+## (The YMF prefix is a holdover from the old name "ymakefile".) 
+YMF_PASS_LDFLAGS=flags
+if test "x$ORDINARY_LINK" = "xyes"; then
+
+  LINKER="\$(CC)"
+  AC_DEFINE(ORDINARY_LINK, 1, [Define if the C compiler is the linker.])
+
+## The system files defining neither ORDINARY_LINK nor LINKER are:
+## (bsd-common), freebsd, gnu-* not on macppc|ibms390x, hpux*.
+elif test "x$GCC" = "xyes" && test "x$LINKER" = "x"; then
+
+  ## Versions of GCC >= 2.0 put their library, libgcc.a, in obscure
+  ## places that are difficult to figure out at make time.  Fortunately,
+  ## these same versions allow you to pass arbitrary flags on to the
+  ## linker, so there is no reason not to use it as a linker.
+  ##
+  ## Well, it is not quite perfect.  The "-nostdlib" keeps GCC from
+  ## searching for libraries in its internal directories, so we have to
+  ## ask GCC explicitly where to find libgcc.a (LIB_GCC below).
+  LINKER="\$(CC) -nostdlib"
+  ## GCC passes any argument prefixed with -Xlinker directly to the linker.
+  ## See prefix-args.c for an explanation of why we do not do this with the
+  ## shell''s ``for'' construct.  Note that sane people do not have '.' in
+  ## their paths, so we must use ./prefix-args.
+  ## TODO either make prefix-args check ORDINARY_LINK internally,
+  ## or remove it altogether (bug#6184), removing the need for this macro.
+  YMF_PASS_LDFLAGS='`./prefix-args -Xlinker flags`'
+fi
+AC_SUBST(YMF_PASS_LDFLAGS)
+
+test "x$LINKER" = "x" && LINKER=ld
+## FIXME? What setting of YMF_PASS_LDFLAGS should this have?
+test "$NS_IMPL_GNUSTEP" = "yes" && LINKER="\$(CC) -rdynamic"
+
+AC_SUBST(LINKER)
+
+
+## FIXME? The logic here is not precisely the same as that above
+## setting YMF_PASS_LDFLAGS.  There is no check here for a pre-defined
+## LINKER.  Should we only be setting LIB_GCC if LD ~ -nostdlib?
 LIB_GCC=
-if test "x$GCC" = "xyes"; then
+if test "x$GCC" = "xyes" && test "x$ORDINARY_LINK" != "xyes"; then
 
   case "$opsys" in
     ## cygwin: don't link against static libgcc.
--- a/doc/emacs/ChangeLog	Sat May 22 17:13:04 2010 +0300
+++ b/doc/emacs/ChangeLog	Sat May 22 22:32:21 2010 +0300
@@ -1,3 +1,12 @@
+2010-05-18  Eli Zaretskii  <eliz@gnu.org>
+
+	* display.texi (Fringes): Document reversal of fringe arrows for R2L
+	paragraphs.
+	(Line Truncation): Fix wording for bidi display.
+
+	* basic.texi (Moving Point): Document bidi-aware behavior of the arrow
+	keys.
+
 2010-05-08  Chong Yidong  <cyd@stupidchicken.com>
 
 	* building.texi (GDB Graphical Interface): Remove misleading comparison
@@ -127,7 +136,7 @@
 
 	* custom.texi (Init Examples): Add xref to Mail Header.
 
-	* emacs.texi (Top):  Fix xrefs.
+	* emacs.texi (Top): Fix xrefs.
 
 2010-03-30  Chong Yidong  <cyd@stupidchicken.com>
 
@@ -1695,7 +1704,7 @@
 	(Fortran Columns): Mention font-locking.
 	(Fortran Abbrev): Word syntax not relevant with new-style abbrev.
 
-2008-08-23  Johan Bockgard  <bojohan@muon>
+2008-08-23  Johan Bockgård  <bojohan@muon>
 
 	* basic.texi (Moving Point): Fix <prior>/<next> confusion.
 
--- a/doc/emacs/basic.texi	Sat May 22 17:13:04 2010 +0300
+++ b/doc/emacs/basic.texi	Sat May 22 22:32:21 2010 +0300
@@ -146,6 +146,8 @@
 @findex move-end-of-line
 @findex forward-char
 @findex backward-char
+@findex right-arrow-command
+@findex left-arrow-command
 @findex next-line
 @findex previous-line
 @findex beginning-of-buffer
@@ -161,11 +163,19 @@
 @itemx @key{End}
 Move to the end of the line (@code{move-end-of-line}).
 @item C-f
-@itemx @key{right}
 Move forward one character (@code{forward-char}).
+@item @key{right}
+Move one character to the right (@code{right-arrow-command}).  This
+moves one character forward in text that is read in the usual
+left-to-right direction, but one character @emph{backward} if the text
+is read right-to-left, as needed for right-to-left scripts such as
+Arabic.  @xref{Bidirectional Editing}.
 @item C-b
-@itemx @key{left}
 Move backward one character (@code{backward-char}).
+@item @key{left}
+Move one character to the left (@code{left-arrow-command}).  This
+moves one character backward in left-to-right text and one character
+forward in right-to-left text.
 @item M-f
 @itemx M-@key{right}
 @itemx C-@key{right}
--- a/doc/emacs/display.texi	Sat May 22 17:13:04 2010 +0300
+++ b/doc/emacs/display.texi	Sat May 22 22:32:21 2010 +0300
@@ -804,7 +804,10 @@
 screen.  The left fringe shows a curving arrow for each screen line
 except the first, indicating that ``this is not the real beginning.''
 The right fringe shows a curving arrow for each screen line except the
-last, indicating that ``this is not the real end.''
+last, indicating that ``this is not the real end.''  If the line's
+direction is right-to-left (@pxref{Bidirectional Editing}), the
+meaning of the curving arrows in the left and right fringes are
+swapped.
 
   The fringes indicate line truncation with short horizontal arrows
 meaning ``there's more text on this line which is scrolled
@@ -1191,8 +1194,8 @@
 characters that do not fit in the width of the screen or window do not
 appear at all.  On graphical displays, a small straight arrow in the
 fringe indicates truncation at either end of the line.  On text-only
-terminals, @samp{$} appears in the first column when there is text
-truncated to the left, and in the last column when there is text
+terminals, @samp{$} appears in the leftmost column when there is text
+truncated to the left, and in the rightmost column when there is text
 truncated to the right.
 
 @vindex truncate-lines
--- a/doc/lispref/ChangeLog	Sat May 22 17:13:04 2010 +0300
+++ b/doc/lispref/ChangeLog	Sat May 22 22:32:21 2010 +0300
@@ -1,3 +1,8 @@
+2010-05-22  Chong Yidong  <cyd@stupidchicken.com>
+
+	* display.texi (Image Cache): Update documentation about image
+	caching.
+
 2010-05-08  Štěpán Němec  <stepnem@gmail.com>  (tiny change)
 
 	* windows.texi (Textual Scrolling):
--- a/doc/lispref/display.texi	Sat May 22 17:13:04 2010 +0300
+++ b/doc/lispref/display.texi	Sat May 22 22:32:21 2010 +0300
@@ -4730,29 +4730,35 @@
 efficiently.  When Emacs displays an image, it searches the image
 cache for an existing image specification @code{equal} to the desired
 specification.  If a match is found, the image is displayed from the
-cache; otherwise, Emacs loads the image normally.
-
-  Occasionally, you may need to tell Emacs to refresh the images
-associated with a given image specification.  For example, suppose you
-display an image using a specification that contains a @code{:file}
-property.  The image is automatically cached, and subsequent displays
-of that image, with the same image specification, will use the image
-cache.  If the image file changes in the meantime, Emacs would be
-displaying the old version of the image.  In such a situation, you can
-``refresh'' the image by calling @code{image-refresh}.
-
-  In Emacs' current implementation, each graphical terminal possesses
-an image cache, which is shared by all the frames on that terminal
+cache.  Otherwise, Emacs loads the image normally.
+
+@defun image-flush spec &optional frame
+This function removes the image with specification @var{spec} from the
+image cache of frame @var{frame}.  Image specifications are compared
+using @code{equal}.  If @var{frame} is @code{nil}, it defaults to the
+selected frame.  If @var{frame} is @code{t}, the image is flushed on
+all existing frames.
+
+In Emacs' current implementation, each graphical terminal possesses an
+image cache, which is shared by all the frames on that terminal
 (@pxref{Multiple Terminals}).  Thus, refreshing an image in one frame
 also refreshes it in all other frames on the same terminal.
-
-@defun image-refresh spec &optional frame
-This function refreshes any images with image specifications
-@code{equal} to @var{spec} on frame @var{frame}.  If @var{frame} is
-@code{nil}, it defaults to the selected frame.  If @var{frame} is
-@code{t}, the refresh is applied to all existing frames.
 @end defun
 
+  One use for @code{image-flush} is to tell Emacs about a change in an
+image file.  If an image specification contains a @code{:file}
+property, the image is cached based on the file's contents when the
+image is first displayed.  Even if the file subsequently changes,
+Emacs continues displaying the old version of the image.  Calling
+@code{image-flush} flushes the image from the cache, forcing Emacs to
+re-read the file the next time it needs to display that image.
+
+  Another use for @code{image-flush} is for memory conservation.  If
+your Lisp program creates a large number of temporary images over a
+period much shorter than @code{image-cache-eviction-delay} (see
+below), you can opt to flush unused images yourself, instead of
+waiting for Emacs to do it automatically.
+
 @defun clear-image-cache &optional filter
 This function clears an image cache, removing all the images stored in
 it.  If @var{filter} is omitted or @code{nil}, it clears the cache for
@@ -4768,9 +4774,12 @@
 associated memory.
 
 @defvar image-cache-eviction-delay
-This variable specifies the number of seconds an image can remain in the
-cache without being displayed.  When an image is not displayed for this
-length of time, Emacs removes it from the image cache.
+This variable specifies the number of seconds an image can remain in
+the cache without being displayed.  When an image is not displayed for
+this length of time, Emacs removes it from the image cache.
+
+Under some circumstances, if the number of images in the cache grows
+too large, the actual eviction delay may be shorter than this.
 
 If the value is @code{nil}, Emacs does not remove images from the cache
 except when you explicitly clear it.  This mode can be useful for
--- a/etc/NEWS	Sat May 22 17:13:04 2010 +0300
+++ b/etc/NEWS	Sat May 22 22:32:21 2010 +0300
@@ -147,6 +147,11 @@
 *** The color widget now has a "Choose" button, which allows you to
 choose a color via list-colors-display.
 
+** Dired-x
+
+*** dired-jump and dired-jump-other-window called with a prefix argument
+read a file name from the minibuffer instead of using buffer-file-name.
+
 ** VC and related modes
 
 *** New VC commands: vc-log-incoming, vc-log-outgoing, vc-find-conflicted-file.
@@ -214,7 +219,9 @@
 
 ** secrets.el is an implementation of the Secret Service API, an
 interface to password managers like GNOME Keyring or KDE Wallet.  The
-Secret Service API requires D-Bus for communication.
+Secret Service API requires D-Bus for communication.  The command
+`secrets-show-secrets' offers a buffer with a visualization of the
+secrets.
 
 
 * Incompatible Lisp Changes in Emacs 24.1
@@ -248,6 +255,10 @@
 
 *** `image-extension-data' is renamed to `image-metadata'.
 
+** Isearch
+
+*** New hook `isearch-update-post-hook' that runs in `isearch-update'.
+
 ** Progress reporters can now "spin".
 The MIN-VALUE and MAX-VALUE arguments of `make-progress-reporter' can
 now be nil, or omitted.  This makes a "non-numeric" reporter.  Each
--- a/etc/TODO	Sat May 22 17:13:04 2010 +0300
+++ b/etc/TODO	Sat May 22 22:32:21 2010 +0300
@@ -40,9 +40,9 @@
   fix_submap_inheritance hack and to more cleanly express the
   relationship between minibuffer-local-*-map): I've had this locally
   for a long time, but the details of the semantics is somewhat ... delicate.
-*** prog-mode (a parent-mode, like text-mode).  Could/should provide
-  a better fill-paragraph default that uses syntax-tables to recognize
-  string/comment boundaries.
+*** Derive from prog-mode in more places, close bug#5532.
+*** prog-mode could/should provide a better fill-paragraph default
+  that uses syntax-tables to recognize string/comment boundaries.
 *** provide more completion-at-point-functions.  Make existing
   in-buffer completion use completion-at-point.
 *** "functional" function-key-map that would make it easy to add (and
--- a/lib-src/ChangeLog	Sat May 22 17:13:04 2010 +0300
+++ b/lib-src/ChangeLog	Sat May 22 22:32:21 2010 +0300
@@ -1,3 +1,11 @@
+2010-05-22  Jan Djärv  <jan.h.d@swipnet.se>
+
+	* Makefile.in (STAMP_INST_SCRIPTS, STAMP_SCRIPS): New (Bug #6246).
+	(all): Depend onSTAMP_INST_SCRIPTS, STAMP_SCRIPS (Bug #6246).
+	(stamp-rcs2log, stamp-rcs-checkin, stamp-grep-changelog, stamp-vcdiff):
+	New rules (Bug #6246).
+	(clean): Remove stamp-* (Bug #6246).
+
 2010-05-12  Glenn Morris  <rgm@gnu.org>
 
 	* Makefile.in (INSTALLABLES): Remove @LIB_SRC_EXTRA_INSTALLABLES@.
--- a/lib-src/Makefile.in	Sat May 22 17:13:04 2010 +0300
+++ b/lib-src/Makefile.in	Sat May 22 22:32:21 2010 +0300
@@ -111,6 +111,7 @@
                b2m${EXEEXT} ebrowse${EXEEXT}
 
 INSTALLABLE_SCRIPTS = rcs-checkin grep-changelog
+STAMP_INST_SCRIPTS = stamp-rcs-checkin stamp-grep-changelog
 
 # Things that Emacs runs internally, or during the build process,
 #  which should not be installed in bindir.
@@ -123,6 +124,7 @@
 # Like UTILITIES, but they're not system-dependent, and should not be
 #  deleted by the distclean target.
 SCRIPTS= rcs2log vcdiff
+STAMP_SCRIPTS= stamp-rcs2log stamp-vcdiff
 
 EXECUTABLES= ${UTILITIES} ${INSTALLABLES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS}
 
@@ -180,23 +182,27 @@
 .c.o:
 	${CC} -c ${CPP_CFLAGS} $<
 
-all: ${DONT_INSTALL} ${UTILITIES} ${INSTALLABLES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS}
+all: ${DONT_INSTALL} ${UTILITIES} ${INSTALLABLES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS}  ${STAMP_INST_SCRIPTS} ${STAMP_SCRIPTS}
 
 ## These targets copy the scripts into the build directory so that
 ## they can be run from there in an uninstalled Emacs.
 ## The "-" is prepended because some versions of cp barf when srcdir
 ## is the current directory, and thus the file will be copied into itself.
-rcs2log: $(srcdir)/rcs2log
+stamp-rcs2log: $(srcdir)/rcs2log
 	-cp -p $(srcdir)/rcs2log rcs2log
+	touch $@
 
-rcs-checkin: $(srcdir)/rcs-checkin
+stamp-rcs-checkin: $(srcdir)/rcs-checkin
 	-cp -p $(srcdir)/rcs-checkin rcs-checkin
+	touch $@
 
-grep-changelog: $(srcdir)/grep-changelog
+stamp-grep-changelog: $(srcdir)/grep-changelog
 	-cp -p $(srcdir)/grep-changelog grep-changelog
+	touch $@
 
-vcdiff: $(srcdir)/vcdiff
+stamp-vcdiff: $(srcdir)/vcdiff
 	-cp -p $(srcdir)/vcdiff vcdiff
+	touch $@
 
 ## Only used if we need blessmail, but no harm in always defining.
 ## This makes the actual blessmail executable.
@@ -273,7 +279,7 @@
 
 clean: mostlyclean
 	-rm -f ${INSTALLABLES} ${UTILITIES} ${DONT_INSTALL}
-	-rm -f fns*.el *.tab.c *.tab.h
+	-rm -f fns*.el *.tab.c *.tab.h stamp-*
 
 distclean: clean
 	-rm -f TAGS
--- a/lisp/ChangeLog	Sat May 22 17:13:04 2010 +0300
+++ b/lisp/ChangeLog	Sat May 22 22:32:21 2010 +0300
@@ -1,3 +1,197 @@
+2010-05-22  Chong Yidong  <cyd@stupidchicken.com>
+
+	* image.el (image-refresh): Define as an alias for image-flush.
+
+	* image-mode.el (image-toggle-display-image): Caller changed.
+
+2010-05-21  Juri Linkov  <juri@jurta.org>
+
+	* progmodes/grep.el (grep-read-files): Fix multi-pattern aliases.
+	Remove "all" from grep-files-aliases.  Split grep-files-aliases by
+	whitespace, call wildcard-to-regexp on substrings and concat them
+	with "\\|".  (Bug#6114)
+
+2010-05-21  Alan Mackenzie  <acm@muc.de>
+
+	* progmodes/cc-engine.el (c-parse-state-get-strategy): Replace
+	parameter `here' with `here-' and `here-plus', which sandwich any
+	pertinent CPP construct.
+	(c-remove-stale-state-cache-backwards): Fix a bug which happens
+	when doing (c-parse-state) in a CPP construct: Exclude any "new"
+	CPP construct from taking part in the scanning.
+
+2010-05-21  Michael Albinus  <michael.albinus@gmx.de>
+
+	* net/tramp.el (tramp-do-copy-or-rename-file)
+	(tramp-handle-file-local-copy, tramp-maybe-open-connection): Tune
+	`with-progress-reporter' messages.
+	(tramp-handle-vc-registered):
+	* net/tramp-fish.el (tramp-fish-handle-file-local-copy)
+	(tramp-fish-handle-insert-file-contents)
+	(tramp-fish-maybe-open-connection):
+	* net/tramp-gvfs.el (tramp-gvfs-maybe-open-connection):
+	* net/tramp-imap.el (tramp-imap-do-copy-or-rename-file)
+	(tramp-imap-handle-insert-file-contents)
+	(tramp-imap-handle-file-local-copy): Use `with-progress-reporter'.
+
+2010-05-21  Juanma Barranquero  <lekktu@gmail.com>
+
+	* add-log.el (change-log-font-lock-keywords):
+	Highlight all authors in multi-author entries.
+
+	* smerge-mode.el (smerge-refine-ignore-whitespace)
+	(smerge-refine-weight-hack, smerge-refine, smerge-makeup-conflict):
+	Fix typos in docstrings.
+	(smerge-resolve, smerge-refine-subst): Reflow docstrings.
+
+2010-05-21  Glenn Morris  <rgm@gnu.org>
+
+	* progmodes/fortran.el (fortran-mode):
+	* progmodes/f90.el (f90-mode): Derive from prog-mode.
+
+	* loadup.el [CANNOT_DUMP]: Update for bootstrap-emacs no longer
+	having a relative path in src/Makefile.in.
+
+2010-05-20  Kevin Ryde  <user42@zip.com.au>
+
+	* help-mode.el (help-make-xrefs): For Info node links turn
+	newlines into spaces.  Link node names with newlines are matched
+	by help-xref-info-regexp and buttonized, this change ensures they
+	can be followed successfully with RET.  (Bug#6206)
+
+2010-05-20  Juri Linkov  <juri@jurta.org>
+
+	* locate.el (locate): Use pop-to-buffer instead of
+	switch-to-buffer-other-window.  (Bug#6204)
+
+2010-05-20  Juri Linkov  <juri@jurta.org>
+
+	* replace.el (replace-highlight): Fix lazy-highlighting
+	for `M-s w str M-% str RET'.
+
+2009-12-15  Masatake YAMATO  <yamato@redhat.com>
+
+	* isearch.el (isearch-yank-word-or-char): Pull next subword
+	when `subword-mode' is activated.  (Bug#6220)
+
+2010-05-20  Mark A. Hershberger  <mah@everybody.org>
+
+	* isearch.el (isearch-update-post-hook): New hook.
+	(isearch-update): Use the new hook.  (Bug#6225)
+
+2010-05-20  Juri Linkov  <juri@jurta.org>
+
+	* isearch.el (isearch-mode-map): Bind more keys to isearch-help-map:
+	[f1], [help], and (char-to-string help-char) instead of "\C-h".
+	(Bug#6222)
+
+2010-05-20  Juri Linkov  <juri@jurta.org>
+
+	* isearch.el (isearch-yank-string): Use isearch-process-search-string.
+	(Bug#6223)
+
+2010-05-20  Juri Linkov  <juri@jurta.org>
+
+	* dired-x.el (dired-jump, dired-jump-other-window): Add arg
+	FILE-NAME to read from the minibuffer when called interactively
+	with prefix argument instead of using buffer-file-name.
+	http://lists.gnu.org/archive/html/emacs-devel/2010-05/msg00534.html
+
+	* dired.el: Update autoloads.
+
+2010-05-20  Chong Yidong  <cyd@stupidchicken.com>
+
+	* nxml/nxml-mode.el (nxml-mode-map): Bind C-c / to
+	nxml-finish-element, for consistency with SGML mode.
+
+	* progmodes/octave-mod.el (octave-mode-map): Bind C-c / to
+	octave-close-block.
+
+2010-05-20  Juanma Barranquero  <lekktu@gmail.com>
+
+	* composite.el: Require cl when compiling.
+	(reference-point-alist, compose-gstring-for-graphic)
+	(compose-gstring-for-terminal): Fix typos in docstrings.
+
+2010-05-19  Juri Linkov  <juri@jurta.org>
+
+	* emacs-lisp/cl-macs.el (window-parameter): Add defsetf with
+	set-window-parameter.
+
+2010-05-19  Michael Albinus  <michael.albinus@gmx.de>
+
+	* net/tramp.el (tramp-methods): Add `tramp-async-args' attribute
+	where appropriate.
+	(tramp-maybe-open-connection): Use it.
+
+2010-05-19  Eli Zaretskii  <eliz@gnu.org>
+
+	* simple.el (move-end-of-line): Make sure we are at line beginning
+	before backing up to end of previous line.
+
+2010-05-19  Michael Albinus  <michael.albinus@gmx.de>
+
+	* password-cache.el (password-cache-remove): Fix docstring.
+
+	* net/secrets.el: Autoload the widget functions.
+	(secrets-search-items, secrets-create-item)
+	(secrets-get-attributes, secrets-expand-item): Attributes will be
+	stored on the password database without leading ":", as all other
+	clients do as well.
+	(secrets-mode): Fix docstring.
+	(secrets-show-secrets): Provide it as autoloaded command only when
+	D-Bus support is available.  Check existence of Secret Service API.
+
+2010-05-19  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* indent.el (indent-region): Deactivate region (bug#6200).
+
+2010-05-19  Glenn Morris  <rgm@gnu.org>
+
+	* vc-dir.el (vc-dir): Don't pop-up-windows.  (Bug#6204)
+
+2010-05-19  Kenichi Handa  <handa@m17n.org>
+
+	* composite.el: Register compose-gstring-for-graphic in
+	composition-function-table only for combining characters (Mn, Mc, Me).
+
+2010-05-18  Jay Belanger  <jay.p.belanger@gmail.com>
+
+	* calc/calc-trail.el (calc-trail-isearch-forward)
+	(calc-trail-isearch-backward): Ensure that the new window
+	point is set correctly.
+
+2010-05-18  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* subr.el (read-quoted-char): Resolve modifiers after key
+	remapping (bug#6212).
+
+2010-05-18  Michael Albinus  <michael.albinus@gmx.de>
+
+	Add visualization code for secrets.
+	* net/secrets.el (secrets-mode): New major mode.
+	(secrets-show-secrets, secrets-show-collections)
+	(secrets-expand-collection, secrets-expand-item)
+	(secrets-tree-widget-after-toggle-function)
+	(secrets-tree-widget-show-password): New defuns.
+
+2010-05-18  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* emacs-lisp/smie.el (smie-next-sexp): Break inf-loop at BOB.
+	(smie-backward-sexp, smie-forward-sexp): Remove boundary condition now
+	handled in smie-next-sexp.
+	(smie-indent-calculate): Provide a starting indentation (so the
+	recursion is well-founded ;-).
+
+	Fix handling of non-associative equal levels.
+	* emacs-lisp/smie.el (smie-prec2-levels): Choose distinct levels even
+	when it's not needed.
+	(smie-op-left, smie-op-right): New functions.
+	(smie-next-sexp): New function, extracted from smie-backward-sexp.
+	Better handle equal levels to distinguish the associative case from
+	the "multi-keyword construct" case.
+	(smie-backward-sexp, smie-forward-sexp): Use it.
+
 2010-05-18  Juanma Barranquero  <lekktu@gmail.com>
 
 	* progmodes/prolog.el (smie-indent-basic): Declare for byte-compiler.
@@ -129,7 +323,7 @@
 2010-05-13  Michael Albinus  <michael.albinus@gmx.de>
 
 	* net/tramp.el (with-progress-reporter): Create reporter object
-	only when the message would be displayed.  Handled nested calls.
+	only when the message would be displayed.  Handle nested calls.
 	(tramp-handle-load, tramp-handle-file-local-copy)
 	(tramp-handle-insert-file-contents, tramp-handle-write-region)
 	(tramp-maybe-send-script, tramp-find-shell):
--- a/lisp/add-log.el	Sat May 22 17:13:04 2010 +0300
+++ b/lisp/add-log.el	Sat May 22 22:32:21 2010 +0300
@@ -245,7 +245,7 @@
     ;; wrongly with a non-date line existing as a random note.  In
     ;; addition, using any kind of fixed setting like this doesn't
     ;; work if a user customizes add-log-time-format.
-    ("^[0-9-]+ +\\|^\\(Sun\\|Mon\\|Tue\\|Wed\\|Thu\\|Fri\\|Sat\\) [A-z][a-z][a-z] [0-9:+ ]+"
+    ("^[0-9-]+ +\\|^ \\{11,\\}\\|^\\(Sun\\|Mon\\|Tue\\|Wed\\|Thu\\|Fri\\|Sat\\) [A-z][a-z][a-z] [0-9:+ ]+"
      (0 'change-log-date-face)
      ;; Name and e-mail; some people put e-mail in parens, not angles.
      ("\\([^<(]+?\\)[ \t]*[(<]\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)[>)]" nil nil
--- a/lisp/calc/calc-trail.el	Sat May 22 17:13:04 2010 +0300
+++ b/lisp/calc/calc-trail.el	Sat May 22 22:32:21 2010 +0300
@@ -108,20 +108,28 @@
 (defun calc-trail-isearch-forward ()
   (interactive)
   (calc-with-trail-buffer
-   (save-window-excursion
-     (select-window (get-buffer-window (current-buffer)))
-     (let ((search-exit-char ?\r))
-       (isearch-forward)))
-   (calc-trail-here)))
+   (let ((win (get-buffer-window (current-buffer)))
+         pos)
+     (save-window-excursion
+       (select-window win)
+       (isearch-forward)
+       (setq pos (point)))
+     (goto-char pos)
+     (set-window-point win pos)
+     (calc-trail-here))))
 
 (defun calc-trail-isearch-backward ()
   (interactive)
   (calc-with-trail-buffer
-   (save-window-excursion
-     (select-window (get-buffer-window (current-buffer)))
-     (let ((search-exit-char ?\r))
-       (isearch-backward)))
-   (calc-trail-here)))
+   (let ((win (get-buffer-window (current-buffer)))
+         pos)
+     (save-window-excursion
+       (select-window win)
+       (isearch-backward)
+       (setq pos (point)))
+     (goto-char pos)
+     (set-window-point win pos)
+     (calc-trail-here))))
 
 (defun calc-trail-yank (arg)
   (interactive "P")
--- a/lisp/comint.el	Sat May 22 17:13:04 2010 +0300
+++ b/lisp/comint.el	Sat May 22 22:32:21 2010 +0300
@@ -309,7 +309,6 @@
   :type 'integer
   :group 'comint)
 
-;; FIXME: this should be defcustom
 (defcustom comint-input-ring-size 500
   "Size of the input history ring in `comint-mode'."
   :type 'integer
--- a/lisp/composite.el	Sat May 22 17:13:04 2010 +0300
+++ b/lisp/composite.el	Sat May 22 22:32:21 2010 +0300
@@ -28,6 +28,8 @@
 
 ;;; Code:
 
+(eval-when-compile (require 'cl))
+
 (defconst reference-point-alist
   '((tl . 0) (tc . 1) (tr . 2)
     (Bl . 3) (Bc . 4) (Br . 5)
@@ -77,7 +79,7 @@
     +----+-----+ <--- new descent
 
 A composition rule may have the form \(GLOBAL-REF-POINT
-NEW-REF-POINT XOFF YOFF), where XOFF and YOFF specifies how much
+NEW-REF-POINT XOFF YOFF), where XOFF and YOFF specify how much
 to shift NEW-REF-POINT from GLOBAL-REF-POINT.  In this case, XOFF
 and YOFF are integers in the range -100..100 representing the
 shifting percentage against the font size.")
@@ -532,12 +534,12 @@
 
 (defun compose-gstring-for-graphic (gstring)
   "Compose glyph-string GSTRING for graphic display.
-Non-spacing characters are composed with the preceding base
+Combining characters are composed with the preceding base
 character.  If the preceding character is not a base character,
-each non-spacing character is composed as a spacing character by
+each combining character is composed as a spacing character by
 a padding space before and/or after the character.
 
-All non-spacing characters has this function in
+All non-spacing characters have this function in
 `composition-function-table' unless overwritten."
   (let* ((header (lgstring-header gstring))
 	 (nchars (lgstring-char-len gstring))
@@ -660,16 +662,16 @@
 	     [nil 0 compose-gstring-for-graphic])))
   (map-char-table
    #'(lambda (key val)
-       (if (= val 0)
+       (if (memq val '(Mn Mc Me))
 	   (set-char-table-range composition-function-table key elt)))
-   char-width-table))
+   unicode-category-table))
 
 (defun compose-gstring-for-terminal (gstring)
   "Compose glyph string GSTRING for terminal display.
 Non-spacing characters are composed with the preceding base
 character.  If the preceding character is not a base character,
 each non-spacing character is composed as a spacing character by
-a prepending a space before it."
+prepending a space before it."
   (let* ((header (lgstring-header gstring))
 	 (nchars (lgstring-char-len gstring))
 	 (nglyphs (lgstring-glyph-len gstring))
--- a/lisp/dired-x.el	Sat May 22 17:13:04 2010 +0300
+++ b/lisp/dired-x.el	Sat May 22 22:32:21 2010 +0300
@@ -506,16 +506,21 @@
 ;;; JUMP.
 
 ;;;###autoload
-(defun dired-jump (&optional other-window)
+(defun dired-jump (&optional other-window file-name)
   "Jump to dired buffer corresponding to current buffer.
 If in a file, dired the current directory and move to file's line.
 If in Dired already, pop up a level and goto old directory's line.
 In case the proper dired file line cannot be found, refresh the dired
-buffer and try again."
-  (interactive "P")
-  (let* ((file buffer-file-name)
+buffer and try again.
+When OTHER-WINDOW is non-nil, jump to dired buffer in other window.
+Interactively with prefix argument, read FILE-NAME and
+move to its line in dired."
+  (interactive
+   (list nil (and current-prefix-arg
+		  (read-file-name "Jump to dired file: "))))
+  (let* ((file (or file-name buffer-file-name))
          (dir (if file (file-name-directory file) default-directory)))
-    (if (eq major-mode 'dired-mode)
+    (if (and (eq major-mode 'dired-mode) (null file-name))
         (progn
           (setq dir (dired-current-directory))
           (dired-up-directory other-window)
@@ -539,10 +544,12 @@
 		    (dired-omit-mode)
 		    (dired-goto-file file))))))))
 
-(defun dired-jump-other-window ()
+(defun dired-jump-other-window (&optional file-name)
   "Like \\[dired-jump] (`dired-jump') but in other window."
-  (interactive)
-  (dired-jump t))
+  (interactive
+   (list (and current-prefix-arg
+	      (read-file-name "Jump to dired file: "))))
+  (dired-jump t file-name))
 
 ;;; OMITTING.
 
--- a/lisp/dired.el	Sat May 22 17:13:04 2010 +0300
+++ b/lisp/dired.el	Sat May 22 22:32:21 2010 +0300
@@ -3974,7 +3974,7 @@
 ;;;***
 
 ;;;### (autoloads (dired-do-relsymlink dired-jump) "dired-x" "dired-x.el"
-;;;;;;  "2f8d3d5a31b969b181e23c40d6bb16a0")
+;;;;;;  "6c492aba3ca0d36a4cd7b02fb9c1cc10")
 ;;; Generated autoloads from dired-x.el
 
 (autoload 'dired-jump "dired-x" "\
@@ -3983,8 +3983,11 @@
 If in Dired already, pop up a level and goto old directory's line.
 In case the proper dired file line cannot be found, refresh the dired
 buffer and try again.
-
-\(fn &optional OTHER-WINDOW)" t nil)
+When OTHER-WINDOW is non-nil, jump to dired buffer in other window.
+Interactively with prefix argument, read FILE-NAME and
+move to its line in dired.
+
+\(fn &optional OTHER-WINDOW FILE-NAME)" t nil)
 
 (autoload 'dired-do-relsymlink "dired-x" "\
 Relative symlink all marked (or next ARG) files into a directory.
--- a/lisp/emacs-lisp/cl-loaddefs.el	Sat May 22 17:13:04 2010 +0300
+++ b/lisp/emacs-lisp/cl-loaddefs.el	Sat May 22 22:32:21 2010 +0300
@@ -282,7 +282,7 @@
 ;;;;;;  flet progv psetq do-all-symbols do-symbols dotimes dolist
 ;;;;;;  do* do loop return-from return block etypecase typecase ecase
 ;;;;;;  case load-time-value eval-when destructuring-bind function*
-;;;;;;  defmacro* defun* gentemp gensym) "cl-macs" "cl-macs.el" "0faa39d8f21ae59f2cc1baa835e28a5f")
+;;;;;;  defmacro* defun* gentemp gensym) "cl-macs" "cl-macs.el" "fbeedbf769c72fee9b4e0671957c1077")
 ;;; Generated autoloads from cl-macs.el
 
 (autoload 'gensym "cl-macs" "\
--- a/lisp/emacs-lisp/cl-macs.el	Sat May 22 17:13:04 2010 +0300
+++ b/lisp/emacs-lisp/cl-macs.el	Sat May 22 22:32:21 2010 +0300
@@ -1813,6 +1813,7 @@
 (defsetf window-height () (store)
   (list 'progn (list 'enlarge-window (list '- store '(window-height))) store))
 (defsetf window-hscroll set-window-hscroll)
+(defsetf window-parameter set-window-parameter)
 (defsetf window-point set-window-point)
 (defsetf window-start set-window-start)
 (defsetf window-width () (store)
--- a/lisp/emacs-lisp/smie.el	Sat May 22 17:13:04 2010 +0300
+++ b/lisp/emacs-lisp/smie.el	Sat May 22 22:32:21 2010 +0300
@@ -252,11 +252,23 @@
           (dolist (cst csts)
             (unless (memq (car cst) rhvs)
               (setq progress t)
+              ;; We could give each var in a given iteration the same value,
+              ;; but we can also give them arbitrarily different values.
+              ;; Basically, these are vars between which there is no
+              ;; constraint (neither equality nor inequality), so
+              ;; anything will do.
+              ;; We give them arbitrary values, which means that we
+              ;; replace the "no constraint" case with either > or <
+              ;; but not =.  The reason we do that is so as to try and
+              ;; distinguish associative operators (which will have
+              ;; left = right).
+              (unless (caar cst)
               (setcar (car cst) i)
+                (incf i))
               (setq csts (delq cst csts))))
           (unless progress
             (error "Can't resolve the precedence table to precedence levels")))
-        (incf i))
+        (incf i 10))
       ;; Propagate equalities back to their source.
       (dolist (eq (nreverse eqs))
         (assert (null (caar eq)))
@@ -278,6 +290,9 @@
 Each element is of the form (TOKEN LEFT-LEVEL RIGHT-LEVEL).
 Parsing is done using an operator precedence parser.")
 
+(defalias 'smie-op-left 'car)
+(defalias 'smie-op-right 'cadr)
+
 (defun smie-backward-token ()
   ;; FIXME: This may be an OK default but probably needs a hook.
   (buffer-substring (point)
@@ -292,6 +307,92 @@
                                (skip-syntax-forward "w_'"))
                            (point))))
 
+(defun smie-associative-p (toklevels)
+  ;; in "a + b + c" we want to stop at each +, but in
+  ;; "if a then b else c" we don't want to stop at each keyword.
+  ;; To distinguish the two cases, we made smie-prec2-levels choose
+  ;; different levels for each part of "if a then b else c", so that
+  ;; by checking if the left-level is equal to the right level, we can
+  ;; figure out that it's an associative operator.
+  ;; This is not 100% foolproof, tho, since a grammar like
+  ;;   (exp ("A" exp "C") ("A" exp "B" exp "C"))
+  ;; will cause "B" to have equal left and right levels, even though
+  ;; it is not an associative operator.
+  ;; A better check would be the check the actual previous operator
+  ;; against this one to see if it's the same, but we'd have to change
+  ;; `levels' to keep a stack of operators rather than only levels.
+  (eq (smie-op-left toklevels) (smie-op-right toklevels)))
+
+(defun smie-next-sexp (next-token next-sexp op-forw op-back halfsexp)
+  "Skip over one sexp.
+NEXT-TOKEN is a function of no argument that moves forward by one
+token (after skipping comments if needed) and returns it.
+NEXT-SEXP is a lower-level function to skip one sexp.
+OP-FORW is the accessor to the forward level of the level data.
+OP-BACK is the accessor to the backward level of the level data.
+HALFSEXP if non-nil, means skip over a partial sexp if needed.  I.e. if the
+first token we see is an operator, skip over its left-hand-side argument.
+Possible return values:
+  (FORW-LEVEL POS TOKEN): we couldn't skip TOKEN because its back-level
+    is too high.  FORW-LEVEL is the forw-level of TOKEN,
+    POS is its start position in the buffer.
+  (t POS TOKEN): same thing when we bump on the wrong side of a paren.
+  (nil POS TOKEN): we skipped over a paren-like pair.
+  nil: we skipped over an identifier, matched parentheses, ..."
+  (catch 'return
+    (let ((levels ()))
+      (while
+          (let* ((pos (point))
+                 (token (funcall next-token))
+                 (toklevels (cdr (assoc token smie-op-levels))))
+
+            (cond
+             ((null toklevels)
+              (when (equal token "")
+                  (condition-case err
+                      (progn (goto-char pos) (funcall next-sexp 1) nil)
+                  (scan-error (throw 'return (list t (caddr err)))))
+                (if (eq pos (point))
+                    ;; We did not move, so let's abort the loop.
+                    (throw 'return (list t (point))))))
+             ((null (funcall op-back toklevels))
+              ;; A token like a paren-close.
+              (assert (funcall op-forw toklevels)) ;Otherwise, why mention it?
+              (push (funcall op-forw toklevels) levels))
+             (t
+              (while (and levels (< (funcall op-back toklevels) (car levels)))
+                (setq levels (cdr levels)))
+              (cond
+               ((null levels)
+                (if (and halfsexp (funcall op-forw toklevels))
+                    (push (funcall op-forw toklevels) levels)
+                  (throw 'return
+                         (prog1 (list (or (car toklevels) t) (point) token)
+                           (goto-char pos)))))
+               (t
+                (if (and levels (= (funcall op-back toklevels) (car levels)))
+                    (setq levels (cdr levels)))
+                (cond
+                 ((null levels)
+                  (cond
+                   ((null (funcall op-forw toklevels))
+                    (throw 'return (list nil (point) token)))
+                   ((smie-associative-p toklevels)
+                    (throw 'return
+                           (prog1 (list (or (car toklevels) t) (point) token)
+                             (goto-char pos))))
+                   ;; We just found a match to the previously pending operator
+                   ;; but this new operator is still part of a larger RHS.
+                   ;; E.g. we're now looking at the "then" in
+                   ;; "if a then b else c".  So we have to keep parsing the
+                   ;; rest of the construct.
+                   (t (push (funcall op-forw toklevels) levels))))
+                 (t
+                  (if (funcall op-forw toklevels)
+                      (push (funcall op-forw toklevels) levels))))))))
+            levels)
+        (setq halfsexp nil)))))
+
 (defun smie-backward-sexp (&optional halfsexp)
   "Skip over one sexp.
 HALFSEXP if non-nil, means skip over a partial sexp if needed.  I.e. if the
@@ -303,55 +404,13 @@
   (t POS TOKEN): same thing but for an open-paren or the beginning of buffer.
   (nil POS TOKEN): we skipped over a paren-like pair.
   nil: we skipped over an identifier, matched parentheses, ..."
-  (if (bobp) (list t (point))
-    (catch 'return
-      (let ((levels ()))
-        (while
-            (let* ((pos (point))
-                   (token (progn (forward-comment (- (point-max)))
-                                 (smie-backward-token)))
-                   (toklevels (cdr (assoc token smie-op-levels))))
+    (smie-next-sexp
+     (lambda () (forward-comment (- (point-max))) (smie-backward-token))
+     (indirect-function 'backward-sexp)
+     (indirect-function 'smie-op-left)
+     (indirect-function 'smie-op-right)
+   halfsexp))
 
-              (cond
-               ((null toklevels)
-                (if (equal token "")
-                    (condition-case err
-                        (progn (goto-char pos) (backward-sexp 1) nil)
-                      (scan-error (throw 'return (list t (caddr err)))))))
-               ((null (nth 1 toklevels))
-                ;; A token like a paren-close.
-                (assert (nth 0 toklevels)) ;Otherwise, why mention it?
-                (push (nth 0 toklevels) levels))
-               (t
-                (while (and levels (< (nth 1 toklevels) (car levels)))
-                  (setq levels (cdr levels)))
-                (cond
-                 ((null levels)
-                  (if (and halfsexp (nth 0 toklevels))
-                      (push (nth 0 toklevels) levels)
-                    (throw 'return
-                           (prog1 (list (or (car toklevels) t) (point) token)
-                             (goto-char pos)))))
-                 (t
-                  (while (and levels (= (nth 1 toklevels) (car levels)))
-                    (setq levels (cdr levels)))
-                  (cond
-                   ((null levels)
-                    (cond
-                     ((null (nth 0 toklevels))
-                      (throw 'return (list nil (point) token)))
-                     ((eq (nth 0 toklevels) (nth 1 toklevels))
-                      (throw 'return
-                             (prog1 (list (or (car toklevels) t) (point) token)
-                               (goto-char pos))))
-                     (t (debug))))      ;Not sure yet what to do here.
-                   (t
-                    (if (nth 0 toklevels)
-                        (push (nth 0 toklevels) levels))))))))
-              levels)
-          (setq halfsexp nil))))))
-
-;; Mirror image, not used for indentation.
 (defun smie-forward-sexp (&optional halfsexp)
   "Skip over one sexp.
 HALFSEXP if non-nil, means skip over a partial sexp if needed.  I.e. if the
@@ -363,53 +422,12 @@
   (t POS TOKEN): same thing but for an open-paren or the beginning of buffer.
   (nil POS TOKEN): we skipped over a paren-like pair.
   nil: we skipped over an identifier, matched parentheses, ..."
-  (if (eobp) (list t (point))
-    (catch 'return
-      (let ((levels ()))
-        (while
-            (let* ((pos (point))
-                   (token (progn (forward-comment (point-max))
-                                 (smie-forward-token)))
-                   (toklevels (cdr (assoc token smie-op-levels))))
-
-              (cond
-               ((null toklevels)
-                (if (equal token "")
-                    (condition-case err
-                        (progn (goto-char pos) (forward-sexp 1) nil)
-                      (scan-error (throw 'return (list t (caddr err)))))))
-               ((null (nth 0 toklevels))
-                ;; A token like a paren-close.
-                (assert (nth 1 toklevels)) ;Otherwise, why mention it?
-                (push (nth 1 toklevels) levels))
-               (t
-                (while (and levels (< (nth 0 toklevels) (car levels)))
-                  (setq levels (cdr levels)))
-                (cond
-                 ((null levels)
-                  (if (and halfsexp (nth 1 toklevels))
-                      (push (nth 1 toklevels) levels)
-                    (throw 'return
-                           (prog1 (list (or (nth 1 toklevels) t) (point) token)
-                             (goto-char pos)))))
-                 (t
-                  (while (and levels (= (nth 0 toklevels) (car levels)))
-                    (setq levels (cdr levels)))
-                  (cond
-                   ((null levels)
-                    (cond
-                     ((null (nth 1 toklevels))
-                      (throw 'return (list nil (point) token)))
-                     ((eq (nth 1 toklevels) (nth 0 toklevels))
-                      (throw 'return
-                             (prog1 (list (or (nth 1 toklevels) t) (point) token)
-                               (goto-char pos))))
-                     (t (debug))))      ;Not sure yet what to do here.
-                   (t
-                    (if (nth 1 toklevels)
-                        (push (nth 1 toklevels) levels))))))))
-              levels)
-          (setq halfsexp nil))))))
+    (smie-next-sexp
+     (lambda () (forward-comment (point-max)) (smie-forward-token))
+     (indirect-function 'forward-sexp)
+     (indirect-function 'smie-op-right)
+     (indirect-function 'smie-op-left)
+   halfsexp))
 
 (defun smie-backward-sexp-command (&optional n)
   "Move backward through N logical elements."
@@ -496,6 +514,10 @@
    (and virtual
         (if (eq virtual :hanging) (not (smie-indent-hanging-p)) (smie-bolp))
         (current-column))
+   ;; Start the file at column 0.
+   (save-excursion
+     (forward-comment (- (point-max)))
+     (if (bobp) 0))
    ;; Align close paren with opening paren.
    (save-excursion
      ;; (forward-comment (point-max))
--- a/lisp/gnus/ChangeLog	Sat May 22 17:13:04 2010 +0300
+++ b/lisp/gnus/ChangeLog	Sat May 22 22:32:21 2010 +0300
@@ -1,3 +1,7 @@
+2010-05-20  Kevin Ryde  <user42@zip.com.au>
+
+	* gnus-start.el (gnus-level-unsubscribed): Doc fix.  (Bug#6206)
+
 2010-05-14  Katsumi Yamaoka  <yamaoka@jpl.org>
 
 	* gnus-sum.el (gnus-summary-save-article): Don't bother to re-fetch
--- a/lisp/gnus/gnus-start.el	Sat May 22 17:13:04 2010 +0300
+++ b/lisp/gnus/gnus-start.el	Sat May 22 22:32:21 2010 +0300
@@ -181,7 +181,7 @@
 should be less than this variable, are subscribed.  Groups with
 levels from `gnus-level-subscribed' (exclusive) upto this
 variable (inclusive) are unsubscribed.  See also
-`gnus-level-zombie', `gnus-level-killed' and the Info node `Group
+`gnus-level-zombie', `gnus-level-killed' and the Info node `(gnus)Group
 Levels' for details.")
 
 (defconst gnus-level-zombie 8
--- a/lisp/help-mode.el	Sat May 22 17:13:04 2010 +0300
+++ b/lisp/help-mode.el	Sat May 22 22:32:21 2010 +0300
@@ -433,7 +433,9 @@
                     (let ((data (match-string 2)))
                       (save-match-data
                         (unless (string-match "^([^)]+)" data)
-                          (setq data (concat "(emacs)" data))))
+                          (setq data (concat "(emacs)" data)))
+			(setq data ;; possible newlines if para filled
+			      (replace-regexp-in-string "[ \t\n]+" " " data t t)))
                       (help-xref-button 2 'help-info data))))
                 ;; URLs
                 (save-excursion
--- a/lisp/image-mode.el	Sat May 22 17:13:04 2010 +0300
+++ b/lisp/image-mode.el	Sat May 22 22:32:21 2010 +0300
@@ -448,7 +448,7 @@
 
 (defvar archive-superior-buffer)
 (defvar tar-superior-buffer)
-(declare-function image-refresh "image.c" (spec &optional frame))
+(declare-function image-flush "image.c" (spec &optional frame))
 
 (defun image-toggle-display-image ()
   "Show the image of the image file.
@@ -477,7 +477,7 @@
 	 (inhibit-read-only t)
 	 (buffer-undo-list t)
 	 (modified (buffer-modified-p)))
-    (image-refresh image)
+    (image-flush image)
     (let ((buffer-file-truename nil)) ; avoid changing dir mtime by lock_file
       (add-text-properties (point-min) (point-max) props)
       (restore-buffer-modified-p modified))
--- a/lisp/image.el	Sat May 22 17:13:04 2010 +0300
+++ b/lisp/image.el	Sat May 22 22:32:21 2010 +0300
@@ -30,6 +30,7 @@
   "Image support."
   :group 'multimedia)
 
+(defalias 'image-refresh 'image-flush)
 
 (defconst image-type-header-regexps
   `(("\\`/[\t\n\r ]*\\*.*XPM.\\*/" . xpm)
--- a/lisp/indent.el	Sat May 22 17:13:04 2010 +0300
+++ b/lisp/indent.el	Sat May 22 22:32:21 2010 +0300
@@ -431,7 +431,11 @@
 	(or (eolp)
 	    (indent-to column 0))
 	(forward-line 1))
-      (move-marker end nil))))
+      (move-marker end nil)))
+  ;; In most cases, reindenting modifies the buffer, but it may also
+  ;; leave it unmodified, in which case we have to deactivate the mark
+  ;; by hand.
+  (deactivate-mark))
 
 (defun indent-relative-maybe ()
   "Indent a new line like previous nonblank line.
--- a/lisp/isearch.el	Sat May 22 17:13:04 2010 +0300
+++ b/lisp/isearch.el	Sat May 22 22:32:21 2010 +0300
@@ -156,6 +156,9 @@
 (defvar isearch-mode-hook nil
   "Function(s) to call after starting up an incremental search.")
 
+(defvar isearch-update-post-hook nil
+  "Function(s) to call after isearch has found matches in the buffer.")
+
 (defvar isearch-mode-end-hook nil
   "Function(s) to call after terminating an incremental search.
 When these functions are called, `isearch-mode-end-hook-quit'
@@ -460,7 +463,9 @@
     (define-key map "\M-\C-y" 'isearch-yank-char)
     (define-key map    "\C-y" 'isearch-yank-line)
 
-    (define-key map "\C-h" isearch-help-map)
+    (define-key map (char-to-string help-char) isearch-help-map)
+    (define-key map [help] isearch-help-map)
+    (define-key map [f1] isearch-help-map)
 
     (define-key map "\M-n" 'isearch-ring-advance)
     (define-key map "\M-p" 'isearch-ring-retreat)
@@ -868,7 +873,8 @@
     (isearch-lazy-highlight-new-loop))
   ;; We must prevent the point moving to the end of composition when a
   ;; part of the composition has just been searched.
-  (setq disable-point-adjustment t))
+  (setq disable-point-adjustment t)
+  (run-hooks 'isearch-update-post-hook))
 
 (defun isearch-done (&optional nopush edit)
   "Exit Isearch mode.
@@ -1476,14 +1482,10 @@
 	   (eq 'not-yanks search-upper-case))
       (setq string (downcase string)))
   (if isearch-regexp (setq string (regexp-quote string)))
-  (setq isearch-string (concat isearch-string string)
-	isearch-message
-	(concat isearch-message
-		(mapconcat 'isearch-text-char-description
-			   string ""))
-	;; Don't move cursor in reverse search.
-	isearch-yank-flag t)
-  (isearch-search-and-update))
+  ;; Don't move cursor in reverse search.
+  (setq isearch-yank-flag t)
+  (isearch-process-search-string
+   string (mapconcat 'isearch-text-char-description string "")))
 
 (defun isearch-yank-kill ()
   "Pull string from kill ring into search string."
@@ -1538,14 +1540,18 @@
   (interactive "p")
   (isearch-yank-internal (lambda () (forward-char arg) (point))))
 
+(declare-function subword-forward "subword" (&optional arg))
 (defun isearch-yank-word-or-char ()
-  "Pull next character or word from buffer into search string."
+  "Pull next character, subword or word from buffer into search string.
+Subword is used when `subword-mode' is activated. "
   (interactive)
   (isearch-yank-internal
    (lambda ()
      (if (or (= (char-syntax (or (char-after) 0)) ?w)
              (= (char-syntax (or (char-after (1+ (point))) 0)) ?w))
-         (forward-word 1)
+	 (if (and (boundp 'subword-mode) subword-mode)
+	     (subword-forward 1)
+	   (forward-word 1))
        (forward-char 1)) (point))))
 
 (defun isearch-yank-word ()
--- a/lisp/loadup.el	Sat May 22 17:13:04 2010 +0300
+++ b/lisp/loadup.el	Sat May 22 22:32:21 2010 +0300
@@ -54,7 +54,7 @@
 	(equal (nth 3 command-line-args) "unidata-gen.el")
 	(equal (nth 4 command-line-args) "unidata-gen-files")
 	;; In case CANNOT_DUMP.
-	(equal (nth 0 command-line-args) "../src/bootstrap-emacs"))
+	(string-match "src/bootstrap-emacs" (nth 0 command-line-args)))
     (let ((dir (car load-path)))
       ;; We'll probably overflow the pure space.
       (setq purify-flag nil)
--- a/lisp/locate.el	Sat May 22 17:13:04 2010 +0300
+++ b/lisp/locate.el	Sat May 22 22:32:21 2010 +0300
@@ -326,7 +326,7 @@
 	(locate-do-setup search-string)
 	))
     (and (not (string-equal (buffer-name) locate-buffer-name))
-	(switch-to-buffer-other-window locate-buffer-name))
+	(pop-to-buffer locate-buffer-name))
 
     (run-hooks 'dired-mode-hook)
     (dired-next-line 3)			;move to first matching file.
--- a/lisp/mh-e/ChangeLog	Sat May 22 17:13:04 2010 +0300
+++ b/lisp/mh-e/ChangeLog	Sat May 22 22:32:21 2010 +0300
@@ -1,3 +1,10 @@
+2010-05-14  Peter S Galbraith  <psg@debian.org>
+
+	* mh-mime.el (mh-decode-message-subject): New function to decode
+	RFC2047 encoded Subject lines. Used for reply drafts.
+	* mh-comp.el (mh-compose-and-send-mail): Call
+	`mh-decode-message-subject' on (reply or forward) message drafts.
+
 2010-05-07  Chong Yidong  <cyd@stupidchicken.com>
 
 	* Version 23.2 released.
--- a/lisp/mh-e/mh-comp.el	Sat May 22 17:13:04 2010 +0300
+++ b/lisp/mh-e/mh-comp.el	Sat May 22 22:32:21 2010 +0300
@@ -905,6 +905,9 @@
   (mh-identity-make-menu)
   (mh-identity-add-menu)
 
+  ;; Cleanup possibly RFC2047 encoded subject header
+  (mh-decode-message-subject)
+
   ;; Insert extra fields.
   (mh-insert-x-mailer)
   (mh-insert-x-face)
--- a/lisp/mh-e/mh-mime.el	Sat May 22 17:13:04 2010 +0300
+++ b/lisp/mh-e/mh-mime.el	Sat May 22 22:32:21 2010 +0300
@@ -508,6 +508,15 @@
       (rfc2047-decode-region (point-min) (mh-mail-header-end)))))
 
 ;;;###mh-autoload
+(defun mh-decode-message-subject ()
+  "Decode RFC2047 encoded message header fields."
+  (when mh-decode-mime-flag
+    (save-excursion
+      (let ((buffer-read-only nil))
+        (rfc2047-decode-region (progn (mh-goto-header-field "subject:") (point))
+                               (progn (mh-header-field-end) (point)))))))
+
+;;;###mh-autoload
 (defun mh-mime-display (&optional pre-dissected-handles)
   "Display (and possibly decode) MIME handles.
 Optional argument, PRE-DISSECTED-HANDLES is a list of MIME
--- a/lisp/net/secrets.el	Sat May 22 17:13:04 2010 +0300
+++ b/lisp/net/secrets.el	Sat May 22 22:32:21 2010 +0300
@@ -129,6 +129,9 @@
 ;;   (secrets-search-items "session" :user "joe")
 ;;    => ("my item" "another item")
 
+;; Interactively, collections, items and their attributes could be
+;; inspected by the command `secrets-show-secrets'.
+
 ;;; Code:
 
 ;; It has been tested with GNOME Keyring 2.29.92.  An implementation
@@ -148,6 +151,13 @@
 
 (require 'dbus)
 
+(autoload 'tree-widget-set-theme "tree-widget")
+(autoload 'widget-create-child-and-convert "wid-edit")
+(autoload 'widget-default-value-set "wid-edit")
+(autoload 'widget-field-end "wid-edit")
+(autoload 'widget-member "wid-edit")
+(defvar tree-widget-after-toggle-functions)
+
 (defvar secrets-enabled nil
   "Whether there is a daemon offering the Secret Service API.")
 
@@ -553,7 +563,7 @@
 	(setq props (add-to-list
 		     'props
 		     (list :dict-entry
-			   (symbol-name (car attributes))
+			   (substring (symbol-name (car attributes)) 1)
 			   (cadr attributes))
 		     'append)
 	      attributes (cddr attributes)))
@@ -591,7 +601,7 @@
 	  (setq props (add-to-list
 		       'props
 		       (list :dict-entry
-			     (symbol-name (car attributes))
+			     (substring (symbol-name (car attributes)) 1)
 			     (cadr attributes))
 		       'append)
 		attributes (cddr attributes)))
@@ -646,7 +656,8 @@
   (let ((item-path (secrets-item-path collection item)))
     (unless (secrets-empty-path item-path)
       (mapcar
-       (lambda (attribute) (cons (intern (car attribute)) (cadr attribute)))
+       (lambda (attribute)
+	 (cons (intern (concat ":" (car attribute))) (cadr attribute)))
        (dbus-get-property
 	:session secrets-service item-path
 	secrets-interface-item "Attributes")))))
@@ -665,6 +676,150 @@
 	:session secrets-service item-path
 	secrets-interface-item "Delete")))))
 
+;;; Visualization.
+
+(define-derived-mode secrets-mode nil "Secrets"
+  "Major mode for presenting password entries retrieved by Security Service.
+In this mode, widgets represent the search results.
+
+\\{secrets-mode-map}"
+  ;; Keymap.
+  (setq secrets-mode-map (copy-keymap special-mode-map))
+  (set-keymap-parent secrets-mode-map widget-keymap)
+  (define-key secrets-mode-map "z" 'kill-this-buffer)
+
+  ;; When we toggle, we must set temporary widgets.
+  (set (make-local-variable 'tree-widget-after-toggle-functions)
+       '(secrets-tree-widget-after-toggle-function))
+
+  (when (not (called-interactively-p 'interactive))
+    ;; Initialize buffer.
+    (setq buffer-read-only t)
+    (let ((inhibit-read-only t))
+      (erase-buffer))))
+
+;; It doesn't make sense to call it interactively.
+(put 'secrets-mode 'disabled t)
+
+;; The very first buffer created with `secrets-mode' does not have the
+;; keymap etc.  So we create a dummy buffer.  Stupid.
+(with-temp-buffer (secrets-mode))
+
+;; We autoload `secrets-show-secrets' only on systems with D-Bus support.
+;;;###autoload(when (featurep 'dbusbind)
+;;;###autoload  (autoload 'secrets-show-secrets "secrets" nil t))
+
+(defun secrets-show-secrets ()
+  "Display a list of collections from the Secret Service API.
+The collections are in tree view, that means they can be expanded
+to the corresponding secret items, which could also be expanded
+to their attributes."
+  (interactive)
+
+  ;; Check, whether the Secret Service API is enabled.
+  (if (null secrets-enabled)
+      (message "Secret Service not available")
+
+    ;; Create the search buffer.
+    (with-current-buffer (get-buffer-create "*Secrets*")
+      (switch-to-buffer-other-window (current-buffer))
+      ;; Inialize buffer with `secrets-mode'.
+      (secrets-mode)
+      (secrets-show-collections))))
+
+(defun secrets-show-collections ()
+  "Show all available collections."
+  (let ((inhibit-read-only t)
+	(alias (secrets-get-alias "default")))
+    (erase-buffer)
+    (tree-widget-set-theme "folder")
+    (dolist (coll (secrets-list-collections))
+      (widget-create
+     `(tree-widget
+       :tag ,coll
+       :collection ,coll
+       :open nil
+       :sample-face bold
+       :expander secrets-expand-collection)))))
+
+(defun secrets-expand-collection (widget)
+  "Expand items of collection shown as WIDGET."
+  (let ((coll (widget-get widget :collection)))
+    (mapcar
+     (lambda (item)
+       `(tree-widget
+	 :tag ,item
+	 :collection ,coll
+	 :item ,item
+	 :open nil
+	 :sample-face bold
+	 :expander secrets-expand-item))
+     (secrets-list-items coll))))
+
+(defun secrets-expand-item (widget)
+  "Expand password and attributes of item shown as WIDGET."
+  (let* ((coll (widget-get widget :collection))
+	 (item (widget-get widget :item))
+	 (attributes (secrets-get-attributes coll item))
+	 ;; padding is needed to format attribute names.
+	 (padding
+	  (apply
+	   'max
+	   (cons
+	    (1+ (length "password"))
+	    (mapcar
+	     ;; Atribute names have a leading ":", which will be suppressed.
+	     (lambda (attribute) (length (symbol-name (car attribute))))
+	     attributes)))))
+    (cons
+     ;; The password widget.
+     `(editable-field :tag "password"
+		      :secret ?*
+		      :value ,(secrets-get-secret coll item)
+		      :sample-face widget-button-pressed
+		      ;; We specify :size in order to limit the field.
+		      :size 0
+		      :format ,(concat
+				"%{%t%}:"
+				(make-string (- padding (length "password")) ? )
+				"%v\n"))
+     (mapcar
+      (lambda (attribute)
+	(let ((name (substring (symbol-name (car attribute)) 1))
+	      (value (cdr attribute)))
+	  ;; The attribute widget.
+	  `(editable-field :tag ,name
+			   :value ,value
+			   :sample-face widget-documentation
+			   ;; We specify :size in order to limit the field.
+			   :size 0
+			   :format ,(concat
+				     "%{%t%}:"
+				     (make-string (- padding (length name)) ? )
+				     "%v\n"))))
+      attributes))))
+
+(defun secrets-tree-widget-after-toggle-function (widget &rest ignore)
+  "Add a temporary widget to show the password."
+  (dolist (child (widget-get widget :children))
+    (when (widget-member child :secret)
+      (goto-char (widget-field-end child))
+      (widget-insert " ")
+      (widget-create-child-and-convert
+       child 'push-button
+       :notify 'secrets-tree-widget-show-password
+       "Show password")))
+  (widget-setup))
+
+(defun secrets-tree-widget-show-password (widget &rest ignore)
+  "Show password, and remove temporary widget."
+  (let ((parent (widget-get widget :parent)))
+    (widget-put parent :secret nil)
+    (widget-default-value-set parent (widget-get parent :value))
+    (widget-setup)))
+
+;;; Initialization.
+
 (when (dbus-ping :session secrets-service 100)
 
   ;; We must reset all variables, when there is a new instance of the
--- a/lisp/net/tramp-fish.el	Sat May 22 17:13:04 2010 +0300
+++ b/lisp/net/tramp-fish.el	Sat May 22 22:32:21 2010 +0300
@@ -149,8 +149,11 @@
 ;; parameter of `write-region'.  Transfer of binary data fails due to
 ;; Emacs' process input/output handling.
 
+;;; Code:
 
-;;; Code:
+(eval-when-compile
+  ;; Pacify byte-compiler.
+  (require 'cl))
 
 (require 'tramp)
 (require 'tramp-cache)
@@ -487,13 +490,13 @@
        v 'file-error
        "Cannot make local copy of non-existing file `%s'" filename))
     (let ((tmpfile (tramp-compat-make-temp-file filename)))
-      (tramp-message v 4 "Fetching %s to tmp file %s..." filename tmpfile)
-      (when (tramp-fish-retrieve-data v)
-	;; Save file
-	(with-current-buffer (tramp-get-buffer v)
-	  (write-region (point-min) (point-max) tmpfile))
-	(tramp-message v 4 "Fetching %s to tmp file %s...done" filename tmpfile)
-	tmpfile))))
+      (with-progress-reporter
+	  v 3 (format "Fetching %s to tmp file %s" filename tmpfile)
+	(when (tramp-fish-retrieve-data v)
+	  ;; Save file
+	  (with-current-buffer (tramp-get-buffer v)
+	    (write-region (point-min) (point-max) tmpfile))
+	  tmpfile)))))
 
 ;; This function should return "foo/" for directories and "bar" for
 ;; files.
@@ -591,17 +594,16 @@
 
       (let ((point (point))
 	    size)
-	(tramp-message v 4 "Fetching file %s..." filename)
-	(when (tramp-fish-retrieve-data v)
-	  ;; Insert file
-	  (insert
-	   (with-current-buffer (tramp-get-buffer v)
-	     (let ((beg (or beg (point-min)))
-		   (end (min (or end (point-max)) (point-max))))
-	       (setq size (- end beg))
-	       (buffer-substring beg end))))
-	  (goto-char point))
-	(tramp-message v 4 "Fetching file %s...done" filename)
+	(with-progress-reporter v 3 (format "Fetching file %s" filename)
+	  (when (tramp-fish-retrieve-data v)
+	    ;; Insert file
+	    (insert
+	     (with-current-buffer (tramp-get-buffer v)
+	       (let ((beg (or beg (point-min)))
+		     (end (min (or end (point-max)) (point-max))))
+		 (setq size (- end beg))
+		 (buffer-substring beg end))))
+	    (goto-char point)))
 
 	(list (expand-file-name filename) size)))))
 
@@ -1115,34 +1117,36 @@
 	(delete-process p))
       (setenv "TERM" tramp-terminal-type)
       (setenv "PS1" tramp-initial-end-of-output)
-      (tramp-message
-       vec 3 "Opening connection for %s@%s using %s..."
-       tramp-current-user tramp-current-host tramp-current-method)
+      (with-progress-reporter
+	  vec 3
+	  (format "Opening connection for %s@%s using %s"
+		  tramp-current-user tramp-current-host tramp-current-method)
 
-      (let* ((process-connection-type tramp-process-connection-type)
-	     (inhibit-eol-conversion nil)
-	     (coding-system-for-read 'binary)
-	     (coding-system-for-write 'binary)
-	     ;; This must be done in order to avoid our file name handler.
-	     (p (let ((default-directory
-			(tramp-compat-temporary-file-directory)))
-		  (start-process
-		   (or (tramp-get-connection-property vec "process-name" nil)
-		       (tramp-buffer-name vec))
-		   (tramp-get-connection-buffer vec)
-		   "ssh" "-l"
-		   (tramp-file-name-user vec)
-		   (tramp-file-name-host vec)))))
-	(tramp-message vec 6 "%s" (mapconcat 'identity (process-command p) " "))
+	(let* ((process-connection-type tramp-process-connection-type)
+	       (inhibit-eol-conversion nil)
+	       (coding-system-for-read 'binary)
+	       (coding-system-for-write 'binary)
+	       ;; This must be done in order to avoid our file name handler.
+	       (p (let ((default-directory
+			  (tramp-compat-temporary-file-directory)))
+		    (start-process
+		     (or (tramp-get-connection-property vec "process-name" nil)
+			 (tramp-buffer-name vec))
+		     (tramp-get-connection-buffer vec)
+		     "ssh" "-l"
+		     (tramp-file-name-user vec)
+		     (tramp-file-name-host vec)))))
+	  (tramp-message
+	   vec 6 "%s" (mapconcat 'identity (process-command p) " "))
 
-	;; Check whether process is alive.
-	(tramp-set-process-query-on-exit-flag p nil)
+	  ;; Check whether process is alive.
+	  (tramp-set-process-query-on-exit-flag p nil)
 
-	(tramp-process-actions p vec tramp-actions-before-shell 60)
-	(tramp-fish-send-command vec tramp-fish-start-fish-server-command)
-	(tramp-message
-	 vec 3
-	 "Found remote shell prompt on `%s'" (tramp-file-name-host vec))))))
+	  (tramp-process-actions p vec tramp-actions-before-shell 60)
+	  (tramp-fish-send-command vec tramp-fish-start-fish-server-command)
+	  (tramp-message
+	   vec 3
+	   "Found remote shell prompt on `%s'" (tramp-file-name-host vec)))))))
 
 (defun tramp-fish-send-command (vec command)
   "Send the COMMAND to connection VEC."
--- a/lisp/net/tramp-gvfs.el	Sat May 22 17:13:04 2010 +0300
+++ b/lisp/net/tramp-gvfs.el	Sat May 22 22:32:21 2010 +0300
@@ -1067,65 +1067,58 @@
 	    (tramp-gvfs-object-path
 	     (tramp-make-tramp-file-name method user host ""))))
 
-      (if (zerop (length (tramp-file-name-user vec)))
-	  (tramp-message
-	   vec 3 "Opening connection for %s using %s..." host method)
-	(tramp-message
-	 vec 3 "Opening connection for %s@%s using %s..." user host method))
+      (with-progress-reporter
+	  vec 3
+	  (if (zerop (length user))
+	      (format "Opening connection for %s using %s" host method)
+	    (format "Opening connection for %s@%s using %s" user host method))
 
-      ;; Enable auth-sorce and password-cache.
-      (tramp-set-connection-property vec "first-password-request" t)
+	;; Enable auth-sorce and password-cache.
+	(tramp-set-connection-property vec "first-password-request" t)
 
-      ;; There will be a callback of "askPassword", when a password is
-      ;; needed.
-      (dbus-register-method
-       :session dbus-service-emacs object-path
-       tramp-gvfs-interface-mountoperation "askPassword"
-       'tramp-gvfs-handler-askpassword)
+	;; There will be a callback of "askPassword", when a password is
+	;; needed.
+	(dbus-register-method
+	 :session dbus-service-emacs object-path
+	 tramp-gvfs-interface-mountoperation "askPassword"
+	 'tramp-gvfs-handler-askpassword)
 
-      ;; There could be a callback of "askQuestion", when adding fingerprint.
-      (dbus-register-method
-       :session dbus-service-emacs object-path
-       tramp-gvfs-interface-mountoperation "askQuestion"
-       'tramp-gvfs-handler-askquestion)
+	;; There could be a callback of "askQuestion", when adding fingerprint.
+	(dbus-register-method
+	 :session dbus-service-emacs object-path
+	 tramp-gvfs-interface-mountoperation "askQuestion"
+	 'tramp-gvfs-handler-askquestion)
 
-      ;; The call must be asynchronously, because of the "askPassword"
-      ;; or "askQuestion"callbacks.
-      (with-tramp-dbus-call-method vec nil
-	:session tramp-gvfs-service-daemon tramp-gvfs-path-mounttracker
-	tramp-gvfs-interface-mounttracker "mountLocation"
-	`(:struct
-	  ,(dbus-string-to-byte-array "/")
-	  ,(tramp-gvfs-mount-spec vec))
-	(dbus-get-unique-name :session)
-	:object-path object-path)
+	;; The call must be asynchronously, because of the "askPassword"
+	;; or "askQuestion"callbacks.
+	(with-tramp-dbus-call-method vec nil
+	  :session tramp-gvfs-service-daemon tramp-gvfs-path-mounttracker
+	  tramp-gvfs-interface-mounttracker "mountLocation"
+	  `(:struct
+	    ,(dbus-string-to-byte-array "/")
+	    ,(tramp-gvfs-mount-spec vec))
+	  (dbus-get-unique-name :session)
+	  :object-path object-path)
 
-      ;; We must wait, until the mount is applied.  This will be
-      ;; indicated by the "mounted" signal, i.e. the "fuse-mountpoint"
-      ;; file property.
-      (with-timeout
-	  (60
-	   (if (zerop (length (tramp-file-name-user vec)))
+	;; We must wait, until the mount is applied.  This will be
+	;; indicated by the "mounted" signal, i.e. the "fuse-mountpoint"
+	;; file property.
+	(with-timeout
+	    (60
+	     (if (zerop (length (tramp-file-name-user vec)))
+		 (tramp-error
+		  vec 'file-error
+		  "Timeout reached mounting %s using %s" host method)
 	       (tramp-error
 		vec 'file-error
-		"Timeout reached mounting %s using %s" host method)
-	     (tramp-error
-	      vec 'file-error
-	      "Timeout reached mounting %s@%s using %s" user host method)))
-	(while (not (tramp-get-file-property vec "/" "fuse-mountpoint" nil))
-	  (read-event nil nil 0.1)))
+		"Timeout reached mounting %s@%s using %s" user host method)))
+	  (while (not (tramp-get-file-property vec "/" "fuse-mountpoint" nil))
+	    (read-event nil nil 0.1)))
 
-      ;; We set the connection property "started" in order to put the
-      ;; remote location into the cache, which is helpful for further
-      ;; completion.
-      (tramp-set-connection-property vec "started" t)
-
-      (if (zerop (length (tramp-file-name-user vec)))
-	  (tramp-message
-	   vec 3 "Opening connection for %s using %s...done" host method)
-	(tramp-message
-	 vec 3
-	 "Opening connection for %s@%s using %s...done" user host method)))))
+	;; We set the connection property "started" in order to put the
+	;; remote location into the cache, which is helpful for further
+	;; completion.
+	(tramp-set-connection-property vec "started" t)))))
 
 
 ;; D-Bus BLUEZ functions.
--- a/lisp/net/tramp-imap.el	Sat May 22 17:13:04 2010 +0300
+++ b/lisp/net/tramp-imap.el	Sat May 22 22:32:21 2010 +0300
@@ -241,32 +241,31 @@
 	(t2 (and (tramp-tramp-file-p newname)
 		 (tramp-imap-file-name-p newname))))
 
-    (when (and (not ok-if-already-exists) (file-exists-p newname))
-      (with-parsed-tramp-file-name (if t1 filename newname) nil
+    (with-parsed-tramp-file-name (if t1 filename newname) nil
+      (when (and (not ok-if-already-exists) (file-exists-p newname))
 	(tramp-error
-	 v 'file-already-exists "File %s already exists" newname)))
+	 v 'file-already-exists "File %s already exists" newname))
 
-    (with-parsed-tramp-file-name (if t1 filename newname) nil
-      (tramp-message v 0 "Transferring %s to %s..." filename newname))
+      (with-progress-reporter
+	  v 0 (format "%s %s to %s"
+		      (if (eq op 'copy) "Copying" "Renaming")
+		      filename newname)
 
-    ;; We just make a local copy of FILENAME, and write it then to
-    ;; NEWNAME.  This must be optimized, when both files are located
-    ;; on the same IMAP server.
-    (with-temp-buffer
-      (if (and t1 t2)
-	  ;; We don't encrypt.
-	  (with-parsed-tramp-file-name newname nil
-	    (insert (tramp-imap-get-file filename nil))
-	    (tramp-imap-put-file
-	     v (current-buffer)
-	     (tramp-imap-file-name-name v)
-	     nil nil (nth 7 (file-attributes filename))))
-	;; One of them is not located on a IMAP mailbox.
-	(insert-file-contents filename)
-	(write-region (point-min) (point-max) newname)))
-
-    (with-parsed-tramp-file-name (if t1 filename newname) nil
-      (tramp-message v 0 "Transferring %s to %s...done" filename newname))
+	;; We just make a local copy of FILENAME, and write it then to
+	;; NEWNAME.  This must be optimized, when both files are
+	;; located on the same IMAP server.
+	(with-temp-buffer
+	  (if (and t1 t2)
+	      ;; We don't encrypt.
+	      (with-parsed-tramp-file-name newname v1
+		(insert (tramp-imap-get-file filename nil))
+		(tramp-imap-put-file
+		 v1 (current-buffer)
+		 (tramp-imap-file-name-name v1)
+		 nil nil (nth 7 (file-attributes filename))))
+	    ;; One of them is not located on a IMAP mailbox.
+	    (insert-file-contents filename)
+	    (write-region (point-min) (point-max) newname)))))
 
     (when (eq op 'rename)
       (tramp-compat-delete-file filename 'force))))
@@ -505,17 +504,16 @@
 	 v 'file-error "File `%s' not found on remote host" filename)
       (let ((point (point))
 	    size data)
-	(tramp-message v 4 "Fetching file %s..." filename)
-	(insert (tramp-imap-get-file filename t))
-	(setq size (- (point) point))
+	(with-progress-reporter v 3 (format "Fetching file %s" filename)
+	  (insert (tramp-imap-get-file filename t))
+	  (setq size (- (point) point))
 ;;; TODO: handle ranges.
 ;;; 	       (let ((beg (or beg (point-min)))
 ;;; 		   (end (min (or end (point-max)) (point-max))))
 ;;; 		 (setq size (- end beg))
 ;;; 	       (buffer-substring beg end))
-	(goto-char point)
-	(tramp-message v 4 "Fetching file %s...done" filename)
-	(list (expand-file-name filename) size)))))
+	  (goto-char point)
+	  (list (expand-file-name filename) size))))))
 
 (defun tramp-imap-handle-file-exists-p (filename)
   "Like `file-exists-p' for Tramp files."
@@ -588,12 +586,12 @@
        v 'file-error
        "Cannot make local copy of non-existing file `%s'" filename))
     (let ((tmpfile (tramp-compat-make-temp-file filename)))
-      (tramp-message v 4 "Fetching %s to tmp file %s..." filename tmpfile)
-      (with-temp-buffer
-	(insert-file-contents filename)
- 	(write-region (point-min) (point-max) tmpfile)
- 	(tramp-message v 4 "Fetching %s to tmp file %s...done" filename tmpfile)
- 	tmpfile))))
+      (with-progress-reporter
+	  v 3 (format "Fetching %s to tmp file %s" filename tmpfile)
+	(with-temp-buffer
+	  (insert-file-contents filename)
+	  (write-region (point-min) (point-max) tmpfile)
+	  tmpfile)))))
 
 (defun tramp-imap-put-file
   (vec filename-or-buffer &optional subject inode encode size)
--- a/lisp/net/tramp.el	Sat May 22 17:13:04 2010 +0300
+++ b/lisp/net/tramp.el	Sat May 22 22:32:21 2010 +0300
@@ -334,6 +334,7 @@
     ("scp"   (tramp-login-program        "ssh")
              (tramp-login-args           (("%h") ("-l" "%u") ("-p" "%p")
 					  ("-e" "none")))
+	     (tramp-async-args           (("-q")))
 	     (tramp-remote-sh            "/bin/sh")
 	     (tramp-copy-program         "scp")
 	     (tramp-copy-args            (("-P" "%p") ("-p" "%k")
@@ -349,6 +350,7 @@
     ("scp1"  (tramp-login-program        "ssh")
              (tramp-login-args           (("%h") ("-l" "%u") ("-p" "%p")
 					  ("-1" "-e" "none")))
+	     (tramp-async-args           (("-q")))
 	     (tramp-remote-sh            "/bin/sh")
 	     (tramp-copy-program         "scp")
 	     (tramp-copy-args            (("-1") ("-P" "%p") ("-p" "%k")
@@ -364,6 +366,7 @@
     ("scp2"  (tramp-login-program        "ssh")
              (tramp-login-args           (("%h") ("-l" "%u") ("-p" "%p")
 					  ("-2" "-e" "none")))
+	     (tramp-async-args           (("-q")))
 	     (tramp-remote-sh            "/bin/sh")
 	     (tramp-copy-program         "scp")
 	     (tramp-copy-args            (("-2") ("-P" "%p") ("-p" "%k")
@@ -399,6 +402,7 @@
     ("sftp"  (tramp-login-program        "ssh")
              (tramp-login-args           (("%h") ("-l" "%u") ("-p" "%p")
 					  ("-e" "none")))
+	     (tramp-async-args           (("-q")))
 	     (tramp-remote-sh            "/bin/sh")
 	     (tramp-copy-program         "sftp")
 	     (tramp-copy-args            nil)
@@ -407,6 +411,7 @@
     ("rsync" (tramp-login-program        "ssh")
              (tramp-login-args           (("%h") ("-l" "%u") ("-p" "%p")
 					  ("-e" "none")))
+	     (tramp-async-args           (("-q")))
 	     (tramp-remote-sh            "/bin/sh")
 	     (tramp-copy-program         "rsync")
 	     (tramp-copy-args            (("-e" "ssh") ("-t" "%k") ("-r")))
@@ -420,6 +425,7 @@
 					  ("-o" "ControlPath=%t.%%r@%%h:%%p")
 					  ("-o" "ControlMaster=yes")
 					  ("-e" "none")))
+	     (tramp-async-args           (("-q")))
 	     (tramp-remote-sh            "/bin/sh")
 	     (tramp-copy-program         "rsync")
 	     (tramp-copy-args            (("-t" "%k") ("-r")))
@@ -449,6 +455,7 @@
     ("ssh"   (tramp-login-program        "ssh")
              (tramp-login-args           (("%h") ("-l" "%u") ("-p" "%p")
 					  ("-e" "none")))
+	     (tramp-async-args           (("-q")))
 	     (tramp-remote-sh            "/bin/sh")
 	     (tramp-copy-program         nil)
 	     (tramp-copy-args            nil)
@@ -462,6 +469,7 @@
     ("ssh1"  (tramp-login-program        "ssh")
              (tramp-login-args           (("%h") ("-l" "%u") ("-p" "%p")
 					  ("-1" "-e" "none")))
+	     (tramp-async-args           (("-q")))
 	     (tramp-remote-sh            "/bin/sh")
 	     (tramp-copy-program         nil)
 	     (tramp-copy-args            nil)
@@ -475,6 +483,7 @@
     ("ssh2"  (tramp-login-program        "ssh")
              (tramp-login-args           (("%h") ("-l" "%u") ("-p" "%p")
 					  ("-2" "-e" "none")))
+	     (tramp-async-args           (("-q")))
 	     (tramp-remote-sh            "/bin/sh")
 	     (tramp-copy-program         nil)
 	     (tramp-copy-args            nil)
@@ -489,6 +498,7 @@
              (tramp-login-program        "ssh1")
 	     (tramp-login-args           (("%h") ("-l" "%u") ("-p" "%p")
 					  ("-e" "none")))
+	     (tramp-async-args           (("-q")))
 	     (tramp-remote-sh            "/bin/sh")
 	     (tramp-copy-program         nil)
 	     (tramp-copy-args            nil)
@@ -539,6 +549,7 @@
 					  ("-o" "ControlPath=%t.%%r@%%h:%%p")
 					  ("-o" "ControlMaster=yes")
 					  ("-e" "none")))
+	     (tramp-async-args           (("-q")))
 	     (tramp-remote-sh            "/bin/sh")
 	     (tramp-copy-program         "scp")
 	     (tramp-copy-args            (("-P" "%p") ("-p" "%k") ("-q")
@@ -554,6 +565,7 @@
     ("scpx"  (tramp-login-program        "ssh")
              (tramp-login-args           (("%h") ("-l" "%u") ("-p" "%p")
 					  ("-e" "none" "-t" "-t" "/bin/sh")))
+	     (tramp-async-args           (("-q")))
 	     (tramp-remote-sh            "/bin/sh")
 	     (tramp-copy-program         "scp")
 	     (tramp-copy-args            (("-p" "%k")))
@@ -567,6 +579,7 @@
     ("sshx"  (tramp-login-program        "ssh")
              (tramp-login-args           (("%h") ("-l" "%u") ("-p" "%p")
 					  ("-e" "none" "-t" "-t" "/bin/sh")))
+	     (tramp-async-args           (("-q")))
 	     (tramp-remote-sh            "/bin/sh")
 	     (tramp-copy-program         nil)
 	     (tramp-copy-args            nil)
@@ -672,6 +685,11 @@
     \"%t\" is replaced by the temporary file name produced with
     `tramp-make-tramp-temp-file'.  \"%k\" indicates the keep-date
     parameter of a program, if exists.
+  * `tramp-async-args'
+    When an asynchronous process is started, we know already that
+    the connection works.  Therefore, we can pass additional
+    parameters to suppress diagnostic messages, in order not to
+    tamper the process output.
   * `tramp-copy-program'
     This specifies the name of the program to use for remotely copying
     the file; this might be the absolute filename of rcp or the name of
@@ -3641,85 +3659,86 @@
 		      (apply 'file-selinux-context (list filename))))
 	pr tm)
 
-    (when (and (not ok-if-already-exists) (file-exists-p newname))
-      (with-parsed-tramp-file-name (if t1 filename newname) nil
+    (with-parsed-tramp-file-name (if t1 filename newname) nil
+      (when (and (not ok-if-already-exists) (file-exists-p newname))
 	(tramp-error
-	 v 'file-already-exists "File %s already exists" newname)))
-
-    (with-parsed-tramp-file-name (if t1 filename newname) nil
+	 v 'file-already-exists "File %s already exists" newname))
+
       (with-progress-reporter
-	  v 0 (format "Transferring %s to %s" filename newname)
-
-       (cond
-	;; Both are Tramp files.
-	((and t1 t2)
-	 (with-parsed-tramp-file-name filename v1
-	   (with-parsed-tramp-file-name newname v2
-	     (cond
-	      ;; Shortcut: if method, host, user are the same for both
-	      ;; files, we invoke `cp' or `mv' on the remote host
-	      ;; directly.
-	      ((tramp-equal-remote filename newname)
-	       (tramp-do-copy-or-rename-file-directly
-		op filename newname
-		ok-if-already-exists keep-date preserve-uid-gid))
-
-	      ;; Try out-of-band operation.
-	      ((tramp-method-out-of-band-p
-		v1 (nth 7 (file-attributes filename)))
-	       (tramp-do-copy-or-rename-file-out-of-band
-		op filename newname keep-date))
-
-	      ;; No shortcut was possible.  So we copy the
-	      ;; file first.  If the operation was `rename', we go
-	      ;; back and delete the original file (if the copy was
-	      ;; successful).  The approach is simple-minded: we
-	      ;; create a new buffer, insert the contents of the
-	      ;; source file into it, then write out the buffer to
-	      ;; the target file.  The advantage is that it doesn't
-	      ;; matter which filename handlers are used for the
-	      ;; source and target file.
-	      (t
-	       (tramp-do-copy-or-rename-file-via-buffer
-		op filename newname keep-date))))))
-
-	;; One file is a Tramp file, the other one is local.
-	((or t1 t2)
-	 (cond
-	  ;; Fast track on local machine.
-	  ((tramp-local-host-p v)
-	   (tramp-do-copy-or-rename-file-directly
-	    op filename newname
-	    ok-if-already-exists keep-date preserve-uid-gid))
-
-	  ;; If the Tramp file has an out-of-band method, the corresponding
-	  ;; copy-program can be invoked.
-	  ((tramp-method-out-of-band-p v (nth 7 (file-attributes filename)))
-	   (tramp-do-copy-or-rename-file-out-of-band
-	    op filename newname keep-date))
-
-	  ;; Use the inline method via a Tramp buffer.
-	  (t (tramp-do-copy-or-rename-file-via-buffer
-	      op filename newname keep-date))))
-
-	(t
-	 ;; One of them must be a Tramp file.
-	 (error "Tramp implementation says this cannot happen")))
-
-       ;; Handle `preserve-selinux-context'.
-       (when context (apply 'set-file-selinux-context (list newname context)))
-
-       ;; In case of `rename', we must flush the cache of the source file.
-       (when (and t1 (eq op 'rename))
-	 (with-parsed-tramp-file-name filename v1
-	   (tramp-flush-file-property v1 (file-name-directory localname))
-	   (tramp-flush-file-property v1 localname)))
-
-       ;; When newname did exist, we have wrong cached values.
-       (when t2
-	 (with-parsed-tramp-file-name newname v2
-	   (tramp-flush-file-property v2 (file-name-directory localname))
-	   (tramp-flush-file-property v2 localname)))))))
+	  v 0 (format "%s %s to %s"
+		      (if (eq op 'copy) "Copying" "Renaming")
+		      filename newname)
+
+	(cond
+	 ;; Both are Tramp files.
+	 ((and t1 t2)
+	  (with-parsed-tramp-file-name filename v1
+	    (with-parsed-tramp-file-name newname v2
+	      (cond
+	       ;; Shortcut: if method, host, user are the same for
+	       ;; both files, we invoke `cp' or `mv' on the remote
+	       ;; host directly.
+	       ((tramp-equal-remote filename newname)
+		(tramp-do-copy-or-rename-file-directly
+		 op filename newname
+		 ok-if-already-exists keep-date preserve-uid-gid))
+
+	       ;; Try out-of-band operation.
+	       ((tramp-method-out-of-band-p
+		 v1 (nth 7 (file-attributes filename)))
+		(tramp-do-copy-or-rename-file-out-of-band
+		 op filename newname keep-date))
+
+	       ;; No shortcut was possible.  So we copy the file
+	       ;; first.  If the operation was `rename', we go back
+	       ;; and delete the original file (if the copy was
+	       ;; successful).  The approach is simple-minded: we
+	       ;; create a new buffer, insert the contents of the
+	       ;; source file into it, then write out the buffer to
+	       ;; the target file.  The advantage is that it doesn't
+	       ;; matter which filename handlers are used for the
+	       ;; source and target file.
+	       (t
+		(tramp-do-copy-or-rename-file-via-buffer
+		 op filename newname keep-date))))))
+
+	 ;; One file is a Tramp file, the other one is local.
+	 ((or t1 t2)
+	  (cond
+	   ;; Fast track on local machine.
+	   ((tramp-local-host-p v)
+	    (tramp-do-copy-or-rename-file-directly
+	     op filename newname
+	     ok-if-already-exists keep-date preserve-uid-gid))
+
+	   ;; If the Tramp file has an out-of-band method, the
+	   ;; corresponding copy-program can be invoked.
+	   ((tramp-method-out-of-band-p v (nth 7 (file-attributes filename)))
+	    (tramp-do-copy-or-rename-file-out-of-band
+	     op filename newname keep-date))
+
+	   ;; Use the inline method via a Tramp buffer.
+	   (t (tramp-do-copy-or-rename-file-via-buffer
+	       op filename newname keep-date))))
+
+	 (t
+	  ;; One of them must be a Tramp file.
+	  (error "Tramp implementation says this cannot happen")))
+
+	;; Handle `preserve-selinux-context'.
+	(when context (apply 'set-file-selinux-context (list newname context)))
+
+	;; In case of `rename', we must flush the cache of the source file.
+	(when (and t1 (eq op 'rename))
+	  (with-parsed-tramp-file-name filename v1
+	    (tramp-flush-file-property v1 (file-name-directory localname))
+	    (tramp-flush-file-property v1 localname)))
+
+	;; When newname did exist, we have wrong cached values.
+	(when t2
+	  (with-parsed-tramp-file-name newname v2
+	    (tramp-flush-file-property v2 (file-name-directory localname))
+	    (tramp-flush-file-property v2 localname)))))))
 
 (defun tramp-do-copy-or-rename-file-via-buffer (op filename newname keep-date)
   "Use an Emacs buffer to copy or rename a file.
@@ -4752,7 +4771,7 @@
 	   (rem-enc
 	    (save-excursion
 	      (with-progress-reporter
-	       v 5 (format "Encoding remote file %s" filename)
+	       v 3 (format "Encoding remote file %s" filename)
 	       (tramp-barf-unless-okay
 		v (format rem-enc (tramp-shell-quote-argument localname))
 		"Encoding remote file failed"))
@@ -5323,46 +5342,50 @@
 ;; any other remote command.
 (defun tramp-handle-vc-registered (file)
   "Like `vc-registered' for Tramp files."
-  (with-parsed-tramp-file-name file nil
-
-    ;; There could be new files, created by the vc backend.  We cannot
-    ;; reuse the old cache entries, therefore.
-    (let (tramp-vc-registered-file-names
-	  (tramp-cache-inhibit-cache (current-time))
-	  (file-name-handler-alist
-	   `((,tramp-file-name-regexp . tramp-vc-file-name-handler))))
-
-      ;; Here we collect only file names, which need an operation.
-      (tramp-run-real-handler 'vc-registered (list file))
-      (tramp-message v 10 "\n%s" tramp-vc-registered-file-names)
-
-      ;; Send just one command, in order to fill the cache.
-      (when tramp-vc-registered-file-names
-	(tramp-maybe-send-script
-	 v
-	 (format tramp-vc-registered-read-file-names
-		 (tramp-get-file-exists-command v)
-		 (format "%s -r" (tramp-get-test-command v)))
-	 "tramp_vc_registered_read_file_names")
-
-	(dolist
-	    (elt
-	     (tramp-send-command-and-read
-	      v
-	      (format
-	       "tramp_vc_registered_read_file_names %s"
-	       (mapconcat 'tramp-shell-quote-argument
-			  tramp-vc-registered-file-names
-			  " "))))
-
-	  (tramp-set-file-property v (car elt) (cadr elt) (cadr (cdr elt))))))
-
-    ;; Second run.  Now all `file-exists-p' or `file-readable-p' calls
-    ;; shall be answered from the file cache.
-    ;; We unset `process-file-side-effects' in order to keep the cache
-    ;; when `process-file' calls appear.
-    (let (process-file-side-effects)
-      (tramp-run-real-handler 'vc-registered (list file)))))
+  (with-temp-message ""
+    (with-parsed-tramp-file-name file nil
+      (with-progress-reporter
+	  v 3 (format "Checking `vc-registered' for %s" file)
+
+	;; There could be new files, created by the vc backend.  We
+	;; cannot reuse the old cache entries, therefore.
+	(let (tramp-vc-registered-file-names
+	      (tramp-cache-inhibit-cache (current-time))
+	      (file-name-handler-alist
+	       `((,tramp-file-name-regexp . tramp-vc-file-name-handler))))
+
+	  ;; Here we collect only file names, which need an operation.
+	  (tramp-run-real-handler 'vc-registered (list file))
+	  (tramp-message v 10 "\n%s" tramp-vc-registered-file-names)
+
+	  ;; Send just one command, in order to fill the cache.
+	  (when tramp-vc-registered-file-names
+	    (tramp-maybe-send-script
+	     v
+	     (format tramp-vc-registered-read-file-names
+		     (tramp-get-file-exists-command v)
+		     (format "%s -r" (tramp-get-test-command v)))
+	     "tramp_vc_registered_read_file_names")
+
+	    (dolist
+		(elt
+		 (tramp-send-command-and-read
+		  v
+		  (format
+		   "tramp_vc_registered_read_file_names %s"
+		   (mapconcat 'tramp-shell-quote-argument
+			      tramp-vc-registered-file-names
+			      " "))))
+
+	      (tramp-set-file-property
+	       v (car elt) (cadr elt) (cadr (cdr elt))))))
+
+	;; Second run.  Now all `file-exists-p' or `file-readable-p'
+	;; calls shall be answered from the file cache.  We unset
+	;; `process-file-side-effects' in order to keep the cache when
+	;; `process-file' calls appear.
+	(let (process-file-side-effects)
+	  (tramp-run-real-handler 'vc-registered (list file)))))))
 
 ;;;###autoload
 (progn (defun tramp-run-real-handler (operation args)
@@ -7380,6 +7403,7 @@
 connection if a previous connection has died for some reason."
   (catch 'uname-changed
     (let ((p (tramp-get-connection-process vec))
+	  (process-name (tramp-get-connection-property vec "process-name" nil))
 	  (process-environment (copy-sequence process-environment)))
 
       ;; If too much time has passed since last command was sent, look
@@ -7413,126 +7437,135 @@
 	;; We call `tramp-get-buffer' in order to get a debug buffer for
 	;; messages from the beginning.
 	(tramp-get-buffer vec)
-	(if (zerop (length (tramp-file-name-user vec)))
+	(with-progress-reporter
+	    vec 3
+	    (if (zerop (length (tramp-file-name-user vec)))
+		(format "Opening connection for %s using %s"
+			(tramp-file-name-host vec)
+			(tramp-file-name-method vec))
+	      (format "Opening connection for %s@%s using %s"
+		      (tramp-file-name-user vec)
+		      (tramp-file-name-host vec)
+		      (tramp-file-name-method vec)))
+
+	  ;; Start new process.
+	  (when (and p (processp p))
+	    (delete-process p))
+	  (setenv "TERM" tramp-terminal-type)
+	  (setenv "LC_ALL" "C")
+	  (setenv "PROMPT_COMMAND")
+	  (setenv "PS1" tramp-initial-end-of-output)
+	  (let* ((target-alist (tramp-compute-multi-hops vec))
+		 (process-connection-type tramp-process-connection-type)
+		 (process-adaptive-read-buffering nil)
+		 (coding-system-for-read nil)
+		 ;; This must be done in order to avoid our file name handler.
+		 (p (let ((default-directory
+			    (tramp-compat-temporary-file-directory)))
+		      (start-process
+		       (or process-name (tramp-buffer-name vec))
+		       (tramp-get-connection-buffer vec)
+		       tramp-encoding-shell))))
+
 	    (tramp-message
-	     vec 3 "Opening connection for %s using %s"
-	     (tramp-file-name-host vec)
-	     (tramp-file-name-method vec))
-	  (tramp-message
-	   vec 3 "Opening connection for %s@%s using %s"
-	   (tramp-file-name-user vec)
-	   (tramp-file-name-host vec)
-	   (tramp-file-name-method vec)))
-
-	;; Start new process.
-	(when (and p (processp p))
-	  (delete-process p))
-	(setenv "TERM" tramp-terminal-type)
-	(setenv "LC_ALL" "C")
-	(setenv "PROMPT_COMMAND")
-	(setenv "PS1" tramp-initial-end-of-output)
-	(let* ((target-alist (tramp-compute-multi-hops vec))
-	       (process-connection-type tramp-process-connection-type)
-	       (process-adaptive-read-buffering nil)
-	       (coding-system-for-read nil)
-	       ;; This must be done in order to avoid our file name handler.
-	       (p (let ((default-directory
-			  (tramp-compat-temporary-file-directory)))
-		    (start-process
-		     (or (tramp-get-connection-property vec "process-name" nil)
-			 (tramp-buffer-name vec))
-		     (tramp-get-connection-buffer vec)
-		     tramp-encoding-shell))))
-
-	  (tramp-message
-	   vec 6 "%s" (mapconcat 'identity (process-command p) " "))
-
-	  ;; Check whether process is alive.
-	  (tramp-set-process-query-on-exit-flag p nil)
-	  (with-progress-reporter vec 3 "Waiting 60s for local shell to come up"
+	     vec 6 "%s" (mapconcat 'identity (process-command p) " "))
+
+	    ;; Check whether process is alive.
+	    (tramp-set-process-query-on-exit-flag p nil)
 	    (tramp-barf-if-no-shell-prompt
-	     p 60 "Couldn't find local shell prompt %s" tramp-encoding-shell))
-
-	  ;; Now do all the connections as specified.
-	  (while target-alist
-	    (let* ((hop (car target-alist))
-		   (l-method (tramp-file-name-method hop))
-		   (l-user (tramp-file-name-user hop))
-		   (l-host (tramp-file-name-host hop))
-		   (l-port nil)
-		   (login-program
-		    (tramp-get-method-parameter l-method 'tramp-login-program))
-		   (login-args
-		    (tramp-get-method-parameter l-method 'tramp-login-args))
-		   (gw-args
-		    (tramp-get-method-parameter l-method 'tramp-gw-args))
-		   (gw (tramp-get-file-property hop "" "gateway" nil))
-		   (g-method (and gw (tramp-file-name-method gw)))
-		   (g-user (and gw (tramp-file-name-user gw)))
-		   (g-host (and gw (tramp-file-name-host gw)))
-		   (command login-program)
-		   ;; We don't create the temporary file.  In fact, it
-		   ;; is just a prefix for the ControlPath option of
-		   ;; ssh; the real temporary file has another name, and
-		   ;; it is created and protected by ssh.  It is also
-		   ;; removed by ssh, when the connection is closed.
-		   (tmpfile
-		    (tramp-set-connection-property
-		     p "temp-file"
-		     (make-temp-name
-		      (expand-file-name
-		       tramp-temp-name-prefix
-		       (tramp-compat-temporary-file-directory)))))
-		   spec)
-
-	      ;; Add gateway arguments if necessary.
-	      (when (and gw gw-args)
-		(setq login-args (append login-args gw-args)))
-
-	      ;; Check for port number.  Until now, there's no need
-	      ;; for handling like method, user, host.
-	      (when (string-match tramp-host-with-port-regexp l-host)
+	     p 60 "Couldn't find local shell prompt %s" tramp-encoding-shell)
+
+	    ;; Now do all the connections as specified.
+	    (while target-alist
+	      (let* ((hop (car target-alist))
+		     (l-method (tramp-file-name-method hop))
+		     (l-user (tramp-file-name-user hop))
+		     (l-host (tramp-file-name-host hop))
+		     (l-port nil)
+		     (login-program
+		      (tramp-get-method-parameter
+		       l-method 'tramp-login-program))
+		     (login-args
+		      (tramp-get-method-parameter l-method 'tramp-login-args))
+		     (async-args
+		      (tramp-get-method-parameter l-method 'tramp-async-args))
+		     (gw-args
+		      (tramp-get-method-parameter l-method 'tramp-gw-args))
+		     (gw (tramp-get-file-property hop "" "gateway" nil))
+		     (g-method (and gw (tramp-file-name-method gw)))
+		     (g-user (and gw (tramp-file-name-user gw)))
+		     (g-host (and gw (tramp-file-name-host gw)))
+		     (command login-program)
+		     ;; We don't create the temporary file.  In fact,
+		     ;; it is just a prefix for the ControlPath option
+		     ;; of ssh; the real temporary file has another
+		     ;; name, and it is created and protected by ssh.
+		     ;; It is also removed by ssh, when the connection
+		     ;; is closed.
+		     (tmpfile
+		      (tramp-set-connection-property
+		       p "temp-file"
+		       (make-temp-name
+			(expand-file-name
+			 tramp-temp-name-prefix
+			 (tramp-compat-temporary-file-directory)))))
+		     spec)
+
+		;; Add arguments for asynchrononous processes.
+		(when (and process-name async-args)
+		  (setq login-args (append login-args async-args)))
+
+		;; Add gateway arguments if necessary.
+		(when (and gw gw-args)
+		  (setq login-args (append login-args gw-args)))
+
+		;; Check for port number.  Until now, there's no need
+		;; for handling like method, user, host.
+		(when (string-match tramp-host-with-port-regexp l-host)
 		(setq l-port (match-string 2 l-host)
 		      l-host (match-string 1 l-host)))
 
-	      ;; Set variables for computing the prompt for reading
-	      ;; password.  They can also be derived from a gateway.
-	      (setq tramp-current-method (or g-method l-method)
-		    tramp-current-user   (or g-user   l-user)
-		    tramp-current-host   (or g-host   l-host))
-
-	      ;; Replace login-args place holders.
-	      (setq
-	       l-host (or l-host "")
-	       l-user (or l-user "")
-	       l-port (or l-port "")
-	       spec (format-spec-make ?h l-host ?u l-user ?p l-port ?t tmpfile)
-	       command
-	       (concat
-		;; We do not want to see the trailing local prompt in
-		;; `start-file-process'.
-		(unless (memq system-type '(windows-nt)) "exec ")
-		command " "
-		(mapconcat
-		 (lambda (x)
-		   (setq x (mapcar (lambda (y) (format-spec y spec)) x))
-		   (unless (member "" x) (mapconcat 'identity x " ")))
-		 login-args " ")
-		;; Local shell could be a Windows COMSPEC.  It doesn't
-		;; know the ";" syntax, but we must exit always for
-		;; `start-file-process'.  "exec" does not work either.
-		(if (memq system-type '(windows-nt)) " && exit || exit")))
-
-	      ;; Send the command.
-	      (tramp-message vec 3 "Sending command `%s'" command)
-	      (tramp-send-command vec command t t)
-	      (tramp-process-actions p vec tramp-actions-before-shell 60)
-	      (tramp-message vec 3 "Found remote shell prompt on `%s'" l-host))
-	    ;; Next hop.
-	    (setq target-alist (cdr target-alist)))
-
-	  ;; Make initial shell settings.
-	  (tramp-open-connection-setup-interactive-shell p vec))))))
+		;; Set variables for computing the prompt for reading
+		;; password.  They can also be derived from a gateway.
+		(setq tramp-current-method (or g-method l-method)
+		      tramp-current-user   (or g-user   l-user)
+		      tramp-current-host   (or g-host   l-host))
+
+		;; Replace login-args place holders.
+		(setq
+		 l-host (or l-host "")
+		 l-user (or l-user "")
+		 l-port (or l-port "")
+		 spec (format-spec-make
+		       ?h l-host ?u l-user ?p l-port ?t tmpfile)
+		 command
+		 (concat
+		  ;; We do not want to see the trailing local prompt in
+		  ;; `start-file-process'.
+		  (unless (memq system-type '(windows-nt)) "exec ")
+		  command " "
+		  (mapconcat
+		   (lambda (x)
+		     (setq x (mapcar (lambda (y) (format-spec y spec)) x))
+		     (unless (member "" x) (mapconcat 'identity x " ")))
+		   login-args " ")
+		  ;; Local shell could be a Windows COMSPEC.  It
+		  ;; doesn't know the ";" syntax, but we must exit
+		  ;; always for `start-file-process'.  "exec" does not
+		  ;; work either.
+		  (if (memq system-type '(windows-nt)) " && exit || exit")))
+
+		;; Send the command.
+		(tramp-message vec 3 "Sending command `%s'" command)
+		(tramp-send-command vec command t t)
+		(tramp-process-actions p vec tramp-actions-before-shell 60)
+		(tramp-message
+		 vec 3 "Found remote shell prompt on `%s'" l-host))
+	      ;; Next hop.
+	      (setq target-alist (cdr target-alist)))
+
+	    ;; Make initial shell settings.
+	    (tramp-open-connection-setup-interactive-shell p vec)))))))
 
 (defun tramp-send-command (vec command &optional neveropen nooutput)
   "Send the COMMAND to connection VEC.
--- a/lisp/nxml/nxml-mode.el	Sat May 22 17:13:04 2010 +0300
+++ b/lisp/nxml/nxml-mode.el	Sat May 22 22:32:21 2010 +0300
@@ -404,6 +404,7 @@
     (define-key map "\M-}" 'nxml-forward-paragraph)
     (define-key map "\M-h" 'nxml-mark-paragraph)
     (define-key map "\C-c\C-f" 'nxml-finish-element)
+    (define-key map "\C-c/" 'nxml-finish-element)
     (define-key map "\C-c\C-m" 'nxml-split-element)
     (define-key map "\C-c\C-b" 'nxml-balanced-close-start-tag-block)
     (define-key map "\C-c\C-i" 'nxml-balanced-close-start-tag-inline)
--- a/lisp/password-cache.el	Sat May 22 17:13:04 2010 +0300
+++ b/lisp/password-cache.el	Sat May 22 22:32:21 2010 +0300
@@ -105,7 +105,7 @@
 
 (defun password-cache-remove (key)
   "Remove password indexed by KEY from password cache.
-This is typically run be a timer setup from `password-cache-add',
+This is typically run by a timer setup from `password-cache-add',
 but can be invoked at any time to forcefully remove passwords
 from the cache.  This may be useful when it has been detected
 that a password is invalid, so that `password-read' query the
--- a/lisp/progmodes/cc-engine.el	Sat May 22 17:13:04 2010 +0300
+++ b/lisp/progmodes/cc-engine.el	Sat May 22 22:32:21 2010 +0300
@@ -2245,50 +2245,50 @@
 	    (setq cnt (1- cnt)))))
     (point)))
 
-(defun c-state-balance-parens-backwards (here top)
-  ;; Return the position of the opening paren/brace/bracket before HERE which
-  ;; matches the outermost close p/b/b between HERE and TOP, like this:
-  ;;
-  ;;      ......................................
-  ;;      |                                    |
-  ;;      (    [ ( ...........  )      ( )  ]  )
-  ;;      ^                 ^                       ^
-  ;;      |                 |                       |
-  ;;   return             HERE                     TOP
+(defun c-state-balance-parens-backwards (here- here+ top)
+  ;; Return the position of the opening paren/brace/bracket before HERE- which
+  ;; matches the outermost close p/b/b between HERE+ and TOP.  Except when
+  ;; there's a macro, HERE- and HERE+ are the same.  Like this:
+  ;;
+  ;;	  ............................................
+  ;;	  |				             |
+  ;;	  (    [ ( .........#macro.. )      ( )  ]  )
+  ;;	  ^		    ^	  ^			    ^
+  ;;	  |		    |	  |			    |
+  ;;   return		  HERE- HERE+			   TOP
   ;;
   ;; If there aren't enough opening paren/brace/brackets, return the position
-  ;; of the outermost one found, or HERE it there are none.  If there are no
-  ;; closeing p/b/bs between HERE and TOP, return HERE.  HERE and TOP must not
-  ;; be inside literals.  Only the accessible portion of the buffer will be
-  ;; scanned.
-
-  ;; PART 1: scan from `here' up to `top', accumulating ")"s which enclose
-  ;; `here'.  Go round the next loop each time we pass over such a ")".  These
-  ;; probably match "("s before `here'.
+  ;; of the outermost one found, or HERE- if there are none.  If there are no
+  ;; closeing p/b/bs between HERE+ and TOP, return HERE-.  HERE-/+ and TOP
+  ;; must not be inside literals.  Only the accessible portion of the buffer
+  ;; will be scanned.
+
+  ;; PART 1: scan from `here+' up to `top', accumulating ")"s which enclose
+  ;; `here'.  Go round the next loop each time we pass over such a ")".	 These
+  ;; probably match "("s before `here-'.
   (let (pos pa ren+1 lonely-rens)
     (save-excursion
       (save-restriction
 	(narrow-to-region (point-min) top) ; This can move point, sometimes.
-	(setq pos here)
+	(setq pos here+)
 	(c-safe
 	  (while
 	      (setq ren+1 (scan-lists pos 1 1)) ; might signal
 	    (setq lonely-rens (cons ren+1 lonely-rens)
 		  pos ren+1)))))
 
-      ;; PART 2: Scan back before `here' searching for the "("s
+      ;; PART 2: Scan back before `here-' searching for the "("s
       ;; matching/mismatching the ")"s found above. We only need to direct the
       ;; caller to scan when we've encountered unmatched right parens.
-      (when lonely-rens
-	(setq pos here)
-	(c-safe
-	  (while
-	      (and lonely-rens		; actual values aren't used.
-		   (setq pa (scan-lists pos -1 1)))
-	    (setq pos pa)
-	    (setq lonely-rens (cdr lonely-rens)))) ;)
-	)
-      pos))
+    (setq pos here-)
+    (when lonely-rens
+      (c-safe
+	(while
+	    (and lonely-rens		; actual values aren't used.
+		 (setq pa (scan-lists pos -1 1)))
+	  (setq pos pa)
+	  (setq lonely-rens (cdr lonely-rens)))))
+    pos))
 
 (defun c-parse-state-get-strategy (here good-pos)
   ;; Determine the scanning strategy for adjusting `c-parse-state', attempting
@@ -2746,6 +2746,7 @@
 	lit	    ; (START . END) of a literal containing some point.
 	here-lit-start here-lit-end	; bounds of literal containing `here'
 					; or `here' itself.
+	here- here+		     ; start/end of macro around HERE, or HERE
 	(here-bol (c-point 'bol here))
 	(too-far-back (max (- here c-state-cache-too-far) 1)))
 
@@ -2758,57 +2759,73 @@
     ;; At this stage, (> pos here);
     ;; (< (c-state-cache-top-lparen) here)  (or is nil).
 
-    ;; CASE 1: The top of the cache is a brace pair which now encloses `here'.
-    ;; As good-pos, return the address. of the "{".
-    (if (and (consp (car c-state-cache))
-	     (> (cdar c-state-cache) here))
-	;; Since we've no knowledge of what's inside these braces, we have no
-	;; alternative but to direct the caller to scan the buffer from the
-	;; opening brace.
-	(progn
-	  (setq pos (caar c-state-cache))
-	  (setcar c-state-cache pos)
-	  (list (1+ pos) pos t)) ; return value.  We've just converted a brace
-			         ; pair entry into a { entry, so the caller
-			         ; needs to search for a brace pair before the
-			         ; {.
-
-      ;; ;; `here' might be inside a literal.  Check for this.
-      (setq lit (c-state-literal-at here)
-	    here-lit-start (or (car lit) here)
-	    here-lit-end (or (cdr lit) here))
-
-      ;; `here' might be nested inside any depth of parens (or brackets but
-      ;; not braces).  Scan backwards to find the outermost such opening
-      ;; paren, if there is one.  This will be the scan position to return.
-      (save-restriction
-	(narrow-to-region cache-pos (point-max))
-	(setq pos (c-state-balance-parens-backwards here-lit-end pos)))
-
-      (if (< pos here-lit-start)
-	  ;; CASE 2: Address of outermost ( or [ which now encloses `here',
-	  ;; but didn't enclose the (previous) `c-state-cache-good-pos'.  If
-	  ;; there is a brace pair preceding this, it will already be in
-	  ;; `c-state-cache', unless there was a brace pair after it,
-	  ;; i.e. there'll only be one to scan for if we've just deleted one.
-	  (list pos (and dropped-cons pos) t) ; Return value.
-
-	;; `here' isn't enclosed in a (previously unrecorded) bracket/paren.
-	;; Further forward scanning isn't needed, but we still need to find a
-	;; GOOD-POS.  Step out of all enclosing "("s on HERE's line.
+    (cond
+     ((and (consp (car c-state-cache))
+	   (> (cdar c-state-cache) here))
+      ;; CASE 1: The top of the cache is a brace pair which now encloses
+      ;; `here'.  As good-pos, return the address. of the "{".  Since we've no
+      ;; knowledge of what's inside these braces, we have no alternative but
+      ;; to direct the caller to scan the buffer from the opening brace.
+      (setq pos (caar c-state-cache))
+      (setcar c-state-cache pos)
+      (list (1+ pos) pos t)) ; return value.  We've just converted a brace pair
+			     ; entry into a { entry, so the caller needs to
+			     ; search for a brace pair before the {.
+
+     ;; `here' might be inside a literal.  Check for this.
+     ((progn
+	(setq lit (c-state-literal-at here)
+	      here-lit-start (or (car lit) here)
+	      here-lit-end (or (cdr lit) here))
+	;; Has `here' just "newly entered" a macro?
+	(save-excursion
+	  (goto-char here-lit-start)
+	  (if (and (c-beginning-of-macro)
+		   (or (null c-state-old-cpp-beg)
+		       (not (= (point) c-state-old-cpp-beg))))
+	      (progn
+		(setq here- (point))
+		(c-end-of-macro)
+		(setq here+ (point)))
+	    (setq here- here-lit-start
+		  here+ here-lit-end)))
+
+	;; `here' might be nested inside any depth of parens (or brackets but
+	;; not braces).  Scan backwards to find the outermost such opening
+	;; paren, if there is one.  This will be the scan position to return.
+	(save-restriction
+	  (narrow-to-region cache-pos (point-max))
+	  (setq pos (c-state-balance-parens-backwards here- here+ pos)))
+	nil))				; for the cond
+
+     ((< pos here-lit-start)
+      ;; CASE 2: Address of outermost ( or [ which now encloses `here', but
+      ;; didn't enclose the (previous) `c-state-cache-good-pos'.  If there is
+      ;; a brace pair preceding this, it will already be in `c-state-cache',
+      ;; unless there was a brace pair after it, i.e. there'll only be one to
+      ;; scan for if we've just deleted one.
+      (list pos (and dropped-cons pos) t)) ; Return value.
+
+      ;; `here' isn't enclosed in a (previously unrecorded) bracket/paren.
+      ;; Further forward scanning isn't needed, but we still need to find a
+      ;; GOOD-POS.  Step out of all enclosing "("s on HERE's line.
+     ((progn
 	(save-restriction
 	  (narrow-to-region here-bol (point-max))
 	  (setq pos here-lit-start)
 	  (c-safe (while (setq pa (scan-lists pos -1 1))
 		    (setq pos pa))))	; might signal
-	(if (setq ren (c-safe-scan-lists pos -1 -1 too-far-back))
-	    ;; CASE 3: After a }/)/] before `here''s BOL.
-	    (list (1+ ren) (and dropped-cons pos) nil) ; Return value
-
-	  ;; CASE 4; Best of a bad job: BOL before `here-bol', or beginning of
-	  ;; literal containing it.
-	  (setq good-pos (c-state-lit-beg (c-point 'bopl here-bol)))
-	  (list good-pos (and dropped-cons good-pos) nil))))))
+	nil))				; for the cond
+
+     ((setq ren (c-safe-scan-lists pos -1 -1 too-far-back))
+       ;; CASE 3: After a }/)/] before `here''s BOL.
+      (list (1+ ren) (and dropped-cons pos) nil)) ; Return value
+
+     (t
+      ;; CASE 4; Best of a bad job: BOL before `here-bol', or beginning of
+      ;; literal containing it.
+      (setq good-pos (c-state-lit-beg (c-point 'bopl here-bol)))
+      (list good-pos (and dropped-cons good-pos) nil)))))
 
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
--- a/lisp/progmodes/f90.el	Sat May 22 17:13:04 2010 +0300
+++ b/lisp/progmodes/f90.el	Sat May 22 22:32:21 2010 +0300
@@ -1008,7 +1008,7 @@
   :regexp "\\(?:[^[:word:]_`]\\|^\\)\\(`?[[:word:]_]+\\)[^[:word:]_]*")
 
 ;;;###autoload
-(defun f90-mode ()
+(define-derived-mode f90-mode prog-mode "F90"
   "Major mode for editing Fortran 90,95 code in free format.
 For fixed format code, use `fortran-mode'.
 
@@ -1065,13 +1065,9 @@
 
 Turning on F90 mode calls the value of the variable `f90-mode-hook'
 with no args, if that value is non-nil."
-  (interactive)
-  (kill-all-local-variables)
-  (setq major-mode 'f90-mode
-        mode-name "F90"
-        local-abbrev-table f90-mode-abbrev-table)
-  (set-syntax-table f90-mode-syntax-table)
-  (use-local-map f90-mode-map)
+  :group 'f90
+  :syntax-table f90-mode-syntax-table
+  :abbrev-table f90-mode-abbrev-table
   (set (make-local-variable 'indent-line-function) 'f90-indent-line)
   (set (make-local-variable 'indent-region-function) 'f90-indent-region)
   (set (make-local-variable 'require-final-newline) mode-require-final-newline)
@@ -1094,8 +1090,7 @@
        'f90-beginning-of-subprogram)
   (set (make-local-variable 'end-of-defun-function) 'f90-end-of-subprogram)
   (set (make-local-variable 'add-log-current-defun-function)
-       #'f90-current-defun)
-  (run-mode-hooks 'f90-mode-hook))
+       #'f90-current-defun))
 
 
 ;; Inline-functions.
--- a/lisp/progmodes/fortran.el	Sat May 22 17:13:04 2010 +0300
+++ b/lisp/progmodes/fortran.el	Sat May 22 22:32:21 2010 +0300
@@ -778,7 +778,7 @@
 
 
 ;;;###autoload
-(defun fortran-mode ()
+(define-derived-mode fortran-mode prog-mode "Fortran"
   "Major mode for editing Fortran code in fixed format.
 For free format code, use `f90-mode'.
 
@@ -848,13 +848,9 @@
 
 Turning on Fortran mode calls the value of the variable `fortran-mode-hook'
 with no args, if that value is non-nil."
-  (interactive)
-  (kill-all-local-variables)
-  (setq major-mode 'fortran-mode
-        mode-name "Fortran"
-        local-abbrev-table fortran-mode-abbrev-table)
-  (set-syntax-table fortran-mode-syntax-table)
-  (use-local-map fortran-mode-map)
+  :group 'fortran
+  :syntax-table fortran-mode-syntax-table
+  :abbrev-table fortran-mode-abbrev-table
   (set (make-local-variable 'indent-line-function) 'fortran-indent-line)
   (set (make-local-variable 'indent-region-function)
        (lambda (start end)
@@ -906,8 +902,7 @@
        #'fortran-current-defun)
   (set (make-local-variable 'dabbrev-case-fold-search) 'case-fold-search)
   (set (make-local-variable 'gud-find-expr-function) 'fortran-gud-find-expr)
-  (add-hook 'hack-local-variables-hook 'fortran-hack-local-variables nil t)
-  (run-mode-hooks 'fortran-mode-hook))
+  (add-hook 'hack-local-variables-hook 'fortran-hack-local-variables nil t))
 
 
 (defun fortran-line-length (nchars &optional global)
--- a/lisp/progmodes/grep.el	Sat May 22 17:13:04 2010 +0300
+++ b/lisp/progmodes/grep.el	Sat May 22 22:32:21 2010 +0300
@@ -781,12 +781,17 @@
 		  (file-name-nondirectory bn)))
 	 (default-alias
 	   (and fn
-		(let ((aliases grep-files-aliases)
+		(let ((aliases (remove (assoc "all" grep-files-aliases)
+				       grep-files-aliases))
 		      alias)
 		  (while aliases
 		    (setq alias (car aliases)
 			  aliases (cdr aliases))
-		    (if (string-match (wildcard-to-regexp (cdr alias)) fn)
+		    (if (string-match (mapconcat
+				       'wildcard-to-regexp
+				       (split-string (cdr alias) nil t)
+				       "\\|")
+				      fn)
 			(setq aliases nil)
 		      (setq alias nil)))
 		  (cdr alias))))
--- a/lisp/progmodes/octave-mod.el	Sat May 22 17:13:04 2010 +0300
+++ b/lisp/progmodes/octave-mod.el	Sat May 22 22:32:21 2010 +0300
@@ -214,6 +214,7 @@
     (define-key map "\C-c\M-\C-d" 'octave-down-block)
     (define-key map "\C-c\M-\C-h" 'octave-mark-block)
     (define-key map "\C-c]" 'octave-close-block)
+    (define-key map "\C-c/" 'octave-close-block)
     (define-key map "\C-c\C-f" 'octave-insert-defun)
     (define-key map "\C-c\C-h" 'octave-help)
     (define-key map "\C-c\C-il" 'octave-send-line)
--- a/lisp/progmodes/subword.el	Sat May 22 17:13:04 2010 +0300
+++ b/lisp/progmodes/subword.el	Sat May 22 22:32:21 2010 +0300
@@ -76,7 +76,7 @@
 ;; the old `c-forward-into-nomenclature' originally contributed by
 ;; Terry_Glanfield dot Southern at rxuk dot xerox dot com.
 
-;; TODO: ispell-word and subword oriented C-w in isearch.
+;; TODO: ispell-word.
 
 ;;; Code:
 
--- a/lisp/replace.el	Sat May 22 17:13:04 2010 +0300
+++ b/lisp/replace.el	Sat May 22 22:32:21 2010 +0300
@@ -1980,6 +1980,9 @@
 	    (isearch-regexp regexp)
 	    (search-whitespace-regexp nil)
 	    (isearch-case-fold-search case-fold))
+	;; Set isearch-word to nil because word-replace is regexp-based,
+	;; so `isearch-search-fun' should not use `word-search-forward'.
+	(if (and isearch-word isearch-regexp) (setq isearch-word nil))
 	(isearch-lazy-highlight-new-loop range-beg range-end))))
 
 (defun replace-dehighlight ()
--- a/lisp/simple.el	Sat May 22 17:13:04 2010 +0300
+++ b/lisp/simple.el	Sat May 22 22:32:21 2010 +0300
@@ -4539,6 +4539,9 @@
 	       (let ((goal-column 0)
 		     (line-move-visual nil))
 		 (and (line-move arg t)
+		      ;; With bidi reordering, we may not be at bol,
+		      ;; so make sure we are.
+		      (skip-chars-backward "^\n")
 		      (not (bobp))
 		      (progn
 			(while (and (not (bobp)) (invisible-p (1- (point))))
--- a/lisp/smerge-mode.el	Sat May 22 17:13:04 2010 +0300
+++ b/lisp/smerge-mode.el	Sat May 22 22:32:21 2010 +0300
@@ -457,8 +457,8 @@
 
 (defun smerge-resolve (&optional safe)
   "Resolve the conflict at point intelligently.
-This relies on mode-specific knowledge and thus only works in
-some major modes.  Uses `smerge-resolve-function' to do the actual work."
+This relies on mode-specific knowledge and thus only works in some
+major modes.  Uses `smerge-resolve-function' to do the actual work."
   (interactive)
   (smerge-match-conflict)
   (smerge-remove-props (match-beginning 0) (match-end 0))
@@ -815,12 +815,12 @@
   This only matters if `smerge-refine-weight-hack' is nil.")
 
 (defvar smerge-refine-ignore-whitespace t
-  "If non-nil,Indicate that smerge-refine should try to ignore change in whitespace.")
+  "If non-nil, indicate that `smerge-refine' should try to ignore change in whitespace.")
 
 (defvar smerge-refine-weight-hack t
   "If non-nil, pass to diff as many lines as there are chars in the region.
 I.e. each atomic element (e.g. word) will be copied as many times (on different
-lines) as it has chars.  This has 2 advantages:
+lines) as it has chars.  This has two advantages:
 - if `diff' tries to minimize the number *lines* (rather than chars)
   added/removed, this adjust the weights so that adding/removing long
   symbols is considered correspondingly more costly.
@@ -919,8 +919,8 @@
   "Show fine differences in the two regions BEG1..END1 and BEG2..END2.
 PROPS is an alist of properties to put (via overlays) on the changes.
 If non-nil, PREPROC is called with no argument in a buffer that contains
-a copy of a region, just before preparing it to for `diff'.  It can be used to
-replace chars to try and eliminate some spurious differences."
+a copy of a region, just before preparing it to for `diff'.  It can be
+used to replace chars to try and eliminate some spurious differences."
   (let* ((buf (current-buffer))
          (pos (point))
          (file1 (make-temp-file "diff1"))
@@ -988,9 +988,9 @@
 
 (defun smerge-refine (&optional part)
   "Highlight the words of the conflict that are different.
-For 3-way conflicts, highlights only 2 of the 3 parts.
-A numeric argument PART can be used to specify which 2 parts;
-repeating the command will highlight other 2 parts."
+For 3-way conflicts, highlights only two of the three parts.
+A numeric argument PART can be used to specify which two parts;
+repeating the command will highlight other two parts."
   (interactive
    (if (integerp current-prefix-arg) (list current-prefix-arg)
      (smerge-match-conflict)
@@ -1161,7 +1161,7 @@
 
 (defun smerge-makeup-conflict (pt1 pt2 pt3 &optional pt4)
   "Insert diff3 markers to make a new conflict.
-Uses point and mark for 2 of the relevant positions and previous marks
+Uses point and mark for two of the relevant positions and previous marks
 for the other ones.
 By default, makes up a 2-way conflict,
 with a \\[universal-argument] prefix, makes up a 3-way conflict."
@@ -1184,7 +1184,7 @@
     (insert "<<<<<<< MINE\n"))
   (if smerge-mode nil (smerge-mode 1))
   (smerge-refine))
-      
+
 
 (defconst smerge-parsep-re
   (concat smerge-begin-re "\\|" smerge-end-re "\\|"
--- a/lisp/subr.el	Sat May 22 17:13:04 2010 +0300
+++ b/lisp/subr.el	Sat May 22 22:32:21 2010 +0300
@@ -1868,16 +1868,14 @@
 	(if inhibit-quit (setq quit-flag nil)))
       ;; Translate TAB key into control-I ASCII character, and so on.
       ;; Note: `read-char' does it using the `ascii-character' property.
-      ;; We could try and use read-key-sequence instead, but then C-q ESC
-      ;; or C-q C-x might not return immediately since ESC or C-x might be
-      ;; bound to some prefix in function-key-map or key-translation-map.
+      ;; We should try and use read-key instead.
+      (let ((translation (lookup-key local-function-key-map (vector char))))
+	(if (arrayp translation)
+	    (setq translated (aref translation 0))))
       (setq translated
 	    (if (integerp char)
 		(char-resolve-modifiers char)
 	      char))
-      (let ((translation (lookup-key local-function-key-map (vector char))))
-	(if (arrayp translation)
-	    (setq translated (aref translation 0))))
       (cond ((null translated))
 	    ((not (integerp translated))
 	     (setq unread-command-events (list char)
--- a/lisp/vc-dir.el	Sat May 22 17:13:04 2010 +0300
+++ b/lisp/vc-dir.el	Sat May 22 22:32:21 2010 +0300
@@ -1169,7 +1169,8 @@
 	  nil t nil nil)))))
   (unless backend
     (setq backend (vc-responsible-backend dir)))
-  (pop-to-buffer (vc-dir-prepare-status-buffer "*vc-dir*" dir backend))
+  (let (pop-up-windows)		      ; based on cvs-examine; bug#6204
+    (pop-to-buffer (vc-dir-prepare-status-buffer "*vc-dir*" dir backend)))
   (if (derived-mode-p 'vc-dir-mode)
       (vc-dir-refresh)
     ;; FIXME: find a better way to pass the backend to `vc-dir-mode'.
--- a/make-dist	Sat May 22 17:13:04 2010 +0300
+++ b/make-dist	Sat May 22 22:32:21 2010 +0300
@@ -440,6 +440,7 @@
  ln [a-zA-Z]*.h ../${tempdir}/src
  ln [a-zA-Z]*.m ../${tempdir}/src
  ln [a-zA-Z]*.in ../${tempdir}/src
+ ln [a-zA-Z]*.mk ../${tempdir}/src
  ## If we ended up with a symlink, or if we did not get anything
  ## due to a cross-device symlink, copy the file.
  for file in [a-zA-Z]*.[hcs] [a-zA-Z]*.in; do
--- a/msdos/ChangeLog	Sat May 22 17:13:04 2010 +0300
+++ b/msdos/ChangeLog	Sat May 22 22:32:21 2010 +0300
@@ -1,3 +1,24 @@
+2010-05-21  Glenn Morris  <rgm@gnu.org>
+
+	* sed1v2.inp(@ns_frag@): Edit to nothing.
+
+	* sed1x.inp (OLDXMENU): Replace any initial value.
+	* sed1v2.inp (OLDXMENU): Edit to "nothing".
+
+	* sed1v2.inp (CANNOT_DUMP): Edit to no.
+
+2010-05-20  Glenn Morris  <rgm@gnu.org>
+
+	* sed1v2.inp (DEPFLAGS, deps_frag): Edit to empty.
+	(MKDEPDIR): Edit to ':'.
+
+2010-05-19  Glenn Morris  <rgm@gnu.org>
+
+	* sed2v2.inp (ORDINARY_LINK): Set here rather than in s/msdos.h.
+
+	* sed1v2.inp (LD): Edit to $(CC).
+	(YMF_PASS_LDFLAGS): Edit to `flags'.
+
 2010-05-18  Eli Zaretskii  <eliz@gnu.org>
 
 	* sed1x.inp: Add copyright notice.
--- a/msdos/mainmake.v2	Sat May 22 17:13:04 2010 +0300
+++ b/msdos/mainmake.v2	Sat May 22 22:32:21 2010 +0300
@@ -68,10 +68,10 @@
 version := ${shell sed -n -e '/(defconst emacs-version/s/^[^"]*\("[^"]*"\).*/\1/p' lisp/version.el}
 
 # Q: Do we need to bootstrap?
-# A: Only if we find admin/admin.el, i.e. we are building out of CVS,
-#    and src/b-emacs.exe does not exist.  This avoids building a
-#    bootstrap-emacs and recompiling Lisp files when building a
-#    pretest/release tarball.
+# A: Only if we find admin/admin.el, i.e. we are building out of 
+#    a VCS-checkout (not a release) and src/b-emacs.exe does not exist.
+#    This avoids building a bootstrap-emacs and recompiling Lisp files
+#    when building a pretest/release tarball.
 boot :=
 ifneq ($(wildcard admin/admin.el),)
 ifeq ($(wildcard src/b-emacs.exe),)
--- a/msdos/sed1v2.inp	Sat May 22 17:13:04 2010 +0300
+++ b/msdos/sed1v2.inp	Sat May 22 22:32:21 2010 +0300
@@ -55,6 +55,7 @@
 /^TEMACS_LDFLAGS2 *=/s/@TEMACS_LDFLAGS2@/$(LDFLAGS)/
 /^LIBS_SYSTEM *=/s/@LIBS_SYSTEM@//
 /^LIB_GCC *=/s/@LIB_GCC@/-Lgcc/
+/^LD *=/s/@LINKER@/$(CC)/
 /^LIB_STANDARD *=/s/@LIB_STANDARD@//
 /^LIB_MATH *=/s/@LIB_MATH@/-lm/
 /^LIBTIFF *=/s/@LIBTIFF@//
@@ -113,7 +114,7 @@
 /^WINDOW_SUPPORT *=/s/@WINDOW_SUPPORT@//
 /^LIBGPM *=/s/@LIBGPM@//
 /^EXEEXT *=/s/@EXEEXT@/.exe/
-/^OLDXMENU *=/s/@OLDXMENU@//
+/^OLDXMENU *=/s/@OLDXMENU@/nothing/
 /^LIBXMENU *=/s/@LIBXMENU@//
 /^LIBX_OTHER *=/s/@LIBX_OTHER@//
 /^GMALLOC_OBJ *=/s/@GMALLOC_OBJ@/gmalloc.o/
@@ -122,6 +123,9 @@
 /^PRE_ALLOC_OBJ *=/s/@PRE_ALLOC_OBJ@/lastfile.o/
 /^POST_ALLOC_OBJ *=/s/@POST_ALLOC_OBJ@/$(vmlimitobj)/
 /^UNEXEC_OBJ *=/s/@unexec@/unexec.o/
+/^CANNOT_DUMP *=/s/@cannot_dump@/no/
+/^DEPFLAGS *=/s/@DEPFLAGS@//
+/^MKDEPDIR *=/s/@MKDEPDIR@/:/
 /^version *=/s/@[^@\n]*@//
 /^M_FILE *=/s!@[^@\n]*@!m/intel386.h!
 /^S_FILE *=/s!@[^@\n]*@!s/msdos.h!
@@ -143,6 +147,9 @@
 /^	@: /d
 /^	-\{0,1\}ln -/s/ln -f/cp -pf/
 /^[ 	]touch /s/touch/djecho $@ >/
+s/@YMF_PASS_LDFLAGS@/flags/
+s/@deps_frag@//
+s/@ns_frag@//
 s/bootstrap-emacs/b-emacs/
 s/bootstrap-temacs/b-temacs/
 s/bootstrap-doc/b-doc/
--- a/msdos/sed1x.inp	Sat May 22 17:13:04 2010 +0300
+++ b/msdos/sed1x.inp	Sat May 22 22:32:21 2010 +0300
@@ -19,7 +19,7 @@
 s!^	cd \${oldXMenudir}; \${MAKE}.*$!	${MAKE} -C ${oldXMenudir}.!
 s!^	@true *$!	@rem!
 s/DOC/DOC-X/g
-/^OLDXMENU *=/s!= *!= ${oldXMenudir}libXMenu11.a!
+/^OLDXMENU *=/s!=.*!= ${oldXMenudir}libXMenu11.a!
 /^LIBXMENU *=/s!= *!= ${OLDXMENU}!
 /^LIBX_OTHER *=/s!= *!= ${LIBXT} ${LIBX_EXTRA}!
 /^OLDXMENU_TARGET *=/s!= *!= really-oldxmenu!
--- a/msdos/sed2v2.inp	Sat May 22 17:13:04 2010 +0300
+++ b/msdos/sed2v2.inp	Sat May 22 22:32:21 2010 +0300
@@ -52,6 +52,7 @@
 /^#undef HAVE_MKSTEMP *$/s/^.*$/#define HAVE_MKSTEMP 1/
 /^#undef HAVE_STRUCT_TM_TM_ZONE *$/s/^.*$/#define HAVE_STRUCT_TM_TM_ZONE 1/
 /^#undef HAVE_SYNC *$/s/^.*$/#define HAVE_SYNC 1/
+/^#undef ORDINARY_LINK/s/^.*$/#define ORDINARY_LINK 1/
 /^#undef PACKAGE_BUGREPORT/s/^.*$/#define PACKAGE_BUGREPORT ""/
 /^#undef PACKAGE_NAME/s/^.*$/#define PACKAGE_NAME ""/
 /^#undef PACKAGE_STRING/s/^.*$/#define PACKAGE_STRING ""/
--- a/src/ChangeLog	Sat May 22 17:13:04 2010 +0300
+++ b/src/ChangeLog	Sat May 22 22:32:21 2010 +0300
@@ -1,34 +1,6 @@
-2010-05-22  Eli Zaretskii  <eliz@gnu.org>
-
-	* xdisp.c (find_row_edges): Handle the case of characters
-	delivered from display vector.  Fix tests related to it->method.
-	Handle the truncated_on_right_p rows.
-
 2010-05-19  Eli Zaretskii  <eliz@gnu.org>
 
-	* .gdbinit (prowlims): Display row->minpos and row->maxpos.
-	Display truncated_on_left_p and truncated_on_right_p flags.
-	Formatting fixes.
-	(pmtxrows): Display the ordinal number of each row.  Don't display
-	rows beyond the last one.
-
-	* xdisp.c (RECORD_MAX_MIN_POS): New macro.
-	(display_line): Use it to record the minimum and maximum buffer
-	positions for glyphs in the row being assembled.  If word wrap is
-	in effect, restore minimum and maximum positions seen up to the
-	wrap point, when iterator returns to it.
-	(find_row_edges): Fix logic; eol_pos should be tested before the
-	rest.
-	(try_window_reusing_current_matrix): Give up if in bidi-reordered
-	row and cursor not already at point.  Restore original pre-bidi
-	code for unidirectional buffers.
-
-	* bidi.c (bidi_cache_shrink, bidi_cache_iterator_state): Fix
-	reallocation of the cache.  (Bug#6210)
-	(bidi_cache_iterator_state): Don't zero out new_paragraph (it is
-	not copied by bidi_copy_it).
-
-2010-05-18  Eli Zaretskii  <eliz@gnu.org>
+	Redesign and reimplement bidi-aware edge positions of glyph rows.
 
 	* dispextern.h (struct glyph_row): New members minpos and maxpos.
 	(MATRIX_ROW_START_CHARPOS, MATRIX_ROW_START_BYTEPOS)
@@ -46,15 +18,115 @@
 	arguments for minimum and maximum buffer positions seen by
 	display_line for this row.  Don't use iterator to find the
 	position following the maximum one; instead, increment the
-	position found by display_line directly.
-	(display_line): Record minimum and maximum buffer positions for
-	glyphs in this row.  Record the position of the newline that
-	terminates the line.
+	position found by display_line directly.  Fix logic; eol_pos
+	should be tested before the rest.  Handle the case of characters
+	delivered from display vector (bug#6036).  Fix tests related to
+	it->method.  Handle the truncated_on_right_p rows.
+	(RECORD_MAX_MIN_POS): New macro.
+	(display_line): Use it to record the minimum and maximum buffer
+	positions for glyphs in the row being assembled.  Record the
+	position of the newline that terminates the line.  If word wrap is
+	in effect, restore minimum and maximum positions seen up to the
+	wrap point, when iterator returns to it.
+	(try_window_reusing_current_matrix): Give up if in bidi-reordered
+	row and cursor not already at point.  Restore original pre-bidi
+	code for unidirectional buffers.
 
 	* dispnew.c (increment_row_positions, check_matrix_invariants):
 	Increment and check row->start.pos and row->end.pos, in addition
 	to MATRIX_ROW_START_CHARPOS and MATRIX_ROW_END_CHARPOS.
 
+	* .gdbinit (prowlims): Display row->minpos and row->maxpos.
+	Display truncated_on_left_p and truncated_on_right_p flags.
+	Formatting fixes.
+	(pmtxrows): Display the ordinal number of each row.  Don't display
+	rows beyond the last one.
+
+	* bidi.c (bidi_cache_iterator_state): Don't zero out new_paragraph:
+	it is not copied by bidi_copy_it.
+
+2010-05-22  Eli Zaretskii  <eliz@gnu.org>
+
+	* w32.c (sys_write): Break writes into chunks smaller than 32MB.
+	(Bug#6237)
+
+2010-05-22  Chong Yidong  <cyd@stupidchicken.com>
+
+	* image.c (Fimage_flush): Rename from image-refresh.
+
+2010-05-21  Chong Yidong  <cyd@stupidchicken.com>
+
+	* xdisp.c (redisplay_internal): Clear caches even if redisplaying
+	just one window.
+
+	* image.c (Vimage_cache_eviction_delay): Decrease to 300.
+	(clear_image_cache): If the number of cached images is unusually
+	large, decrease the cache eviction delay (Bug#6230).
+
+2010-05-21  Glenn Morris  <rgm@gnu.org>
+
+	* Makefile.in (${ns_appdir}, ${ns_appbindir}Emacs, ns-app):
+	Move these rules to ns.mk.
+	* ns.mk: New file.
+
+	* Makefile.in (../src/$(OLDXMENU), $(OLDXMENU)): Always define rules.
+
+	* Makefile.in (CANNOT_DUMP): New, set by configure.
+	(emacs${EXEEXT}, bootstrap-emacs${EXEEXT}): Use $CANNOT_DUMP.
+
+2010-05-20  Juri Linkov  <juri@jurta.org>
+
+	* fileio.c (Fdelete_file): Change interative spec to use
+	`read-file-name' like in `find-file-read-args' where the default
+	value is `default-directory' instead of `buffer-file-name'.
+	http://lists.gnu.org/archive/html/emacs-devel/2010-05/msg00533.html
+
+2010-05-20  Kevin Ryde  <user42@zip.com.au>
+
+	* keyboard.c (Vlast_command, Vkeyboard_translate_table)
+	(Voverriding_terminal_local_map, Vsystem_key_alist)
+	(Vlocal_function_key_map): Fix manual link in docstring (Bug#6224).
+
+2010-05-20  Glenn Morris  <rgm@gnu.org>
+
+	* Makefile.in (DEPDIR): New constant.
+	(DEPFLAGS): Set with configure, not cpp.
+	(MKDEPDIR): New, set by configure.
+	(.c.o, .m.o, ecrt0.o): Use $MKDEPDIR.
+	(clean): Use $DEPDIR.
+	(deps_frag): Include from configure.
+	Move static/dynamic dependency stuff to deps.mk/autodeps.mk.
+	* deps.mk, autodeps.mk: New files, extracted from Makefile.in.
+
+	* bidi.c (bidi_cache_shrink, bidi_cache_iterator_state): Fix
+	reallocation of the cache.  (Bug#6210)
+
+2010-05-19  Glenn Morris  <rgm@gnu.org>
+
+	* s/msdos.h (ORDINARY_LINK): Move to sed2v2.inp.
+
+	* Makefile.in (LD, YMF_PASS_LDFLAGS): Set with configure, not cpp.
+	(GNULIB_VAR): Remove.
+	(LIBES): Use LIB_GCC instead of GNULIB_VAR.
+
+	* m/ibms390x.h (LINKER):
+	* m/macppc.h (LINKER) [GNU_LINUX]:
+	* s/aix4-2.h (ORDINARY_LINK):
+	* s/cygwin.h (LINKER):
+	* s/darwin.h (ORDINARY_LINK):
+	* s/gnu.h (ORDINARY_LINK):
+	* s/netbsd.h (LINKER):
+	* s/usg5-4.h (ORDINARY_LINK):
+	Move to configure.
+
+	* s/aix4-2.h (LINKER): Remove; this file sets ORDINARY_LINK.
+
+2010-05-18  Chong Yidong  <cyd@stupidchicken.com>
+
+	* character.c (Fstring, Funibyte_string): Use SAFE_ALLOCA to
+	prevent stack overflow if number of arguments is too large
+	(Bug#6214).
+
 2010-05-18  Juanma Barranquero  <lekktu@gmail.com>
 
 	* charset.c (load_charset_map_from_file): Don't call close after fclose.
--- a/src/Makefile.in	Sat May 22 17:13:04 2010 +0300
+++ b/src/Makefile.in	Sat May 22 22:32:21 2010 +0300
@@ -124,6 +124,8 @@
 ## Where to find libgcc.a, if using gcc and necessary.
 LIB_GCC=@LIB_GCC@
 
+LD=@LINKER@
+
 ## May use $CRT_DIR.
 LIB_STANDARD=@LIB_STANDARD@
 
@@ -171,13 +173,20 @@
 ## Only used if HAVE_X_WINDOWS.
 LIBXT_OTHER=@LIBXT_OTHER@
 
-## Only used if HAVE_X11 && !USE_GTK.
-## really-lwlib if USE_X_TOOLKIT, else really-oldxmenu.
+## If !HAVE_X11 || USE_GTK, empty.
+## Else if USE_X_TOOLKIT really-lwlib, else really-oldxmenu.
 OLDXMENU_TARGET=@OLDXMENU_TARGET@
 
 ## If !HAVE_X11 || USE_GTK, empty.
 ## Else if USE_X_TOOLKIT, ${lwlibdir}liblw.a.
 ## Else ${oldXMenudir}libXMenu11.a.
+## (Actually, rather than being empty, it is set to "nothing".
+## It is never actually used for anything in this case.
+## This is done because there is a rule with target $(OLDXMENU) below,
+## and I think it might be a syntax error with some makes to have
+## an empty target, even if the associated rule is never run.
+## http://lists.gnu.org/archive/html/help-make/2010-05/msg00058.html
+## The alternative would be to put that rule in a makefile fragment.)
 OLDXMENU=@OLDXMENU@
 
 ## If HAVE_X11 && !USE_GTK, ${OLDXMENU} ../src/${OLDXMENU}; else empty.
@@ -282,16 +291,20 @@
 
 UNEXEC_OBJ = @unexec@
 
+CANNOT_DUMP=@cannot_dump@
+
+DEPDIR=deps
+## -MMD -MF ${DEPDIR}/$*.d if AUTO_DEPEND; else empty.
+DEPFLAGS=@DEPFLAGS@
+## test -d ${DEPDIR} || mkdir ${DEPDIR} (if AUTO_DEPEND); else ':'.
+MKDEPDIR=@MKDEPDIR@
+
 # ========================== start of cpp stuff =======================
 /* From here on, comments must be done in C syntax.  */
 
 #define NOT_C_CODE
 #include "config.h"
 
-#ifdef AUTO_DEPEND
-DEPFLAGS = -MMD -MF deps/$*.d
-#endif
-
 /* If NS_IMPL_GNUSTEP, some definitions and includes are expanded here.  */
 @NS_IMPL_GNUSTEP_INC@
 
@@ -318,63 +331,13 @@
 
 .SUFFIXES: .m
 .c.o:
-#ifdef AUTO_DEPEND
-	@-test -d deps || mkdir deps
-#endif
+	@$(MKDEPDIR)
 	$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $<
 .m.o:
-#ifdef AUTO_DEPEND
-	@-test -d deps || mkdir deps
-#endif
+	@$(MKDEPDIR)
 	$(CC) -c $(CPPFLAGS) $(ALL_OBJC_CFLAGS) $<
 
 
-/* A macro which other sections of Makefile can redefine to munge the
-   flags before they are passed to LD.  This is helpful if you have
-   redefined LD to something odd, like "gcc".
-   (The YMF prefix is a holdover from the old name "ymakefile".)  */
-#define YMF_PASS_LDFLAGS(flags) flags
-
-
-#ifdef ORDINARY_LINK
-LD = $(CC)
-
-#else /* not ORDINARY_LINK */
-GNULIB_VAR = $(LIB_GCC)
-
-/* Fix linking if compiled with GCC.  */
-#if defined (__GNUC__) && ! defined (LINKER)
-/* Versions of GCC >= 2.0 put their library, libgcc.a, in obscure
-   places that are difficult to figure out at make time.  Fortunately,
-   these same versions allow you to pass arbitrary flags on to the
-   linker, so there is no reason not to use it as a linker.
-
-   Well, it is not quite perfect.  The "-nostdlib" keeps GCC from
-   searching for libraries in its internal directories, so we have to
-   ask GCC explicitly where to find libgcc.a.  */
-#define LINKER $(CC) -nostdlib
-/* GCC passes any argument prefixed with -Xlinker directly to the linker.
-   See prefix-args.c for an explanation of why we do not do this with the
-   shell''s ``for'' construct.  Note that sane people do not have '.' in
-   their paths, so we must use ./prefix-args.  */
-#undef YMF_PASS_LDFLAGS
-#define YMF_PASS_LDFLAGS(flags) `./prefix-args -Xlinker flags`
-#endif /* defined (__GNUC__) && ! defined (LINKER) */
-
-#ifdef LINKER
-LD=LINKER
-#else /* not LINKER */
-LD=ld
-#endif /* not LINKER */
-
-#endif /* not ORDINARY_LINK */
-
-
-#ifdef NS_IMPL_GNUSTEP
-LD=$(CC) -rdynamic
-#endif
-
-
 /* lastfile must follow all files whose initialized data areas should
    be dumped as pure by dump-emacs.  */
 obj=    dispnew.o frame.o scroll.o xdisp.o menu.o $(XMENU_OBJ) window.o \
@@ -634,29 +597,29 @@
 /* Construct full set of libraries to be linked.
    Note that SunOS needs -lm to come before -lc; otherwise, you get
    duplicated symbols.  If the standard libraries were compiled
-   with GCC, we might need gnulib again after them.  */
+   with GCC, we might need LIB_GCC again after them.  */
 
 LIBES = $(LOADLIBES) $(LIBS) $(LIBX_BASE) $(LIBX_OTHER) $(LIBSOUND) \
    $(RSVG_LIBS) $(DBUS_LIBS) $(LIBGPM) $(LIBRESOLV) $(LIBS_SYSTEM) \
    $(LIBS_TERMCAP) $(GETLOADAVG_LIBS) ${GCONF_LIBS} ${LIBSELINUX_LIBS} \
    $(FREETYPE_LIBS) $(FONTCONFIG_LIBS) $(LIBOTF_LIBS) $(M17N_FLT_LIBS) \
-   $(GNULIB_VAR) $(LIB_MATH) $(LIB_STANDARD) $(GNULIB_VAR)
+   $(LIB_GCC) $(LIB_MATH) $(LIB_STANDARD) $(LIB_GCC)
 
 all: emacs${EXEEXT} $(OTHER_FILES)
 
 /* Does anyone ever pay attention to the load-path-shadows output here?  */
+/* The dumped Emacs is as functional and more efficient than
+   bootstrap-emacs, so we replace the latter with the former.  */
 emacs${EXEEXT}: temacs${EXEEXT} ${etc}DOC ${lisp}
-#ifdef CANNOT_DUMP
-	rm -f emacs${EXEEXT}
-	ln temacs${EXEEXT} emacs${EXEEXT}
-	-EMACSLOADPATH=${lispsource} ./emacs -q -batch -f list-load-path-shadows
-#else
-	LC_ALL=C $(RUN_TEMACS) -batch -l loadup dump
-	@: This new Emacs is as functional and more efficient then
-	@: bootstrap-emacs, so let us replace it.
-	-ln -f emacs${EXEEXT} bootstrap-emacs${EXEEXT}
-	-./emacs -q -batch -f list-load-path-shadows
-#endif /* ! defined (CANNOT_DUMP) */
+	if test "${CANNOT_DUMP}" = "yes"; then \
+	  ln -f temacs${EXEEXT} emacs${EXEEXT}; \
+	  EMACSLOADPATH=${lispsource} ./emacs -q -batch \
+	    -f list-load-path-shadows || true; \
+	else \
+	  LC_ALL=C $(RUN_TEMACS) -batch -l loadup dump || exit 1; \
+	  ln -f emacs${EXEEXT} bootstrap-emacs${EXEEXT}; \
+	  ./emacs -q -batch -f list-load-path-shadows || true; \
+	fi
 
 /* We run make-docfile twice because the command line may get too long
    on some systems.  */
@@ -682,6 +645,8 @@
 buildobj.h: Makefile
 	echo "#define BUILDOBJ \"${obj} ${otherobj} " "\"" > buildobj.h
 
+#define YMF_PASS_LDFLAGS(flags) @YMF_PASS_LDFLAGS@
+
 temacs${EXEEXT}: $(START_FILES) stamp-oldxmenu ${obj} ${otherobj} prefix-args${EXEEXT}
 	$(LD) YMF_PASS_LDFLAGS ( ${TEMACS_LDFLAGS} \
 	  ${NS_IMPL_GNUSTEP_TEMACS_LDFLAGS} ) \
@@ -692,8 +657,9 @@
 	$(CC) $(LDFLAGS) prefix-args.o -o prefix-args
 
 
-/* Only (possibly) used if HAVE_X11 && !USE_GTK, but no harm in always
-   defining.  */
+/* The following oldxmenu-related rules are only (possibly) used if
+   HAVE_X11 && !USE_GTK, but there is no harm in always defining them
+   (provided we take a little care that OLDXMENU is never empty).  */
 really-lwlib:
 	cd ${lwlibdir}; ${MAKE} ${MFLAGS} \
     CC='${CC}' CFLAGS='${CFLAGS}' MAKE='${MAKE}'
@@ -711,13 +677,10 @@
 stamp-oldxmenu: ${OLDXMENU_DEPS}
 	touch stamp-oldxmenu
 
-/* HAVE_X11 implies HAVE_X_WINDOWS and HAVE_MENUS.  */
-#if defined (HAVE_X11) && ! defined (USE_GTK)
 /* Supply an ordering for parallel make.  */
 ../src/$(OLDXMENU): ${OLDXMENU}
 
 $(OLDXMENU): $(OLDXMENU_TARGET)
-#endif /* HAVE_X11 && !USE_GTK */ 
 
 ../config.status:: epaths.in
 	@echo "The file epaths.h needs to be set up from epaths.in."
@@ -730,278 +693,14 @@
 	exit 1
 
 ecrt0.o: ecrt0.c $(config_h)
-#ifdef AUTO_DEPEND
-	@-test -d deps || mkdir deps
-#endif
+	@$(MKDEPDIR)
 	$(CC) -c $(ALL_CFLAGS) ${srcdir}/ecrt0.c
 doc.o: buildobj.h
 
-#ifndef AUTO_DEPEND
-
-/* FIXME some of these dependencies are platform-specific.
-Eg callproc.c only depends on w32.h for WINDOWSNT builds.
-One way to fix this would be to replace w32.h (etc) by $(W32_H),
-a variable set by configure.  Does not seem worth the trouble.
-Since the w32 build does not even use this file, you might ask
-why these dependencies are here at all...
 
-nsgui.h: In fact, every .o file depends directly or indirectly on
-dispextern.h and hence nsgui.h under NS.  But the ones that actually
-use stuff there are more limited.  */
-atimer.o: atimer.c atimer.h syssignal.h systime.h lisp.h blockinput.h \
- $(config_h)
-bidi.o: bidi.c buffer.h character.h dispextern.h lisp.h $(config_h)
-buffer.o: buffer.c buffer.h region-cache.h commands.h window.h \
-   $(INTERVALS_H) blockinput.h atimer.h systime.h character.h \
-   indent.h keyboard.h coding.h keymap.h frame.h lisp.h $(config_h)
-callint.o: callint.c window.h commands.h buffer.h keymap.h \
-   keyboard.h dispextern.h systime.h coding.h composite.h lisp.h $(config_h)
-callproc.o: callproc.c epaths.h buffer.h commands.h lisp.h $(config_h) \
-	process.h systty.h syssignal.h character.h coding.h ccl.h msdos.h \
-        composite.h w32.h blockinput.h atimer.h systime.h frame.h termhooks.h \
-        buffer.h
-casefiddle.o: casefiddle.c syntax.h commands.h buffer.h character.h \
-   composite.h keymap.h lisp.h $(config_h)
-casetab.o: casetab.c buffer.h character.h lisp.h $(config_h)
-category.o: category.c category.h buffer.h charset.h keymap.h	\
-	character.h lisp.h $(config_h)
-ccl.o: ccl.c ccl.h charset.h character.h coding.h composite.h lisp.h $(config_h)
-character.o: character.c character.h buffer.h charset.h composite.h disptab.h \
-   lisp.h $(config_h)
-charset.o: charset.c charset.h character.h buffer.h coding.h composite.h \
-   disptab.h lisp.h $(config_h)
-chartab.o: charset.h character.h ccl.h lisp.h $(config_h)
-coding.o: coding.c coding.h ccl.h buffer.h character.h charset.h composite.h \
-	window.h dispextern.h frame.h termhooks.h lisp.h $(config_h)
-cm.o: cm.c frame.h cm.h termhooks.h termchar.h dispextern.h lisp.h $(config_h)
-cmds.o: cmds.c syntax.h buffer.h character.h commands.h window.h lisp.h $(config_h) \
-	msdos.h dispextern.h keyboard.h keymap.h systime.h coding.h frame.h \
-        composite.h
-pre-crt0.o: pre-crt0.c
-dbusbind.o: dbusbind.c termhooks.h frame.h keyboard.h lisp.h $(config_h)
-dired.o: dired.c commands.h buffer.h lisp.h $(config_h) character.h charset.h \
-   coding.h regex.h systime.h blockinput.h atimer.h composite.h
-dispnew.o: dispnew.c systime.h commands.h process.h frame.h coding.h \
-   window.h buffer.h termchar.h termopts.h termhooks.h cm.h \
-   disptab.h indent.h $(INTERVALS_H) nsgui.h \
-   xterm.h blockinput.h atimer.h character.h msdos.h keyboard.h \
-   syssignal.h lisp.h $(config_h)
-doc.o: doc.c lisp.h $(config_h) epaths.h buffer.h keyboard.h keymap.h \
-   character.h systime.h coding.h composite.h
-doprnt.o: doprnt.c character.h lisp.h $(config_h)
-dosfns.o: buffer.h termchar.h termhooks.h frame.h blockinput.h window.h \
-   msdos.h dosfns.h dispextern.h charset.h coding.h atimer.h systime.h \
-   lisp.h $(config_h)
-editfns.o: editfns.c window.h buffer.h systime.h $(INTERVALS_H) character.h \
-   coding.h frame.h blockinput.h atimer.h lisp.h $(config_h)
-emacs.o: emacs.c commands.h systty.h syssignal.h blockinput.h process.h \
-   termhooks.h buffer.h atimer.h systime.h $(INTERVALS_H) lisp.h $(config_h) \
-   window.h dispextern.h keyboard.h keymap.h frame.h coding.h
-fileio.o: fileio.c window.h buffer.h systime.h $(INTERVALS_H) character.h \
-   coding.h msdos.h blockinput.h atimer.h lisp.h $(config_h) frame.h commands.h
-filelock.o: filelock.c buffer.h character.h coding.h systime.h composite.h \
-   lisp.h $(config_h)
-filemode.o: filemode.c $(config_h)
-frame.o: frame.c xterm.h window.h frame.h termhooks.h commands.h keyboard.h \
-   blockinput.h atimer.h systime.h buffer.h character.h fontset.h font.h    \
-   msdos.h dosfns.h dispextern.h w32term.h nsgui.h termchar.h coding.h \
-   composite.h lisp.h $(config_h) termhooks.h ccl.h
-fringe.o: fringe.c dispextern.h nsgui.h frame.h window.h buffer.h termhooks.h \
-   blockinput.h atimer.h systime.h lisp.h $(config_h)
-font.o: font.c dispextern.h frame.h window.h ccl.h character.h charset.h \
-   font.h lisp.h $(config_h) buffer.h composite.h fontset.h xterm.h nsgui.h
-ftfont.o: dispextern.h frame.h character.h charset.h composite.h font.h \
-   lisp.h $(config_h) blockinput.h atimer.h systime.h coding.h fontset.h \
-   ccl.h ftfont.h
-fontset.o: fontset.c fontset.h ccl.h buffer.h character.h \
-   charset.h frame.h keyboard.h termhooks.h font.h lisp.h $(config_h) \
-   blockinput.h atimer.h systime.h coding.h $(INTERVALS_H) nsgui.h \
-   window.h xterm.h
-getloadavg.o: getloadavg.c $(config_h)
-gtkutil.o: gtkutil.c gtkutil.h xterm.h lisp.h frame.h lisp.h $(config_h) \
-  blockinput.h window.h atimer.h systime.h termhooks.h keyboard.h \
-  charset.h coding.h syssignal.h dispextern.h composite.h
-image.o: image.c frame.h window.h dispextern.h blockinput.h atimer.h \
-   systime.h xterm.h w32term.h w32gui.h font.h epaths.h character.h coding.h \
-   nsterm.h nsgui.h lisp.h $(config_h) composite.h termhooks.h ccl.h
-indent.o: indent.c frame.h window.h indent.h buffer.h lisp.h $(config_h) termchar.h \
-   termopts.h disptab.h region-cache.h character.h category.h \
-   keyboard.h systime.h coding.h $(INTERVALS_H)
-insdel.o: insdel.c window.h buffer.h $(INTERVALS_H) blockinput.h character.h \
-   dispextern.h atimer.h systime.h region-cache.h lisp.h $(config_h)
-keyboard.o: keyboard.c termchar.h termhooks.h termopts.h buffer.h character.h \
-   commands.h frame.h window.h macros.h disptab.h keyboard.h syssignal.h \
-   systime.h syntax.h $(INTERVALS_H) blockinput.h atimer.h composite.h \
-   xterm.h puresize.h msdos.h keymap.h w32term.h nsterm.h nsgui.h coding.h \
-   lisp.h $(config_h)
-keymap.o: keymap.c buffer.h commands.h keyboard.h termhooks.h blockinput.h \
-   atimer.h systime.h puresize.h character.h charset.h $(INTERVALS_H) keymap.h window.h \
-   coding.h frame.h lisp.h $(config_h)
-lastfile.o: lastfile.c $(config_h)
-macros.o: macros.c window.h buffer.h commands.h macros.h keyboard.h \
-	dispextern.h lisp.h $(config_h) systime.h coding.h composite.h
-gmalloc.o: gmalloc.c $(config_h)
-ralloc.o: ralloc.c lisp.h $(config_h)
-vm-limit.o: vm-limit.c mem-limits.h lisp.h $(config_h)
-marker.o: marker.c buffer.h character.h lisp.h $(config_h)
-md5.o: md5.c md5.h $(config_h)
-minibuf.o: minibuf.c syntax.h frame.h window.h keyboard.h systime.h \
-   buffer.h commands.h character.h msdos.h $(INTERVALS_H) keymap.h \
-   termhooks.h lisp.h $(config_h) coding.h
-mktime.o: mktime.c $(config_h)
-msdos.o: msdos.c msdos.h dosfns.h systime.h termhooks.h dispextern.h frame.h \
-   termopts.h termchar.h character.h coding.h ccl.h disptab.h window.h \
-   keyboard.h $(INTERVALS_H) buffer.h commands.h blockinput.h atimer.h lisp.h $(config_h)
-nsfns.o: nsfns.m charset.h nsterm.h nsgui.h frame.h window.h buffer.h \
-  dispextern.h fontset.h $(INTERVALS_H) keyboard.h blockinput.h \
-  atimer.h systime.h epaths.h termhooks.h coding.h systime.h lisp.h $(config_h)
-nsfont.o: nsterm.h dispextern.h frame.h lisp.h lisp.h $(config_h)
-nsimage.o: nsimage.m nsterm.h lisp.h $(config_h)
-nsmenu.o: nsmenu.m termhooks.h frame.h window.h dispextern.h \
-  nsgui.h keyboard.h blockinput.h atimer.h systime.h buffer.h \
-  nsterm.h lisp.h $(config_h)
-nsterm.o: nsterm.m blockinput.h atimer.h systime.h syssignal.h nsterm.h \
-  nsgui.h frame.h charset.h ccl.h dispextern.h fontset.h termhooks.h \
-  termopts.h termchar.h disptab.h buffer.h window.h keyboard.h \
-  $(INTERVALS_H) process.h coding.h lisp.h $(config_h)
-nsselect.o: nsselect.m blockinput.h nsterm.h nsgui.h frame.h lisp.h $(config_h)
-process.o: process.c process.h buffer.h window.h termhooks.h termopts.h \
-   commands.h syssignal.h systime.h systty.h syswait.h frame.h dispextern.h \
-   blockinput.h atimer.h charset.h coding.h ccl.h msdos.h composite.h \
-   keyboard.h lisp.h $(config_h) character.h xgselect.h sysselect.h
-regex.o: regex.c syntax.h buffer.h lisp.h $(config_h) regex.h category.h character.h
-region-cache.o: region-cache.c buffer.h region-cache.h lisp.h $(config_h)
-scroll.o: scroll.c termchar.h dispextern.h frame.h msdos.h keyboard.h \
-   termhooks.h lisp.h $(config_h) systime.h coding.h composite.h window.h
-search.o: search.c regex.h commands.h buffer.h region-cache.h syntax.h \
-   blockinput.h atimer.h systime.h category.h character.h charset.h \
-   $(INTERVALS_H) \
-   lisp.h $(config_h)
-sound.o: sound.c dispextern.h syssignal.h lisp.h $(config_h) atimer.h systime.h
-strftime.o: strftime.c $(config_h)
-syntax.o: syntax.c syntax.h buffer.h commands.h category.h character.h \
-   keymap.h regex.h $(INTERVALS_H) lisp.h $(config_h)
-sysdep.o: sysdep.c syssignal.h systty.h systime.h syswait.h blockinput.h \
-   process.h dispextern.h termhooks.h termchar.h termopts.h coding.h \
-   frame.h atimer.h window.h msdos.h dosfns.h keyboard.h cm.h lisp.h $(config_h) \
-   composite.h
-term.o: term.c termchar.h termhooks.h termopts.h lisp.h $(config_h) cm.h frame.h \
-   disptab.h keyboard.h character.h charset.h coding.h ccl.h xterm.h \
-   msdos.h window.h keymap.h blockinput.h atimer.h systime.h systty.h \
-   syssignal.h $(INTERVALS_H) buffer.h
-termcap.o: termcap.c lisp.h $(config_h)
-terminal.o: terminal.c frame.h termchar.h termhooks.h charset.h coding.h \
-   keyboard.h lisp.h $(config_h) dispextern.h composite.h systime.h
-terminfo.o: terminfo.c lisp.h $(config_h)
-tparam.o: tparam.c lisp.h $(config_h)
-undo.o: undo.c buffer.h commands.h window.h dispextern.h lisp.h $(config_h)
-unexaix.o: unexaix.c lisp.h $(config_h)
-unexalpha.o: unexalpha.c $(config_h)
-unexcw.o: unexcw.c lisp.h $(config_h)
-unexec.o: unexec.c lisp.h $(config_h)
-unexelf.o: unexelf.c $(config_h)
-unexhp9k800.o: unexhp9k800.c $(config_h)
-unexmacosx.o: unexmacosx.c $(config_h)
-unexsol.o: unexsol.c lisp.h $(config_h)
-unexw32.o: unexw32.c $(config_h)
-w16select.o: w16select.c dispextern.h frame.h blockinput.h atimer.h systime.h \
-   msdos.h buffer.h charset.h coding.h composite.h lisp.h $(config_h)
-widget.o: widget.c xterm.h frame.h dispextern.h widgetprv.h \
-   $(srcdir)/../lwlib/lwlib.h lisp.h $(config_h)
-window.o: window.c indent.h commands.h frame.h window.h buffer.h termchar.h \
-   disptab.h keyboard.h msdos.h coding.h termhooks.h \
-   keymap.h blockinput.h atimer.h systime.h $(INTERVALS_H) \
-   xterm.h w32term.h nsterm.h nsgui.h lisp.h $(config_h)
-xdisp.o: xdisp.c macros.h commands.h process.h indent.h buffer.h dispextern.h \
-   coding.h termchar.h frame.h window.h disptab.h termhooks.h character.h \
-   charset.h lisp.h $(config_h) keyboard.h $(INTERVALS_H) region-cache.h \
-   xterm.h w32term.h nsterm.h nsgui.h msdos.h composite.h fontset.h ccl.h \
-   blockinput.h atimer.h systime.h keymap.h font.h
-xfaces.o: xfaces.c dispextern.h frame.h xterm.h buffer.h blockinput.h	\
-   window.h character.h charset.h msdos.h dosfns.h composite.h atimer.h	\
-   systime.h keyboard.h fontset.h w32term.h nsterm.h coding.h ccl.h \
-   $(INTERVALS_H) nsgui.h termchar.h termhooks.h font.h lisp.h $(config_h)
-xfns.o: xfns.c buffer.h frame.h window.h keyboard.h xterm.h dispextern.h \
-   $(srcdir)/../lwlib/lwlib.h blockinput.h atimer.h systime.h epaths.h \
-   character.h charset.h coding.h gtkutil.h lisp.h $(config_h) termhooks.h \
-   fontset.h termchar.h font.h xsettings.h $(INTERVALS_H) ccl.h
-xfont.o: dispextern.h xterm.h frame.h blockinput.h character.h charset.h \
-   font.h lisp.h $(config_h) atimer.h systime.h fontset.h ccl.h
-xftfont.o: dispextern.h xterm.h frame.h blockinput.h character.h charset.h \
-   font.h lisp.h $(config_h) atimer.h systime.h fontset.h ccl.h ftfont.h
-ftxfont.o: dispextern.h xterm.h frame.h blockinput.h character.h charset.h \
-   font.h lisp.h $(config_h) atimer.h systime.h fontset.h ccl.h
-menu.o: menu.c lisp.h keyboard.h keymap.h frame.h termhooks.h blockinput.h \
-   dispextern.h $(srcdir)/../lwlib/lwlib.h xterm.h gtkutil.h menu.h \
-   lisp.h $(config_h) systime.h coding.h composite.h window.h atimer.h nsgui.h
-xmenu.o: xmenu.c xterm.h termhooks.h window.h dispextern.h frame.h buffer.h \
-   charset.h keyboard.h $(srcdir)/../lwlib/lwlib.h blockinput.h atimer.h \
-   systime.h gtkutil.h msdos.h coding.h menu.h lisp.h $(config_h) composite.h \
-   keymap.h sysselect.h
-xterm.o: xterm.c xterm.h termhooks.h termopts.h termchar.h window.h buffer.h \
-   dispextern.h frame.h disptab.h blockinput.h atimer.h systime.h syssignal.h \
-   keyboard.h emacs-icon.h character.h charset.h ccl.h fontset.h composite.h \
-   coding.h process.h gtkutil.h font.h fontset.h lisp.h $(config_h) \
-   xsettings.h intervals.h keymap.h xgselect.h sysselect.h
-xselect.o: xselect.c process.h dispextern.h frame.h xterm.h blockinput.h \
-  buffer.h atimer.h systime.h termhooks.h lisp.h $(config_h) keyboard.h \
-  coding.h composite.h
-xgselect.o: xgselect.h systime.h sysselect.h lisp.h $(config_h)
-xrdb.o: xrdb.c lisp.h $(config_h) epaths.h
-xsmfns.o: xsmfns.c lisp.h $(config_h) systime.h sysselect.h termhooks.h xterm.h \
-  lisp.h termopts.h frame.h dispextern.h
-xsettings.o: xterm.h xsettings.h lisp.h frame.h termhooks.h $(config_h) \
-  dispextern.h keyboard.h systime.h coding.h composite.h blockinput.h atimer.h \
-  termopts.h
+/* If HAVE_NS, some ns-specific rules (for OTHER_FILES) are inserted here.  */
+@ns_frag@
 
-/* The files of Lisp proper.  */
-alloc.o: alloc.c process.h frame.h window.h buffer.h  puresize.h syssignal.h \
- keyboard.h blockinput.h atimer.h systime.h character.h lisp.h $(config_h) \
- $(INTERVALS_H) termhooks.h
-bytecode.o: bytecode.c buffer.h syntax.h character.h window.h dispextern.h \
-  frame.h xterm.h lisp.h $(config_h)
-data.o: data.c buffer.h puresize.h character.h syssignal.h keyboard.h frame.h \
-   termhooks.h systime.h coding.h composite.h dispextern.h font.h ccl.h \
-   lisp.h $(config_h)
-eval.o: eval.c commands.h keyboard.h blockinput.h atimer.h systime.h \
-  dispextern.h lisp.h $(config_h) coding.h composite.h xterm.h
-floatfns.o: floatfns.c syssignal.h lisp.h $(config_h)
-fns.o: fns.c commands.h lisp.h $(config_h) frame.h buffer.h character.h keyboard.h \
- keymap.h window.h dispextern.h $(INTERVALS_H) coding.h md5.h \
- blockinput.h atimer.h systime.h xterm.h
-print.o: print.c process.h frame.h window.h buffer.h keyboard.h character.h \
-   lisp.h $(config_h) termchar.h $(INTERVALS_H) msdos.h termhooks.h \
-   blockinput.h atimer.h systime.h font.h charset.h coding.h ccl.h
-lread.o: lread.c commands.h keyboard.h buffer.h epaths.h character.h \
- charset.h lisp.h $(config_h) $(INTERVALS_H) termhooks.h coding.h msdos.h \
- systime.h frame.h blockinput.h atimer.h
-
-/* Text properties support.  */
-composite.o: composite.c buffer.h character.h coding.h font.h ccl.h \
-	 frame.h termhooks.h $(INTERVALS_H) window.h lisp.h $(config_h)
-intervals.o: intervals.c buffer.h $(INTERVALS_H) keyboard.h puresize.h \
-	keymap.h lisp.h $(config_h) systime.h coding.h
-textprop.o: textprop.c buffer.h window.h $(INTERVALS_H) \
-	lisp.h $(config_h)
-
-#endif /* ! AUTO_DEPEND */
-
-/* System-specific programs to be made.
-   OTHER_FILES select which of these should be compiled.  */
-
-#ifdef HAVE_NS
-${ns_appdir}: ${ns_appsrc}
-	rm -fr ${ns_appdir}
-	mkdir -p ${ns_appdir}
-	( cd ${ns_appsrc} ; tar cfh - . ) | ( cd ${ns_appdir} ; umask 022; tar xf - )
-#endif /* HAVE_NS */
-
-/* These are only used if HAVE_NS, but no harm in always defining them.  */
-${ns_appbindir}Emacs: emacs${EXEEXT}
-	mkdir -p ${ns_appbindir}
-	cp -f emacs${EXEEXT} ${ns_appbindir}Emacs
-
-ns-app: ${ns_appdir} ${ns_appbindir}Emacs
 
 mostlyclean:
 	rm -f temacs${EXEEXT} prefix-args${EXEEXT} core *.core \#* *.o libXMenu11.a liblw.a
@@ -1010,7 +709,7 @@
 	rm -f buildobj.h
 clean: mostlyclean
 	rm -f emacs-*.*.*${EXEEXT} emacs${EXEEXT}
-	-rm -rf deps
+	-rm -rf ${DEPDIR}
 	test "X${ns_appdir}" = "X" || rm -rf ${ns_appdir}
 
 /* bootstrap-clean is used to clean up just before a bootstrap.
@@ -1102,16 +801,14 @@
 
 bootstrap-emacs${EXEEXT}: temacs${EXEEXT}
 	cd ../lisp; $(MAKE) $(MFLAGS) update-subdirs
-#ifdef CANNOT_DUMP
-	ln -f temacs${EXEEXT} bootstrap-emacs${EXEEXT}
-#else
-	$(RUN_TEMACS) --batch --load loadup bootstrap
-	mv -f emacs${EXEEXT} bootstrap-emacs${EXEEXT}
-#endif /* ! defined (CANNOT_DUMP) */
+	if test "${CANNOT_DUMP}" = "yes"; then \
+	  ln -f temacs${EXEEXT} bootstrap-emacs${EXEEXT}; \
+	else \
+	  $(RUN_TEMACS) --batch --load loadup bootstrap || exit 1; \
+	  mv -f emacs${EXEEXT} bootstrap-emacs${EXEEXT}; \
+	fi
 	@: Compile some files earlier to speed up further compilation.
 	cd ../lisp; $(MAKE) $(MFLAGS) compile-first EMACS=${bootstrap_exe}
 
-#ifdef AUTO_DEPEND
-ALLOBJS=$(START_FILES) ${obj} ${otherobj} prefix-args.o
--include $(ALLOBJS:%.o=deps/%.d)
-#endif
+/* Insert either autodeps.mk (if AUTO_DEPEND), else deps.mk.  */
+@deps_frag@
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/autodeps.mk	Sat May 22 22:32:21 2010 +0300
@@ -0,0 +1,6 @@
+/* autodeps.mk --- src/Makefile fragment for GNU Emacs
+
+This is inserted in src/Makefile if AUTO_DEPEND=yes.  */
+
+ALLOBJS=$(START_FILES) ${obj} ${otherobj} prefix-args.o
+-include $(ALLOBJS:%.o=${DEPDIR}/%.d)
--- a/src/character.c	Sat May 22 17:13:04 2010 +0300
+++ b/src/character.c	Sat May 22 22:32:21 2010 +0300
@@ -961,10 +961,13 @@
      int n;
      Lisp_Object *args;
 {
-  int i;
-  unsigned char *buf = (unsigned char *) alloca (MAX_MULTIBYTE_LENGTH * n);
-  unsigned char *p = buf;
-  int c;
+  int i, c;
+  unsigned char *buf, *p;
+  Lisp_Object str;
+  USE_SAFE_ALLOCA;
+
+  SAFE_ALLOCA (buf, unsigned char *, MAX_MULTIBYTE_LENGTH * n);
+  p = buf;
 
   for (i = 0; i < n; i++)
     {
@@ -973,7 +976,9 @@
       p += CHAR_STRING (c, p);
     }
 
-  return make_string_from_bytes ((char *) buf, n, p - buf);
+  str = make_string_from_bytes ((char *) buf, n, p - buf);
+  SAFE_FREE ();
+  return str;
 }
 
 DEFUN ("unibyte-string", Funibyte_string, Sunibyte_string, 0, MANY, 0,
@@ -983,10 +988,13 @@
      int n;
      Lisp_Object *args;
 {
-  int i;
-  unsigned char *buf = (unsigned char *) alloca (n);
-  unsigned char *p = buf;
-  unsigned c;
+  int i, c;
+  unsigned char *buf, *p;
+  Lisp_Object str;
+  USE_SAFE_ALLOCA;
+
+  SAFE_ALLOCA (buf, unsigned char *, n);
+  p = buf;
 
   for (i = 0; i < n; i++)
     {
@@ -997,7 +1005,9 @@
       *p++ = c;
     }
 
-  return make_string_from_bytes ((char *) buf, n, p - buf);
+  str = make_string_from_bytes ((char *) buf, n, p - buf);
+  SAFE_FREE ();
+  return str;
 }
 
 DEFUN ("char-resolve-modifiers", Fchar_resolve_modifiers,
--- a/src/config.in	Sat May 22 17:13:04 2010 +0300
+++ b/src/config.in	Sat May 22 22:32:21 2010 +0300
@@ -27,9 +27,6 @@
 #define EMACS_CONFIG_H
 
 
-/* Generate dependencies with gcc. */
-#undef AUTO_DEPEND
-
 /* Define to 1 if the mktime function is broken. */
 #undef BROKEN_MKTIME
 
@@ -841,6 +838,9 @@
 /* Define to 1 if you are using NS windowing under GNUstep. */
 #undef NS_IMPL_GNUSTEP
 
+/* Define if the C compiler is the linker. */
+#undef ORDINARY_LINK
+
 /* Define to the address where bug reports for this package should be sent. */
 #undef PACKAGE_BUGREPORT
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/deps.mk	Sat May 22 22:32:21 2010 +0300
@@ -0,0 +1,279 @@
+/* deps.mk --- src/Makefile fragment for GNU Emacs
+
+Copyright (C) 1985, 1987, 1988, 1993, 1994, 1995, 1999, 2000, 2001, 2002,
+  2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+  Free Software Foundation, Inc.
+
+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 is inserted in src/Makefile if AUTO_DEPEND=no.
+It defines static dependencies between the various source files.
+
+FIXME some of these dependencies are platform-specific.
+Eg callproc.c only depends on w32.h for WINDOWSNT builds.
+One way to fix this would be to replace w32.h (etc) by $(W32_H),
+a variable set by configure.  Does not seem worth the trouble.
+Since the w32 build does not even use this file, you might ask
+why these dependencies are here at all...
+
+nsgui.h: In fact, every .o file depends directly or indirectly on
+dispextern.h and hence nsgui.h under NS.  But the ones that actually
+use stuff there are more limited.
+
+Code:  */
+
+atimer.o: atimer.c atimer.h syssignal.h systime.h lisp.h blockinput.h \
+ $(config_h)
+bidi.o: bidi.c buffer.h character.h dispextern.h lisp.h $(config_h)
+buffer.o: buffer.c buffer.h region-cache.h commands.h window.h \
+   $(INTERVALS_H) blockinput.h atimer.h systime.h character.h \
+   indent.h keyboard.h coding.h keymap.h frame.h lisp.h $(config_h)
+callint.o: callint.c window.h commands.h buffer.h keymap.h \
+   keyboard.h dispextern.h systime.h coding.h composite.h lisp.h $(config_h)
+callproc.o: callproc.c epaths.h buffer.h commands.h lisp.h $(config_h) \
+   process.h systty.h syssignal.h character.h coding.h ccl.h msdos.h \
+   composite.h w32.h blockinput.h atimer.h systime.h frame.h termhooks.h \
+   buffer.h
+casefiddle.o: casefiddle.c syntax.h commands.h buffer.h character.h \
+   composite.h keymap.h lisp.h $(config_h)
+casetab.o: casetab.c buffer.h character.h lisp.h $(config_h)
+category.o: category.c category.h buffer.h charset.h keymap.h	\
+   character.h lisp.h $(config_h)
+ccl.o: ccl.c ccl.h charset.h character.h coding.h composite.h lisp.h $(config_h)
+character.o: character.c character.h buffer.h charset.h composite.h disptab.h \
+   lisp.h $(config_h)
+charset.o: charset.c charset.h character.h buffer.h coding.h composite.h \
+   disptab.h lisp.h $(config_h)
+chartab.o: charset.h character.h ccl.h lisp.h $(config_h)
+coding.o: coding.c coding.h ccl.h buffer.h character.h charset.h composite.h \
+   window.h dispextern.h frame.h termhooks.h lisp.h $(config_h)
+cm.o: cm.c frame.h cm.h termhooks.h termchar.h dispextern.h lisp.h $(config_h)
+cmds.o: cmds.c syntax.h buffer.h character.h commands.h window.h lisp.h \
+   $(config_h) msdos.h dispextern.h keyboard.h keymap.h systime.h \
+   coding.h frame.h composite.h
+pre-crt0.o: pre-crt0.c
+dbusbind.o: dbusbind.c termhooks.h frame.h keyboard.h lisp.h $(config_h)
+dired.o: dired.c commands.h buffer.h lisp.h $(config_h) character.h charset.h \
+   coding.h regex.h systime.h blockinput.h atimer.h composite.h
+dispnew.o: dispnew.c systime.h commands.h process.h frame.h coding.h \
+   window.h buffer.h termchar.h termopts.h termhooks.h cm.h \
+   disptab.h indent.h $(INTERVALS_H) nsgui.h \
+   xterm.h blockinput.h atimer.h character.h msdos.h keyboard.h \
+   syssignal.h lisp.h $(config_h)
+doc.o: doc.c lisp.h $(config_h) epaths.h buffer.h keyboard.h keymap.h \
+   character.h systime.h coding.h composite.h
+doprnt.o: doprnt.c character.h lisp.h $(config_h)
+dosfns.o: buffer.h termchar.h termhooks.h frame.h blockinput.h window.h \
+   msdos.h dosfns.h dispextern.h charset.h coding.h atimer.h systime.h \
+   lisp.h $(config_h)
+editfns.o: editfns.c window.h buffer.h systime.h $(INTERVALS_H) character.h \
+   coding.h frame.h blockinput.h atimer.h lisp.h $(config_h)
+emacs.o: emacs.c commands.h systty.h syssignal.h blockinput.h process.h \
+   termhooks.h buffer.h atimer.h systime.h $(INTERVALS_H) lisp.h $(config_h) \
+   window.h dispextern.h keyboard.h keymap.h frame.h coding.h
+fileio.o: fileio.c window.h buffer.h systime.h $(INTERVALS_H) character.h \
+   coding.h msdos.h blockinput.h atimer.h lisp.h $(config_h) frame.h commands.h
+filelock.o: filelock.c buffer.h character.h coding.h systime.h composite.h \
+   lisp.h $(config_h)
+filemode.o: filemode.c $(config_h)
+frame.o: frame.c xterm.h window.h frame.h termhooks.h commands.h keyboard.h \
+   blockinput.h atimer.h systime.h buffer.h character.h fontset.h font.h    \
+   msdos.h dosfns.h dispextern.h w32term.h nsgui.h termchar.h coding.h \
+   composite.h lisp.h $(config_h) termhooks.h ccl.h
+fringe.o: fringe.c dispextern.h nsgui.h frame.h window.h buffer.h termhooks.h \
+   blockinput.h atimer.h systime.h lisp.h $(config_h)
+font.o: font.c dispextern.h frame.h window.h ccl.h character.h charset.h \
+   font.h lisp.h $(config_h) buffer.h composite.h fontset.h xterm.h nsgui.h
+ftfont.o: dispextern.h frame.h character.h charset.h composite.h font.h \
+   lisp.h $(config_h) blockinput.h atimer.h systime.h coding.h fontset.h \
+   ccl.h ftfont.h
+fontset.o: fontset.c fontset.h ccl.h buffer.h character.h \
+   charset.h frame.h keyboard.h termhooks.h font.h lisp.h $(config_h) \
+   blockinput.h atimer.h systime.h coding.h $(INTERVALS_H) nsgui.h \
+   window.h xterm.h
+getloadavg.o: getloadavg.c $(config_h)
+gtkutil.o: gtkutil.c gtkutil.h xterm.h lisp.h frame.h lisp.h $(config_h) \
+   blockinput.h window.h atimer.h systime.h termhooks.h keyboard.h \
+   charset.h coding.h syssignal.h dispextern.h composite.h
+image.o: image.c frame.h window.h dispextern.h blockinput.h atimer.h \
+   systime.h xterm.h w32term.h w32gui.h font.h epaths.h character.h coding.h \
+   nsterm.h nsgui.h lisp.h $(config_h) composite.h termhooks.h ccl.h
+indent.o: indent.c frame.h window.h indent.h buffer.h lisp.h $(config_h) \
+   termchar.h termopts.h disptab.h region-cache.h character.h category.h \
+   keyboard.h systime.h coding.h $(INTERVALS_H)
+insdel.o: insdel.c window.h buffer.h $(INTERVALS_H) blockinput.h character.h \
+   dispextern.h atimer.h systime.h region-cache.h lisp.h $(config_h)
+keyboard.o: keyboard.c termchar.h termhooks.h termopts.h buffer.h character.h \
+   commands.h frame.h window.h macros.h disptab.h keyboard.h syssignal.h \
+   systime.h syntax.h $(INTERVALS_H) blockinput.h atimer.h composite.h \
+   xterm.h puresize.h msdos.h keymap.h w32term.h nsterm.h nsgui.h coding.h \
+   lisp.h $(config_h)
+keymap.o: keymap.c buffer.h commands.h keyboard.h termhooks.h blockinput.h \
+   atimer.h systime.h puresize.h character.h charset.h $(INTERVALS_H) \
+   keymap.h window.h coding.h frame.h lisp.h $(config_h)
+lastfile.o: lastfile.c $(config_h)
+macros.o: macros.c window.h buffer.h commands.h macros.h keyboard.h \
+   dispextern.h lisp.h $(config_h) systime.h coding.h composite.h
+gmalloc.o: gmalloc.c $(config_h)
+ralloc.o: ralloc.c lisp.h $(config_h)
+vm-limit.o: vm-limit.c mem-limits.h lisp.h $(config_h)
+marker.o: marker.c buffer.h character.h lisp.h $(config_h)
+md5.o: md5.c md5.h $(config_h)
+minibuf.o: minibuf.c syntax.h frame.h window.h keyboard.h systime.h \
+   buffer.h commands.h character.h msdos.h $(INTERVALS_H) keymap.h \
+   termhooks.h lisp.h $(config_h) coding.h
+mktime.o: mktime.c $(config_h)
+msdos.o: msdos.c msdos.h dosfns.h systime.h termhooks.h dispextern.h frame.h \
+   termopts.h termchar.h character.h coding.h ccl.h disptab.h window.h \
+   keyboard.h $(INTERVALS_H) buffer.h commands.h blockinput.h atimer.h \
+   lisp.h $(config_h)
+nsfns.o: nsfns.m charset.h nsterm.h nsgui.h frame.h window.h buffer.h \
+   dispextern.h fontset.h $(INTERVALS_H) keyboard.h blockinput.h \
+   atimer.h systime.h epaths.h termhooks.h coding.h systime.h lisp.h $(config_h)
+nsfont.o: nsterm.h dispextern.h frame.h lisp.h lisp.h $(config_h)
+nsimage.o: nsimage.m nsterm.h lisp.h $(config_h)
+nsmenu.o: nsmenu.m termhooks.h frame.h window.h dispextern.h \
+   nsgui.h keyboard.h blockinput.h atimer.h systime.h buffer.h \
+   nsterm.h lisp.h $(config_h)
+nsterm.o: nsterm.m blockinput.h atimer.h systime.h syssignal.h nsterm.h \
+   nsgui.h frame.h charset.h ccl.h dispextern.h fontset.h termhooks.h \
+   termopts.h termchar.h disptab.h buffer.h window.h keyboard.h \
+   $(INTERVALS_H) process.h coding.h lisp.h $(config_h)
+nsselect.o: nsselect.m blockinput.h nsterm.h nsgui.h frame.h lisp.h $(config_h)
+process.o: process.c process.h buffer.h window.h termhooks.h termopts.h \
+   commands.h syssignal.h systime.h systty.h syswait.h frame.h dispextern.h \
+   blockinput.h atimer.h charset.h coding.h ccl.h msdos.h composite.h \
+   keyboard.h lisp.h $(config_h) character.h xgselect.h sysselect.h
+regex.o: regex.c syntax.h buffer.h lisp.h $(config_h) regex.h \
+   category.h character.h
+region-cache.o: region-cache.c buffer.h region-cache.h lisp.h $(config_h)
+scroll.o: scroll.c termchar.h dispextern.h frame.h msdos.h keyboard.h \
+   termhooks.h lisp.h $(config_h) systime.h coding.h composite.h window.h
+search.o: search.c regex.h commands.h buffer.h region-cache.h syntax.h \
+   blockinput.h atimer.h systime.h category.h character.h charset.h \
+   $(INTERVALS_H) \
+   lisp.h $(config_h)
+sound.o: sound.c dispextern.h syssignal.h lisp.h $(config_h) atimer.h systime.h
+strftime.o: strftime.c $(config_h)
+syntax.o: syntax.c syntax.h buffer.h commands.h category.h character.h \
+   keymap.h regex.h $(INTERVALS_H) lisp.h $(config_h)
+sysdep.o: sysdep.c syssignal.h systty.h systime.h syswait.h blockinput.h \
+   process.h dispextern.h termhooks.h termchar.h termopts.h coding.h \
+   frame.h atimer.h window.h msdos.h dosfns.h keyboard.h cm.h lisp.h \
+   $(config_h) composite.h
+term.o: term.c termchar.h termhooks.h termopts.h lisp.h $(config_h) \
+   cm.h frame.h disptab.h keyboard.h character.h charset.h coding.h ccl.h \
+   xterm.h msdos.h window.h keymap.h blockinput.h atimer.h systime.h \
+   systty.h syssignal.h $(INTERVALS_H) buffer.h
+termcap.o: termcap.c lisp.h $(config_h)
+terminal.o: terminal.c frame.h termchar.h termhooks.h charset.h coding.h \
+   keyboard.h lisp.h $(config_h) dispextern.h composite.h systime.h
+terminfo.o: terminfo.c lisp.h $(config_h)
+tparam.o: tparam.c lisp.h $(config_h)
+undo.o: undo.c buffer.h commands.h window.h dispextern.h lisp.h $(config_h)
+unexaix.o: unexaix.c lisp.h $(config_h)
+unexalpha.o: unexalpha.c $(config_h)
+unexcw.o: unexcw.c lisp.h $(config_h)
+unexec.o: unexec.c lisp.h $(config_h)
+unexelf.o: unexelf.c $(config_h)
+unexhp9k800.o: unexhp9k800.c $(config_h)
+unexmacosx.o: unexmacosx.c $(config_h)
+unexsol.o: unexsol.c lisp.h $(config_h)
+unexw32.o: unexw32.c $(config_h)
+w16select.o: w16select.c dispextern.h frame.h blockinput.h atimer.h systime.h \
+   msdos.h buffer.h charset.h coding.h composite.h lisp.h $(config_h)
+widget.o: widget.c xterm.h frame.h dispextern.h widgetprv.h \
+   $(srcdir)/../lwlib/lwlib.h lisp.h $(config_h)
+window.o: window.c indent.h commands.h frame.h window.h buffer.h termchar.h \
+   disptab.h keyboard.h msdos.h coding.h termhooks.h \
+   keymap.h blockinput.h atimer.h systime.h $(INTERVALS_H) \
+   xterm.h w32term.h nsterm.h nsgui.h lisp.h $(config_h)
+xdisp.o: xdisp.c macros.h commands.h process.h indent.h buffer.h dispextern.h \
+   coding.h termchar.h frame.h window.h disptab.h termhooks.h character.h \
+   charset.h lisp.h $(config_h) keyboard.h $(INTERVALS_H) region-cache.h \
+   xterm.h w32term.h nsterm.h nsgui.h msdos.h composite.h fontset.h ccl.h \
+   blockinput.h atimer.h systime.h keymap.h font.h
+xfaces.o: xfaces.c dispextern.h frame.h xterm.h buffer.h blockinput.h	\
+   window.h character.h charset.h msdos.h dosfns.h composite.h atimer.h	\
+   systime.h keyboard.h fontset.h w32term.h nsterm.h coding.h ccl.h \
+   $(INTERVALS_H) nsgui.h termchar.h termhooks.h font.h lisp.h $(config_h)
+xfns.o: xfns.c buffer.h frame.h window.h keyboard.h xterm.h dispextern.h \
+   $(srcdir)/../lwlib/lwlib.h blockinput.h atimer.h systime.h epaths.h \
+   character.h charset.h coding.h gtkutil.h lisp.h $(config_h) termhooks.h \
+   fontset.h termchar.h font.h xsettings.h $(INTERVALS_H) ccl.h
+xfont.o: dispextern.h xterm.h frame.h blockinput.h character.h charset.h \
+   font.h lisp.h $(config_h) atimer.h systime.h fontset.h ccl.h
+xftfont.o: dispextern.h xterm.h frame.h blockinput.h character.h charset.h \
+   font.h lisp.h $(config_h) atimer.h systime.h fontset.h ccl.h ftfont.h
+ftxfont.o: dispextern.h xterm.h frame.h blockinput.h character.h charset.h \
+   font.h lisp.h $(config_h) atimer.h systime.h fontset.h ccl.h
+menu.o: menu.c lisp.h keyboard.h keymap.h frame.h termhooks.h blockinput.h \
+   dispextern.h $(srcdir)/../lwlib/lwlib.h xterm.h gtkutil.h menu.h \
+   lisp.h $(config_h) systime.h coding.h composite.h window.h atimer.h nsgui.h
+xmenu.o: xmenu.c xterm.h termhooks.h window.h dispextern.h frame.h buffer.h \
+   charset.h keyboard.h $(srcdir)/../lwlib/lwlib.h blockinput.h atimer.h \
+   systime.h gtkutil.h msdos.h coding.h menu.h lisp.h $(config_h) composite.h \
+   keymap.h sysselect.h
+xterm.o: xterm.c xterm.h termhooks.h termopts.h termchar.h window.h buffer.h \
+   dispextern.h frame.h disptab.h blockinput.h atimer.h systime.h syssignal.h \
+   keyboard.h emacs-icon.h character.h charset.h ccl.h fontset.h composite.h \
+   coding.h process.h gtkutil.h font.h fontset.h lisp.h $(config_h) \
+   xsettings.h intervals.h keymap.h xgselect.h sysselect.h
+xselect.o: xselect.c process.h dispextern.h frame.h xterm.h blockinput.h \
+   buffer.h atimer.h systime.h termhooks.h lisp.h $(config_h) keyboard.h \
+   coding.h composite.h
+xgselect.o: xgselect.h systime.h sysselect.h lisp.h $(config_h)
+xrdb.o: xrdb.c lisp.h $(config_h) epaths.h
+xsmfns.o: xsmfns.c lisp.h $(config_h) systime.h sysselect.h termhooks.h \
+   xterm.h lisp.h termopts.h frame.h dispextern.h
+xsettings.o: xterm.h xsettings.h lisp.h frame.h termhooks.h $(config_h) \
+   dispextern.h keyboard.h systime.h coding.h composite.h blockinput.h \
+   atimer.h termopts.h
+
+/* The files of Lisp proper.  */
+alloc.o: alloc.c process.h frame.h window.h buffer.h  puresize.h syssignal.h \
+   keyboard.h blockinput.h atimer.h systime.h character.h lisp.h $(config_h) \
+   $(INTERVALS_H) termhooks.h
+bytecode.o: bytecode.c buffer.h syntax.h character.h window.h dispextern.h \
+  frame.h xterm.h lisp.h $(config_h)
+data.o: data.c buffer.h puresize.h character.h syssignal.h keyboard.h frame.h \
+   termhooks.h systime.h coding.h composite.h dispextern.h font.h ccl.h \
+   lisp.h $(config_h)
+eval.o: eval.c commands.h keyboard.h blockinput.h atimer.h systime.h \
+   dispextern.h lisp.h $(config_h) coding.h composite.h xterm.h
+floatfns.o: floatfns.c syssignal.h lisp.h $(config_h)
+fns.o: fns.c commands.h lisp.h $(config_h) frame.h buffer.h character.h \
+   keyboard.h keymap.h window.h dispextern.h $(INTERVALS_H) coding.h md5.h \
+   blockinput.h atimer.h systime.h xterm.h
+print.o: print.c process.h frame.h window.h buffer.h keyboard.h character.h \
+   lisp.h $(config_h) termchar.h $(INTERVALS_H) msdos.h termhooks.h \
+   blockinput.h atimer.h systime.h font.h charset.h coding.h ccl.h
+lread.o: lread.c commands.h keyboard.h buffer.h epaths.h character.h \
+   charset.h lisp.h $(config_h) $(INTERVALS_H) termhooks.h coding.h msdos.h \
+   systime.h frame.h blockinput.h atimer.h
+
+/* Text properties support.  */
+composite.o: composite.c buffer.h character.h coding.h font.h ccl.h \
+   frame.h termhooks.h $(INTERVALS_H) window.h lisp.h $(config_h)
+intervals.o: intervals.c buffer.h $(INTERVALS_H) keyboard.h puresize.h \
+   keymap.h lisp.h $(config_h) systime.h coding.h
+textprop.o: textprop.c buffer.h window.h $(INTERVALS_H) \
+   lisp.h $(config_h)
+
+
+/* deps.mk ends here  */
--- a/src/fileio.c	Sat May 22 17:13:04 2010 +0300
+++ b/src/fileio.c	Sat May 22 22:32:21 2010 +0300
@@ -2194,7 +2194,10 @@
   return Qnil;
 }
 
-DEFUN ("delete-file", Fdelete_file, Sdelete_file, 1, 2, "fDelete file: \nP",
+DEFUN ("delete-file", Fdelete_file, Sdelete_file, 1, 2,
+       "(list (read-file-name \"Delete file: \" nil default-directory \
+                (confirm-nonexistent-file-or-buffer))                 \
+              current-prefix-arg)",
        doc: /* Delete file named FILENAME.  If it is a symlink, remove the symlink.
 If file has multiple names, it continues to exist with the other names.
 
--- a/src/image.c	Sat May 22 17:13:04 2010 +0300
+++ b/src/image.c	Sat May 22 22:32:21 2010 +0300
@@ -1582,29 +1582,56 @@
 {
   struct image_cache *c = FRAME_IMAGE_CACHE (f);
 
-  if (c && (!NILP (filter) || INTEGERP (Vimage_cache_eviction_delay)))
-    {
-      EMACS_TIME t;
-      unsigned long old;
-      int i, nfreed;
-
-      EMACS_GET_TIME (t);
-      old = EMACS_SECS (t) - XFASTINT (Vimage_cache_eviction_delay);
+  if (c)
+    {
+      int i, nfreed = 0;
 
       /* Block input so that we won't be interrupted by a SIGIO
 	 while being in an inconsistent state.  */
       BLOCK_INPUT;
 
-      for (i = nfreed = 0; i < c->used; ++i)
+      if (!NILP (filter))
+	{
+	  /* Filter image cache.  */
+	  for (i = 0; i < c->used; ++i)
+	    {
+	      struct image *img = c->images[i];
+	      if (img && (EQ (Qt, filter)
+			  || !NILP (Fmember (filter, img->dependencies))))
+		{
+		  free_image (f, img);
+		  ++nfreed;
+		}
+	    }
+	}
+      else if (INTEGERP (Vimage_cache_eviction_delay))
 	{
-	  struct image *img = c->images[i];
-	  if (img != NULL
-	      && (NILP (filter) ? img->timestamp < old
-		  : (EQ (Qt, filter)
-		     || !NILP (Fmember (filter, img->dependencies)))))
+	  /* Free cache based on timestamp.  */
+	  EMACS_TIME t;
+	  unsigned long old;
+	  int delay, nimages = 0;
+
+	  for (i = 0; i < c->used; ++i)
+	    if (c->images[i])
+	      nimages++;
+
+	  /* If the number of cached images has grown unusually large,
+	     decrease the cache eviction delay (Bug#6230).  */
+	  delay = XFASTINT (Vimage_cache_eviction_delay);
+	  if (nimages > 40)
+	    delay = max (1, 1600 * delay / (nimages*nimages));
+
+	  EMACS_GET_TIME (t);
+	  old = EMACS_SECS (t) - delay;
+
+	  for (i = 0; i < c->used; ++i)
 	    {
-	      free_image (f, img);
-	      ++nfreed;
+	      struct image *img = c->images[i];
+	      if (img && img->timestamp < old)
+		{
+		  free_image (f, img);
+		  ++nfreed;
+		}
 	    }
 	}
 
@@ -1662,11 +1689,13 @@
 }
 
 
-DEFUN ("image-refresh", Fimage_refresh, Simage_refresh,
+DEFUN ("image-flush", Fimage_flush, Simage_flush,
        1, 2, 0,
-       doc: /* Refresh the image with specification SPEC on frame FRAME.
-If SPEC specifies an image file, the displayed image is updated with
-the current contents of that file.
+       doc: /* Fush the image with specification SPEC on frame FRAME.
+This removes the image from the Emacs image cache.  If SPEC specifies
+an image file, the next redisplay of this image will read from the
+current contents of that file.
+
 FRAME nil or omitted means use the selected frame.
 FRAME t means refresh the image on all frames.  */)
      (spec, frame)
@@ -8499,7 +8528,7 @@
 
   defsubr (&Sinit_image_library);
   defsubr (&Sclear_image_cache);
-  defsubr (&Simage_refresh);
+  defsubr (&Simage_flush);
   defsubr (&Simage_size);
   defsubr (&Simage_mask_p);
   defsubr (&Simage_metadata);
@@ -8520,11 +8549,14 @@
   Vx_bitmap_file_path = decode_env_path ((char *) 0, PATH_BITMAPS);
 
   DEFVAR_LISP ("image-cache-eviction-delay", &Vimage_cache_eviction_delay,
-    doc: /* Time after which cached images are removed from the cache.
-When an image has not been displayed this many seconds, remove it
-from the image cache.  Value must be an integer or nil with nil
-meaning don't clear the cache.  */);
-  Vimage_cache_eviction_delay = make_number (30 * 60);
+    doc: /* Maximum time after which images are removed from the cache.
+When an image has not been displayed this many seconds, Emacs
+automatically removes it from the image cache.  If the cache contains
+a large number of images, the actual eviction time may be shorter.
+The value can also be nil, meaning the cache is never cleared.
+
+The function `clear-image-cache' disregards this variable.  */);
+  Vimage_cache_eviction_delay = make_number (300);
 }
 
 void
--- a/src/keyboard.c	Sat May 22 17:13:04 2010 +0300
+++ b/src/keyboard.c	Sat May 22 22:32:21 2010 +0300
@@ -11985,7 +11985,7 @@
 was a kill command.
 
 `last-command' has a separate binding for each terminal device.
-See Info node `(elisp)Multiple displays'.  */);
+See Info node `(elisp)Multiple Terminals'.  */);
 
   DEFVAR_KBOARD ("real-last-command", Vreal_last_command,
 		 doc: /* Same as `last-command', but never altered by Lisp code.  */);
@@ -12123,8 +12123,8 @@
 This is applied to the characters supplied to input methods, not their
 output.  See also `translation-table-for-input'.
 
-This variable has a separate binding for each terminal.  See Info node
-`(elisp)Multiple displays'.  */);
+This variable has a separate binding for each terminal.
+See Info node `(elisp)Multiple Terminals'.  */);
 
   DEFVAR_BOOL ("cannot-suspend", &cannot_suspend,
 	       doc: /* Non-nil means to always spawn a subshell instead of suspending.
@@ -12215,7 +12215,7 @@
 
 `overriding-terminal-local-map' has a separate binding for each
 terminal device.
-See Info node `(elisp)Multiple displays'.  */);
+See Info node `(elisp)Multiple Terminals'.  */);
 
   DEFVAR_LISP ("overriding-local-map", &Voverriding_local_map,
 	       doc: /* Keymap that overrides all other local keymaps.
@@ -12243,7 +12243,7 @@
 and SYMBOL is its name.
 
 `system-key-alist' has a separate binding for each terminal device.
-See Info node `(elisp)Multiple displays'.  */);
+See Info node `(elisp)Multiple Terminals'.  */);
 
   DEFVAR_KBOARD ("local-function-key-map", Vlocal_function_key_map,
                  doc: /* Keymap that translates key sequences to key sequences during input.
@@ -12269,7 +12269,7 @@
 typing `ESC O P x' would return [f1 x].
 
 `local-function-key-map' has a separate binding for each terminal
-device.  See Info node `(elisp)Multiple displays'.  If you need to
+device.  See Info node `(elisp)Multiple Terminals'.  If you need to
 define a binding on all terminals, change `function-key-map'
 instead.  Initially, `local-function-key-map' is an empty keymap that
 has `function-key-map' as its parent on all terminal devices.  */);
--- a/src/m/ibms390x.h	Sat May 22 17:13:04 2010 +0300
+++ b/src/m/ibms390x.h	Sat May 22 22:32:21 2010 +0300
@@ -62,8 +62,6 @@
 /* On the 64 bit architecture, we can use 60 bits for addresses */
 #define VALBITS         60
 
-#define LINKER $(CC) -nostdlib
-
 /* Define XPNTR to avoid or'ing with DATA_SEG_BITS */
 #define XPNTR(a) XUINT (a)
 
--- a/src/m/macppc.h	Sat May 22 17:13:04 2010 +0300
+++ b/src/m/macppc.h	Sat May 22 22:32:21 2010 +0300
@@ -32,12 +32,6 @@
 #define HAVE_TEXT_START
 #endif
 
-/* NAKAJI Hiroyuki <nakaji@tutrp.tut.ac.jp> says this is needed
-   For MkLinux/LinuxPPC.  */
-#ifdef GNU_LINUX
-#define LINKER $(CC) -nostdlib
-#endif
-
 #ifdef _ARCH_PPC64
 #ifndef _LP64
 #define _LP64
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/ns.mk	Sat May 22 22:32:21 2010 +0300
@@ -0,0 +1,39 @@
+/* autodeps.mk --- src/Makefile fragment for GNU Emacs
+
+Copyright (C) 2008, 2009, 2010  Free Software Foundation, Inc.
+
+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 is inserted in src/Makefile if HAVE_NS. 
+
+The only reason this is in a separate file is because $ns_appdir,
+which appears as a target, is empty on non-NS builds.  Some makes
+do not like empty targets, even if they are never used.  */
+
+${ns_appdir}: ${ns_appsrc}
+	rm -fr ${ns_appdir}
+	mkdir -p ${ns_appdir}
+	( cd ${ns_appsrc} ; tar cfh - . ) | ( cd ${ns_appdir} ; umask 022; tar xf - )
+
+${ns_appbindir}Emacs: emacs${EXEEXT}
+	mkdir -p ${ns_appbindir}
+	cp -f emacs${EXEEXT} ${ns_appbindir}Emacs
+
+ns-app: ${ns_appdir} ${ns_appbindir}Emacs
+
+/* ns.mk ends here  */
--- a/src/s/aix4-2.h	Sat May 22 17:13:04 2010 +0300
+++ b/src/s/aix4-2.h	Sat May 22 22:32:21 2010 +0300
@@ -61,11 +61,7 @@
 /* The kernel symbol where the load average is found is named avenrun.  */
 #define LDAV_SYMBOL "avenrun"
 
-/* Special itemss needed to make Emacs run on this system.  */
-
-#ifndef __GNUC__
-#define LINKER cc
-#endif
+/* Special items needed to make Emacs run on this system.  */
 
 /* The following definition seems to be needed in AIX version 3.1.6.8.
    It may not have been needed in certain earlier versions.  */
@@ -110,7 +106,5 @@
 
 #define UNEXEC unexaix.o
 
-#define ORDINARY_LINK
-
 /* arch-tag: 38fe75ea-6aef-42bd-8449-bc34d921a562
    (do not change this comment) */
--- a/src/s/cygwin.h	Sat May 22 17:13:04 2010 +0300
+++ b/src/s/cygwin.h	Sat May 22 22:32:21 2010 +0300
@@ -1,7 +1,7 @@
 /* System description header file for Cygwin.
 
 Copyright (C) 1985, 1986, 1992, 1999, 2002, 2003, 2004, 2005, 2006,
-  2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+  2007, 2008, 2009, 2010  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -19,7 +19,7 @@
 along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 /* SYSTEM_TYPE should indicate the kind of system you are using.
- It sets the Lisp variable system-type.  */
+   It sets the Lisp variable system-type.  */
 #define SYSTEM_TYPE "cygwin"
 
 /* Emacs can read input using SIGIO and buffering characters itself,
@@ -94,7 +94,6 @@
 #define PENDING_OUTPUT_COUNT(FILE) ((FILE)->_p - (FILE)->_bf._base)
 #define SYSV_SYSTEM_DIR 1
 #define UNEXEC unexcw.o
-#define LINKER $(CC)
 
 #define HAVE_SOCKETS
 
--- a/src/s/darwin.h	Sat May 22 17:13:04 2010 +0300
+++ b/src/s/darwin.h	Sat May 22 22:32:21 2010 +0300
@@ -147,9 +147,6 @@
 #undef HAVE_POSIX_MEMALIGN
 #endif
 
-/* Link this program just by running cc.  */
-#define ORDINARY_LINK
-
 /* Define the following so emacs symbols will not conflict with those
    in the System framework.  Otherwise -prebind will not work.  */
 
--- a/src/s/gnu.h	Sat May 22 17:13:04 2010 +0300
+++ b/src/s/gnu.h	Sat May 22 22:32:21 2010 +0300
@@ -29,8 +29,7 @@
 
 #define SIGNALS_VIA_CHARACTERS
 
-/* GNU needs its own crt0, and libc defines data_start.  */
-#define ORDINARY_LINK
+/* libc defines data_start.  */
 #define DATA_START ({ extern int data_start; (char *) &data_start; })
 
 /* Some losing code fails to include this and then assumes
--- a/src/s/msdos.h	Sat May 22 17:13:04 2010 +0300
+++ b/src/s/msdos.h	Sat May 22 22:32:21 2010 +0300
@@ -82,8 +82,6 @@
 
 #define _NAIVE_DOS_REGS
 
-#define ORDINARY_LINK
-
 /* command.com does not understand `...` so we define this.  */
 #define SEPCHAR ';'
 
--- a/src/s/netbsd.h	Sat May 22 17:13:04 2010 +0300
+++ b/src/s/netbsd.h	Sat May 22 22:32:21 2010 +0300
@@ -26,12 +26,6 @@
 
 #define PENDING_OUTPUT_COUNT(FILE) ((FILE)->_p - (FILE)->_bf._base)
 
-/* On post 1.3 releases of NetBSD, gcc -nostdlib also clears
-   the library search parth, i.e. it won't search /usr/lib
-   for libc and friends.  Using -nostartfiles instead avoids
-   this problem, and will also work on earlier NetBSD releases.  */
-#define LINKER $(CC) -nostartfiles
-
 #define DEFAULT_SOUND_DEVICE "/dev/audio"
 
 /* Greg A. Woods <woods@weird.com> says we must include signal.h
--- a/src/s/usg5-4.h	Sat May 22 17:13:04 2010 +0300
+++ b/src/s/usg5-4.h	Sat May 22 22:32:21 2010 +0300
@@ -69,8 +69,6 @@
 /* On USG systems signal handlers return void.  */
 #define SIGTYPE void
 
-#define ORDINARY_LINK
-
 /* Undump with ELF.  */
 #undef COFF
 
--- a/src/w32.c	Sat May 22 17:13:04 2010 +0300
+++ b/src/w32.c	Sat May 22 22:32:21 2010 +0300
@@ -5700,7 +5700,34 @@
     }
   else
 #endif
-    nchars = _write (fd, buffer, count);
+    {
+      /* Some networked filesystems don't like too large writes, so
+	 break them into smaller chunks.  See the Comments section of
+	 the MSDN documentation of WriteFile for details behind the
+	 choice of the value of CHUNK below.  See also the thread
+	 http://thread.gmane.org/gmane.comp.version-control.git/145294
+	 in the git mailing list.  */
+      const unsigned char *p = buffer;
+      const unsigned chunk = 30 * 1024 * 1024;
+
+      nchars = 0;
+      while (count > 0)
+	{
+	  unsigned this_chunk = count < chunk ? count : chunk;
+	  int n = _write (fd, p, this_chunk);
+
+	  nchars += n;
+	  if (n < 0)
+	    {
+	      nchars = n;
+	      break;
+	    }
+	  else if (n < this_chunk)
+	    break;
+	  count -= n;
+	  p += n;
+	}
+    }
 
   return nchars;
 }
--- a/src/xdisp.c	Sat May 22 17:13:04 2010 +0300
+++ b/src/xdisp.c	Sat May 22 22:32:21 2010 +0300
@@ -12499,22 +12499,25 @@
   if (windows_or_buffers_changed && !pause)
     goto retry;
 
-  /* Clear the face cache eventually.  */
-  if (consider_all_windows_p)
-    {
-      if (clear_face_cache_count > CLEAR_FACE_CACHE_COUNT)
-	{
-	  clear_face_cache (0);
-	  clear_face_cache_count = 0;
-	}
-#ifdef HAVE_WINDOW_SYSTEM
-      if (clear_image_cache_count > CLEAR_IMAGE_CACHE_COUNT)
-	{
-	  clear_image_caches (Qnil);
-	  clear_image_cache_count = 0;
-	}
+  /* Clear the face and image caches.
+
+     We used to do this only if consider_all_windows_p.  But the cache
+     needs to be cleared if a timer creates images in the current
+     buffer (e.g. the test case in Bug#6230).  */
+
+  if (clear_face_cache_count > CLEAR_FACE_CACHE_COUNT)
+    {
+      clear_face_cache (0);
+      clear_face_cache_count = 0;
+    }
+
+#ifdef HAVE_WINDOW_SYSTEM
+  if (clear_image_cache_count > CLEAR_IMAGE_CACHE_COUNT)
+    {
+      clear_image_caches (Qnil);
+      clear_image_cache_count = 0;
+    }
 #endif /* HAVE_WINDOW_SYSTEM */
-    }
 
  end_of_redisplay:
   unbind_to (count, Qnil);