changeset 83518:ab6ab63755f7

Merged from emacs@sv.gnu.org Patches applied: * emacs@sv.gnu.org/emacs--devo--0--patch-285 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-286 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-287 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-288 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-102 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-558
author Karoly Lorentey <lorentey@elte.hu>
date Sat, 20 May 2006 10:32:11 +0000
parents b6689e223e2f (current diff) e68fe4e7401b (diff)
children 717426715b03
files ChangeLog configure configure.in etc/TODO lisp/ChangeLog lisp/files.el lisp/term/mac-win.el lispref/ChangeLog mac/makefile.MPW man/ChangeLog src/Makefile.in src/buffer.c src/callproc.c src/coding.c src/coding.h src/config.in src/frame.c src/image.c src/macfns.c src/macterm.c src/window.c src/xdisp.c src/xfaces.c src/xterm.c
diffstat 44 files changed, 1221 insertions(+), 422 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed May 17 18:05:02 2006 +0000
+++ b/ChangeLog	Sat May 20 10:32:11 2006 +0000
@@ -1,3 +1,8 @@
+2006-05-18  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
+
+	* configure.in: Add check for ALSA.
+	* configure: Regenerate.
+
 2006-05-06  Eli Zaretskii  <eliz@gnu.org>
 
 	* Makefile.in (INFO_FILES): Remove emacs-xtra.
--- a/configure	Wed May 17 18:05:02 2006 +0000
+++ b/configure	Sat May 20 10:32:11 2006 +0000
@@ -2,7 +2,7 @@
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.59.
 #
-# Copyright (C) 2003, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2003 Free Software Foundation, Inc.
 # This configure script is free software; the Free Software Foundation
 # gives unlimited permission to copy, distribute and modify it.
 ## --------------------- ##
@@ -310,7 +310,7 @@
 # include <unistd.h>
 #endif"
 
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS MAINT build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP LN_S INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA RANLIB ac_ct_RANLIB INSTALL_INFO GZIP_PROG LIBSOUND SET_MAKE PKG_CONFIG GTK_CFLAGS GTK_LIBS ALLOCA liblockfile LIBOBJS NEED_SETGID KMEM_GROUP GETLOADAVG_LIBS GETOPT_H GETOPTOBJS version configuration canonical srcdir lispdir locallisppath lisppath x_default_search_path etcdir archlibdir docdir bitmapdir gamedir gameuser c_switch_system c_switch_machine LD_SWITCH_X_SITE LD_SWITCH_X_SITE_AUX C_SWITCH_X_SITE X_TOOLKIT_TYPE machfile opsysfile carbon_appdir LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS MAINT build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP LN_S INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA RANLIB ac_ct_RANLIB INSTALL_INFO GZIP_PROG LIBSOUND PKG_CONFIG ALSA_CFLAGS ALSA_LIBS CFLAGS_SOUND SET_MAKE GTK_CFLAGS GTK_LIBS ALLOCA liblockfile LIBOBJS NEED_SETGID KMEM_GROUP GETLOADAVG_LIBS GETOPT_H GETOPTOBJS version configuration canonical srcdir lispdir locallisppath lisppath x_default_search_path etcdir archlibdir docdir bitmapdir gamedir gameuser c_switch_system c_switch_machine LD_SWITCH_X_SITE LD_SWITCH_X_SITE_AUX C_SWITCH_X_SITE X_TOOLKIT_TYPE machfile opsysfile carbon_appdir LTLIBOBJS'
 ac_subst_files=''
 
 # Initialize some variables set by options.
@@ -5151,6 +5151,10 @@
 fi
 
 
+
+
+
+
 if test "${with_sound}" != "no"; then
   # Sound support for GNU/Linux and the free BSDs.
   echo "$as_me:$LINENO: checking for ANSI C header files" >&5
@@ -5611,6 +5615,117 @@
 fi
 
 
+
+  ALSA_REQUIRED=1.0.0
+  ALSA_MODULES="alsa >= $ALSA_REQUIRED"
+    if test "X${with_pkg_config_prog}" != X; then
+    PKG_CONFIG="${with_pkg_config_prog}"
+  fi
+
+  succeeded=no
+
+  if test -z "$PKG_CONFIG"; then
+    # Extract the first word of "pkg-config", so it can be a program name with args.
+set dummy pkg-config; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_path_PKG_CONFIG+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $PKG_CONFIG in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+  test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no"
+  ;;
+esac
+fi
+PKG_CONFIG=$ac_cv_path_PKG_CONFIG
+
+if test -n "$PKG_CONFIG"; then
+  echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5
+echo "${ECHO_T}$PKG_CONFIG" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  fi
+
+  if test "$PKG_CONFIG" = "no" ; then
+     HAVE_ALSA=no
+  else
+     PKG_CONFIG_MIN_VERSION=0.9.0
+     if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
+        echo "$as_me:$LINENO: checking for $ALSA_MODULES" >&5
+echo $ECHO_N "checking for $ALSA_MODULES... $ECHO_C" >&6
+
+        if $PKG_CONFIG --exists "$ALSA_MODULES" ; then
+            echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+            succeeded=yes
+
+            echo "$as_me:$LINENO: checking ALSA_CFLAGS" >&5
+echo $ECHO_N "checking ALSA_CFLAGS... $ECHO_C" >&6
+            ALSA_CFLAGS=`$PKG_CONFIG --cflags "$ALSA_MODULES"`
+            echo "$as_me:$LINENO: result: $ALSA_CFLAGS" >&5
+echo "${ECHO_T}$ALSA_CFLAGS" >&6
+
+            echo "$as_me:$LINENO: checking ALSA_LIBS" >&5
+echo $ECHO_N "checking ALSA_LIBS... $ECHO_C" >&6
+            ALSA_LIBS=`$PKG_CONFIG --libs "$ALSA_MODULES"`
+            echo "$as_me:$LINENO: result: $ALSA_LIBS" >&5
+echo "${ECHO_T}$ALSA_LIBS" >&6
+        else
+            echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+            ALSA_CFLAGS=""
+            ALSA_LIBS=""
+            ## If we have a custom action on failure, don't print errors, but
+            ## do set a variable so people can do so.
+            ALSA_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$ALSA_MODULES"`
+
+        fi
+
+
+
+     else
+        echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
+        echo "*** See http://www.freedesktop.org/software/pkgconfig"
+     fi
+  fi
+
+  if test $succeeded = yes; then
+     HAVE_ALSA=yes
+  else
+     HAVE_ALSA=no
+  fi
+
+  if test $HAVE_ALSA = yes; then
+    LIBSOUND="$LIBSOUND $ALSA_LIBS"
+    CFLAGS_SOUND="$CFLAGS_SOUND $ALSA_CFLAGS"
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_ALSA 1
+_ACEOF
+
+  fi
+
 fi
 
 
@@ -10132,8 +10247,6 @@
   fi
 fi
 
-
-
 HAVE_GTK=no
 if test "${with_gtk}" = "yes" || test "$USE_X_TOOLKIT" = "gtk"; then
   if test "$USE_X_TOOLKIT" != "none" && test "$USE_X_TOOLKIT" != "maybe"; then
@@ -10195,10 +10308,11 @@
   fi
 
   if test "$PKG_CONFIG" = "no" ; then
-     echo "*** The pkg-config script could not be found. Make sure it is"
-     echo "*** in your path, or give the full path to pkg-config with"
-     echo "*** the PKG_CONFIG environment variable or --with-pkg-config-prog."
-     echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
+     { { echo "$as_me:$LINENO: error:
+      *** The pkg-config script could not be found. Make sure it is in your path, or give the full path to pkg-config with the PKG_CONFIG environment variable or --with-pkg-config-prog.  Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." >&5
+echo "$as_me: error:
+      *** The pkg-config script could not be found. Make sure it is in your path, or give the full path to pkg-config with the PKG_CONFIG environment variable or --with-pkg-config-prog.  Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." >&2;}
+   { (exit 1); exit 1; }; }
   else
      PKG_CONFIG_MIN_VERSION=0.9.0
      if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
@@ -10222,6 +10336,8 @@
             echo "$as_me:$LINENO: result: $GTK_LIBS" >&5
 echo "${ECHO_T}$GTK_LIBS" >&6
         else
+            echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
             GTK_CFLAGS=""
             GTK_LIBS=""
             ## If we have a custom action on failure, don't print errors, but
@@ -23374,8 +23490,11 @@
 s,@INSTALL_INFO@,$INSTALL_INFO,;t t
 s,@GZIP_PROG@,$GZIP_PROG,;t t
 s,@LIBSOUND@,$LIBSOUND,;t t
+s,@PKG_CONFIG@,$PKG_CONFIG,;t t
+s,@ALSA_CFLAGS@,$ALSA_CFLAGS,;t t
+s,@ALSA_LIBS@,$ALSA_LIBS,;t t
+s,@CFLAGS_SOUND@,$CFLAGS_SOUND,;t t
 s,@SET_MAKE@,$SET_MAKE,;t t
-s,@PKG_CONFIG@,$PKG_CONFIG,;t t
 s,@GTK_CFLAGS@,$GTK_CFLAGS,;t t
 s,@GTK_LIBS@,$GTK_LIBS,;t t
 s,@ALLOCA@,$ALLOCA,;t t
--- a/configure.in	Wed May 17 18:05:02 2006 +0000
+++ b/configure.in	Sat May 20 10:32:11 2006 +0000
@@ -1480,12 +1480,83 @@
 dnl Do this early because it can frob feature test macros for Unix-98 &c.
 AC_SYS_LARGEFILE
 
+
+dnl This function defintion taken from Gnome 2.0
+dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
+dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
+dnl also defines GSTUFF_PKG_ERRORS on error
+AC_DEFUN([PKG_CHECK_MODULES], [
+  succeeded=no
+
+  if test -z "$PKG_CONFIG"; then
+    AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
+  fi
+
+  if test "$PKG_CONFIG" = "no" ; then
+     ifelse([$4], , [AC_MSG_ERROR([
+      *** The pkg-config script could not be found. Make sure it is in your path, or give the full path to pkg-config with the PKG_CONFIG environment variable or --with-pkg-config-prog.  Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config.])], [$4])
+  else
+     PKG_CONFIG_MIN_VERSION=0.9.0
+     if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
+        AC_MSG_CHECKING(for $2)
+
+        if $PKG_CONFIG --exists "$2" ; then
+            AC_MSG_RESULT(yes)
+            succeeded=yes
+
+            AC_MSG_CHECKING($1_CFLAGS)
+            $1_CFLAGS=`$PKG_CONFIG --cflags "$2"`
+            AC_MSG_RESULT($$1_CFLAGS)
+
+            AC_MSG_CHECKING($1_LIBS)
+            $1_LIBS=`$PKG_CONFIG --libs "$2"`
+            AC_MSG_RESULT($$1_LIBS)
+        else
+            AC_MSG_RESULT(no)
+            $1_CFLAGS=""
+            $1_LIBS=""
+            ## If we have a custom action on failure, don't print errors, but
+            ## do set a variable so people can do so.
+            $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
+            ifelse([$4], ,echo $$1_PKG_ERRORS,)
+        fi
+
+        AC_SUBST($1_CFLAGS)
+        AC_SUBST($1_LIBS)
+     else
+        echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
+        echo "*** See http://www.freedesktop.org/software/pkgconfig"
+     fi
+  fi
+
+  if test $succeeded = yes; then
+     ifelse([$3], , :, [$3])
+  else
+     ifelse([$4], , [AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.])], [$4])
+  fi
+])
+
+
 if test "${with_sound}" != "no"; then
   # Sound support for GNU/Linux and the free BSDs.
   AC_CHECK_HEADERS(machine/soundcard.h sys/soundcard.h soundcard.h)
   # Emulation library used on NetBSD.
   AC_CHECK_LIB(ossaudio, _oss_ioctl, LIBSOUND=-lossaudio, LIBSOUND=)
   AC_SUBST(LIBSOUND)
+
+  ALSA_REQUIRED=1.0.0
+  ALSA_MODULES="alsa >= $ALSA_REQUIRED"
+  dnl Check if --with-pkg-config-prog has been given.
+  if test "X${with_pkg_config_prog}" != X; then
+    PKG_CONFIG="${with_pkg_config_prog}"
+  fi
+  PKG_CHECK_MODULES(ALSA, $ALSA_MODULES, HAVE_ALSA=yes, HAVE_ALSA=no)
+  if test $HAVE_ALSA = yes; then
+    LIBSOUND="$LIBSOUND $ALSA_LIBS"
+    CFLAGS_SOUND="$CFLAGS_SOUND $ALSA_CFLAGS"
+    AC_DEFINE(HAVE_ALSA, 1, [Define to 1 if ALSA is available.])
+  fi
+  AC_SUBST(CFLAGS_SOUND)
 fi
 
 dnl checks for header files
@@ -1943,62 +2014,6 @@
   fi
 fi
 
-dnl This function defintion taken from Gnome 2.0
-dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
-dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
-dnl also defines GSTUFF_PKG_ERRORS on error
-AC_DEFUN([PKG_CHECK_MODULES], [
-  succeeded=no
-
-  if test -z "$PKG_CONFIG"; then
-    AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
-  fi
-
-  if test "$PKG_CONFIG" = "no" ; then
-     echo "*** The pkg-config script could not be found. Make sure it is"
-     echo "*** in your path, or give the full path to pkg-config with"
-     echo "*** the PKG_CONFIG environment variable or --with-pkg-config-prog."
-     echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
-  else
-     PKG_CONFIG_MIN_VERSION=0.9.0
-     if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
-        AC_MSG_CHECKING(for $2)
-
-        if $PKG_CONFIG --exists "$2" ; then
-            AC_MSG_RESULT(yes)
-            succeeded=yes
-
-            AC_MSG_CHECKING($1_CFLAGS)
-            $1_CFLAGS=`$PKG_CONFIG --cflags "$2"`
-            AC_MSG_RESULT($$1_CFLAGS)
-
-            AC_MSG_CHECKING($1_LIBS)
-            $1_LIBS=`$PKG_CONFIG --libs "$2"`
-            AC_MSG_RESULT($$1_LIBS)
-        else
-            $1_CFLAGS=""
-            $1_LIBS=""
-            ## If we have a custom action on failure, don't print errors, but
-            ## do set a variable so people can do so.
-            $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
-            ifelse([$4], ,echo $$1_PKG_ERRORS,)
-        fi
-
-        AC_SUBST($1_CFLAGS)
-        AC_SUBST($1_LIBS)
-     else
-        echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
-        echo "*** See http://www.freedesktop.org/software/pkgconfig"
-     fi
-  fi
-
-  if test $succeeded = yes; then
-     ifelse([$3], , :, [$3])
-  else
-     ifelse([$4], , [AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.])], [$4])
-  fi
-])
-
 HAVE_GTK=no
 if test "${with_gtk}" = "yes" || test "$USE_X_TOOLKIT" = "gtk"; then
   if test "$USE_X_TOOLKIT" != "none" && test "$USE_X_TOOLKIT" != "maybe"; then
@@ -2920,6 +2935,9 @@
 #ifdef HAVE_SOUNDCARD_H
 #define HAVE_SOUND 1
 #endif
+#ifdef HAVE_ALSA
+#define HAVE_SOUND 1
+#endif
 #endif /* __FreeBSD__ || __NetBSD__ || __linux__  */
 
 /* If using GNU, then support inline function declarations. */
--- a/etc/TODO	Wed May 17 18:05:02 2006 +0000
+++ b/etc/TODO	Sat May 20 10:32:11 2006 +0000
@@ -135,6 +135,8 @@
 
 * Other features we would like:
 
+** Remove the default toggling behavior of minor modes when called from elisp
+rather than interactively.  This a trivial one-liner in easy-mode.el.
 ** Create a category of errors called `user-error' for errors which are
 typically due to pilot errors and should thus be in debug-ignored-errors.
 
--- a/lisp/ChangeLog	Wed May 17 18:05:02 2006 +0000
+++ b/lisp/ChangeLog	Sat May 20 10:32:11 2006 +0000
@@ -1,8 +1,81 @@
+2006-05-19  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
+
+	* term/mac-win.el (mac-bytes-to-digits): Remove function.
+	(mac-handle-toolbar-switch-mode): Use coercion instead of it.
+
+2006-05-19  Glenn Morris  <rgm@gnu.org>
+
+	* calendar/diary-lib.el (diary-bahai-date)
+	(list-bahai-diary-entries, mark-bahai-diary-entries)
+	(mark-bahai-calendar-date-pattern): Not interactive.
+	(add-to-diary-list): New optional arg LITERAL.  Doc fix.
+	(diary-entries-list): Change format of 4th element in each entry.
+	(diary-list-entries): Use add-to-diary-list.
+	(diary-goto-entry): Handle the case where the buffer visiting the
+	diary has been killed.
+	(fancy-diary-display): Add 'locator to button rather than 'marker.
+	Only generate temp-face when there are marks to apply.
+	(list-sexp-diary-entries): Pass literal to add-to-diary-list.
+	(diary-fancy-date-pattern): New variable.
+	(diary-time-regexp): Doc fix.
+	(diary-anniversary, diary-time): New faces.
+	(fancy-diary-font-lock-keywords): Use diary-fancy-date-pattern and
+	diary-time-regexp.  Add font-lock-multiline property where needed.
+	Use new faces diary-anniversary and diary-time.
+	(diary-fancy-font-lock-fontify-region-function): New function, to
+	handle multiline font-lock pattern in fancy diary.
+	(fancy-diary-display-mode): Set font-lock-fontify-region-function.
+	(diary-font-lock-keywords): Tweak time regexp.  Use new face
+	diary-time.
+
+2006-05-19  Alexander Shopov  <ash@contact.bg>  (tiny change)
+
+	* international/code-pages.el (mik): Table corrected.
+
+2006-05-18  Kim F. Storm  <storm@cua.dk>
+
+	* progmodes/grep.el (grep-find): Don't check grep-find-command
+	before running command (breaks non-interactive usage).
+
+2006-05-18  Thien-Thi Nguyen  <ttn@gnu.org>
+
+	* emacs-lisp/ewoc.el (ewoc--adjust): New func.
+	(ewoc--insert-new-node): Don't insert trailing newline.
+	Instead, adjust succesor nodes' start markers.
+	(ewoc--refresh-node): Delete all text from current node's start
+	marker to the next one's; adjust successor nodes' start markers.
+	(ewoc--create): Doc fixes.
+	(ewoc--refresh): Don't insert newline.
+	(ewoc--set-hf): Use `ewoc--set-buffer-bind-dll-let*'.
+	* pcvs.el (cvs-make-cvs-buffer): Specify
+	extra newline for ewoc's header and footer.
+	(cvs-update-header): Update initial header recognition.
+	Append newline to final header and footer values.
+	* pcvs-info.el (cvs-fileinfo-pp): Insert trailing newline.
+
+2006-05-17  Richard Stallman  <rms@gnu.org>
+
+	* files.el (file-name-extension): Doc fix.
+
+2006-05-17  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* shell.el (shell-dirtrack-mode): Make it into a proper minor mode, so
+	we can explicitly enable/disable rather than toggle.
+	(shell-mode): Use it.
+	(shell-cd): Don't try to reproduce what `cd' does.
+
+2006-05-17  Kim F. Storm  <storm@cua.dk>
+
+	* ido.el (ido-read-internal): Use only nondirectory part of
+	default item.
+
 2006-05-17  Thien-Thi Nguyen  <ttn@gnu.org>
 
 	* emacs-lisp/ewoc.el (ewoc-data): Add docstring.
 	(ewoc-nth): Doc fix.
 
+	(ewoc-map, ewoc-invalidate): Compute PP before looping.
+
 2006-05-16  Eli Zaretskii  <eliz@gnu.org>
 
 	* international/mule.el (auto-coding-alist): Add .lha to files
--- a/lisp/calendar/diary-lib.el	Wed May 17 18:05:02 2006 +0000
+++ b/lisp/calendar/diary-lib.el	Sat May 20 10:32:11 2006 +0000
@@ -121,20 +121,16 @@
    "Mark dates in calendar window that conform to Islamic date MONTH/DAY/YEAR.")
 
 (autoload 'diary-bahai-date "cal-bahai"
-  "Baha'i calendar equivalent of date diary entry."
-  t)
+  "Baha'i calendar equivalent of date diary entry.")
 
 (autoload 'list-bahai-diary-entries "cal-bahai"
-  "Add any Baha'i date entries from the diary file to `diary-entries-list'."
-  t)
+  "Add any Baha'i date entries from the diary file to `diary-entries-list'.")
 
 (autoload 'mark-bahai-diary-entries "cal-bahai"
-  "Mark days in the calendar window that have Baha'i date diary entries."
-  t)
+  "Mark days in the calendar window that have Baha'i date diary entries.")
 
 (autoload 'mark-bahai-calendar-date-pattern "cal-bahai"
-   "Mark dates in calendar window that conform to Baha'i date MONTH/DAY/YEAR."
-  t)
+   "Mark dates in calendar window that conform to Baha'i date MONTH/DAY/YEAR.")
 
 (autoload 'diary-hebrew-date "cal-hebrew"
   "Hebrew calendar equivalent of date diary entry.")
@@ -323,6 +319,42 @@
 			 (integer :tag "Saturday")))
   :group 'diary)
 
+
+(defvar diary-modify-entry-list-string-function nil
+  "Function applied to entry string before putting it into the entries list.
+Can be used by programs integrating a diary list into other buffers (e.g.
+org.el and planner.el) to modify the string or add properties to it.
+The function takes a string argument and must return a string.")
+
+(defun add-to-diary-list (date string specifier &optional marker
+                               globcolor literal)
+  "Add an entry to `diary-entries-list'.
+Do nothing if DATE or STRING is nil.  DATE is the (MONTH DAY
+YEAR) for which the entry applies; STRING is the text of the
+entry as it will appear in the diary (i.e. with any format
+strings such as \"%d\" expanded); SPECIFIER is the date part of
+the entry as it appears in the diary-file; LITERAL is the entry
+as it appears in the diary-file (i.e. before expansion).  If
+LITERAL is nil, it is taken to be the same as STRING.
+
+The entry is added to the list as (DATE STRING SPECIFIER LOCATOR
+GLOBCOLOR), where LOCATOR has the form (MARKER FILENAME LITERAL),
+FILENAME being the file containing the diary entry."
+  (when (and date string)
+    (if diary-file-name-prefix
+        (let ((prefix (funcall diary-file-name-prefix-function
+                               (buffer-file-name))))
+          (or (string= prefix "")
+              (setq string (format "[%s] %s" prefix string)))))
+    (and diary-modify-entry-list-string-function
+	 (setq string (funcall diary-modify-entry-list-string-function
+			       string)))
+    (setq diary-entries-list
+          (append diary-entries-list
+                  (list (list date string specifier
+                              (list marker (buffer-file-name) literal)
+                              globcolor))))))
+
 (define-obsolete-function-alias 'list-diary-entries 'diary-list-entries)
 (defun diary-list-entries (date number &optional list-only)
   "Create and display a buffer containing the relevant lines in `diary-file'.
@@ -468,9 +500,7 @@
                               (copy-marker entry-start) (nth 1 temp)))))))
                    (or entry-found
                        (not diary-list-include-blanks)
-                       (setq diary-entries-list
-                             (append diary-entries-list
-                                     (list (list date "" "" "" "")))))
+                       (add-to-diary-list date "" "" "" ""))
                    (setq date
                          (calendar-gregorian-from-absolute
                           (1+ (calendar-absolute-from-gregorian date))))
@@ -577,10 +607,27 @@
   'face 'diary-button)
 
 (defun diary-goto-entry (button)
-  (let ((marker (button-get button 'marker)))
-    (when marker
-      (pop-to-buffer (marker-buffer marker))
-      (goto-char (marker-position marker)))))
+  (let* ((locator (button-get button 'locator))
+         (marker (car locator))
+         markbuf file)
+    ;; If marker pointing to diary location is valid, use that.
+    (if (and marker (setq markbuf (marker-buffer marker)))
+        (progn
+          (pop-to-buffer markbuf)
+          (goto-char (marker-position marker)))
+      ;; Marker is invalid (eg buffer has been killed).
+      (or (and (setq file (cadr locator))
+               (file-exists-p file)
+               (find-file-other-window file)
+               (progn
+                 (when (eq major-mode default-major-mode) (diary-mode))
+                 (goto-char (point-min))
+                 (if (re-search-forward (format "%s.*\\(%s\\)"
+                                                (regexp-quote (nth 2 locator))
+                                                (regexp-quote (nth 3 locator)))
+                                        nil t)
+                     (goto-char (match-beginning 1)))))
+          (message "Unable to locate this diary entry")))))
 
 (defun fancy-diary-display ()
   "Prepare a diary buffer with relevant entries in a fancy, noneditable form.
@@ -666,37 +713,45 @@
 
 	  (setq entry (car (cdr (car entry-list))))
 	  (if (< 0 (length entry))
-	      (progn
-		(if (nth 3 (car entry-list))
+              (let ((this-entry (car entry-list))
+                    this-loc)
+		(if (setq this-loc (nth 3 this-entry))
 		    (insert-button (concat entry "\n")
-				   'marker (nth 3 (car entry-list))
+                                   ;; (MARKER FILENAME SPECIFIER LITERAL)
+                                   'locator (list (car this-loc)
+                                                  (cadr this-loc)
+                                                  (nth 2 this-entry)
+                                                  (or (nth 2 this-loc)
+                                                      (nth 1 this-entry)))
 				   :type 'diary-entry)
 		  (insert entry ?\n))
 		(save-excursion
-                  (let* ((marks (nth 4 (car entry-list)))
-                         (temp-face (make-symbol
-                                     (apply
-                                      'concat "temp-face-"
-                                      (mapcar (lambda (sym)
-                                                (if (stringp sym)
-                                                    sym
-                                                  (symbol-name sym)))
-                                              marks))))
-                         (faceinfo marks))
-                    (make-face temp-face)
-                    ;; Remove :face info from the marks,
-                    ;; copy the face info into temp-face
-                    (while (setq faceinfo (memq :face faceinfo))
-                      (copy-face (read (nth 1 faceinfo)) temp-face)
-                      (setcar faceinfo nil)
-                      (setcar (cdr faceinfo) nil))
-                    (setq marks (delq nil marks))
-                    ;; Apply the font aspects.
-                    (apply 'set-face-attribute temp-face nil marks)
-                    (search-backward entry)
-                    (overlay-put
-                     (make-overlay (match-beginning 0) (match-end 0))
-                     'face temp-face)))))
+                  (let* ((marks (nth 4 this-entry))
+                         (faceinfo marks)
+                         temp-face)
+                    (when marks
+                      (setq temp-face (make-symbol
+                                       (apply
+                                        'concat "temp-face-"
+                                        (mapcar (lambda (sym)
+                                                  (if (stringp sym)
+                                                      sym
+                                                    (symbol-name sym)))
+                                                marks))))
+                      (make-face temp-face)
+                      ;; Remove :face info from the marks,
+                      ;; copy the face info into temp-face
+                      (while (setq faceinfo (memq :face faceinfo))
+                        (copy-face (read (nth 1 faceinfo)) temp-face)
+                        (setcar faceinfo nil)
+                        (setcar (cdr faceinfo) nil))
+                      (setq marks (delq nil marks))
+                      ;; Apply the font aspects.
+                      (apply 'set-face-attribute temp-face nil marks)
+                      (search-backward entry)
+                      (overlay-put
+                       (make-overlay (match-beginning 0) (match-end 0))
+                       'face temp-face))))))
 	  (setq entry-list (cdr entry-list))))
       (set-buffer-modified-p nil)
       (goto-char (point-min))
@@ -1350,7 +1405,7 @@
           (setq line-start (point)))
         (setq specifier
               (buffer-substring-no-properties (1+ line-start) (point))
-	      entry-start (1+ line-start))
+              entry-start (1+ line-start))
         (forward-char 1)
         (if (and (or (char-equal (preceding-char) ?\^M)
                      (char-equal (preceding-char) ?\n))
@@ -1367,24 +1422,26 @@
           (while (string-match "[\^M]" entry)
             (aset entry (match-beginning 0) ?\n )))
         (let ((diary-entry (diary-sexp-entry sexp entry date))
-              temp)
-	  (setq entry (if (consp diary-entry)
-			  (cdr diary-entry)
-			diary-entry))
+              temp literal)
+          (setq literal entry           ; before evaluation
+                entry (if (consp diary-entry)
+                          (cdr diary-entry)
+                        diary-entry))
           (if diary-entry
-	      (progn
+              (progn
                 (remove-overlays line-start (point) 'invisible 'diary)
-		(if (< 0 (length entry))
-		    (setq temp (diary-pull-attrs entry file-glob-attrs)
-			  entry (nth 0 temp)
-			  marks (nth 1 temp)))))
-	  (add-to-diary-list date
-			     entry
-			     specifier
-			     (if entry-start (copy-marker entry-start)
-			       nil)
-			     marks)
-	  (setq entry-found (or entry-found diary-entry)))))
+                (if (< 0 (length entry))
+                    (setq temp (diary-pull-attrs entry file-glob-attrs)
+                          entry (nth 0 temp)
+                          marks (nth 1 temp)))))
+          (add-to-diary-list date
+                             entry
+                             specifier
+                             (if entry-start (copy-marker entry-start)
+                               nil)
+                             marks
+                             literal)
+          (setq entry-found (or entry-found diary-entry)))))
     entry-found))
 
 (defun diary-sexp-entry (sexp entry date)
@@ -1636,28 +1693,6 @@
       (or (diary-remind sexp (car days) marking)
           (diary-remind sexp (cdr days) marking))))))
 
-(defvar diary-modify-entry-list-string-function nil
-  "Function applied to entry string before putting it into the entries list.
-Can be used by programs integrating a diary list into other buffers (e.g.
-org.el and planner.el) to modify the string or add properties to it.
-The function takes a string argument and must return a string.")
-
-(defun add-to-diary-list (date string specifier &optional marker globcolor)
-  "Add the entry (DATE STRING SPECIFIER MARKER GLOBCOLOR) to `diary-entries-list'.
-Do nothing if DATE or STRING is nil."
-  (when (and date string)
-    (if diary-file-name-prefix
-        (let ((prefix (funcall diary-file-name-prefix-function
-                               (buffer-file-name))))
-          (or (string= prefix "")
-              (setq string (format "[%s] %s" prefix string)))))
-    (and diary-modify-entry-list-string-function
-	 (setq string (funcall diary-modify-entry-list-string-function
-			       string)))
-    (setq diary-entries-list
-          (append diary-entries-list
-                  (list (list date string specifier marker globcolor))))))
-
 (defun diary-redraw-calendar ()
   "If `calendar-buffer' is live and diary entries are marked, redraw it."
   (and mark-diary-entries-in-calendar
@@ -1796,37 +1831,87 @@
   (if diary-header-line-flag
       (setq header-line-format diary-header-line-format)))
 
+
+(defvar diary-fancy-date-pattern
+  (concat
+   (let ((dayname (diary-name-pattern calendar-day-name-array nil t))
+         (monthname (diary-name-pattern calendar-month-name-array nil t))
+         (day "[0-9]+")
+         (month "[0-9]+")
+         (year "-?[0-9]+"))
+     (mapconcat 'eval calendar-date-display-form ""))
+   ;; Optional ": holiday name" after the date.
+   "\\(: .*\\)?")
+  "Regular expression matching a date header in Fancy Diary.")
+
+(defconst diary-time-regexp
+  ;; Accepted formats: 10:00 10.00 10h00 10h 10am 10:00am 10.00am
+  ;; Use of "." as a separator annoyingly matches numbers, eg "123.45".
+  ;; Hence often prefix this with "\\(^\\|\\s-\\)."
+  (concat "[0-9]?[0-9]\\([AaPp][mM]\\|\\("
+          "[Hh]\\([0-9][0-9]\\)?\\|[:.][0-9][0-9]"
+          "\\)\\([AaPp][Mm]\\)?\\)")
+  "Regular expression matching a time of day.")
+
+(defface diary-anniversary '((t :inherit font-lock-keyword-face))
+  "Face used for anniversaries in the diary."
+  :version "22.1"
+  :group 'diary)
+
+(defface diary-time '((t :inherit font-lock-variable-name-face))
+  "Face used for times of day in the diary."
+  :version "22.1"
+  :group 'diary)
+
+(defvar fancy-diary-font-lock-keywords
+  (list
+   (list
+    ;; Any number of " other holiday name" lines, followed by "==" line.
+    (concat diary-fancy-date-pattern "\\(\n +.*\\)*\n=+$")
+    '(0 (progn (put-text-property (match-beginning 0) (match-end 0)
+                                  'font-lock-multiline t)
+               diary-face)))
+   '("^.*\\([aA]nniversary\\|[bB]irthday\\).*$" . 'diary-anniversary)
+   '("^.*Yahrzeit.*$" . font-lock-reference-face)
+   '("^\\(Erev \\)?Rosh Hodesh.*" . font-lock-function-name-face)
+   '("^Day.*omer.*$" . font-lock-builtin-face)
+   '("^Parashat.*$" . font-lock-comment-face)
+   `(,(format "\\(^\\|\\s-\\)%s\\(-%s\\)?" diary-time-regexp
+              diary-time-regexp) . 'diary-time))
+  "Keywords to highlight in fancy diary display")
+
+;; If region looks like it might start or end in the middle of a
+;; multiline pattern, extend the region to encompass the whole pattern.
+(defun diary-fancy-font-lock-fontify-region-function (beg end &optional verbose)
+  "Function to use for `font-lock-fontify-region-function' in Fancy Diary.
+Needed to handle multiline keyword in `fancy-diary-font-lock-keywords'."
+  (goto-char beg)
+  (forward-line 0)
+  (if (looking-at "=+$") (forward-line -1))
+  (while (and (looking-at " +[^ ]")
+              (zerop (forward-line -1))))
+  ;; This check not essential.
+  (if (looking-at diary-fancy-date-pattern)
+      (setq beg (line-beginning-position)))
+  (goto-char end)
+  (forward-line 0)
+  (while (and (looking-at " +[^ ]")
+              (zerop (forward-line 1))))
+  (if (looking-at "=+$")
+      (setq end (line-beginning-position 2)))
+  (font-lock-default-fontify-region beg end verbose))
+
 (define-derived-mode fancy-diary-display-mode fundamental-mode
   "Diary"
   "Major mode used while displaying diary entries using Fancy Display."
   (set (make-local-variable 'font-lock-defaults)
-       '(fancy-diary-font-lock-keywords t))
+       '(fancy-diary-font-lock-keywords
+         t nil nil nil
+         (font-lock-fontify-region-function
+          . diary-fancy-font-lock-fontify-region-function)))
   (local-set-key "q" 'quit-window))
 
 
-(defvar fancy-diary-font-lock-keywords
-  (list
-   (cons
-    (concat
-     (let ((dayname (diary-name-pattern calendar-day-name-array nil t))
-           (monthname (diary-name-pattern calendar-month-name-array nil t))
-	   (day "[0-9]+")
-           (month "[0-9]+")
-	   (year "-?[0-9]+"))
-       (mapconcat 'eval calendar-date-display-form ""))
-     "\\(\\(: .*\\)\\|\\(\n +.*\\)\\)*\n=+$")
-    'diary-face)
-   '("^.*anniversary.*$" . font-lock-keyword-face)
-   '("^.*birthday.*$" . font-lock-keyword-face)
-   '("^.*Yahrzeit.*$" . font-lock-reference-face)
-   '("^\\(Erev \\)?Rosh Hodesh.*" . font-lock-function-name-face)
-   '("^Day.*omer.*$" . font-lock-builtin-face)
-   '("^Parashat.*$" . font-lock-comment-face)
-   '("^[ \t]*[0-9]?[0-9]\\([:.]?[0-9][0-9]\\)?\\(am\\|pm\\|AM\\|PM\\)?\\(-[0-9]?[0-9]\\([:.]?[0-9][0-9]\\)?\\(am\\|pm\\|AM\\|PM\\)?\\)?"
-     . font-lock-variable-name-face))
-  "Keywords to highlight in fancy diary display")
-
-
 (defun diary-font-lock-sexps (limit)
   "Recognize sexp diary entry for font-locking."
   (if (re-search-forward
@@ -1877,13 +1962,6 @@
 (eval-when-compile (require 'cal-hebrew)
                    (require 'cal-islam))
 
-(defconst diary-time-regexp
-  ;; Formats that should be accepted:
-  ;;   10:00 10.00 10h00 10h 10am 10:00am 10.00am
-  (concat "[0-9]?[0-9]\\([AaPp][mM]\\|\\("
-          "[Hh]\\([0-9][0-9]\\)?\\|[:.][0-9][0-9]"
-          "\\)\\([AaPp][Mm]\\)?\\)"))
-
 (defvar diary-font-lock-keywords
       (append
        (diary-font-lock-date-forms calendar-month-name-array
@@ -1924,10 +2002,9 @@
                  "?\\(" (regexp-quote islamic-diary-entry-symbol) "\\)")
          '(1 font-lock-reference-face))
         '(diary-font-lock-sexps . font-lock-keyword-face)
-        (cons
-         (concat ;; "^[ \t]+"
-                 diary-time-regexp "\\(-" diary-time-regexp "\\)?")
-         'font-lock-function-name-face)))
+        `(,(concat "\\(^\\|\\s-\\)"
+                   diary-time-regexp "\\(-" diary-time-regexp "\\)?")
+          . 'diary-time)))
       "Forms to highlight in `diary-mode'.")
 
 
--- a/lisp/emacs-lisp/ewoc.el	Wed May 17 18:05:02 2006 +0000
+++ b/lisp/emacs-lisp/ewoc.el	Sat May 20 10:32:11 2006 +0000
@@ -205,6 +205,22 @@
 	      (eq node (ewoc--footer ewoc)))
     node))
 
+(defun ewoc--adjust (beg end node)
+  ;; "Manually reseat" markers for NODE and its successors (including footer
+  ;; and dll), in the case where they originally shared start position with
+  ;; BEG, to END.  BEG and END are buffer positions describing NODE's left
+  ;; neighbor.  This operation is functionally equivalent to temporarily
+  ;; setting these nodes' markers' insertion type to t around the pretty-print
+  ;; call that precedes the call to `ewoc-adjust', and then changing them back
+  ;; to nil.
+  (when (< beg end)
+    (let (m)
+      (while (and (= beg (setq m (ewoc--node-start-marker node)))
+                  (progn
+                    (set-marker m end)
+                    (not (eq dll node))))
+        (setq node (ewoc--node-right node))))))
+
 (defun ewoc--insert-new-node (node data pretty-printer)
   "Insert before NODE a new node for DATA, displayed by PRETTY-PRINTER.
 Call PRETTY-PRINTER with point at NODE's start, thus pushing back
@@ -215,29 +231,26 @@
            (pos (marker-position m))
            (elemnode (ewoc--node-create m data)))
       (goto-char pos)
-      ;; Insert the trailing newline using insert-before-markers
-      ;; so that the start position for the next element is updated.
-      (insert-before-markers ?\n)
-      ;; Move back, and call the pretty-printer.
-      (backward-char 1)
       (funcall pretty-printer data)
       (setf (marker-position m) pos
             (ewoc--node-left  elemnode) (ewoc--node-left node)
             (ewoc--node-right elemnode)                  node
             (ewoc--node-right (ewoc--node-left node)) elemnode
             (ewoc--node-left                   node)  elemnode)
+      (ewoc--adjust pos (point) node)
       elemnode)))
 
 (defun ewoc--refresh-node (pp node)
   "Redisplay the element represented by NODE using the pretty-printer PP."
-  (let ((inhibit-read-only t))
+  (let ((inhibit-read-only t)
+        (m (ewoc--node-start-marker node))
+        (R (ewoc--node-right node)))
     ;; First, remove the string from the buffer:
-    (delete-region (ewoc--node-start-marker node)
-                   (1- (marker-position
-                        (ewoc--node-start-marker (ewoc--node-right node)))))
+    (delete-region m (ewoc--node-start-marker R))
     ;; Calculate and insert the string.
-    (goto-char (ewoc--node-start-marker node))
-    (funcall pp (ewoc--node-data node))))
+    (goto-char m)
+    (funcall pp (ewoc--node-data node))
+    (ewoc--adjust m (point) R)))
 
 ;;; ===========================================================================
 ;;;                  Public members of the Ewoc package
@@ -251,14 +264,12 @@
 PRETTY-PRINTER should be a function that takes one argument, an
 element, and inserts a string representing it in the buffer (at
 point).  The string PRETTY-PRINTER inserts may be empty or span
-several lines.  A trailing newline will always be inserted
-automatically.  The PRETTY-PRINTER should use `insert', and not
+several lines.  The PRETTY-PRINTER should use `insert', and not
 `insert-before-markers'.
 
-Optional second argument HEADER is a string that will always be
-present at the top of the ewoc.  HEADER should end with a
-newline.  Optional third argument FOOTER is similar, and will
-be inserted at the bottom of the ewoc."
+Optional second and third arguments HEADER and FOOTER are strings,
+possibly empty, that will always be present at the top and bottom,
+respectively, of the ewoc."
   (let* ((dummy-node (ewoc--node-create 'DL-LIST 'DL-LIST))
          (dll (progn (setf (ewoc--node-right dummy-node) dummy-node)
                      (setf (ewoc--node-left dummy-node) dummy-node)
@@ -352,11 +363,12 @@
 arguments will be passed to MAP-FUNCTION."
   (ewoc--set-buffer-bind-dll-let* ewoc
       ((footer (ewoc--footer ewoc))
+       (pp (ewoc--pretty-printer ewoc))
        (node (ewoc--node-nth dll 1)))
     (save-excursion
       (while (not (eq node footer))
         (if (apply map-function (ewoc--node-data node) args)
-            (ewoc--refresh-node (ewoc--pretty-printer ewoc) node))
+            (ewoc--refresh-node pp node))
         (setq node (ewoc--node-next dll node))))))
 
 (defun ewoc-filter (ewoc predicate &rest args)
@@ -465,10 +477,11 @@
 (defun ewoc-invalidate (ewoc &rest nodes)
   "Call EWOC's pretty-printer for each element in NODES.
 Delete current text first, thus effecting a \"refresh\"."
-  (ewoc--set-buffer-bind-dll ewoc
+  (ewoc--set-buffer-bind-dll-let* ewoc
+      ((pp (ewoc--pretty-printer ewoc)))
     (save-excursion
       (dolist (node nodes)
-        (ewoc--refresh-node (ewoc--pretty-printer ewoc) node)))))
+        (ewoc--refresh-node pp node)))))
 
 (defun ewoc-goto-prev (ewoc arg)
   "Move point to the ARGth previous element in EWOC.
@@ -525,7 +538,6 @@
 	(while (not (eq node footer))
 	  (set-marker (ewoc--node-start-marker node) (point))
 	  (funcall pp (ewoc--node-data node))
-	  (insert "\n")
 	  (setq node (ewoc--node-next dll node)))))
     (set-marker (ewoc--node-start-marker footer) (point))))
 
@@ -564,11 +576,14 @@
 
 (defun ewoc-set-hf (ewoc header footer)
   "Set the HEADER and FOOTER of EWOC."
-  (setf (ewoc--node-data (ewoc--header ewoc)) header)
-  (setf (ewoc--node-data (ewoc--footer ewoc)) footer)
-  (save-excursion
-    (ewoc--refresh-node 'insert (ewoc--header ewoc))
-    (ewoc--refresh-node 'insert (ewoc--footer ewoc))))
+  (ewoc--set-buffer-bind-dll-let* ewoc
+      ((head (ewoc--header ewoc))
+       (foot (ewoc--footer ewoc)))
+    (setf (ewoc--node-data head) header
+          (ewoc--node-data foot) footer)
+    (save-excursion
+      (ewoc--refresh-node 'insert head)
+      (ewoc--refresh-node 'insert foot))))
 
 
 (provide 'ewoc)
--- a/lisp/files.el	Wed May 17 18:05:02 2006 +0000
+++ b/lisp/files.el	Sat May 20 10:32:11 2006 +0000
@@ -3063,6 +3063,7 @@
 (defun file-name-extension (filename &optional period)
   "Return FILENAME's final \"extension\".
 The extension, in a file name, is the part that follows the last `.',
+excluding version numbers and backup suffixes,
 except that a leading `.', if any, doesn't count.
 Return nil for extensionless file names such as `foo'.
 Return the empty string for file names such as `foo.'.
--- a/lisp/gnus/ChangeLog	Wed May 17 18:05:02 2006 +0000
+++ b/lisp/gnus/ChangeLog	Sat May 20 10:32:11 2006 +0000
@@ -1,3 +1,13 @@
+2006-05-18  Reiner Steib  <Reiner.Steib@gmx.de>
+
+	* gnus-sum.el (gnus-summary-save-article-mail): Clarify doc string.
+	(gnus-summary-expire-articles-now): Shorten prompt.
+
+	* gmm-utils.el (wid-edit): Require.
+	(defun-gmm): Renamed from `gmm-defun-compat'.
+	(gmm-image-search-load-path): Use it.
+	(gmm-image-load-path-for-library): Use it.  Sync with `mh-compat.el'.
+
 2006-05-04  Stefan Monnier  <monnier@iro.umontreal.ca>
 
 	* mm-decode.el (mm-dissect-buffer): Remove spurious double assignment.
@@ -4112,6 +4122,7 @@
 
 ;; Local Variables:
 ;; coding: iso-2022-7bit
+;; fill-column: 79
 ;; End:
 
 ;;; arch-tag: 3f33a3e7-090d-492b-bedd-02a1417d32b4
--- a/lisp/gnus/gmm-utils.el	Wed May 17 18:05:02 2006 +0000
+++ b/lisp/gnus/gmm-utils.el	Sat May 20 10:32:11 2006 +0000
@@ -30,7 +30,7 @@
 
 ;;; Code:
 
-;; (require 'wid-edit)
+(require 'wid-edit)
 
 (defgroup gmm nil
   "Utility functions for Gnus, Message and MML"
@@ -279,11 +279,7 @@
 	    icon-list))
     tool-bar-map))
 
-;; WARNING: The following is subject to change.  Don't rely on it yet.
-
-;; From MH-E without modifications:
-
-(defmacro gmm-defun-compat (name function arg-list &rest body)
+(defmacro defun-gmm (name function arg-list &rest body)
   "Create function NAME.
 If FUNCTION exists, then NAME becomes an alias for FUNCTION.
 Otherwise, create function NAME with ARG-LIST and BODY."
@@ -292,21 +288,19 @@
         `(defalias ',name ',function)
       `(defun ,name ,arg-list ,@body))))
 
-(gmm-defun-compat gmm-image-search-load-path
+(defun-gmm gmm-image-search-load-path
   image-search-load-path (file &optional path)
   "Emacs 21 and XEmacs don't have `image-search-load-path'.
 This function returns nil on those systems."
   nil)
 
-;; From MH-E with modifications:
-
-;; Don't use `gmm-defun-compat' until API changes in
-;; `image-load-path-for-library' in Emacs CVS are completed.
+;; Cf. `mh-image-load-path-for-library' in `mh-compat.el'.
 
-(defun gmm-image-load-path-for-library (library image &optional path no-error)
-  "Return a suitable search path for images relative to LIBRARY.
+(defun-gmm gmm-image-load-path-for-library
+  image-load-path-for-library (library image &optional path no-error)
+  "Return a suitable search path for images used by LIBRARY.
 
-First it searches for IMAGE in `image-load-path' (excluding
+It searches for IMAGE in `image-load-path' (excluding
 \"`data-directory'/images\") and `load-path', followed by a path
 suitable for LIBRARY, which includes \"../../etc/images\" and
 \"../etc/images\" relative to the library file itself, and then
--- a/lisp/gnus/gnus-sum.el	Wed May 17 18:05:02 2006 +0000
+++ b/lisp/gnus/gnus-sum.el	Sat May 20 10:32:11 2006 +0000
@@ -9507,7 +9507,7 @@
   (interactive)
   (or gnus-expert-user
       (gnus-yes-or-no-p
-       "Are you really, really, really sure you want to delete all these messages? ")
+       "Are you really, really sure you want to delete all expirable messages? ")
       (error "Phew!"))
   (gnus-summary-expire-articles t))
 
@@ -11043,7 +11043,7 @@
       (gnus-configure-windows 'pipe))))
 
 (defun gnus-summary-save-article-mail (&optional arg)
-  "Append the current article to an mail file.
+  "Append the current article to a Unix mail box file.
 If N is a positive number, save the N next articles.
 If N is a negative number, save the N previous articles.
 If N is nil and any articles have been marked with the process mark,
--- a/lisp/ido.el	Wed May 17 18:05:02 2006 +0000
+++ b/lisp/ido.el	Sat May 20 10:32:11 2006 +0000
@@ -1778,7 +1778,7 @@
   "Perform the `ido-read-buffer' and `ido-read-file-name' functions.
 Return the name of a buffer or file selected.
 PROMPT is the prompt to give to the user.
-DEFAULT if given is the default directory to start with.
+DEFAULT if given is the default item to start with.
 If REQUIRE-MATCH is non-nil, an existing file must be selected.
 If INITIAL is non-nil, it specifies the initial input string."
   (let
@@ -1822,7 +1822,10 @@
 	      (cond
 	       ((eq item 'buffer)
 		(if (bufferp default) (buffer-name default) default))
-	       ((stringp default) default)
+	       ((stringp default)
+		(if (memq item '(file dir))
+		    (file-name-nondirectory default)
+		  default))
 	       ((eq item 'file)
 		(and ido-enable-last-directory-history
 		     (let ((d (assoc ido-current-directory ido-last-directory-list)))
--- a/lisp/international/code-pages.el	Wed May 17 18:05:02 2006 +0000
+++ b/lisp/international/code-pages.el	Sat May 20 10:32:11 2006 +0000
@@ -4489,7 +4489,7 @@
 
 ;; Suggested by Anton Zinoviev <anton@lml.bas.bg>: Bulgarian DOS
 ;; codepage.  Table at
-;; <URL:http://czyborra.com/charsets/bulgarian-mik.txt.gz>.
+;; <http://en.wikipedia.org/wiki/MIK_Code_page>.
 ;;;###autoload(autoload-coding-system 'mik '(require 'code-pages))
 (cp-make-coding-system
  mik
@@ -4497,7 +4497,7 @@
   ?Ч ?Ш ?Щ ?Ъ ?Ы ?Ь ?Э ?Ю ?Я ?а ?б ?в ?г ?д ?е ?ж ?з ?и ?й ?к ?л ?м ?н
   ?о ?п ?Ñ€ ?Ñ ?Ñ‚ ?у ?Ñ„ ?Ñ… ?ц ?ч ?ш ?щ ?ÑŠ ?Ñ‹ ?ÑŒ ?Ñ ?ÑŽ ?Ñ ?â”” ?â”´ ?┬ ?├ ?─
   ?┼ ?╣ ?║ ?╚ ?╔ ?╩ ?╦ ?╠ ?╠?╬ ?┠?░ ?▒ ?▓ ?│ ?┤ ?№ ?§ ?╗ ?╠?┘ ?┌ ?█
-  ?▄ ?▌ ?■?▀ ?α ?β ?Γ ?π ?Σ ?σ ?μ ?τ ?Φ ?Θ ?Ω ?δ ?∞ ?∅ ?∈ ?∩ ?≡ ?± ?≥
+  ?▄ ?▌ ?■?▀ ?α ?ß ?Γ ?π ?Σ ?σ ?µ ?τ ?Φ ?Θ ?Ω ?δ ?∞ ?φ ?ε ?∩ ?≡ ?± ?≥
   ?≤ ?⌠ ?⌡ ?÷ ?≈ ?° ?∙ ?· ?√ ?⿠?² ?■ ? ])
 (coding-system-put 'mik 'mime-charset nil)
 
--- a/lisp/pcvs-info.el	Wed May 17 18:05:02 2006 +0000
+++ b/lisp/pcvs-info.el	Sat May 20 10:32:11 2006 +0000
@@ -379,7 +379,8 @@
 		      ;; or nothing
 		      "")))
 	   (format "%-11s %s %-11s %-11s %s"
-		   side status type base file)))))))
+		   side status type base file))))
+     "\n")))
 
 
 (defun cvs-fileinfo-update (fi fi-new)
--- a/lisp/pcvs.el	Wed May 17 18:05:02 2006 +0000
+++ b/lisp/pcvs.el	Sat May 20 10:32:11 2006 +0000
@@ -467,7 +467,7 @@
 	 (cvs-mode)
 	 (set (make-local-variable 'list-buffers-directory) buffer-name)
 	 ;;(set (make-local-variable 'cvs-temp-buffer) (cvs-temp-buffer))
-	 (let ((cookies (ewoc-create 'cvs-fileinfo-pp "\n" "")))
+	 (let ((cookies (ewoc-create 'cvs-fileinfo-pp "\n\n" "\n")))
 	   (set (make-local-variable 'cvs-cookies) cookies)
 	   (add-hook 'kill-buffer-hook
 		     (lambda ()
@@ -618,7 +618,7 @@
 	 (str (car hf))
 	 (done "")
 	 (tin (ewoc-nth cvs-cookies 0)))
-    (if (eq (length str) 1) (setq str ""))
+    (if (eq (length str) 2) (setq str ""))
     ;; look for the first *real* fileinfo (to determine emptyness)
     (while
 	(and tin
@@ -633,6 +633,7 @@
 	(setq str (replace-match "" t t str))
 	(if (zerop (length str)) (setq str "\n"))
 	(setq done (concat "-- last cmd: " cmd " --"))))
+    (setq str (concat str "\n") done (concat done "\n"))
     ;; set the new header and footer
     (ewoc-set-hf cvs-cookies
 		 str (concat "\n--------------------- "
--- a/lisp/progmodes/grep.el	Wed May 17 18:05:02 2006 +0000
+++ b/lisp/progmodes/grep.el	Sat May 20 10:32:11 2006 +0000
@@ -553,7 +553,7 @@
        (read-string
         "compile.el: No `grep-find-command' command available. Press RET.")
        (list nil))))
-  (when (and grep-find-command command-args)
+  (when command-args
     (let ((null-device nil))		; see grep
       (grep command-args))))
 
--- a/lisp/shell.el	Wed May 17 18:05:02 2006 +0000
+++ b/lisp/shell.el	Sat May 20 10:32:11 2006 +0000
@@ -150,7 +150,7 @@
   :group 'shell)
 
 (defcustom shell-completion-fignore nil
-  "*List of suffixes to be disregarded during file/command completion.
+  "List of suffixes to be disregarded during file/command completion.
 This variable is used to initialize `comint-completion-fignore' in the shell
 buffer.  The default is nil, for compatibility with most shells.
 Some people like (\"~\" \"#\" \"%\").
@@ -199,19 +199,19 @@
 This is a fine thing to set in your `.emacs' file.")
 
 (defcustom shell-command-regexp "[^;&|\n]+"
-  "*Regexp to match a single command within a pipeline.
+  "Regexp to match a single command within a pipeline.
 This is used for directory tracking and does not do a perfect job."
   :type 'regexp
   :group 'shell)
 
 (defcustom shell-command-separator-regexp "[;&|\n \t]*"
-  "*Regexp to match a single command within a pipeline.
+  "Regexp to match a single command within a pipeline.
 This is used for directory tracking and does not do a perfect job."
   :type 'regexp
   :group 'shell)
 
 (defcustom shell-completion-execonly t
-  "*If non-nil, use executable files only for completion candidates.
+  "If non-nil, use executable files only for completion candidates.
 This mirrors the optional behavior of tcsh.
 
 Detecting executability of files may slow command completion considerably."
@@ -219,35 +219,35 @@
   :group 'shell)
 
 (defcustom shell-popd-regexp "popd"
-  "*Regexp to match subshell commands equivalent to popd."
+  "Regexp to match subshell commands equivalent to popd."
   :type 'regexp
   :group 'shell-directories)
 
 (defcustom shell-pushd-regexp "pushd"
-  "*Regexp to match subshell commands equivalent to pushd."
+  "Regexp to match subshell commands equivalent to pushd."
   :type 'regexp
   :group 'shell-directories)
 
 (defcustom shell-pushd-tohome nil
-  "*If non-nil, make pushd with no arg behave as \"pushd ~\" (like cd).
+  "If non-nil, make pushd with no arg behave as \"pushd ~\" (like cd).
 This mirrors the optional behavior of tcsh."
   :type 'boolean
   :group 'shell-directories)
 
 (defcustom shell-pushd-dextract nil
-  "*If non-nil, make \"pushd +n\" pop the nth dir to the stack top.
+  "If non-nil, make \"pushd +n\" pop the nth dir to the stack top.
 This mirrors the optional behavior of tcsh."
   :type 'boolean
   :group 'shell-directories)
 
 (defcustom shell-pushd-dunique nil
-  "*If non-nil, make pushd only add unique directories to the stack.
+  "If non-nil, make pushd only add unique directories to the stack.
 This mirrors the optional behavior of tcsh."
   :type 'boolean
   :group 'shell-directories)
 
 (defcustom shell-cd-regexp "cd"
-  "*Regexp to match subshell commands equivalent to cd."
+  "Regexp to match subshell commands equivalent to cd."
   :type 'regexp
   :group 'shell-directories)
 
@@ -256,19 +256,19 @@
       ; NetWare allows the five chars between upper and lower alphabetics.
       "[]a-zA-Z^_`\\[\\\\]:"
     nil)
-  "*If non-nil, is regexp used to track drive changes."
+  "If non-nil, is regexp used to track drive changes."
   :type '(choice regexp
 		 (const nil))
   :group 'shell-directories)
 
 (defcustom shell-dirtrack-verbose t
-  "*If non-nil, show the directory stack following directory change.
+  "If non-nil, show the directory stack following directory change.
 This is effective only if directory tracking is enabled."
   :type 'boolean
   :group 'shell-directories)
 
 (defcustom explicit-shell-file-name nil
-  "*If non-nil, is file name to use for explicitly requested inferior shell."
+  "If non-nil, is file name to use for explicitly requested inferior shell."
   :type '(choice (const :tag "None" nil) file)
   :group 'shell)
 
@@ -278,7 +278,7 @@
       ;; than us about what terminal modes to use.
       '("-i" "-T")
     '("-i"))
-  "*Args passed to inferior shell by M-x shell, if the shell is csh.
+  "Args passed to inferior shell by \\[shell], if the shell is csh.
 Value is a list of strings, which may be nil."
   :type '(repeat (string :tag "Argument"))
   :group 'shell)
@@ -296,13 +296,13 @@
 			   (shell-command-to-string (concat prog " --noediting"))))
 	'("-i")
       '("--noediting" "-i")))
-  "*Args passed to inferior shell by M-x shell, if the shell is bash.
+  "Args passed to inferior shell by \\[shell], if the shell is bash.
 Value is a list of strings, which may be nil."
   :type '(repeat (string :tag "Argument"))
   :group 'shell)
 
 (defcustom shell-input-autoexpand 'history
-  "*If non-nil, expand input command history references on completion.
+  "If non-nil, expand input command history references on completion.
 This mirrors the optional behavior of tcsh (its autoexpand and histlit).
 
 If the value is `input', then the expansion is seen on input.
@@ -433,9 +433,7 @@
   (setq shell-dirstack nil)
   (make-local-variable 'shell-last-dir)
   (setq shell-last-dir nil)
-  (make-local-variable 'shell-dirtrackp)
-  (setq shell-dirtrackp t)
-  (add-hook 'comint-input-filter-functions 'shell-directory-tracker nil t)
+  (shell-dirtrack-mode 1)
   (setq comint-input-autoexpand shell-input-autoexpand)
   ;; This is not really correct, since the shell buffer does not really
   ;; edit this directory.  But it is useful in the buffer list and menus.
@@ -558,48 +556,48 @@
       (shell-mode)))
   buffer)
 
-;;; Don't do this when shell.el is loaded, only while dumping.
+;; Don't do this when shell.el is loaded, only while dumping.
 ;;;###autoload (add-hook 'same-window-buffer-names "*shell*")
 
 ;;; Directory tracking
-;;;
-;;; This code provides the shell mode input sentinel
-;;;     SHELL-DIRECTORY-TRACKER
-;;; that tracks cd, pushd, and popd commands issued to the shell, and
-;;; changes the current directory of the shell buffer accordingly.
-;;;
-;;; This is basically a fragile hack, although it's more accurate than
-;;; the version in Emacs 18's shell.el. It has the following failings:
-;;; 1. It doesn't know about the cdpath shell variable.
-;;; 2. It cannot infallibly deal with command sequences, though it does well
-;;;    with these and with ignoring commands forked in another shell with ()s.
-;;; 3. More generally, any complex command is going to throw it. Otherwise,
-;;;    you'd have to build an entire shell interpreter in Emacs Lisp.  Failing
-;;;    that, there's no way to catch shell commands where cd's are buried
-;;;    inside conditional expressions, aliases, and so forth.
-;;;
-;;; The whole approach is a crock. Shell aliases mess it up. File sourcing
-;;; messes it up. You run other processes under the shell; these each have
-;;; separate working directories, and some have commands for manipulating
-;;; their w.d.'s (e.g., the lcd command in ftp). Some of these programs have
-;;; commands that do *not* affect the current w.d. at all, but look like they
-;;; do (e.g., the cd command in ftp).  In shells that allow you job
-;;; control, you can switch between jobs, all having different w.d.'s. So
-;;; simply saying %3 can shift your w.d..
-;;;
-;;; The solution is to relax, not stress out about it, and settle for
-;;; a hack that works pretty well in typical circumstances. Remember
-;;; that a half-assed solution is more in keeping with the spirit of Unix,
-;;; anyway. Blech.
-;;;
-;;; One good hack not implemented here for users of programmable shells
-;;; is to program up the shell w.d. manipulation commands to output
-;;; a coded command sequence to the tty. Something like
-;;;     ESC | <cwd> |
-;;; where <cwd> is the new current working directory. Then trash the
-;;; directory tracking machinery currently used in this package, and
-;;; replace it with a process filter that watches for and strips out
-;;; these messages.
+;;
+;; This code provides the shell mode input sentinel
+;;     SHELL-DIRECTORY-TRACKER
+;; that tracks cd, pushd, and popd commands issued to the shell, and
+;; changes the current directory of the shell buffer accordingly.
+;;
+;; This is basically a fragile hack, although it's more accurate than
+;; the version in Emacs 18's shell.el. It has the following failings:
+;; 1. It doesn't know about the cdpath shell variable.
+;; 2. It cannot infallibly deal with command sequences, though it does well
+;;    with these and with ignoring commands forked in another shell with ()s.
+;; 3. More generally, any complex command is going to throw it. Otherwise,
+;;    you'd have to build an entire shell interpreter in Emacs Lisp.  Failing
+;;    that, there's no way to catch shell commands where cd's are buried
+;;    inside conditional expressions, aliases, and so forth.
+;;
+;; The whole approach is a crock. Shell aliases mess it up. File sourcing
+;; messes it up. You run other processes under the shell; these each have
+;; separate working directories, and some have commands for manipulating
+;; their w.d.'s (e.g., the lcd command in ftp). Some of these programs have
+;; commands that do *not* affect the current w.d. at all, but look like they
+;; do (e.g., the cd command in ftp).  In shells that allow you job
+;; control, you can switch between jobs, all having different w.d.'s. So
+;; simply saying %3 can shift your w.d..
+;;
+;; The solution is to relax, not stress out about it, and settle for
+;; a hack that works pretty well in typical circumstances. Remember
+;; that a half-assed solution is more in keeping with the spirit of Unix,
+;; anyway. Blech.
+;;
+;; One good hack not implemented here for users of programmable shells
+;; is to program up the shell w.d. manipulation commands to output
+;; a coded command sequence to the tty. Something like
+;;     ESC | <cwd> |
+;; where <cwd> is the new current working directory. Then trash the
+;; directory tracking machinery currently used in this package, and
+;; replace it with a process filter that watches for and strips out
+;; these messages.
 
 (defun shell-directory-tracker (str)
   "Tracks cd, pushd and popd commands issued to the shell.
@@ -607,8 +605,8 @@
 It watches for cd, pushd and popd commands and sets the buffer's
 default directory to track these commands.
 
-You may toggle this tracking on and off with M-x dirtrack-mode.
-If Emacs gets confused, you can resync with the shell with M-x dirs.
+You may toggle this tracking on and off with \\[dirtrack-mode].
+If Emacs gets confused, you can resync with the shell with \\[dirs].
 
 See variables `shell-cd-regexp', `shell-chdrive-regexp', `shell-pushd-regexp',
 and  `shell-popd-regexp', while `shell-pushd-tohome', `shell-pushd-dextract',
@@ -677,7 +675,7 @@
 	       (setq string (replace-match "" nil nil string)))))
       string)))
 
-;;; popd [+n]
+;; popd [+n]
 (defun shell-process-popd (arg)
   (let ((num (or (shell-extract-num arg) 0)))
     (cond ((and num (= num 0) shell-dirstack)
@@ -703,7 +701,7 @@
       ;; For relative name we assume default-directory already has the prefix.
       (expand-file-name dir))))
 
-;;; cd [dir]
+;; cd [dir]
 (defun shell-process-cd (arg)
   (let ((new-dir (cond ((zerop (length arg)) (concat comint-file-name-prefix
 						     "~"))
@@ -713,7 +711,7 @@
     (shell-cd new-dir)
     (shell-dirstack-message)))
 
-;;; pushd [+n | dir]
+;; pushd [+n | dir]
 (defun shell-process-pushd (arg)
   (let ((num (shell-extract-num arg)))
     (cond ((zerop (length arg))
@@ -762,26 +760,25 @@
   (and (string-match "^\\+[1-9][0-9]*$" str)
        (string-to-number str)))
 
-
-(defun shell-dirtrack-mode ()
+(defvaralias 'shell-dirtrack-mode 'shell-dirtrackp)
+(define-minor-mode shell-dirtrack-mode
   "Turn directory tracking on and off in a shell buffer."
-  (interactive)
-  (if (setq shell-dirtrackp (not shell-dirtrackp))
-      (setq list-buffers-directory default-directory)
-    (setq list-buffers-directory nil))
-  (message "Directory tracking %s" (if shell-dirtrackp "ON" "OFF")))
+  nil nil nil
+  (setq list-buffers-directory (if shell-dirtrack-mode default-directory))
+  (if shell-dirtrack-mode
+      (add-hook 'comint-input-filter-functions 'shell-directory-tracker nil t)
+    (remove-hook 'comint-input-filter-functions 'shell-directory-tracker t)))
 
-;;; For your typing convenience:
-(defalias 'shell-dirtrack-toggle 'shell-dirtrack-mode)
+;; For your typing convenience:
+(defalias 'shell-dirtrack-toggle 'shell-dirtrack-mode) ;??Convenience??
 (defalias 'dirtrack-toggle 'shell-dirtrack-mode)
 (defalias 'dirtrack-mode 'shell-dirtrack-mode)
 
 (defun shell-cd (dir)
   "Do normal `cd' to DIR, and set `list-buffers-directory'."
+  (cd dir)
   (if shell-dirtrackp
-      (setq list-buffers-directory (file-name-as-directory
-				    (expand-file-name dir))))
-  (cd dir))
+      (setq list-buffers-directory default-directory)))
 
 (defun shell-resync-dirs ()
   "Resync the buffer's idea of the current directory stack.
@@ -841,15 +838,15 @@
 		   (shell-dirstack-message))
 	  (error (message "Couldn't cd")))))))
 
-;;; For your typing convenience:
+;; For your typing convenience:
 (defalias 'dirs 'shell-resync-dirs)
 
 
-;;; Show the current dirstack on the message line.
-;;; Pretty up dirs a bit by changing "/usr/jqr/foo" to "~/foo".
-;;; (This isn't necessary if the dirlisting is generated with a simple "dirs".)
-;;; All the commands that mung the buffer's dirstack finish by calling
-;;; this guy.
+;; Show the current dirstack on the message line.
+;; Pretty up dirs a bit by changing "/usr/jqr/foo" to "~/foo".
+;; (This isn't necessary if the dirlisting is generated with a simple "dirs".)
+;; All the commands that mung the buffer's dirstack finish by calling
+;; this guy.
 (defun shell-dirstack-message ()
   (when shell-dirtrack-verbose
     (let* ((msg "")
@@ -1076,5 +1073,5 @@
 
 (provide 'shell)
 
-;;; arch-tag: bcb5f12a-c1f4-4aea-a809-2504bd5bd797
+;; arch-tag: bcb5f12a-c1f4-4aea-a809-2504bd5bd797
 ;;; shell.el ends here
--- a/lisp/term/mac-win.el	Wed May 17 18:05:02 2006 +0000
+++ b/lisp/term/mac-win.el	Sat May 20 10:32:11 2006 +0000
@@ -1585,17 +1585,6 @@
 	(ash (lsh result extended-sign-len) (- extended-sign-len))
       result)))
 
-(defun mac-bytes-to-digits (bytes &optional from to)
-  (or from (setq from 0))
-  (or to (setq to (length bytes)))
-  (let ((len (- to from))
-	(val 0.0))
-    (dotimes (i len)
-      (setq val (+ (* val 256.0)
-		   (aref bytes (+ from (if (eq (byteorder) ?B) i
-					 (- len i 1)))))))
-    (format "%.0f" val)))
-
 (defun mac-ae-selection-range (ae)
 ;; #pragma options align=mac68k
 ;; typedef struct SelectionRange {
@@ -1693,7 +1682,8 @@
     (if (and modifiers (not (string= modifiers "\000\000\000\000")))
 	;; Globally toggle tool-bar-mode if some modifier key is pressed.
 	(tool-bar-mode)
-      (let ((window-id (mac-bytes-to-digits (cdr (mac-ae-parameter ae))))
+      (let ((window-id
+	     (mac-coerce-ae-data "long" (cdr (mac-ae-parameter ae)) "TEXT"))
 	    (rest (frame-list))
 	    frame)
 	(while (and (null frame) rest)
--- a/lispintro/ChangeLog	Wed May 17 18:05:02 2006 +0000
+++ b/lispintro/ChangeLog	Sat May 20 10:32:11 2006 +0000
@@ -1,3 +1,7 @@
+2006-05-19  Thien-Thi Nguyen  <ttn@gnu.org>
+
+	* emacs-lisp-intro.texi (Digression concerning error): Fix typo.
+
 2005-09-16  Romain Francoise  <romain@orebokech.com>
 
 	* emacs-lisp-intro.texi (GNU Free Documentation License):
--- a/lispintro/emacs-lisp-intro.texi	Wed May 17 18:05:02 2006 +0000
+++ b/lispintro/emacs-lisp-intro.texi	Sat May 20 10:32:11 2006 +0000
@@ -18278,7 +18278,7 @@
 whether the kill ring is full or empty.  This is an act of
 exploration.
 
-(From the human point of view, the act of exploration and discovery is
+From the human point of view, the act of exploration and discovery is
 not necessarily an error, and therefore should not be labelled as one,
 even in the bowels of a computer.  As it is, the code in Emacs implies
 that a human who is acting virtuously, by exploring his or her
--- a/lispref/ChangeLog	Wed May 17 18:05:02 2006 +0000
+++ b/lispref/ChangeLog	Sat May 20 10:32:11 2006 +0000
@@ -1,3 +1,9 @@
+2006-05-17  Richard Stallman  <rms@gnu.org>
+
+	* minibuf.texi (Minibuffer History): Clarify.
+
+	* searching.texi (Regexp Special): Clarify nested regexp warning.
+
 2006-05-16  Kim F. Storm  <storm@cua.dk>
 
 	* minibuf.texi (Minibuffer History): Update add-to-history.
--- a/lispref/minibuf.texi	Wed May 17 18:05:02 2006 +0000
+++ b/lispref/minibuf.texi	Sat May 20 10:32:11 2006 +0000
@@ -450,19 +450,17 @@
 specifies whether to delete duplicates in history.
 
 @defun add-to-history history-var newelt &optional maxelt keep-all
-This function adds a new element @var{newelt}, if non-empty, to the
-history list stored in the variable @var{history-var}, and returns the
-updated history list.  By default, the list length is limited by the
-value specified by @code{history-length} (described below), but the
-optional argument @var{maxelt} overrides that.  The possible values of
-@var{maxelt} have the same meaning as the values of
-@code{history-length}.
+This function adds a new element @var{newelt}, if it isn't the empty
+string, to the history list stored in the variable @var{history-var},
+and returns the updated history list.  It limits the list length to
+the value of @var{maxelt} (if non-@code{nil}) or @code{history-length}
+(described below).  The possible values of @var{maxelt} have the same
+meaning as the values of @code{history-length}.
 
-Duplicate members are removed from the history list, if
-@code{history-delete-duplicates} is non-@code{nil}.
-
-If @var{keep-all} is non-@code{nil}, even an empty or duplicate
-@var{newelt} element is added to the history list.
+Normally, @code{add-to-history} removes duplicate members from the
+history list if @code{history-delete-duplicates} is non-@code{nil}.
+However, if @var{keep-all} is non-@code{nil}, that says not to remove
+duplicates, and to add @var{newelt} to the list even if it is empty.
 @end defun
 
 @defvar history-length
--- a/lispref/searching.texi	Wed May 17 18:05:02 2006 +0000
+++ b/lispref/searching.texi	Sat May 20 10:32:11 2006 +0000
@@ -306,9 +306,10 @@
 first tries to match all three @samp{a}s; but the rest of the pattern is
 @samp{ar} and there is only @samp{r} left to match, so this try fails.
 The next alternative is for @samp{a*} to match only two @samp{a}s.  With
-this choice, the rest of the regexp matches successfully.@refill
+this choice, the rest of the regexp matches successfully.
 
-Nested repetition operators take a long time, or even forever, if they
+@strong{Warning:} Nested repetition operators take a long time,
+or even forever, if they
 lead to ambiguous matching.  For example, trying to match the regular
 expression @samp{\(x+y*\)*a} against the string
 @samp{xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxz} could take hours before it
@@ -316,7 +317,8 @@
 @samp{x}s before concluding that none of them can work.  Even worse,
 @samp{\(x*\)*} can match the null string in infinitely many ways, so
 it causes an infinite loop.  To avoid these problems, check nested
-repetitions carefully.
+repetitions carefully, to make sure that they do not cause combinatorial
+explosions in backtracking.
 
 @item @samp{+}
 @cindex @samp{+} in regexp
--- a/mac/ChangeLog	Wed May 17 18:05:02 2006 +0000
+++ b/mac/ChangeLog	Sat May 20 10:32:11 2006 +0000
@@ -1,3 +1,7 @@
+2006-05-19  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
+
+	* makefile.MPW (SOME_MACHINE_LISP): Add fringe.elc.
+
 2006-04-12  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
 
 	* inc/config.h (pid_t): Define to int.
--- a/mac/makefile.MPW	Wed May 17 18:05:02 2006 +0000
+++ b/mac/makefile.MPW	Sat May 20 10:32:11 2006 +0000
@@ -1115,8 +1115,8 @@
   {Lisp}w32-fns.elc {Lisp}dos-w32.elc ¶
   {Lisp}disp-table.elc {Lisp}dos-vars.elc ¶
   {Lisp}tooltip.elc {Lisp}image.elc ¶
-  {Lisp}dnd.elc {Lisp}mwheel.elc ¶
-  {Lisp}tool-bar.elc ¶
+  {Lisp}fringe.elc {Lisp}dnd.elc ¶
+  {Lisp}mwheel.elc {Lisp}tool-bar.elc ¶
   {Lisp}x-dnd.elc ¶
   {Lisp}international:ccl.elc ¶
   {Lisp}international:codepage.elc ¶
--- a/man/ChangeLog	Wed May 17 18:05:02 2006 +0000
+++ b/man/ChangeLog	Sat May 20 10:32:11 2006 +0000
@@ -1,3 +1,15 @@
+2006-05-18  Reiner Steib  <Reiner.Steib@gmx.de>
+
+	* gnus.texi (Saving Articles): Clarify gnus-summary-save-article-mail.
+
+2006-05-17  Richard Stallman  <rms@gnu.org>
+
+	* files.texi (Diff Mode): Mention C-x `.
+
+2006-05-08  Richard Stallman  <rms@gnu.org>
+
+	* custom.texi (Disabling): Textual cleanups.
+
 2006-05-12  Reiner Steib  <Reiner.Steib@gmx.de>
 
 	* message.texi (Interface): Add tool bar customization.
@@ -6222,6 +6234,7 @@
 
 ;; Local Variables:
 ;; coding: iso-2022-7bit
+;; fill-column: 79
 ;; End:
 
     Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2002,
--- a/man/files.texi	Wed May 17 18:05:02 2006 +0000
+++ b/man/files.texi	Sat May 20 10:32:11 2006 +0000
@@ -2333,8 +2333,10 @@
   One general feature of Diff mode is that manual edits to the patch
 automatically correct line numbers, including those in the hunk
 header, so that you can actually apply the edited patch.  Diff mode
-also provides the following commands to navigate, manipulate and apply
-parts of patches:
+treats each hunk location as an ``error message'', so that you can use
+commands such as @kbd{C-x '} to visit the corresponding source
+locations.  It also provides the following commands to navigate,
+manipulate and apply parts of patches:
 
 @table @kbd
 @item M-n
--- a/man/gnus.texi	Wed May 17 18:05:02 2006 +0000
+++ b/man/gnus.texi	Sat May 20 10:32:11 2006 +0000
@@ -7377,7 +7377,7 @@
 @item O m
 @kindex O m (Summary)
 @findex gnus-summary-save-article-mail
-Save the current article in mail format
+Save the current article in a Unix mail box (mbox) file
 (@code{gnus-summary-save-article-mail}).
 
 @item O r
--- a/src/ChangeLog	Wed May 17 18:05:02 2006 +0000
+++ b/src/ChangeLog	Sat May 20 10:32:11 2006 +0000
@@ -1,3 +1,54 @@
+2006-05-19  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
+
+	* frame.c (x_set_border_width): Remove #ifndef MAC_OS.
+
+	* image.c [MAC_OS] (gif_load): Allocate Lisp string first.
+
+	* macfns.c (Fx_focus_frame): Don't check dpyinfo->x_focus_frame.
+
+	* macterm.c (XTread_socket) [TARGET_API_MAC_CARBON && MAC_OSX]:
+	Forward keyUp events to toolbox_dispatcher.
+
+	* window.c (foreach_window): Check WINDOWP (FRAME_ROOT_WINDOW (f)).
+
+2006-05-18  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
+
+	* config.in: Regenerated (HAVE_ALSA).
+
+	* sound.c (alsa_sound_perror, alsa_open, alsa_period_size)
+	(alsa_configure, alsa_close, alsa_choose_format, alsa_write)
+	(snd_error_quiet, alsa_init): New functions.
+	(vox_init): Return 0 if unable to open device.
+	(Fplay_sound_internal): Test for alsa first and use vox (oss) as
+	a fallback.
+	(struct sound_device): Add period_size.
+	(wav_play, au_play): Use period_size if set.
+
+	* Makefile.in (CFLAGS_SOUND): New flags for ALSA
+	(ALL_CFLAGS): Add CFLAGS_SOUND
+
+2006-05-18  Kenichi Handa  <handa@m17n.org>
+
+	* callproc.c (Fcall_process): Reject encoding arguments by
+	ascii-incompatible coding systems (e.g. utf-16).
+
+	* coding.c (Qascii_incompatible): New variable.
+	(syms_of_coding): Setup Qascii_incompatible.
+	(setup_coding_system): Be sure to initialize coding->common_flags.
+	Check `ascii-incompatible' property of the coding system.
+
+	* coding.h (CODING_ASCII_INCOMPATIBLE_MASK): New macro.
+
+2006-05-18  Kim F. Storm  <storm@cua.dk>
+
+	* xdisp.c (display_tool_bar_line): Restore entire tool-bar geometry when
+	backtracking in case last image doesn't fit on line.
+
+2006-05-18  MIYOSHI Masanori <miyoshi@meadowy.org>  (tiny change)
+
+	* xdisp.c (display_tool_bar_line): Don't adjust tool-bar height by more than
+	height of one frame default line.
+
 2006-05-16  Kim F. Storm  <storm@cua.dk>
 
 	* xterm.c (handle_one_xevent): Check that f is not NULL before
@@ -17012,8 +17063,7 @@
 	(Fapropos_internal): Initialize them and clear them out.
 	Don't GCPRO them.
 
-	* buffer.c (syms_of_buffer) <scroll-up-aggressively, scroll-down-aggressively>:
-	Doc fixes.
+	* buffer.c (syms_of_buffer) <scroll-up|down-aggressively>: Doc fixes.
 
 	* lisp.h: New misc type Lisp_Save_Value.
 	(enum Lisp_Misc_Type): Add Lisp_Misc_Save_Value.
--- a/src/Makefile.in	Wed May 17 18:05:02 2006 +0000
+++ b/src/Makefile.in	Sat May 20 10:32:11 2006 +0000
@@ -280,7 +280,7 @@
 
 /* C_SWITCH_X_SITE must come before C_SWITCH_X_MACHINE and C_SWITCH_X_SYSTEM
    since it may have -I options that should override those two.  */
-ALL_CFLAGS=-Demacs -DHAVE_CONFIG_H $(TOOLKIT_DEFINES) $(MYCPPFLAGS) -I. -I${srcdir} C_SWITCH_MACHINE C_SWITCH_SYSTEM C_SWITCH_SITE C_SWITCH_X_SITE C_SWITCH_X_MACHINE C_SWITCH_X_SYSTEM C_SWITCH_SYSTEM_TEMACS ${CFLAGS}
+ALL_CFLAGS=-Demacs -DHAVE_CONFIG_H $(TOOLKIT_DEFINES) $(MYCPPFLAGS) -I. -I${srcdir} C_SWITCH_MACHINE C_SWITCH_SYSTEM C_SWITCH_SITE C_SWITCH_X_SITE C_SWITCH_X_MACHINE C_SWITCH_X_SYSTEM C_SWITCH_SYSTEM_TEMACS ${CFLAGS_SOUND} ${CFLAGS}
 .c.o:
 	$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $<
 
@@ -453,6 +453,7 @@
 #endif /* not HAVE_X_WINDOWS */
 
 LIBSOUND= @LIBSOUND@
+CFLAGS_SOUND= @CFLAGS_SOUND@
 
 #ifndef ORDINARY_LINK
 /* Fix linking if compiled with GCC.  */
--- a/src/buffer.c	Wed May 17 18:05:02 2006 +0000
+++ b/src/buffer.c	Sat May 20 10:32:11 2006 +0000
@@ -2495,10 +2495,10 @@
    Return the number found, and store them in a vector in *VEC_PTR.
    Store in *LEN_PTR the size allocated for the vector.
    Store in *NEXT_PTR the next position after POS where an overlay starts,
-     or ZV if there are no more overlays.
+     or ZV if there are no more overlays between POS and ZV.
    Store in *PREV_PTR the previous position before POS where an overlay ends,
      or where an overlay starts which ends at or after POS;
-     or BEGV if there are no such overlays.
+     or BEGV if there are no such overlays from BEGV to POS.
    NEXT_PTR and/or PREV_PTR may be 0, meaning don't store that info.
 
    *VEC_PTR and *LEN_PTR should contain a valid vector and size
@@ -3969,7 +3969,8 @@
 DEFUN ("next-overlay-change", Fnext_overlay_change, Snext_overlay_change,
        1, 1, 0,
        doc: /* Return the next position after POS where an overlay starts or ends.
-If there are no more overlay boundaries after POS, return (point-max).  */)
+If there are no overlay boundaries from POS to (point-max),
+the value is (point-max).  */)
      (pos)
      Lisp_Object pos;
 {
@@ -4010,7 +4011,8 @@
 DEFUN ("previous-overlay-change", Fprevious_overlay_change,
        Sprevious_overlay_change, 1, 1, 0,
        doc: /* Return the previous position before POS where an overlay starts or ends.
-If there are no more overlay boundaries before POS, return (point-min).  */)
+If there are no overlay boundaries from (point-min) to POS,
+the value is (point-min).  */)
      (pos)
      Lisp_Object pos;
 {
--- a/src/callproc.c	Wed May 17 18:05:02 2006 +0000
+++ b/src/callproc.c	Sat May 20 10:32:11 2006 +0000
@@ -302,6 +302,8 @@
 	      val = Qnil;
 	  }
 	setup_coding_system (Fcheck_coding_system (val), &argument_coding);
+	if (argument_coding.common_flags & CODING_ASCII_INCOMPATIBLE_MASK)
+	  setup_coding_system (Qraw_text, &argument_coding);
 	if (argument_coding.eol_type == CODING_EOL_UNDECIDED)
 	  argument_coding.eol_type = system_eol_type;
       }
--- a/src/coding.c	Wed May 17 18:05:02 2006 +0000
+++ b/src/coding.c	Sat May 20 10:32:11 2006 +0000
@@ -365,6 +365,7 @@
 Lisp_Object Qcoding_system_history;
 Lisp_Object Qsafe_chars;
 Lisp_Object Qvalid_codes;
+Lisp_Object Qascii_incompatible;
 
 extern Lisp_Object Qinsert_file_contents, Qwrite_region;
 Lisp_Object Qcall_process, Qcall_process_region;
@@ -3621,7 +3622,10 @@
 	= CODING_REQUIRE_DECODING_MASK | CODING_REQUIRE_ENCODING_MASK;
     }
   else
-    coding->eol_type = CODING_EOL_LF;
+    {
+      coding->common_flags = 0;
+      coding->eol_type = CODING_EOL_LF;
+    }
 
   coding_type = XVECTOR (coding_spec)->contents[0];
   /* Try short cut.  */
@@ -3681,6 +3685,12 @@
   if (!NILP (val))
     coding->composing = COMPOSITION_NO;
 
+  /* If the coding system is ascii-incompatible, record it in
+     common_flags.   */
+  val = Fplist_get (plist, Qascii_incompatible);
+  if (! NILP (val))
+    coding->common_flags |= CODING_ASCII_INCOMPATIBLE_MASK;
+
   switch (XFASTINT (coding_type))
     {
     case 0:
@@ -7820,6 +7830,9 @@
   Qvalid_codes = intern ("valid-codes");
   staticpro (&Qvalid_codes);
 
+  Qascii_incompatible = intern ("ascii-incompatible");
+  staticpro (&Qascii_incompatible);
+
   Qemacs_mule = intern ("emacs-mule");
   staticpro (&Qemacs_mule);
 
--- a/src/coding.h	Wed May 17 18:05:02 2006 +0000
+++ b/src/coding.h	Sat May 20 10:32:11 2006 +0000
@@ -443,10 +443,12 @@
   Lisp_Object translation_table_for_encode;
 };
 
-#define CODING_REQUIRE_FLUSHING_MASK	1
-#define CODING_REQUIRE_DECODING_MASK	2
-#define CODING_REQUIRE_ENCODING_MASK	4
-#define CODING_REQUIRE_DETECTION_MASK	8
+/* Mask bits for (struct coding_system *)->common_flags.  */
+#define CODING_REQUIRE_FLUSHING_MASK	0x01
+#define CODING_REQUIRE_DECODING_MASK	0x02
+#define CODING_REQUIRE_ENCODING_MASK	0x04
+#define CODING_REQUIRE_DETECTION_MASK	0x08
+#define CODING_ASCII_INCOMPATIBLE_MASK	0x10
 
 /* Return 1 if the coding system CODING requires specific code to be
    attached at the tail of converted text.  */
--- a/src/config.in	Wed May 17 18:05:02 2006 +0000
+++ b/src/config.in	Sat May 20 10:32:11 2006 +0000
@@ -87,6 +87,9 @@
    */
 #undef HAVE_ALLOCA_H
 
+/* Define to 1 if ALSA is available. */
+#undef HAVE_ALSA
+
 /* Define to 1 if you have the `bcmp' function. */
 #undef HAVE_BCMP
 
@@ -949,6 +952,9 @@
 #ifdef HAVE_SOUNDCARD_H
 #define HAVE_SOUND 1
 #endif
+#ifdef HAVE_ALSA
+#define HAVE_SOUND 1
+#endif
 #endif /* __FreeBSD__ || __NetBSD__ || __linux__  */
 
 /* If using GNU, then support inline function declarations. */
--- a/src/frame.c	Wed May 17 18:05:02 2006 +0000
+++ b/src/frame.c	Sat May 20 10:32:11 2006 +0000
@@ -3443,10 +3443,8 @@
   if (XINT (arg) == f->border_width)
     return;
 
-#ifndef MAC_OS
   if (FRAME_X_WINDOW (f) != 0)
     error ("Cannot change the border width of a frame");
-#endif /* MAC_TODO */
 
   f->border_width = XINT (arg);
 }
--- a/src/image.c	Wed May 17 18:05:02 2006 +0000
+++ b/src/image.c	Sat May 20 10:32:11 2006 +0000
@@ -8069,18 +8069,18 @@
   /* Save GIF image extension data for `image-extension-data'.
      Format is (count IMAGES 0xf9 GRAPHIC_CONTROL_EXTENSION_BLOCK).  */
   {
-    unsigned char gce[4];
+    Lisp_Object gce = make_uninit_string (4);
     int centisec = ((float)duration / time_scale) * 100.0f + 0.5f;
 
     /* Fill the delay time field.  */
-    gce[1] = centisec & 0xff;
-    gce[2] = (centisec >> 8) & 0xff;
+    SSET (gce, 1, centisec & 0xff);
+    SSET (gce, 2, (centisec >> 8) & 0xff);
     /* We don't know about other fields.  */
-    gce[0] = gce[3] = 0;
+    SSET (gce, 0, 0);
+    SSET (gce, 3, 0);
 
     img->data.lisp_val = list4 (Qcount, make_number (nsamples),
-				make_number (0xf9),
-				make_unibyte_string (gce, 4));
+				make_number (0xf9), gce);
   }
 
   /* Maybe fill in the background field while we have ximg handy. */
--- a/src/macfns.c	Wed May 17 18:05:02 2006 +0000
+++ b/src/macfns.c	Sat May 20 10:32:11 2006 +0000
@@ -2829,26 +2829,22 @@
      Lisp_Object frame;
 {
   struct frame *f = check_x_frame (frame);
-  struct mac_display_info *dpyinfo = FRAME_MAC_DISPLAY_INFO (f);
-
-  if (dpyinfo->x_focus_frame != f)
-    {
-      BLOCK_INPUT;
+
+  BLOCK_INPUT;
 #ifdef MAC_OSX
-      ActivateWindow (ActiveNonFloatingWindow (), false);
-      ActivateWindow (FRAME_MAC_WINDOW (f), true);
+  ActivateWindow (ActiveNonFloatingWindow (), false);
+  ActivateWindow (FRAME_MAC_WINDOW (f), true);
 #else
 #if !TARGET_API_MAC_CARBON
-      /* SelectWindow (Non-Carbon) does not issue deactivate events if
-	 the possibly inactive window that is to be selected is
-	 already the frontmost one.  */
-      SendBehind (FRAME_MAC_WINDOW (f), NULL);
+  /* SelectWindow (Non-Carbon) does not issue deactivate events if the
+     possibly inactive window that is to be selected is already the
+     frontmost one.  */
+  SendBehind (FRAME_MAC_WINDOW (f), NULL);
 #endif
-      /* This brings the window to the front.  */
-      SelectWindow (FRAME_MAC_WINDOW (f));
+  /* This brings the window to the front.  */
+  SelectWindow (FRAME_MAC_WINDOW (f));
 #endif
-      UNBLOCK_INPUT;
-    }
+  UNBLOCK_INPUT;
 
   return Qnil;
 }
--- a/src/macterm.c	Wed May 17 18:05:02 2006 +0000
+++ b/src/macterm.c	Sat May 20 10:32:11 2006 +0000
@@ -10333,6 +10333,7 @@
 	  break;
 
 	case keyDown:
+	case keyUp:
 	case autoKey:
 	  {
 	    int keycode = (er.message & keyCodeMask) >> 8;
@@ -10354,6 +10355,8 @@
 		  != eventNotHandledErr)
 		break;
 #endif
+	    if (er.what == keyUp)
+	      break;
 
 #if 0
 	    if (dpyinfo->x_focus_frame == NULL)
--- a/src/sound.c	Wed May 17 18:05:02 2006 +0000
+++ b/src/sound.c	Sat May 20 10:32:11 2006 +0000
@@ -73,6 +73,10 @@
 #ifdef HAVE_SOUNDCARD_H
 #include <soundcard.h>
 #endif
+#ifdef HAVE_ALSA
+#include <asoundlib.h>
+#endif
+
 /* END: Non Windows Includes */
 
 #else /* WINDOWSNT */
@@ -121,6 +125,9 @@
 #ifndef DEFAULT_SOUND_DEVICE
 #define DEFAULT_SOUND_DEVICE "/dev/dsp"
 #endif
+#ifndef DEFAULT_ALSA_SOUND_DEVICE
+#define DEFAULT_ALSA_SOUND_DEVICE "default"
+#endif
 
 
 /* Structure forward declarations.  */
@@ -227,6 +234,10 @@
   void (* choose_format) P_ ((struct sound_device *sd,
 			      struct sound *s));
 
+  /* Return a preferred data size in bytes to be sent to write (below)
+     each time.  2048 is used if this is NULL.  */
+  int (* period_size) P_ ((struct sound_device *sd));
+
   /* Write NYBTES bytes from BUFFER to device SD.  */
   void (* write) P_ ((struct sound_device *sd, const char *buffer,
 		      int nbytes));
@@ -280,7 +291,7 @@
 static void vox_configure P_ ((struct sound_device *));
 static void vox_close P_ ((struct sound_device *sd));
 static void vox_choose_format P_ ((struct sound_device *, struct sound *));
-static void vox_init P_ ((struct sound_device *));
+static int vox_init P_ ((struct sound_device *));
 static void vox_write P_ ((struct sound_device *, const char *, int));
 static void find_sound_type P_ ((struct sound *));
 static u_int32_t le2hl P_ ((u_int32_t));
@@ -604,7 +615,7 @@
     {
       char *buffer;
       int nbytes;
-      int blksize = 2048;
+      int blksize = sd->period_size ? sd->period_size (sd) : 2048;
 
       buffer = (char *) alloca (blksize);
       lseek (s->fd, sizeof *header, SEEK_SET);
@@ -633,7 +644,8 @@
   AU_ENCODING_32,
   AU_ENCODING_IEEE32,
   AU_ENCODING_IEEE64,
-  AU_COMPRESSED = 23
+  AU_COMPRESSED = 23,
+  AU_ENCODING_ALAW_8 = 27
 };
 
 
@@ -689,7 +701,7 @@
 	       SBYTES (s->data) - header->data_offset);
   else
     {
-      int blksize = 2048;
+      int blksize = sd->period_size ? sd->period_size (sd) : 2048;
       char *buffer;
       int nbytes;
 
@@ -868,16 +880,33 @@
 /* Initialize device SD.  Set up the interface functions in the device
    structure.  */
 
-static void
+static int
 vox_init (sd)
      struct sound_device *sd;
 {
+  char *file;
+  int fd;
+
+  /* Open the sound device.  Default is /dev/dsp.  */
+  if (sd->file)
+    file = sd->file;
+  else
+    file = DEFAULT_SOUND_DEVICE;
+  fd = emacs_open (file, O_WRONLY, 0);
+  if (fd >= 0)
+    emacs_close (fd);
+  else
+    return 0;
+
   sd->fd = -1;
   sd->open = vox_open;
   sd->close = vox_close;
   sd->configure = vox_configure;
   sd->choose_format = vox_choose_format;
   sd->write = vox_write;
+  sd->period_size = NULL;
+
+  return 1;
 }
 
 /* Write NBYTES bytes from BUFFER to device SD.  */
@@ -893,6 +922,359 @@
     sound_perror ("Error writing to sound device");
 }
 
+#ifdef HAVE_ALSA
+/***********************************************************************
+		       ALSA Driver Interface
+ ***********************************************************************/
+
+/* This driver is available on GNU/Linux. */
+
+static void
+alsa_sound_perror (msg, err)
+     char *msg;
+     int err;
+{
+  error ("%s: %s", msg, snd_strerror (err));
+}
+
+struct alsa_params
+{
+  snd_pcm_t *handle;
+  snd_pcm_hw_params_t *hwparams;
+  snd_pcm_sw_params_t *swparams;
+  snd_pcm_uframes_t period_size;
+};
+
+/* Open device SD.  If SD->file is non-null, open that device,
+   otherwise use a default device name.  */
+
+static void
+alsa_open (sd)
+     struct sound_device *sd;
+{
+  char *file;
+  struct alsa_params *p;
+  int err;
+
+  /* Open the sound device.  Default is "default".  */
+  if (sd->file)
+    file = sd->file;
+  else
+    file = DEFAULT_ALSA_SOUND_DEVICE;
+
+  p = xmalloc (sizeof (*p));
+  p->handle = NULL;
+  p->hwparams = NULL;
+  p->swparams = NULL;
+
+  sd->fd = -1;
+  sd->data = p;
+
+
+  if ((err = snd_pcm_open (&p->handle, file, SND_PCM_STREAM_PLAYBACK, 0)) < 0)
+    alsa_sound_perror (file, err);
+}
+
+static int
+alsa_period_size (sd)
+       struct sound_device *sd;
+{
+  struct alsa_params *p = (struct alsa_params *) sd->data;
+  return p->period_size;
+}
+
+static void
+alsa_configure (sd)
+     struct sound_device *sd;
+{
+  int val, err, dir;
+  struct alsa_params *p = (struct alsa_params *) sd->data;
+  snd_pcm_uframes_t buffer_size;
+
+  xassert (p->handle != 0);
+
+  if ((err = snd_pcm_hw_params_malloc (&p->hwparams)) < 0)
+    alsa_sound_perror ("Could not allocate hardware parameter structure", err);
+
+  if ((err = snd_pcm_sw_params_malloc (&p->swparams)) < 0)
+    alsa_sound_perror ("Could not allocate software parameter structure", err);
+
+  if ((err = snd_pcm_hw_params_any (p->handle, p->hwparams)) < 0)
+    alsa_sound_perror ("Could not initialize hardware parameter structure", err);
+
+  if ((err = snd_pcm_hw_params_set_access (p->handle, p->hwparams,
+                                           SND_PCM_ACCESS_RW_INTERLEAVED)) < 0)
+    alsa_sound_perror ("Could not set access type", err);
+
+  val = sd->format;
+  if ((err = snd_pcm_hw_params_set_format (p->handle, p->hwparams, val)) < 0) 
+    alsa_sound_perror ("Could not set sound format", err);
+
+  val = sd->sample_rate;
+  if ((err = snd_pcm_hw_params_set_rate_near (p->handle, p->hwparams, &val, 0))
+      < 0)
+    alsa_sound_perror ("Could not set sample rate", err);
+  
+  val = sd->channels;
+  if ((err = snd_pcm_hw_params_set_channels (p->handle, p->hwparams, val)) < 0)
+    alsa_sound_perror ("Could not set channel count", err);
+
+
+  err = snd_pcm_hw_params_get_period_size (p->hwparams, &p->period_size, &dir);
+  if (err < 0)
+    alsa_sound_perror ("Unable to get period size for playback", err);
+
+  err = snd_pcm_hw_params_get_buffer_size (p->hwparams, &buffer_size);
+  if (err < 0)
+    alsa_sound_perror("Unable to get buffer size for playback", err);
+
+  if ((err = snd_pcm_hw_params (p->handle, p->hwparams)) < 0)
+    alsa_sound_perror ("Could not set parameters", err);
+
+  err = snd_pcm_sw_params_current (p->handle, p->swparams);
+  if (err < 0)
+    alsa_sound_perror ("Unable to determine current swparams for playback",
+                       err);
+
+  /* Start the transfer when the buffer is almost full */
+  err = snd_pcm_sw_params_set_start_threshold (p->handle, p->swparams,
+                                               (buffer_size / p->period_size)
+                                               * p->period_size);
+  if (err < 0)
+    alsa_sound_perror ("Unable to set start threshold mode for playback", err);
+
+  /* Allow the transfer when at least period_size samples can be processed */
+  err = snd_pcm_sw_params_set_avail_min (p->handle, p->swparams, p->period_size);
+  if (err < 0)
+    alsa_sound_perror ("Unable to set avail min for playback", err);
+
+  /* Align all transfers to 1 period */
+  err = snd_pcm_sw_params_set_xfer_align (p->handle, p->swparams,
+                                          p->period_size);
+  if (err < 0)
+    alsa_sound_perror ("Unable to set transfer align for playback", err);
+
+  err = snd_pcm_sw_params (p->handle, p->swparams);
+  if (err < 0)
+    alsa_sound_perror ("Unable to set sw params for playback\n", err);
+
+  snd_pcm_hw_params_free (p->hwparams);
+  p->hwparams = NULL;
+  snd_pcm_sw_params_free (p->swparams);
+  p->swparams = NULL;
+  
+  if ((err = snd_pcm_prepare (p->handle)) < 0)
+    alsa_sound_perror ("Could not prepare audio interface for use", err);
+  
+  if (sd->volume > 0)
+    {
+      int chn;
+      snd_mixer_t *handle;
+      snd_mixer_elem_t *e;
+      char *file = sd->file ? sd->file : DEFAULT_ALSA_SOUND_DEVICE;
+
+      if (snd_mixer_open (&handle, 0) >= 0)
+        {
+          if (snd_mixer_attach (handle, file) >= 0
+              && snd_mixer_load (handle) >= 0
+              && snd_mixer_selem_register (handle, NULL, NULL) >= 0)
+            for (e = snd_mixer_first_elem (handle);
+                 e;
+                 e = snd_mixer_elem_next (e))
+              {
+                if (snd_mixer_selem_has_playback_volume (e))
+                  {
+                    long pmin, pmax;
+                    snd_mixer_selem_get_playback_volume_range (e, &pmin, &pmax);
+                    long vol = pmin + (sd->volume * (pmax - pmin)) / 100;
+                    
+                    for (chn = 0; chn <= SND_MIXER_SCHN_LAST; chn++)
+                      snd_mixer_selem_set_playback_volume (e, chn, vol);
+                  }
+              }
+          snd_mixer_close(handle);
+        }
+    }
+}
+
+
+/* Close device SD if it is open.  */
+
+static void
+alsa_close (sd)
+     struct sound_device *sd;
+{
+  struct alsa_params *p = (struct alsa_params *) sd->data;
+  if (p)
+    {
+      if (p->hwparams)
+        snd_pcm_hw_params_free (p->hwparams);
+      if (p->swparams)
+        snd_pcm_sw_params_free (p->swparams);
+      if (p->handle)
+        {
+          snd_pcm_drain(p->handle);
+          snd_pcm_close (p->handle);
+        }
+      free (p);
+    }
+}
+
+/* Choose device-dependent format for device SD from sound file S.  */
+
+static void
+alsa_choose_format (sd, s)
+     struct sound_device *sd;
+     struct sound *s;
+{
+  struct alsa_params *p = (struct alsa_params *) sd->data;
+  if (s->type == RIFF)
+    {
+      struct wav_header *h = (struct wav_header *) s->header;
+      if (h->precision == 8)
+	sd->format = SND_PCM_FORMAT_U8;
+      else if (h->precision == 16)
+          sd->format = SND_PCM_FORMAT_S16_LE;
+      else
+	error ("Unsupported WAV file format");
+    }
+  else if (s->type == SUN_AUDIO)
+    {
+      struct au_header *header = (struct au_header *) s->header;
+      switch (header->encoding)
+	{
+	case AU_ENCODING_ULAW_8:
+	  sd->format = SND_PCM_FORMAT_MU_LAW;
+          break;
+	case AU_ENCODING_ALAW_8:
+	  sd->format = SND_PCM_FORMAT_A_LAW;
+          break;
+	case AU_ENCODING_IEEE32:
+          sd->format = SND_PCM_FORMAT_FLOAT_BE;
+          break;
+	case AU_ENCODING_IEEE64:
+	  sd->format = SND_PCM_FORMAT_FLOAT64_BE;
+	  break;
+	case AU_ENCODING_8:
+	  sd->format = SND_PCM_FORMAT_S8;
+	  break;
+	case AU_ENCODING_16:
+	  sd->format = SND_PCM_FORMAT_S16_BE;
+	  break;
+	case AU_ENCODING_24:
+	  sd->format = SND_PCM_FORMAT_S24_BE;
+	  break;
+	case AU_ENCODING_32:
+	  sd->format = SND_PCM_FORMAT_S32_BE;
+	  break;
+
+	default:
+	  error ("Unsupported AU file format");
+	}
+    }
+  else
+    abort ();
+}
+
+
+/* Write NBYTES bytes from BUFFER to device SD.  */
+
+static void
+alsa_write (sd, buffer, nbytes)
+     struct sound_device *sd;
+     const char *buffer;
+     int nbytes;
+{
+  struct alsa_params *p = (struct alsa_params *) sd->data;
+
+  /* The the third parameter to snd_pcm_writei is frames, not bytes. */
+  int fact = snd_pcm_format_size (sd->format, 1) * sd->channels;
+  int nwritten = 0;
+  int err;
+
+  while (nwritten < nbytes)
+    {
+      if ((err = snd_pcm_writei (p->handle,
+                                 buffer + nwritten,
+                                 (nbytes - nwritten)/fact)) < 0)
+        {
+          fprintf(stderr, "Err %d/%s\n", err, snd_strerror(err));
+          if (err == -EPIPE)
+            {	/* under-run */
+              err = snd_pcm_prepare (p->handle);
+              if (err < 0)
+                alsa_sound_perror ("Can't recover from underrun, prepare failed",
+                                   err);
+            }
+          else if (err == -ESTRPIPE)
+            {
+              while ((err = snd_pcm_resume (p->handle)) == -EAGAIN)
+                sleep(1);	/* wait until the suspend flag is released */
+              if (err < 0)
+                {
+                  err = snd_pcm_prepare (p->handle);
+                  if (err < 0)
+                    alsa_sound_perror ("Can't recover from suspend, "
+                                       "prepare failed",
+                                       err);
+                }
+            }
+          else 
+            alsa_sound_perror ("Error writing to sound device", err);
+          
+        }
+      else
+        nwritten += err * fact;
+    }
+}
+
+static void
+snd_error_quiet (file, line, function, err, fmt)
+     const char *file;
+     int line;
+     const char *function;
+     int err;
+     const char *fmt;
+{
+}
+
+/* Initialize device SD.  Set up the interface functions in the device
+   structure.  */
+
+static int
+alsa_init (sd)
+     struct sound_device *sd;
+{
+  char *file;
+  snd_pcm_t *handle;
+  int err;
+
+  /* Open the sound device.  Default is "default".  */
+  if (sd->file)
+    file = sd->file;
+  else
+    file = DEFAULT_ALSA_SOUND_DEVICE;
+
+  snd_lib_error_set_handler ((snd_lib_error_handler_t) snd_error_quiet);
+  err = snd_pcm_open (&handle, file, SND_PCM_STREAM_PLAYBACK, 0);
+  snd_lib_error_set_handler (NULL);
+  if (err < 0)
+    return 0;
+
+  sd->fd = -1;
+  sd->open = alsa_open;
+  sd->close = alsa_close;
+  sd->configure = alsa_configure;
+  sd->choose_format = alsa_choose_format;
+  sd->write = alsa_write;
+  sd->period_size = alsa_period_size;
+
+  return 1;
+}
+
+#endif /* HAVE_ALSA */
+
+
 /* END: Non Windows functions */
 #else /* WINDOWSNT */
 
@@ -1056,10 +1438,11 @@
   args[1] = sound;
   Frun_hook_with_args (2, args);
 
-  /* There is only one type of device we currently support, the VOX
-     sound driver.  Set up the device interface functions for that
-     device.  */
-  vox_init (current_sound_device);
+#ifdef HAVE_ALSA
+  if (!alsa_init (current_sound_device))
+#endif
+    if (!vox_init (current_sound_device))
+      error ("No usable sound device driver found");
 
   /* Open the device.  */
   current_sound_device->open (current_sound_device);
--- a/src/window.c	Wed May 17 18:05:02 2006 +0000
+++ b/src/window.c	Sat May 20 10:32:11 2006 +0000
@@ -6798,7 +6798,9 @@
      int (* fn) P_ ((struct window *, void *));
      void *user_data;
 {
-  foreach_window_1 (XWINDOW (FRAME_ROOT_WINDOW (f)), fn, user_data);
+  /* Fdelete_frame may set FRAME_ROOT_WINDOW (f) to Qnil.  */
+  if (WINDOWP (FRAME_ROOT_WINDOW (f)))
+    foreach_window_1 (XWINDOW (FRAME_ROOT_WINDOW (f)), fn, user_data);
 }
 
 
--- a/src/xdisp.c	Wed May 17 18:05:02 2006 +0000
+++ b/src/xdisp.c	Sat May 20 10:32:11 2006 +0000
@@ -9492,7 +9492,8 @@
 
   while (it->current_x < max_x)
     {
-      int x_before, x, n_glyphs_before, i, nglyphs;
+      int x, n_glyphs_before, i, nglyphs;
+      struct it it_before;
 
       /* Get the next display element.  */
       if (!get_next_display_element (it))
@@ -9504,22 +9505,23 @@
 	}
 
       /* Produce glyphs.  */
-      x_before = it->current_x;
-      n_glyphs_before = it->glyph_row->used[TEXT_AREA];
+      n_glyphs_before = row->used[TEXT_AREA];
+      it_before = *it;
+
       PRODUCE_GLYPHS (it);
 
-      nglyphs = it->glyph_row->used[TEXT_AREA] - n_glyphs_before;
+      nglyphs = row->used[TEXT_AREA] - n_glyphs_before;
       i = 0;
-      x = x_before;
+      x = it_before.current_x;
       while (i < nglyphs)
 	{
 	  struct glyph *glyph = row->glyphs[TEXT_AREA] + n_glyphs_before + i;
 
 	  if (x + glyph->pixel_width > max_x)
 	    {
-	      /* Glyph doesn't fit on line.  */
-	      it->glyph_row->used[TEXT_AREA] = n_glyphs_before + i;
-	      it->current_x = x;
+	      /* Glyph doesn't fit on line.  Backtrack.  */
+	      row->used[TEXT_AREA] = n_glyphs_before;
+	      *it = it_before;
 	      goto out;
 	    }
 
@@ -9550,6 +9552,8 @@
   /* Make line the desired height and center it vertically.  */
   if ((height -= it->max_ascent + it->max_descent) > 0)
     {
+      /* Don't add more than one line height.  */
+      height %= FRAME_LINE_HEIGHT (it->f);
       it->max_ascent += height / 2;
       it->max_descent += (height + 1) / 2;
     }
--- a/src/xfaces.c	Wed May 17 18:05:02 2006 +0000
+++ b/src/xfaces.c	Sat May 20 10:32:11 2006 +0000
@@ -6400,6 +6400,12 @@
 {
   int i;
 
+  /* Any font is better than no font.  */
+  if (! font1)
+    return 0;
+  if (! font2)
+    return 1;
+
   for (i = 0; i < DIM (font_sort_order); ++i)
     {
       int xlfd_idx = font_sort_order[i];
@@ -6644,29 +6650,19 @@
   if (needs_overstrike)
     *needs_overstrike = 0;
 
-  /* Start with the first non-scalable font in the list.  */
-  for (i = 0; i < nfonts; ++i)
-    if (!font_scalable_p (fonts + i))
-      break;
+  best = NULL;
 
   /* Find the best match among the non-scalable fonts.  */
-  if (i < nfonts)
-    {
-      best = fonts + i;
-
-      for (i = 1; i < nfonts; ++i)
-	if (!font_scalable_p (fonts + i)
-	    && better_font_p (specified, fonts + i, best, 1, avgwidth))
-	  {
-	    best = fonts + i;
-
-	    exact_p = exact_face_match_p (specified, best, avgwidth);
-	    if (exact_p)
-	      break;
-	  }
-    }
-  else
-    best = NULL;
+  for (i = 1; i < nfonts; ++i)
+    if (!font_scalable_p (fonts + i)
+	&& better_font_p (specified, fonts + i, best, 1, avgwidth))
+      {
+	best = fonts + i;
+
+	exact_p = exact_face_match_p (specified, best, avgwidth);
+	if (exact_p)
+	  break;
+      }
 
   /* Unless we found an exact match among non-scalable fonts, see if
      we can find a better match among scalable fonts.  */
@@ -6690,8 +6686,7 @@
       for (i = 0; i < nfonts; ++i)
 	if (font_scalable_p (fonts + i))
 	  {
-	    if (best == NULL
-		|| better_font_p (specified, fonts + i, best, 0, 0)
+	    if (better_font_p (specified, fonts + i, best, 0, 0)
 		|| (!non_scalable_has_exact_height_p
 		    && !better_font_p (specified, best, fonts + i, 0, 0)))
 	      {
@@ -6719,6 +6714,10 @@
 	}
     }
 
+  /* We should have found SOME font.  */
+  if (best == NULL)
+    abort ();
+
   if (font_scalable_p (best))
     font_name = build_scalable_font_name (f, best, pt);
   else
--- a/src/xterm.c	Wed May 17 18:05:02 2006 +0000
+++ b/src/xterm.c	Sat May 20 10:32:11 2006 +0000
@@ -6097,6 +6097,8 @@
 
       f = x_any_window_to_frame (dpyinfo, event.xkey.window);
 
+      /* If mouse-highlight is an integer, input clears out
+	 mouse highlighting.  */
       if (!dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight)
 	  && (f == 0
 	      || !EQ (f->tool_bar_window, dpyinfo->mouse_face_window)))